show attachments to user
This commit is contained in:
parent
bacae17b87
commit
7022e5da1d
2 changed files with 27 additions and 12 deletions
|
|
@ -95,19 +95,18 @@ class EventAttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if organizer_or_admin?
|
@proposal = Event.find(params[:proposal_id])
|
||||||
@upload = Upload.find(params[:id])
|
|
||||||
else
|
if organizer_or_admin? || current_user.person == @proposal.submitter
|
||||||
@proposal = current_user.person.events.find(params[:proposal_id])
|
|
||||||
@upload = @proposal.event_attachments.find(params[:id])
|
@upload = @proposal.event_attachments.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
@upload.destroy if !@upload.nil?
|
if @upload.destroy
|
||||||
|
flash[:notice] = "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'"
|
||||||
respond_to do |format|
|
else
|
||||||
|
flash[:error] = "Attachment could not be deleted."
|
||||||
format.html { redirect_to uploads_url }
|
|
||||||
format.json { head :no_content }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
redirect_back_or_to conference_proposal_index_path(@conference.short_title)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event), :html => { :multipart => true, :id => "fileupload" } do |f|
|
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event), :html => { :multipart => true, :id => "fileupload" } do |f|
|
||||||
%table.table.table-striped
|
%table.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%th
|
|
||||||
%th
|
%th
|
||||||
%b Filename
|
%b Filename
|
||||||
%th
|
%th
|
||||||
|
|
@ -24,6 +23,23 @@
|
||||||
%b Public
|
%b Public
|
||||||
%th
|
%th
|
||||||
%tbody.files
|
%tbody.files
|
||||||
|
- @event.event_attachments.each do |a|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= link_to a.attachment_file_name, conference_proposal_event_attachment_path(@conference.short_title, @event.id, a.id)
|
||||||
|
%td
|
||||||
|
= a.title
|
||||||
|
%td
|
||||||
|
= number_to_human_size a.attachment_file_size
|
||||||
|
%td
|
||||||
|
- if a.public?
|
||||||
|
Public
|
||||||
|
- else
|
||||||
|
Not Public
|
||||||
|
%td
|
||||||
|
= link_to "Delete", conference_proposal_event_attachment_path(@conference.short_title, @event.id, a.id),
|
||||||
|
:method => :delete, :confirm => "Are you sure you want to delete this attachment? It's permanant!"
|
||||||
|
|
||||||
.row-fluid.fileupload-buttonbar
|
.row-fluid.fileupload-buttonbar
|
||||||
.btn.btn-success.fileinput-button
|
.btn.btn-success.fileinput-button
|
||||||
%span.glyphicon.glyphicon-icon-plus.icon-white
|
%span.glyphicon.glyphicon-icon-plus.icon-white
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue