fixes for event attachment

This commit is contained in:
Stella Rouzi 2014-07-15 10:23:56 +03:00
parent 2244f55629
commit 1d4ec06bac
2 changed files with 5 additions and 5 deletions

View file

@ -71,7 +71,7 @@ class EventAttachmentsController < ApplicationController
:content_type => 'text/html', :content_type => 'text/html',
:layout => false :layout => false
} }
format.json { render json: [@upload.to_jq_upload].to_json, status: :created, 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) } location: conference_proposal_event_attachment_path(@upload.event.conference.short_title, @upload.event, @upload) }
else else
format.html { render action: "new" } format.html { render action: "new" }
@ -97,13 +97,13 @@ class EventAttachmentsController < ApplicationController
def destroy def destroy
@proposal = Event.find(params[:proposal_id]) @proposal = Event.find(params[:proposal_id])
if organizer_or_admin? || current_user == @proposal.submitter if organizer_or_admin? || current_user == @proposal.submitter
@upload = @proposal.event_attachments.find(params[:id]) @upload = @proposal.event_attachments.find(params[:id])
end end
@upload.destroy if !@upload.nil? @upload.destroy if !@upload.nil?
respond_to do |format| 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}'" }

View file

@ -45,7 +45,7 @@
data.formData = inputs.serializeArray(); data.formData = inputs.serializeArray();
}); });
$.getJSON($('#fileupload').prop('action'), function (files) { $.getJSON($('#fileupload').prop('action'), function (files) {
var fu = $('#fileupload').data('fileupload'), var fu = $('#fileupload').data('blueimpFileupload'),
template; template;
fu._adjustMaxNumberOfFiles(-files.length); fu._adjustMaxNumberOfFiles(-files.length);
template = fu._renderDownload(files) template = fu._renderDownload(files)