style fixes

This commit is contained in:
Stella Rouzi 2014-07-15 10:40:51 +03:00
parent 1d4ec06bac
commit 48b9b49655
3 changed files with 27 additions and 28 deletions

View file

@ -1,15 +1,15 @@
class EventAttachmentsController < ApplicationController
before_filter :verify_user
skip_before_filter :verify_user, :only => [:show]
skip_before_filter :verify_user, only: [:show]
def index
@proposal = Event.find(params[:proposal_id])
@uploads = @proposal.event_attachments
@uploads = @uploads.map{|upload| upload.to_jq_upload }
@uploads = @uploads.map { |upload| upload.to_jq_upload }
respond_to do |format|
format.html # index.html.erb
format.json { render json: @uploads.to_json}
format.json { render json: @uploads.to_json }
end
end
@ -53,7 +53,7 @@ class EventAttachmentsController < ApplicationController
if !organizer_or_admin?
begin
event = current_user.events.find(params[:proposal_id])
rescue Exception => e
rescue => e
# They certainly aren't allowed to attach a file to someone else's proposal
raise ActionController::RoutingError.new('Invalid proposal')
end
@ -67,14 +67,15 @@ class EventAttachmentsController < ApplicationController
respond_to do |format|
if @upload.save
format.html {
render :json => [@upload.to_jq_upload].to_json,
:content_type => 'text/html',
:layout => false
render json: [@upload.to_jq_upload].to_json,
content_type: 'text/html',
layout: false
}
format.json { render json: {files: [@upload.to_jq_upload]}, status: :created,
location: conference_proposal_event_attachment_path(@upload.event.conference.short_title, @upload.event, @upload) }
format.json { render json: { files: [@upload.to_jq_upload] }, status: :created,
location: conference_proposal_event_attachment_path(
@upload.event.conference.short_title, @upload.event, @upload) }
else
format.html { render action: "new" }
format.html { render action: 'new' }
format.json { render json: @upload.errors, status: :unprocessable_entity }
end
end
@ -89,7 +90,7 @@ class EventAttachmentsController < ApplicationController
format.html { redirect_to @upload, notice: 'Upload was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.html { render action: 'edit' }
format.json { render json: @upload.errors, status: :unprocessable_entity }
end
end
@ -106,7 +107,8 @@ class EventAttachmentsController < ApplicationController
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.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