Loading .rubocop.yml 0 → 100644 +57 −0 Original line number Diff line number Diff line # old ruby style syntax may still be needed Style/HashSyntax: Enabled: false # never break line due to length, except in data # vim: set wrap Metrics/LineLength: Max: 1024 # use and/or for flow control, but not in boolean assignments # http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/ Style/AndOr: Enabled: false # use not with .select and flow control Style/Not: Enabled: false # use self for clarity (args?) Style/RedundantSelf: Enabled: false # Good cop, but to spammy Style/StringLiterals: Enabled: false # use { only for single line blocks, but allow block content on its own line to keep line length short # each { |l| # l.apply_long_method_name # } Style/BlockDelimiters: Enabled: false # Do not use lambda Style/Lambda: Enabled: false # allow TODO instead of requiring TODO: Style/CommentAnnotation: Enabled: false # Can't decide on alignment, vim prefers fixed indent Style/AlignParameters: Enabled: false EnforcedStyle: with_fixed_indentation # Do not write 1234 as 1_234 Style/NumericLiterals: Enabled: false # Relax for controllers with multiple formats Metrics/AbcSize: Max: 40 # to spammy Style/Documentation: Enabled: false app/controllers/application_controller.rb +6 −10 Original line number Diff line number Diff line class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_locale before_action :set_locale prepend_before_filter :load_conference helper_method :current_user Loading @@ -28,7 +28,7 @@ class ApplicationController < ActionController::Base end def set_locale if %w{en de}.include?( params[:locale] ) if %w(en de).include?(params[:locale]) I18n.locale = params[:locale] else I18n.locale = 'en' Loading @@ -39,16 +39,14 @@ class ApplicationController < ActionController::Base def load_conference if params[:conference_acronym] @conference = Conference.find_by_acronym(params[:conference_acronym]) raise ActionController::RoutingError.new("Not found") unless @conference elsif session.has_key?(:conference_acronym) fail ActionController::RoutingError.new("Not found") unless @conference elsif session.key?(:conference_acronym) @conference = Conference.find_by_acronym(session[:conference_acronym]) elsif Conference.count > 0 @conference = Conference.current end unless @conference.nil? session[:conference_acronym] = @conference.acronym end session[:conference_acronym] = @conference.acronym unless @conference.nil? Time.zone = @conference.timezone if @conference end Loading @@ -59,9 +57,7 @@ class ApplicationController < ActionController::Base def default_url_options result = { locale: params[:locale] } if @conference result.merge!(conference_acronym: @conference.acronym) end result.merge!(conference_acronym: @conference.acronym) if @conference result end Loading app/controllers/availabilities_controller.rb +3 −4 Original line number Diff line number Diff line class AvailabilitiesController < ApplicationController before_filter :authenticate_user! before_filter :not_submitter! before_filter :find_person before_action :authenticate_user! before_action :not_submitter! before_action :find_person def new @availabilities = Availability.build_for(@conference) Loading app/controllers/call_for_participations_controller.rb +2 −3 Original line number Diff line number Diff line class CallForParticipationsController < ApplicationController before_filter :authenticate_user! before_filter :not_submitter! before_action :authenticate_user! before_action :not_submitter! load_and_authorize_resource def show Loading app/controllers/cfp/availabilities_controller.rb +2 −4 Original line number Diff line number Diff line class Cfp::AvailabilitiesController < ApplicationController layout 'cfp' before_filter :authenticate_user! before_action :authenticate_user! def new authorize! :create, current_user.person Loading @@ -16,7 +15,7 @@ class Cfp::AvailabilitiesController < ApplicationController def update authorize! :update, current_user.person if params.has_key? :person if params.key? :person current_user.person.update_attributes_from_slider_form(person_params) end redirect_to cfp_root_path, notice: t("cfp.update_availability_notice") Loading @@ -27,5 +26,4 @@ class Cfp::AvailabilitiesController < ApplicationController def person_params params.require(:person).permit(:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar, :abstract, :description, :include_in_mailings, availabilities_attributes: %i(id start_date end_date conference_id day_id)) end end Loading
.rubocop.yml 0 → 100644 +57 −0 Original line number Diff line number Diff line # old ruby style syntax may still be needed Style/HashSyntax: Enabled: false # never break line due to length, except in data # vim: set wrap Metrics/LineLength: Max: 1024 # use and/or for flow control, but not in boolean assignments # http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/ Style/AndOr: Enabled: false # use not with .select and flow control Style/Not: Enabled: false # use self for clarity (args?) Style/RedundantSelf: Enabled: false # Good cop, but to spammy Style/StringLiterals: Enabled: false # use { only for single line blocks, but allow block content on its own line to keep line length short # each { |l| # l.apply_long_method_name # } Style/BlockDelimiters: Enabled: false # Do not use lambda Style/Lambda: Enabled: false # allow TODO instead of requiring TODO: Style/CommentAnnotation: Enabled: false # Can't decide on alignment, vim prefers fixed indent Style/AlignParameters: Enabled: false EnforcedStyle: with_fixed_indentation # Do not write 1234 as 1_234 Style/NumericLiterals: Enabled: false # Relax for controllers with multiple formats Metrics/AbcSize: Max: 40 # to spammy Style/Documentation: Enabled: false
app/controllers/application_controller.rb +6 −10 Original line number Diff line number Diff line class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_locale before_action :set_locale prepend_before_filter :load_conference helper_method :current_user Loading @@ -28,7 +28,7 @@ class ApplicationController < ActionController::Base end def set_locale if %w{en de}.include?( params[:locale] ) if %w(en de).include?(params[:locale]) I18n.locale = params[:locale] else I18n.locale = 'en' Loading @@ -39,16 +39,14 @@ class ApplicationController < ActionController::Base def load_conference if params[:conference_acronym] @conference = Conference.find_by_acronym(params[:conference_acronym]) raise ActionController::RoutingError.new("Not found") unless @conference elsif session.has_key?(:conference_acronym) fail ActionController::RoutingError.new("Not found") unless @conference elsif session.key?(:conference_acronym) @conference = Conference.find_by_acronym(session[:conference_acronym]) elsif Conference.count > 0 @conference = Conference.current end unless @conference.nil? session[:conference_acronym] = @conference.acronym end session[:conference_acronym] = @conference.acronym unless @conference.nil? Time.zone = @conference.timezone if @conference end Loading @@ -59,9 +57,7 @@ class ApplicationController < ActionController::Base def default_url_options result = { locale: params[:locale] } if @conference result.merge!(conference_acronym: @conference.acronym) end result.merge!(conference_acronym: @conference.acronym) if @conference result end Loading
app/controllers/availabilities_controller.rb +3 −4 Original line number Diff line number Diff line class AvailabilitiesController < ApplicationController before_filter :authenticate_user! before_filter :not_submitter! before_filter :find_person before_action :authenticate_user! before_action :not_submitter! before_action :find_person def new @availabilities = Availability.build_for(@conference) Loading
app/controllers/call_for_participations_controller.rb +2 −3 Original line number Diff line number Diff line class CallForParticipationsController < ApplicationController before_filter :authenticate_user! before_filter :not_submitter! before_action :authenticate_user! before_action :not_submitter! load_and_authorize_resource def show Loading
app/controllers/cfp/availabilities_controller.rb +2 −4 Original line number Diff line number Diff line class Cfp::AvailabilitiesController < ApplicationController layout 'cfp' before_filter :authenticate_user! before_action :authenticate_user! def new authorize! :create, current_user.person Loading @@ -16,7 +15,7 @@ class Cfp::AvailabilitiesController < ApplicationController def update authorize! :update, current_user.person if params.has_key? :person if params.key? :person current_user.person.update_attributes_from_slider_form(person_params) end redirect_to cfp_root_path, notice: t("cfp.update_availability_notice") Loading @@ -27,5 +26,4 @@ class Cfp::AvailabilitiesController < ApplicationController def person_params params.require(:person).permit(:first_name, :last_name, :public_name, :email, :email_public, :gender, :avatar, :abstract, :description, :include_in_mailings, availabilities_attributes: %i(id start_date end_date conference_id day_id)) end end