From 1d4ec06bacaa9251d566d0ce411d85b5a7c19ac6 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Tue, 15 Jul 2014 10:23:56 +0300 Subject: [PATCH] fixes for event attachment --- app/controllers/event_attachments_controller.rb | 8 ++++---- app/views/proposal/_form.html.haml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/event_attachments_controller.rb b/app/controllers/event_attachments_controller.rb index a7e63b47..93632c05 100644 --- a/app/controllers/event_attachments_controller.rb +++ b/app/controllers/event_attachments_controller.rb @@ -71,7 +71,7 @@ class EventAttachmentsController < ApplicationController :content_type => 'text/html', :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) } else format.html { render action: "new" } @@ -97,13 +97,13 @@ class EventAttachmentsController < ApplicationController def destroy @proposal = Event.find(params[:proposal_id]) - + if organizer_or_admin? || current_user == @proposal.submitter @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}'" } diff --git a/app/views/proposal/_form.html.haml b/app/views/proposal/_form.html.haml index e8c8d17d..0e88e38a 100644 --- a/app/views/proposal/_form.html.haml +++ b/app/views/proposal/_form.html.haml @@ -45,7 +45,7 @@ data.formData = inputs.serializeArray(); }); $.getJSON($('#fileupload').prop('action'), function (files) { - var fu = $('#fileupload').data('fileupload'), + var fu = $('#fileupload').data('blueimpFileupload'), template; fu._adjustMaxNumberOfFiles(-files.length); template = fu._renderDownload(files)