apply StringLiterals cop (remove double quotes, unless there is string interpolation)
This commit is contained in:
parent
f91467a00a
commit
b7c45718d8
45 changed files with 275 additions and 109 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
19
app/controllers/admin/supporters_controller.rb
Normal file
19
app/controllers/admin/supporters_controller.rb
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
|
|||
check_authorization unless: :devise_controller?
|
||||
|
||||
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
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
|
|
@ -49,7 +49,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
Rails.logger.debug("Access denied!")
|
||||
Rails.logger.debug('Access denied!')
|
||||
redirect_to root_path, alert: exception.message
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ class ConferenceController < ApplicationController
|
|||
subscription = Subscription.new(user_id: current_user.id, conference_id: conference.id)
|
||||
begin
|
||||
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
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
flash[:error] = subscription.errors.full_messages.to_sentence
|
||||
redirect_to root_path
|
||||
end
|
||||
else
|
||||
flash[:notice] = "Already Subscribed"
|
||||
flash[:notice] = 'Already Subscribed'
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
|
@ -25,7 +25,7 @@ class ConferenceController < ApplicationController
|
|||
conference = Conference.find_by_short_title(params[:id])
|
||||
subscription = current_user.subscriptions.where(conference_id: conference.id).first
|
||||
if subscription.blank?
|
||||
flash[:notice] = "Already Unsubscribed"
|
||||
flash[:notice] = 'Already Unsubscribed'
|
||||
redirect_to root_path
|
||||
else
|
||||
begin
|
||||
|
|
@ -41,6 +41,6 @@ class ConferenceController < ApplicationController
|
|||
|
||||
def gallery_photos
|
||||
@photos = @conference.photos
|
||||
render "photos", formats: [:js]
|
||||
render 'photos', formats: [:js]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
110
app/controllers/event_attachments_controller.rb
Normal file
110
app/controllers/event_attachments_controller.rb
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
class EventAttachmentsController < ApplicationController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :proposal, class: Event
|
||||
load_and_authorize_resource :upload, class: EventAttachment, through: :proposal
|
||||
before_filter :verify_user
|
||||
skip_before_filter :verify_user, only: [:show]
|
||||
|
||||
def index
|
||||
@uploads = @proposal.event_attachments
|
||||
@uploads = @uploads.map{|upload| upload.to_jq_upload }
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @uploads.to_json}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
if @upload.public?
|
||||
send_file @upload.attachment.path
|
||||
return
|
||||
end
|
||||
|
||||
if current_user.nil?
|
||||
verify_user
|
||||
return
|
||||
end
|
||||
|
||||
if organizer_or_admin? || current_user == upload.event.submitter
|
||||
send_file @upload.attachment.path
|
||||
else
|
||||
raise ActionController::RoutingError.new('Not Found')
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@upload = EventAttachment.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @upload }
|
||||
end
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
params[:event_attachment][:title] = params[:title][0]
|
||||
params[:event_attachment][:public] = false
|
||||
params[:event_attachment][:event_id] = params[:proposal_id]
|
||||
|
||||
if cannot? :create, EventAttachment
|
||||
begin
|
||||
current_user.events.find(params[:proposal_id])
|
||||
rescue
|
||||
# They certainly aren't allowed to attach a file to someone else's proposal
|
||||
raise ActionController::RoutingError.new('Invalid proposal')
|
||||
end
|
||||
end
|
||||
|
||||
if params.has_key?(:public)
|
||||
params[:event_attachment][:public] = true
|
||||
end
|
||||
@upload = EventAttachment.new(params[:event_attachment])
|
||||
|
||||
respond_to do |format|
|
||||
if @upload.save
|
||||
format.html do
|
||||
render json: [@upload.to_jq_upload].to_json,
|
||||
content_type: 'text/html',
|
||||
layout: false
|
||||
end
|
||||
format.json do
|
||||
render json: [@upload.to_jq_upload].to_json, status: :created,
|
||||
location: conference_proposal_event_attachment_path(@upload.event.conference.short_title, @upload.event, @upload)
|
||||
end
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @upload.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @upload.update_attributes(params[:upload])
|
||||
format.html { redirect_to @upload, notice: 'Upload was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
format.json { render json: @upload.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if can? :destroy, @proposal
|
||||
@upload = @proposal.event_attachments.find(params[:id])
|
||||
end
|
||||
|
||||
@upload.destroy if !@upload.nil?
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_back_or_to conference_proposal_index_path(@conference.short_title), notice: "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'" }
|
||||
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -4,7 +4,7 @@ class HomeController < ApplicationController
|
|||
|
||||
def index
|
||||
@today = Date.current
|
||||
@current = Conference.where("end_date >= ?", @today).order("start_date ASC")
|
||||
@current = Conference.where('end_date >= ?', @today).order('start_date ASC')
|
||||
end
|
||||
|
||||
def respond_to_options
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class ProposalController < ApplicationController
|
|||
end
|
||||
|
||||
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||
notice: "Proposal was successfully updated.")
|
||||
notice: 'Proposal was successfully updated.')
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
@ -92,7 +92,7 @@ class ProposalController < ApplicationController
|
|||
|
||||
@event.save(validate: false)
|
||||
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||
notice: "Proposal was successfully withdrawn.")
|
||||
notice: 'Proposal was successfully withdrawn.')
|
||||
end
|
||||
|
||||
def confirm
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class ScheduleController < ApplicationController
|
||||
authorize_resource class: false
|
||||
layout "application"
|
||||
layout 'application'
|
||||
|
||||
def index
|
||||
@conference = Conference.
|
||||
|
|
@ -11,9 +11,9 @@ class ScheduleController < ApplicationController
|
|||
@dates = @conference.start_date..@conference.end_date
|
||||
|
||||
if @dates == Date.current
|
||||
@today = Date.current.strftime("%Y-%m-%d")
|
||||
@today = Date.current.strftime('%Y-%m-%d')
|
||||
else
|
||||
@today = @conference.start_date.strftime("%Y-%m-%d")
|
||||
@today = @conference.start_date.strftime('%Y-%m-%d')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue