1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Quotes and indentation

This commit is contained in:
Daniel Barber 2018-02-15 22:45:17 -05:00
parent a5dbc31419
commit 36a5d4c390
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
27 changed files with 118 additions and 92 deletions

View File

@ -1,9 +1,9 @@
module ApplicationHelper module ApplicationHelper
def page_title(title) def page_title(title)
if title.present? if title.present?
"#{title} - #{APP_CONFIG['page_title']}" "#{title} - #{APP_CONFIG["page_title"]}"
else else
APP_CONFIG['page_title'] APP_CONFIG["page_title"]
end end
end end
end end

View File

@ -1,5 +1,5 @@
module PhotosHelper module PhotosHelper
def link_to_photo(photo) def link_to_photo(photo)
link_to '', photo.image.url, rel: 'photos', class: 'fancy', data: { id: photo.id } link_to "", photo.image.url, rel: "photos", class: "fancy", data: { id: photo.id }
end end
end end

View File

@ -1,8 +1,8 @@
class Notifier < ActionMailer::Base class Notifier < ActionMailer::Base
default from: 'enquiries@danbarberphoto.com' default from: "enquiries@danbarberphoto.com"
def contact_notification(sender) def contact_notification(sender)
@sender = sender @sender = sender
mail(to: 'enquiries@danbarberphoto.com', from: sender.email, subject: sender.subject) mail(to: "enquiries@danbarberphoto.com", from: sender.email, subject: sender.subject)
end end
end end

View File

@ -1,6 +1,6 @@
require File.expand_path('../boot', __FILE__) require File.expand_path("../boot", __FILE__)
require 'rails/all' require "rails/all"
if defined?(Bundler) if defined?(Bundler)
# If you precompile assets before deploying to production, use this line # If you precompile assets before deploying to production, use this line
@ -27,10 +27,10 @@ module DanBarberPhoto
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)' # config.time_zone = "Central Time (US & Canada)"
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.load_path += Dir[Rails.root.join("my", "locales", "*.{rb,yml}").to_s]
config.i18n.enforce_available_locales = true config.i18n.enforce_available_locales = true
config.i18n.default_locale = :en config.i18n.default_locale = :en
@ -46,7 +46,7 @@ module DanBarberPhoto
config.assets.precompile += %w(favicon.ico fancybox/sprite.png fancybox/loading.gif fancybox/blank.gif fancybox/overlay.png) config.assets.precompile += %w(favicon.ico fancybox/sprite.png fancybox/loading.gif fancybox/blank.gif fancybox/overlay.png)
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = "1.0"
# Prefer SASS syntax for stylesheets # Prefer SASS syntax for stylesheets
config.sass.preferred_syntax = :sass config.sass.preferred_syntax = :sass
@ -54,7 +54,7 @@ module DanBarberPhoto
# Configure factories # Configure factories
config.generators do |g| config.generators do |g|
g.test_framework :rspec, fixture: true g.test_framework :rspec, fixture: true
g.fixture_replacement :factory_girl, dir: 'spec/factories' g.fixture_replacement :factory_girl, dir: "spec/factories"
end end
end end
end end

View File

@ -1,6 +1,6 @@
require 'rubygems' require "rubygems"
# Set up gems listed in the Gemfile. # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) require "bundler/setup" if File.exists?(ENV["BUNDLE_GEMFILE"])

View File

@ -1,5 +1,5 @@
# Load the rails application # Load the rails application
require File.expand_path('../application', __FILE__) require File.expand_path("../application", __FILE__)
# Initialize the rails application # Initialize the rails application
DanBarberPhoto::Application.initialize! DanBarberPhoto::Application.initialize!

View File

@ -66,12 +66,12 @@ DanBarberPhoto::Application.configure do
# Settings for Sendgrid Free on Heroku # Settings for Sendgrid Free on Heroku
ActionMailer::Base.smtp_settings = { ActionMailer::Base.smtp_settings = {
address: 'smtp.sendgrid.net', address: "smtp.sendgrid.net",
port: '587', port: "587",
authentication: :plain, authentication: :plain,
user_name: ENV['SENDGRID_USERNAME'], user_name: ENV["SENDGRID_USERNAME"],
password: ENV['SENDGRID_PASSWORD'], password: ENV["SENDGRID_PASSWORD"],
domain: 'heroku.com' domain: "heroku.com"
} }
ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.delivery_method = :smtp

View File

@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path # Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path # Rails.application.config.assets.paths << Emoji.images_path

View File

@ -1,4 +1,4 @@
require 'dragonfly' require "dragonfly"
# Configure # Configure
Dragonfly.app.configure do Dragonfly.app.configure do
@ -11,33 +11,61 @@ Dragonfly.app.configure do
if Rails.env.in?(%w(development production)) if Rails.env.in?(%w(development production))
datastore :s3, datastore :s3,
bucket_name: ENV['AWS_BUCKET'], bucket_name: ENV["AWS_BUCKET"],
access_key_id: ENV['AWS_KEY'], access_key_id: ENV["AWS_KEY"],
secret_access_key: ENV['AWS_SECRET'], secret_access_key: ENV["AWS_SECRET"],
region: 'eu-west-1' region: "eu-west-1"
else else
datastore :file, datastore :file,
root_path: Rails.root.join('public/system/dragonfly', Rails.env), root_path: Rails.root.join("public/system/dragonfly", Rails.env),
server_root: Rails.root.join('public') server_root: Rails.root.join("public")
end end
processor :preview do |content| content.process! :thumb, '600x600' end processor :preview do |content|
content.process! :thumb, "600x600"
end
processor :admin do |content| content.process! :thumb, '140x140#' end processor :admin do |content|
content.process! :thumb, "140x140#"
end
processor :size17 do |content| content.process! :thumb, '476x476#' end processor :size17 do |content|
processor :size11 do |content| content.process! :thumb, '308x308#' end content.process! :thumb, "476x476#"
processor :size8 do |content| content.process! :thumb, '224x224#' end end
processor :size5 do |content| content.process! :thumb, '140x140#' end processor :size11 do |content|
processor :size3 do |content| content.process! :thumb, '84x84#' end content.process! :thumb, "308x308#"
processor :size2 do |content| content.process! :thumb, '56x56#' end end
processor :size8 do |content|
content.process! :thumb, "224x224#"
end
processor :size5 do |content|
content.process! :thumb, "140x140#"
end
processor :size3 do |content|
content.process! :thumb, "84x84#"
end
processor :size2 do |content|
content.process! :thumb, "56x56#"
end
processor :size17x2 do |content| content.process! :thumb, '952x952#' end processor :size17x2 do |content|
processor :size11x2 do |content| content.process! :thumb, '616x616#' end content.process! :thumb, "952x952#"
processor :size8x2 do |content| content.process! :thumb, '448x448#' end end
processor :size5x2 do |content| content.process! :thumb, '280x280#' end processor :size11x2 do |content|
processor :size3x2 do |content| content.process! :thumb, '168x168#' end content.process! :thumb, "616x616#"
processor :size2x2 do |content| content.process! :thumb, '112x112#' end end
processor :size8x2 do |content|
content.process! :thumb, "448x448#"
end
processor :size5x2 do |content|
content.process! :thumb, "280x280#"
end
processor :size3x2 do |content|
content.process! :thumb, "168x168#"
end
processor :size2x2 do |content|
content.process! :thumb, "112x112#"
end
end end
# Logger # Logger

View File

@ -3,8 +3,8 @@
# Add new inflection rules using the following format # Add new inflection rules using the following format
# (all these examples are active by default): # (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect| # ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, "\1en"
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, "\1"
# inflect.irregular 'person', 'people' # inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end

View File

@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
DanBarberPhoto::Application.config.session_store :cookie_store, key: '_danbarberphoto_session' DanBarberPhoto::Application.config.session_store :cookie_store, key: "_danbarberphoto_session"
# Use the database for sessions instead of the cookie-based default, # Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information # which shouldn't be used to store highly confidential information

View File

@ -55,7 +55,7 @@ SimpleForm.setup do |config|
config.boolean_style = :nested config.boolean_style = :nested
# Default class for buttons # Default class for buttons
config.button_class = 'btn' config.button_class = "btn"
# Method used to tidy up errors. Specify any Rails Array method. # Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field. # :first lists the first message for each field.
@ -66,7 +66,7 @@ SimpleForm.setup do |config|
config.error_notification_tag = :div config.error_notification_tag = :div
# CSS class to add for error notification helper. # CSS class to add for error notification helper.
config.error_notification_class = 'alert alert-error' config.error_notification_class = "alert alert-error"
# ID to add for error notification helper. # ID to add for error notification helper.
# config.error_notification_id = nil # config.error_notification_id = nil
@ -95,7 +95,7 @@ SimpleForm.setup do |config|
# config.label_text = lambda { |label, required| "#{required} #{label}" } # config.label_text = lambda { |label, required| "#{required} #{label}" }
# You can define the class to use on all labels. Default is nil. # You can define the class to use on all labels. Default is nil.
config.label_class = 'control-label' config.label_class = "control-label"
# You can define the class to use on all forms. Default is simple_form. # You can define the class to use on all forms. Default is simple_form.
# config.form_class = :simple_form # config.form_class = :simple_form

View File

@ -1,18 +1,18 @@
workers Integer(ENV['PUMA_WORKERS'] || 3) workers Integer(ENV["PUMA_WORKERS"] || 3)
threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16) threads Integer(ENV["MIN_THREADS"] || 1), Integer(ENV["MAX_THREADS"] || 16)
preload_app! preload_app!
rackup DefaultRackup rackup DefaultRackup
port ENV['PORT'] || 3000 port ENV["PORT"] || 3000
environment ENV['RACK_ENV'] || 'development' environment ENV["RACK_ENV"] || "development"
on_worker_boot do on_worker_boot do
# worker specific setup # worker specific setup
ActiveSupport.on_load(:active_record) do ActiveSupport.on_load(:active_record) do
config = ActiveRecord::Base.configurations[Rails.env] || config = ActiveRecord::Base.configurations[Rails.env] ||
Rails.application.config.database_configuration[Rails.env] Rails.application.config.database_configuration[Rails.env]
config['pool'] = ENV['MAX_THREADS'] || 16 config["pool"] = ENV["MAX_THREADS"] || 16
ActiveRecord::Base.establish_connection(config) ActiveRecord::Base.establish_connection(config)
end end
end end

View File

@ -1,5 +1,4 @@
class CreateAdminUsers < ActiveRecord::Migration class CreateAdminUsers < ActiveRecord::Migration
def self.up def self.up
create_table :admin_users do |t| create_table :admin_users do |t|
t.string :first_name, default: "", null: false t.string :first_name, default: "", null: false
@ -18,5 +17,4 @@ class CreateAdminUsers < ActiveRecord::Migration
def self.down def self.down
drop_table :admin_users drop_table :admin_users
end end
end end

View File

@ -23,11 +23,11 @@ class CreateDeviseAdminUsers < ActiveRecord::Migration
t.string :confirmation_token t.string :confirmation_token
t.datetime :confirmed_at t.datetime :confirmed_at
t.datetime :confirmation_sent_at t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable t.string :unconfirmed_email
# Lockable # Lockable
t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts t.integer :failed_attempts, default: 0
t.string :unlock_token # Only if unlock strategy is :email or :both t.string :unlock_token
t.datetime :locked_at t.datetime :locked_at
t.timestamps t.timestamps

View File

@ -1,5 +1,5 @@
class AddIndexToCategoriesPhotos < ActiveRecord::Migration class AddIndexToCategoriesPhotos < ActiveRecord::Migration
def change def change
add_index :categories_photos, [:category_id, :photo_id], unique: true add_index :categories_photos, %i[category_id photo_id], unique: true
end end
end end

View File

@ -27,11 +27,11 @@ class RemoveDeviseAdminUsers < ActiveRecord::Migration
t.string :confirmation_token t.string :confirmation_token
t.datetime :confirmed_at t.datetime :confirmed_at
t.datetime :confirmation_sent_at t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable t.string :unconfirmed_email
# Lockable # Lockable
t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts t.integer :failed_attempts, default: 0
t.string :unlock_token # Only if unlock strategy is :email or :both t.string :unlock_token
t.datetime :locked_at t.datetime :locked_at
t.timestamps t.timestamps

View File

@ -3,5 +3,5 @@
# #
# Examples: # Examples:
# #
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # cities = City.create([{ name: "Chicago" }, { name: "Copenhagen" }])
# Mayor.create(name: 'Daley', city: cities.first) # Mayor.create(name: "Daley", city: cities.first)

View File

@ -5,8 +5,8 @@ describe Contact do
it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:message) } it { is_expected.to validate_presence_of(:message) }
it { is_expected.to allow_value('test@test.com').for(:email) } it { is_expected.to allow_value("test@test.com").for(:email) }
it { is_expected.not_to allow_value('test@test').for(:email) } it { is_expected.not_to allow_value("test@test").for(:email) }
let(:contact) { build(:contact) } let(:contact) { build(:contact) }
end end

View File

@ -1,12 +1,12 @@
# This file is copied to spec/ when you run 'rails generate rspec:install' # This file is copied to spec/ when you run "rails generate rspec:install"
ENV['RAILS_ENV'] ||= 'test' ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__) require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails' require "rspec/rails"
require 'capybara/rspec' require "capybara/rspec"
require 'capybara/poltergeist' require "capybara/poltergeist"
# For code coverage # For code coverage
require 'simplecov' require "simplecov"
SimpleCov.start SimpleCov.start
# Use Poltergeist # Use Poltergeist
@ -14,7 +14,7 @@ Capybara.javascript_driver = :poltergeist
# Requires supporting ruby files with custom matchers and macros, etc, # Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories. # in spec/support/ and its subdirectories.
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config| RSpec.configure do |config|
# ## Mock Framework # ## Mock Framework
@ -29,10 +29,10 @@ RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods config.include FactoryBot::Syntax::Methods
config.include Ajax, type: :feature config.include Ajax, type: :feature
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # Remove this line if you"re not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures" config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your # If you"re not using ActiveRecord, or you"d prefer not to run each of your
# examples within a transaction, remove the following line or assign false # examples within a transaction, remove the following line or assign false
# instead of true. # instead of true.
config.use_transactional_fixtures = false config.use_transactional_fixtures = false
@ -46,7 +46,7 @@ RSpec.configure do |config|
# order dependency and want to debug it, you can fix the order by providing # order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run. # the seed, which is printed after each run.
# --seed 1234 # --seed 1234
config.order = 'random' config.order = "random"
config.before(:suite) do config.before(:suite) do
DatabaseCleaner.clean_with(:truncation) DatabaseCleaner.clean_with(:truncation)

View File

@ -2,7 +2,7 @@ module Ajax
def wait_for_ajax def wait_for_ajax
Timeout.timeout(Capybara.default_max_wait_time) do Timeout.timeout(Capybara.default_max_wait_time) do
loop do loop do
active = page.evaluate_script('jQuery.active') active = page.evaluate_script("jQuery.active")
break if active == 0 break if active == 0
end end
end end