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
def page_title(title)
if title.present?
"#{title} - #{APP_CONFIG['page_title']}"
"#{title} - #{APP_CONFIG["page_title"]}"
else
APP_CONFIG['page_title']
APP_CONFIG["page_title"]
end
end
end

View File

@ -1,5 +1,5 @@
module PhotosHelper
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

View File

@ -1,8 +1,8 @@
class Notifier < ActionMailer::Base
default from: 'enquiries@danbarberphoto.com'
default from: "enquiries@danbarberphoto.com"
def contact_notification(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

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 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.
# 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.
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.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)
# 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
config.sass.preferred_syntax = :sass
@ -54,7 +54,7 @@ module DanBarberPhoto
# Configure factories
config.generators do |g|
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

View File

@ -1,6 +1,6 @@
require 'rubygems'
require "rubygems"
# 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
require File.expand_path('../application', __FILE__)
require File.expand_path("../application", __FILE__)
# Initialize the rails application
DanBarberPhoto::Application.initialize!

View File

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

View File

@ -1,7 +1,7 @@
# 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.
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path

View File

@ -1,4 +1,4 @@
require 'dragonfly'
require "dragonfly"
# Configure
Dragonfly.app.configure do
@ -11,33 +11,61 @@ Dragonfly.app.configure do
if Rails.env.in?(%w(development production))
datastore :s3,
bucket_name: ENV['AWS_BUCKET'],
access_key_id: ENV['AWS_KEY'],
secret_access_key: ENV['AWS_SECRET'],
region: 'eu-west-1'
bucket_name: ENV["AWS_BUCKET"],
access_key_id: ENV["AWS_KEY"],
secret_access_key: ENV["AWS_SECRET"],
region: "eu-west-1"
else
datastore :file,
root_path: Rails.root.join('public/system/dragonfly', Rails.env),
server_root: Rails.root.join('public')
root_path: Rails.root.join("public/system/dragonfly", Rails.env),
server_root: Rails.root.join("public")
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 :size11 do |content| content.process! :thumb, '308x308#' 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 :size17 do |content|
content.process! :thumb, "476x476#"
end
processor :size11 do |content|
content.process! :thumb, "308x308#"
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 :size11x2 do |content| content.process! :thumb, '616x616#' 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
processor :size17x2 do |content|
content.process! :thumb, "952x952#"
end
processor :size11x2 do |content|
content.process! :thumb, "616x616#"
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
# Logger

View File

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

View File

@ -1,6 +1,6 @@
# 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,
# which shouldn't be used to store highly confidential information

View File

@ -55,7 +55,7 @@ SimpleForm.setup do |config|
config.boolean_style = :nested
# Default class for buttons
config.button_class = 'btn'
config.button_class = "btn"
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
@ -66,7 +66,7 @@ SimpleForm.setup do |config|
config.error_notification_tag = :div
# 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.
# config.error_notification_id = nil
@ -95,7 +95,7 @@ SimpleForm.setup do |config|
# config.label_text = lambda { |label, required| "#{required} #{label}" }
# 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.
# config.form_class = :simple_form

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
class AddIndexToCategoriesPhotos < ActiveRecord::Migration
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

View File

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

View File

@ -3,5 +3,5 @@
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Daley', city: cities.first)
# cities = City.create([{ name: "Chicago" }, { name: "Copenhagen" }])
# 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(:message) }
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.to allow_value("test@test.com").for(:email) }
it { is_expected.not_to allow_value("test@test").for(:email) }
let(:contact) { build(:contact) }
end

View File

@ -1,12 +1,12 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
# This file is copied to spec/ when you run "rails generate rspec:install"
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../../config/environment", __FILE__)
require "rspec/rails"
require "capybara/rspec"
require "capybara/poltergeist"
# For code coverage
require 'simplecov'
require "simplecov"
SimpleCov.start
# Use Poltergeist
@ -14,7 +14,7 @@ Capybara.javascript_driver = :poltergeist
# Requires supporting ruby files with custom matchers and macros, etc,
# 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|
# ## Mock Framework
@ -29,10 +29,10 @@ RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
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"
# 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
# instead of true.
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
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
config.order = "random"
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)

View File

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