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
|
||||
|
||||
def destroy
|
||||
if organizer_or_admin?
|
||||
@upload = Upload.find(params[:id])
|
||||
else
|
||||
@proposal = current_user.person.events.find(params[:proposal_id])
|
||||
@proposal = Event.find(params[:proposal_id])
|
||||
|
||||
if organizer_or_admin? || current_user.person == @proposal.submitter
|
||||
@upload = @proposal.event_attachments.find(params[:id])
|
||||
end
|
||||
|
||||
@upload.destroy if !@upload.nil?
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to uploads_url }
|
||||
format.json { head :no_content }
|
||||
|
||||
if @upload.destroy
|
||||
flash[:notice] = "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'"
|
||||
else
|
||||
flash[:error] = "Attachment could not be deleted."
|
||||
end
|
||||
|
||||
redirect_back_or_to conference_proposal_index_path(@conference.short_title)
|
||||
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|
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%th
|
||||
%th
|
||||
%b Filename
|
||||
%th
|
||||
|
|
@ -24,6 +23,23 @@
|
|||
%b Public
|
||||
%th
|
||||
%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
|
||||
.btn.btn-success.fileinput-button
|
||||
%span.glyphicon.glyphicon-icon-plus.icon-white
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue