Merge pull request #468 from differentreality/styling

Styling
This commit is contained in:
Stella Rouzi 2014-09-02 23:03:53 +03:00
commit 9ff8becaf6
59 changed files with 137 additions and 149 deletions

View file

@ -108,6 +108,18 @@ Style/BracesAroundHashParameters:
Style/CaseEquality: Style/CaseEquality:
Enabled: true Enabled: true
Style/ClassAndModuleChildren:
Enabled: true
Style/StringLiterals:
Enabled: true
Style/TrailingBlankLines:
Enabled: true
Style/TrailingWhitespace:
Enabled: true
AllCops: AllCops:
Include: Include:
- '**/Rakefile' - '**/Rakefile'
@ -115,3 +127,5 @@ AllCops:
Exclude: Exclude:
- 'db/schema.rb' - 'db/schema.rb'
- 'vendor/bundle/**/*' - 'vendor/bundle/**/*'
- 'bundle/**/*'
- 'config/**/*'

View file

@ -5,11 +5,6 @@
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 20
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: true
# Offense count: 3 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
@ -258,32 +253,15 @@ Style/SpaceInsideBrackets:
Style/SpaceInsideHashLiteralBraces: Style/SpaceInsideHashLiteralBraces:
Enabled: false Enabled: false
# Offense count: 577
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
# Offense count: 1 # Offense count: 1
Style/Tab: Style/Tab:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false
# Offense count: 24 # Offense count: 24
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma: Style/TrailingComma:
Enabled: false Enabled: false
# Offense count: 38
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false
# Offense count: 8 # Offense count: 8
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/WordArray: Style/WordArray:

View file

@ -8,7 +8,7 @@ guard_opts = {
cmd: 'spring rspec' cmd: 'spring rspec'
} }
def model_specs ; "spec/models" end def model_specs ; 'spec/models' end
def model_spec(model) def model_spec(model)
"spec/models/#{model}_spec.rb" "spec/models/#{model}_spec.rb"

View file

@ -28,7 +28,7 @@ module Admin
else else
redirect_to(admin_conference_callforpapers_path( redirect_to(admin_conference_callforpapers_path(
id: @conference.short_title), id: @conference.short_title),
alert: "Updating call for papers failed. #{@cfp.errors.to_a.join(". ")}.") alert: "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}.")
end end
end end
@ -44,7 +44,7 @@ module Admin
else else
redirect_to(admin_conference_callforpapers_path( redirect_to(admin_conference_callforpapers_path(
id: @conference.short_title), id: @conference.short_title),
alert: "Creating the call for papers failed. #{@cfp.errors.to_a.join(". ")}.") alert: "Creating the call for papers failed. #{@cfp.errors.to_a.join('. ')}.")
end end
end end
end end

View file

@ -13,18 +13,18 @@ module Admin
begin begin
@conference.use_difficulty_levels = false @conference.use_difficulty_levels = false
@conference.save! @conference.save!
flash[:error] = "You cannot enable the usage of difficulty levels without having set any levels." flash[:error] = 'You cannot enable the usage of difficulty levels without having set any levels.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
flash[:error] = "Something went wrong. Difficulty Levels update failed." flash[:error] = 'Something went wrong. Difficulty Levels update failed.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end end
else else
flash[:notice] = "Difficulty Levels were successfully updated." flash[:notice] = 'Difficulty Levels were successfully updated.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end end
else else
flash[:error] = "Difficulty Levels update failed." flash[:error] = 'Difficulty Levels update failed.'
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end end
end end

View file

@ -51,4 +51,3 @@ module Admin
end end
end end
end end

View file

@ -33,7 +33,7 @@ module Admin
# GET questions/1/edit # GET questions/1/edit
def edit def edit
if @question.global if @question.global
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), alert: "Sorry, you cannot edit global questions. Create a new one.") redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), alert: 'Sorry, you cannot edit global questions. Create a new one.')
end end
end end
@ -73,13 +73,13 @@ module Admin
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}" flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
end end
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
flash[:error] = "Could not delete question." flash[:error] = 'Could not delete question.'
end end
else else
flash[:error] = "You cannot delete global questions." flash[:error] = 'You cannot delete global questions.'
end end
else else
flash[:error] = "You must be an admin to delete a question." flash[:error] = 'You must be an admin to delete a question.'
end end
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id) @questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)

View file

@ -36,7 +36,7 @@ module Admin
redirect_to admin_conference_registration_period_path(@conference.short_title), redirect_to admin_conference_registration_period_path(@conference.short_title),
notice: 'Registration Period successfully updated.' notice: 'Registration Period successfully updated.'
else else
flash[:alert] = "A error prohibited the Registration Period from being saved: " \ flash[:alert] = 'A error prohibited the Registration Period from being saved: ' \
"#{@registration_period.errors.full_messages.join('. ')}." "#{@registration_period.errors.full_messages.join('. ')}."
render :edit render :edit
end end

View file

@ -35,7 +35,7 @@ module Admin
if @splashpage.destroy if @splashpage.destroy
redirect_to admin_conference_splashpage_path, notice: 'Splashpage was successfully destroyed.' redirect_to admin_conference_splashpage_path, notice: 'Splashpage was successfully destroyed.'
else else
redirect_to admin_conference_splashpage_path, alert: "A error prohibited this Splashpage from being destroyed: "\ redirect_to admin_conference_splashpage_path, alert: 'A error prohibited this Splashpage from being destroyed: '\
"#{@splashpage.errors.full_messages.join('. ')}." "#{@splashpage.errors.full_messages.join('. ')}."
end end
end end

View file

@ -40,7 +40,7 @@ module Admin
notice: 'Ticket successfully destroyed.') notice: 'Ticket successfully destroyed.')
else else
redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title), redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title),
alert: "Ticket was successfully destroyed." \ alert: 'Ticket was successfully destroyed.' \
"#{@ticket.errors.full_messages.join('. ')}.") "#{@ticket.errors.full_messages.join('. ')}.")
end end
end end

View file

@ -25,7 +25,7 @@ module Admin
def update def update
if can_manage_volunteers(@conference) if can_manage_volunteers(@conference)
if @conference.update_attributes(params[:conference]) if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.") redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: 'Volunteering options were successfully updated.')
else else
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}") redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}")
end end

View file

@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
check_authorization unless: :devise_controller? check_authorization unless: :devise_controller?
def store_location def store_location
session[:return_to] = request.fullpath if request.get? && controller_name != "user_sessions" && controller_name != "sessions" session[:return_to] = request.fullpath if request.get? && controller_name != 'user_sessions' && controller_name != 'sessions'
end end
def after_sign_in_path_for(resource) def after_sign_in_path_for(resource)
@ -49,7 +49,7 @@ class ApplicationController < ActionController::Base
end end
rescue_from CanCan::AccessDenied do |exception| rescue_from CanCan::AccessDenied do |exception|
Rails.logger.debug("Access denied!") Rails.logger.debug('Access denied!')
redirect_to root_path, alert: exception.message redirect_to root_path, alert: exception.message
end end

View file

@ -9,14 +9,14 @@ class ConferenceController < ApplicationController
subscription = Subscription.new(user_id: current_user.id, conference_id: conference.id) subscription = Subscription.new(user_id: current_user.id, conference_id: conference.id)
begin begin
subscription.save! subscription.save!
flash[:success] = "You have been subscribed to receive Email Notifications from this Conference." flash[:success] = 'You have been subscribed to receive Email Notifications from this Conference.'
redirect_to root_path redirect_to root_path
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
flash[:error] = subscription.errors.full_messages.to_sentence flash[:error] = subscription.errors.full_messages.to_sentence
redirect_to root_path redirect_to root_path
end end
else else
flash[:notice] = "Already Subscribed" flash[:notice] = 'Already Subscribed'
redirect_to root_path redirect_to root_path
end end
end end
@ -25,7 +25,7 @@ class ConferenceController < ApplicationController
conference = Conference.find_by_short_title(params[:id]) conference = Conference.find_by_short_title(params[:id])
subscription = current_user.subscriptions.where(conference_id: conference.id).first subscription = current_user.subscriptions.where(conference_id: conference.id).first
if subscription.blank? if subscription.blank?
flash[:notice] = "Already Unsubscribed" flash[:notice] = 'Already Unsubscribed'
redirect_to root_path redirect_to root_path
else else
begin begin
@ -41,6 +41,6 @@ class ConferenceController < ApplicationController
def gallery_photos def gallery_photos
@photos = @conference.photos @photos = @conference.photos
render "photos", formats: [:js] render 'photos', formats: [:js]
end end
end end

View file

@ -4,7 +4,7 @@ class HomeController < ApplicationController
def index def index
@today = Date.current @today = Date.current
@current = Conference.where("end_date >= ?", @today).order("start_date ASC") @current = Conference.where('end_date >= ?', @today).order('start_date ASC')
end end
def respond_to_options def respond_to_options

View file

@ -76,7 +76,7 @@ class ProposalController < ApplicationController
end end
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title), redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
notice: "Proposal was successfully updated.") notice: 'Proposal was successfully updated.')
end end
def destroy def destroy
@ -92,7 +92,7 @@ class ProposalController < ApplicationController
@event.save(validate: false) @event.save(validate: false)
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title), redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
notice: "Proposal was successfully withdrawn.") notice: 'Proposal was successfully withdrawn.')
end end
def confirm def confirm

View file

@ -1,6 +1,6 @@
class ScheduleController < ApplicationController class ScheduleController < ApplicationController
authorize_resource class: false authorize_resource class: false
layout "application" layout 'application'
def index def index
@conference = Conference. @conference = Conference.
@ -11,9 +11,9 @@ class ScheduleController < ApplicationController
@dates = @conference.start_date..@conference.end_date @dates = @conference.start_date..@conference.end_date
if @dates == Date.current if @dates == Date.current
@today = Date.current.strftime("%Y-%m-%d") @today = Date.current.strftime('%Y-%m-%d')
else else
@today = @conference.start_date.strftime("%Y-%m-%d") @today = @conference.start_date.strftime('%Y-%m-%d')
end end
end end
end end

View file

@ -7,7 +7,7 @@ class TicketPurchasesController < ApplicationController
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0]) message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
if message.blank? if message.blank?
redirect_to conference_conference_registrations_path(@conference.short_title), redirect_to conference_conference_registrations_path(@conference.short_title),
notice: "Congratulations, you have successfully purchased a ticket! " \ notice: 'Congratulations, you have successfully purchased a ticket! ' \
"You can pay it cash on check in! Thank you for supporting #{@conference.title}!" "You can pay it cash on check in! Thank you for supporting #{@conference.title}!"
else else
redirect_to conference_conference_registrations_path(@conference.short_title), redirect_to conference_conference_registrations_path(@conference.short_title),
@ -22,7 +22,7 @@ class TicketPurchasesController < ApplicationController
notice: 'Ticket successfully destroyed.' notice: 'Ticket successfully destroyed.'
else else
redirect_to conference_conference_registrations_path(@conference.short_title), redirect_to conference_conference_registrations_path(@conference.short_title),
notice: "A error prohibited deleting your purchase! "\ notice: 'A error prohibited deleting your purchase! '\
"#{@ticket_purchases.errors.full_messages.join('. ')}." "#{@ticket_purchases.errors.full_messages.join('. ')}."
end end
end end

View file

@ -92,17 +92,17 @@ module ApplicationHelper
def getdatetime(registration, field) def getdatetime(registration, field)
if registration.send(field.to_sym).kind_of?(String) if registration.send(field.to_sym).kind_of?(String)
DateTime.parse(registration.send(field.to_sym)).strftime("%d %b %H:%M") if registration.send(field.to_sym) DateTime.parse(registration.send(field.to_sym)).strftime('%d %b %H:%M') if registration.send(field.to_sym)
else else
registration.send(field.to_sym).strftime("%d %b %H:%M") if registration.send(field.to_sym) registration.send(field.to_sym).strftime('%d %b %H:%M') if registration.send(field.to_sym)
end end
end end
def getdate(var) def getdate(var)
if var.kind_of?(String) if var.kind_of?(String)
DateTime.parse(var).strftime("%a, %d %b") DateTime.parse(var).strftime('%a, %d %b')
else else
var.strftime("%a, %d %b") var.strftime('%a, %d %b')
end end
end end
@ -122,24 +122,24 @@ module ApplicationHelper
end end
def pre_registered(event) def pre_registered(event)
@conference.events.joins(:registrations).where("events.id = ?", event.id) @conference.events.joins(:registrations).where('events.id = ?', event.id)
end end
def add_association_link(association_name, form_builder, div_class, html_options = {}) def add_association_link(association_name, form_builder, div_class, html_options = {})
link_to_add_association "Add " + association_name.to_s.singularize, form_builder, div_class, html_options.merge(class: "assoc btn btn-success") link_to_add_association 'Add ' + association_name.to_s.singularize, form_builder, div_class, html_options.merge(class: 'assoc btn btn-success')
end end
def remove_association_link(association_name, form_builder) def remove_association_link(association_name, form_builder)
link_to_remove_association("Remove " + association_name.to_s.singularize, form_builder, class: "assoc btn btn-danger") + tag(:hr) link_to_remove_association('Remove ' + association_name.to_s.singularize, form_builder, class: 'assoc btn btn-danger') + tag(:hr)
end end
def dynamic_association(association_name, title, form_builder, options = {}) def dynamic_association(association_name, title, form_builder, options = {})
render "shared/dynamic_association", association_name: association_name, title: title, f: form_builder, hint: options[:hint] render 'shared/dynamic_association', association_name: association_name, title: title, f: form_builder, hint: options[:hint]
end end
# Same as redirect_to(:back) if there is a valid HTTP referer, otherwise redirect_to() # Same as redirect_to(:back) if there is a valid HTTP referer, otherwise redirect_to()
def redirect_back_or_to(options = {}, response_status = {}) def redirect_back_or_to(options = {}, response_status = {})
if request.env["HTTP_REFERER"] if request.env['HTTP_REFERER']
redirect_to(:back) redirect_to(:back)
else else
redirect_to(options, response_status) redirect_to(options, response_status)
@ -148,7 +148,7 @@ module ApplicationHelper
# TODO Output better html # TODO Output better html
def format_comments(comment, padding = 0) def format_comments(comment, padding = 0)
result = "" result = ''
result += "<div style='padding-left:#{padding}px'>" result += "<div style='padding-left:#{padding}px'>"
result += "<div class='well'>" result += "<div class='well'>"
result += "<b>#{comment.user.name}</b> <i>#{comment.created_at}</i><br><br>" result += "<b>#{comment.user.name}</b> <i>#{comment.created_at}</i><br><br>"
@ -160,12 +160,12 @@ module ApplicationHelper
result += "<input name='authenticity_token' type='hidden' value='#{form_authenticity_token}' />" result += "<input name='authenticity_token' type='hidden' value='#{form_authenticity_token}' />"
result += "<textarea name='comment'></textarea>" result += "<textarea name='comment'></textarea>"
result += "<button class='btn btn-primary pull-right' name='button' type='submit'>Add Reply</button>" result += "<button class='btn btn-primary pull-right' name='button' type='submit'>Add Reply</button>"
result += "</form></div></div>" result += '</form></div></div>'
result += "</div>" result += '</div>'
#result += edit_admin_conference_event_path(@conference.short_title, @event) #result += edit_admin_conference_event_path(@conference.short_title, @event)
comment.children.each do |child| comment.children.each do |child|
result += format_comments(child, 50) result += format_comments(child, 50)
result += "</div>" result += '</div>'
end end
result result
@ -181,7 +181,7 @@ module ApplicationHelper
markdown.render(text).html_safe markdown.render(text).html_safe
end end
def markdown_hint(text="") def markdown_hint(text='')
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text") markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text")
end end

View file

@ -1,6 +1,6 @@
module ProposalHelper module ProposalHelper
def generate_abstract_length_js(conference) def generate_abstract_length_js(conference)
str = "" str = ''
conference.event_types.map do |t| conference.event_types.map do |t|
str += "if ($('select option:selected').text() == '#{t.title}') {\n" str += "if ($('select option:selected').text() == '#{t.title}') {\n"
str += "str = '#{t.maximum_abstract_length}';\n" str += "str = '#{t.maximum_abstract_length}';\n"

View file

@ -1,5 +1,5 @@
class Mailbot < ActionMailer::Base class Mailbot < ActionMailer::Base
default from: "no-reply@example.com" default from: 'no-reply@example.com'
def registration_mail(conference, person) def registration_mail(conference, person)
build_email(conference, build_email(conference,

View file

@ -1,6 +1,6 @@
module Ahoy module Ahoy
class Event < ActiveRecord::Base class Event < ActiveRecord::Base
self.table_name = "ahoy_events" self.table_name = 'ahoy_events'
belongs_to :visit belongs_to :visit
belongs_to :user belongs_to :user

View file

@ -1,6 +1,6 @@
class Answer < ActiveRecord::Base class Answer < ActiveRecord::Base
attr_accessible :title attr_accessible :title
has_many :qanswers has_many :qanswers
has_many :questions, through: :qanswers has_many :questions, through: :qanswers

View file

@ -4,7 +4,7 @@ class Contact < ActiveRecord::Base
validates :conference, presence: true validates :conference, presence: true
# Conferences only have one contact # Conferences only have one contact
validates :conference_id, uniqueness: {message: "has already contact details"} validates :conference_id, uniqueness: {message: 'has already contact details'}
validates :facebook, :twitter, :googleplus, :instagram, validates :facebook, :twitter, :googleplus, :instagram,
format: URI::regexp(%w(http https)), allow_blank: true format: URI::regexp(%w(http https)), allow_blank: true

View file

@ -79,7 +79,7 @@ class Datatable
sort_by << "#{sort_column(colnum)} #{sort_direction(colnum)}" sort_by << "#{sort_column(colnum)} #{sort_direction(colnum)}"
colnum += 1 colnum += 1
end end
sort_by.join(", ") sort_by.join(', ')
end end
def sorted? index=0 def sorted? index=0
@ -93,6 +93,6 @@ class Datatable
def sort_direction index=0 def sort_direction index=0
index = "sSortDir_#{index}" index = "sSortDir_#{index}"
params[index] == "desc" ? "desc" : "asc" params[index] == 'desc' ? 'desc' : 'asc'
end end
end end

View file

@ -3,7 +3,7 @@ class Photo < ActiveRecord::Base
belongs_to :conference belongs_to :conference
validates_presence_of :picture validates_presence_of :picture
has_attached_file :picture, has_attached_file :picture,
styles: { thumb: "100x100>", large: "300x300>", banner: "600x300>" } styles: { thumb: '100x100>', large: '300x300>', banner: '600x300>' }
validates_attachment_content_type :picture, validates_attachment_content_type :picture,
content_type: [/jpg/, /jpeg/, /png/, /gif/], content_type: [/jpg/, /jpeg/, /png/, /gif/],

View file

@ -3,6 +3,6 @@ class Qanswer < ActiveRecord::Base
belongs_to :question belongs_to :question
belongs_to :answer, dependent: :delete belongs_to :answer, dependent: :delete
has_and_belongs_to_many :registrations has_and_belongs_to_many :registrations
end end

View file

@ -1,5 +1,5 @@
class QuestionType < ActiveRecord::Base class QuestionType < ActiveRecord::Base
attr_accessible :title, :description attr_accessible :title, :description
has_many :questions has_many :questions
end end

View file

@ -1,4 +1,4 @@
class Visit < ActiveRecord::Base class Visit < ActiveRecord::Base
has_many :ahoy_events, class_name: "Ahoy::Event" has_many :ahoy_events, class_name: 'Ahoy::Event'
belongs_to :user belongs_to :user
end end

View file

@ -36,7 +36,7 @@ module Osem
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9. # Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8" config.encoding = 'utf-8'
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password] config.filter_parameters += [:password]

View file

@ -2,7 +2,7 @@
require File.expand_path('../application', __FILE__) require File.expand_path('../application', __FILE__)
# Load the configuration file # Load the configuration file
path = Rails.root.join("config", "config.yml") path = Rails.root.join('config', 'config.yml')
begin begin
CONFIG = YAML.load_file(path)[Rails.env] CONFIG = YAML.load_file(path)[Rails.env]
rescue rescue

View file

@ -9,9 +9,9 @@ Osem::Application.configure do
# Configure static asset server for tests with Cache-Control for performance # Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600" config.static_cache_control = 'public, max-age=3600'
# Do not eager load code on boot. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
# Show full error reports and disable caching # Show full error reports and disable caching

View file

@ -22,7 +22,7 @@ Formtastic::FormBuilder.include_blank_for_select_by_default = false
# '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
# in your locale, it will replace the abbr title properly. But if you don't want to use # in your locale, it will replace the abbr title properly. But if you don't want to use
# abbr tag, you can simply give a string as below # abbr tag, you can simply give a string as below
Formtastic::FormBuilder.required_string = "(required)" Formtastic::FormBuilder.required_string = '(required)'
# Set the string that will be appended to the labels/fieldsets which are optional # Set the string that will be appended to the labels/fieldsets which are optional
# Defaults to an empty string ("") and also accepts procs (see required_string above) # Defaults to an empty string ("") and also accepts procs (see required_string above)

View file

@ -1 +1 @@
Time::DATE_FORMATS[:db_without_seconds] = "%Y-%m-%d %H:%M" Time::DATE_FORMATS[:db_without_seconds] = '%Y-%m-%d %H:%M'

View file

@ -69,7 +69,7 @@ Osem::Application.routes.draw do
end end
end end
patch "/questions/update_conference" => "questions#update_conference" patch '/questions/update_conference' => 'questions#update_conference'
resources :questions resources :questions
resources :events do resources :events do
@ -91,7 +91,7 @@ Osem::Application.routes.draw do
resources :conference, only: [:show] do resources :conference, only: [:show] do
resources :proposal do resources :proposal do
resources :commercials, except: [:show, :index] resources :commercials, except: [:show, :index]
resources :event_attachment, controller: "event_attachments" resources :event_attachment, controller: 'event_attachments'
member do member do
patch '/confirm' => 'proposal#confirm' patch '/confirm' => 'proposal#confirm'
patch '/restart' => 'proposal#restart' patch '/restart' => 'proposal#restart'
@ -103,13 +103,13 @@ Osem::Application.routes.draw do
resources :ticket_purchases, only: [:create, :destroy] resources :ticket_purchases, only: [:create, :destroy]
resource :schedule, only: [] do resource :schedule, only: [] do
get "/" => "schedule#index" get '/' => 'schedule#index'
end end
member do member do
get "gallery_photos" get 'gallery_photos'
patch "subscription" => "conference#subscribe" patch 'subscription' => 'conference#subscribe'
delete "subscription" => "conference#unsubscribe" delete 'subscription' => 'conference#unsubscribe'
end end
end end
@ -129,7 +129,7 @@ Osem::Application.routes.draw do
end end
end end
get "/admin" => redirect("/admin/conference") get '/admin' => redirect('/admin/conference')
root to: 'home#index', via: [:get, :options] root to: 'home#index', via: [:get, :options]
end end

View file

@ -2,8 +2,8 @@ class DeviseCreateUsers < ActiveRecord::Migration
def up def up
create_table(:users) do |t| create_table(:users) do |t|
## Database authenticatable ## Database authenticatable
t.string :email, null: false, default: "" t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: "" t.string :encrypted_password, null: false, default: ''
## Recoverable ## Recoverable
t.string :reset_password_token t.string :reset_password_token

View file

@ -2,10 +2,10 @@ class CreatePeopleTable < ActiveRecord::Migration
def up def up
create_table :people do |t| create_table :people do |t|
t.string :guid, null: false t.string :guid, null: false
t.string :first_name, default: "" t.string :first_name, default: ''
t.string :last_name, default: "" t.string :last_name, default: ''
t.string :public_name, default: "" t.string :public_name, default: ''
t.string :company, default: "" t.string :company, default: ''
t.string :email, null: false t.string :email, null: false
t.boolean :email_public t.boolean :email_public
t.string :avatar_file_name t.string :avatar_file_name

View file

@ -5,7 +5,7 @@ class CreateTracksTable < ActiveRecord::Migration
t.references :conference t.references :conference
t.string :name, null: false t.string :name, null: false
t.text :description t.text :description
t.string :color, default: "#ffffff" t.string :color, default: '#ffffff'
t.timestamps t.timestamps
end end

View file

@ -7,8 +7,8 @@ class CreateEventsTable < ActiveRecord::Migration
t.string :title, null: false t.string :title, null: false
t.string :subtitle t.string :subtitle
t.integer :time_slots t.integer :time_slots
t.string :state, null: false, default: "new" t.string :state, null: false, default: 'new'
t.string :progress, null: false, default: "new" t.string :progress, null: false, default: 'new'
t.string :language t.string :language
t.datetime :start_time t.datetime :start_time
t.text :abstract t.text :abstract

View file

@ -4,7 +4,7 @@ class CreateEventPeopleTable < ActiveRecord::Migration
t.references :proposal t.references :proposal
t.references :person t.references :person
t.references :event t.references :event
t.string :event_role, null: false, default: "participant" t.string :event_role, null: false, default: 'participant'
t.string :comment t.string :comment
t.timestamps t.timestamps

View file

@ -5,7 +5,7 @@ class CreateRolesTable < ActiveRecord::Migration
t.timestamps t.timestamps
end end
end end
def self.down def self.down
drop_table :roles drop_table :roles
end end

View file

@ -4,7 +4,7 @@ class UserRolesTable < ActiveRecord::Migration
t.references :role, :user t.references :role, :user
end end
end end
def self.down def self.down
drop_table :roles_users drop_table :roles_users
end end

View file

@ -1,7 +1,7 @@
class CreateComments < ActiveRecord::Migration class CreateComments < ActiveRecord::Migration
def self.up def self.up
create_table :comments do |t| create_table :comments do |t|
t.string :title, limit: 50, default: "" t.string :title, limit: 50, default: ''
t.text :comment t.text :comment
t.references :commentable, polymorphic: true t.references :commentable, polymorphic: true
t.references :user t.references :user

View file

@ -5,15 +5,13 @@ class ActsAsCommentableUpgradeMigration < ActiveRecord::Migration
add_column :comments, :parent_id, :integer add_column :comments, :parent_id, :integer
add_column :comments, :lft, :integer add_column :comments, :lft, :integer
add_column :comments, :rgt, :integer add_column :comments, :rgt, :integer
end end
def self.down def self.down
rename_column :comments, :body, :comment rename_column :comments, :body, :comment
remove_column :comments, :subject remove_column :comments, :subject
remove_column :comments, :parent_id remove_column :comments, :parent_id
remove_column :comments, :lft remove_column :comments, :lft
remove_column :comments, :rgt remove_column :comments, :rgt
end end
end end

View file

@ -4,7 +4,7 @@ class CreateDifficultyLevels < ActiveRecord::Migration
t.references :conference t.references :conference
t.string :title t.string :title
t.text :description t.text :description
t.string :color, default: "#ffffff" t.string :color, default: '#ffffff'
t.timestamps t.timestamps
end end

View file

@ -1,5 +1,5 @@
class AddUseDifficultyLevelsToConference < ActiveRecord::Migration class AddUseDifficultyLevelsToConference < ActiveRecord::Migration
def change def change
add_column :conferences, :use_difficulty_levels, :boolean, default: false add_column :conferences, :use_difficulty_levels, :boolean, default: false
end end
end end

View file

@ -5,7 +5,7 @@ class UseVdaysVpositionsDefaults < ActiveRecord::Migration
end end
def down def down
change_column :conferences, :use_vpositions, :boolean, default: nil change_column :conferences, :use_vpositions, :boolean, default: nil
change_column :conferences, :use_vdays, :boolean, default: nil change_column :conferences, :use_vdays, :boolean, default: nil
end end
end end

View file

@ -14,9 +14,9 @@ user.skip_confirmation!
user.save! user.save!
# Questions # Questions
qtype_yesno = QuestionType.create(title: "Yes/No") qtype_yesno = QuestionType.create(title: 'Yes/No')
QuestionType.create(title: "Single Choice") QuestionType.create(title: 'Single Choice')
QuestionType.create(title: "Multiple Choice") QuestionType.create(title: 'Multiple Choice')
answer_yes = Answer.create(title: 'Yes') answer_yes = Answer.create(title: 'Yes')
answer_no = Answer.create(title: 'No') answer_no = Answer.create(title: 'No')

View file

@ -162,4 +162,3 @@ describe Admin::RegistrationPeriodsController do
end end
end end

View file

@ -15,13 +15,13 @@ FactoryGirl.define do
updated_conference_registration_dates_subject 'Conference registration dates have been updated' updated_conference_registration_dates_subject 'Conference registration dates have been updated'
updated_conference_registration_dates_template 'Sample Conference\n New Dates: January 17 - 21 2014' updated_conference_registration_dates_template 'Sample Conference\n New Dates: January 17 - 21 2014'
send_on_venue_update true send_on_venue_update true
venue_update_subject "Venue has been updated" venue_update_subject 'Venue has been updated'
venue_update_template "Venue has been Updated to Sample Location" venue_update_template 'Venue has been Updated to Sample Location'
registration_subject 'Lorem Ipsum Dolsum' registration_subject 'Lorem Ipsum Dolsum'
registration_email_template 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' registration_email_template 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
call_for_papers_dates_updates_subject "Call for Papers dates have been updated" call_for_papers_dates_updates_subject 'Call for Papers dates have been updated'
call_for_papers_dates_updates_template "Please checkout the new updates to submit your proposal for Sample Conference" call_for_papers_dates_updates_template 'Please checkout the new updates to submit your proposal for Sample Conference'
call_for_papers_schedule_public_subject "Sample Conference Cfp schedule is Public" call_for_papers_schedule_public_subject 'Sample Conference Cfp schedule is Public'
call_for_papers_schedule_public_template "Call for Papers schedule is Public.Checkout the link" call_for_papers_schedule_public_template 'Call for Papers schedule is Public.Checkout the link'
end end
end end

View file

@ -44,7 +44,7 @@ feature EventType do
value).to eq('300') value).to eq('300')
# Remove event type # Remove event type
within("div.nested-fields:nth-of-type(3)") do within('div.nested-fields:nth-of-type(3)') do
click_link 'Remove event_type' click_link 'Remove event_type'
end end
expect(page.all('div.nested-fields').count == 2).to be true expect(page.all('div.nested-fields').count == 2).to be true

View file

@ -15,7 +15,7 @@ feature Openid do
visit '/accounts/sign_in' visit '/accounts/sign_in'
mock_auth_new_user mock_auth_new_user
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
expect(flash).to eq('test-1@gmail.com signed in successfully with google') expect(flash).to eq('test-1@gmail.com signed in successfully with google')
@ -30,7 +30,7 @@ feature Openid do
visit '/accounts/sign_in' visit '/accounts/sign_in'
mock_auth_existing_user_participant mock_auth_existing_user_participant
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google') expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
@ -42,7 +42,7 @@ feature Openid do
OmniAuth.config.mock_auth[:google] = :invalid_credentials OmniAuth.config.mock_auth[:google] = :invalid_credentials
visit '/accounts/sign_in' visit '/accounts/sign_in'
expect(page.has_content?('or sign in using')).to be true expect(page.has_content?('or sign in using')).to be true
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
@ -60,7 +60,7 @@ feature Openid do
visit '/accounts/edit' visit '/accounts/edit'
mock_auth_new_user mock_auth_new_user
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google') expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
@ -77,7 +77,7 @@ feature Openid do
visit '/accounts/sign_in' visit '/accounts/sign_in'
mock_auth_existing_user_participant mock_auth_existing_user_participant
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google') expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
@ -90,7 +90,7 @@ feature Openid do
visit '/accounts/edit' visit '/accounts/edit'
mock_auth_new_user mock_auth_new_user
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google') expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
@ -106,7 +106,7 @@ feature Openid do
visit '/accounts/sign_in' visit '/accounts/sign_in'
mock_auth_new_user_fb mock_auth_new_user_fb
within("#openidlinks") do within('#openidlinks') do
click_link 'omniauth-facebook' click_link 'omniauth-facebook'
end end
expect(flash).to eq('test-participant-1@google.com signed in successfully with facebook') expect(flash).to eq('test-participant-1@google.com signed in successfully with facebook')

View file

@ -56,7 +56,7 @@ feature Photo do
click_button 'Save Photo' click_button 'Save Photo'
expect(flash). expect(flash).
to eq("A error prohibited this Photo from being saved: Picture content type is invalid. Picture is invalid.") to eq('A error prohibited this Photo from being saved: Picture content type is invalid. Picture is invalid.')
expect(Photo.count).to eq(expected_count) expect(Photo.count).to eq(expected_count)
end end
end end

View file

@ -17,7 +17,7 @@ feature RegistrationPeriod do
click_button 'Save Registration Period' click_button 'Save Registration Period'
expect(flash). expect(flash).
to eq("A error prohibited the Registration Period from being saved: " \ to eq('A error prohibited the Registration Period from being saved: ' \
"Start date can't be blank. End date can't be blank.") "Start date can't be blank. End date can't be blank.")
page. page.

View file

@ -6,7 +6,7 @@ RSpec.configure do |config|
config.before(:each) do config.before(:each) do
DatabaseCleaner.strategy = :transaction DatabaseCleaner.strategy = :transaction
end end
config.before(:each, js: true) do config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation DatabaseCleaner.strategy = :truncation
end end

View file

@ -3,9 +3,9 @@
RSpec.configure do |config| RSpec.configure do |config|
config.after(:each, type: :feature) do config.after(:each, type: :feature) do
ename = RSpec.current_example.full_description ename = RSpec.current_example.full_description
ename = ename.gsub " ", "_" ename = ename.gsub ' ', '_'
ename.downcase! ename.downcase!
ename = ename + ".html" ename = ename + '.html'
if RSpec.current_example.exception.present? if RSpec.current_example.exception.present?
save_page(ename) save_page(ename)
else else

View file

@ -16,11 +16,11 @@ describe 'admin/conference/roles' do
expect(rendered).to include("Add role 'Organizer' to user:") expect(rendered).to include("Add role 'Organizer' to user:")
expect(rendered).to include('Add role') expect(rendered).to include('Add role')
expect(rendered).to include('Users with role Organizer') expect(rendered).to include('Users with role Organizer')
expect(rendered).to have_selector("table thead th:nth-of-type(1)", text: 'ID') expect(rendered).to have_selector('table thead th:nth-of-type(1)', text: 'ID')
expect(rendered).to have_selector("table thead th:nth-of-type(2)", text: 'Name') expect(rendered).to have_selector('table thead th:nth-of-type(2)', text: 'Name')
expect(rendered).to have_selector("table thead th:nth-of-type(3)", text: 'Email') expect(rendered).to have_selector('table thead th:nth-of-type(3)', text: 'Email')
expect(rendered).to have_selector("table tbody tr:nth-of-type(1) td:nth-of-type(1)", text: organizer.id) expect(rendered).to have_selector('table tbody tr:nth-of-type(1) td:nth-of-type(1)', text: organizer.id)
expect(rendered).to have_selector("table tbody tr:nth-of-type(1) td:nth-of-type(2)", text: 'test name') expect(rendered).to have_selector('table tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 'test name')
expect(rendered).to have_selector("table tbody tr:nth-of-type(1) td:nth-of-type(3)", text: 'test@email.com') expect(rendered).to have_selector('table tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 'test@email.com')
end end
end end

View file

@ -18,15 +18,15 @@ describe 'admin/emails/index' do
to include('Conference dates have been updated') to include('Conference dates have been updated')
expect(rendered). expect(rendered).
to include('Conference registration dates have been updated') to include('Conference registration dates have been updated')
expect(rendered).to include("Venue has been updated") expect(rendered).to include('Venue has been updated')
expect(rendered).to include("Venue has been Updated to Sample Location") expect(rendered).to include('Venue has been Updated to Sample Location')
expect(rendered). expect(rendered).
to include("Call for Papers dates have been updated") to include('Call for Papers dates have been updated')
expect(rendered). expect(rendered).
to include("Please checkout the new updates to submit your proposal for Sample Conference") to include('Please checkout the new updates to submit your proposal for Sample Conference')
expect(rendered). expect(rendered).
to include("Sample Conference Cfp schedule is Public") to include('Sample Conference Cfp schedule is Public')
expect(rendered). expect(rendered).
to include("Call for Papers schedule is Public.Checkout the link") to include('Call for Papers schedule is Public.Checkout the link')
end end
end end

View file

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'conference/show.html.haml' do describe 'conference/show.html.haml' do
before(:each) do before(:each) do
allow(view).to receive(:date_string).and_return("January 17 - 21 2014") allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
@conference = create(:conference, @conference = create(:conference,
sponsor_email: 'example@example.com') sponsor_email: 'example@example.com')

View file

@ -1,10 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe 'home/index' do describe 'home/index' do
it "renders _conference partial for each conference" do it 'renders _conference partial for each conference' do
allow(view).to receive(:date_string).and_return("January 17 - 21 2014") allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
assign(:current, [create(:conference), create(:conference)]) assign(:current, [create(:conference), create(:conference)])
render render
expect(view).to render_template(partial: "_conference_details", count: 2) expect(view).to render_template(partial: '_conference_details', count: 2)
end end
end end