apply StringLiterals cop (remove double quotes, unless there is string interpolation)

This commit is contained in:
Stella Rouzi 2014-08-18 21:54:43 +03:00
parent f91467a00a
commit b7c45718d8
45 changed files with 275 additions and 109 deletions

View file

@ -28,7 +28,7 @@ module Admin
else
redirect_to(admin_conference_callforpapers_path(
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
@ -44,7 +44,7 @@ module Admin
else
redirect_to(admin_conference_callforpapers_path(
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

View file

@ -13,18 +13,18 @@ module Admin
begin
@conference.use_difficulty_levels = false
@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))
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))
end
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))
end
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))
end
end

View file

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

View file

@ -0,0 +1,19 @@
module Admin
class SupportersController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference
def index
respond_to do |format|
format.html
format.json { render json: DatatableSupporters.new(@conference.supporter_registrations, view_context) }
end
end
def create
params[:supporter_registration][:conference_id] = @conference.id
SupporterRegistration.create!(params[:supporter_registration])
redirect_to(admin_conference_supporters_path(conference_id: @conference.short_title), notice: 'Supporter added')
end
end
end

View file

@ -25,7 +25,7 @@ module Admin
def update
if can_manage_volunteers(@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
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}")
end