Attachments can now be added to wiki pages (original patch by Pavol Murin). Only authorized users can add/delete attachments.
Attached images can be displayed inline, using textile image tag (for wiki pages, issue descriptions and forum messages). git-svn-id: http://redmine.rubyforge.org/svn/trunk@541 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
|
||||
<%= image_to_function "add.png", "addFileField();return false" %></label>
|
||||
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="attachments">
|
||||
<% for attachment in attachments %>
|
||||
<p><%= link_to attachment.filename, {:controller => 'attachments', :action => 'download', :id => attachment }, :class => 'icon icon-attachment' %>
|
||||
(<%= number_to_human_size attachment.filesize %>)
|
||||
<% unless options[:no_author] %>
|
||||
<em><%= attachment.author.display_name %>, <%= format_date(attachment.created_on) %></em>
|
||||
<% end %>
|
||||
<% if options[:delete_url] %>
|
||||
<%= link_to image_tag('delete.png'), options[:delete_url].update({:attachment_id => attachment}), :confirm => l(:text_are_you_sure), :method => :post %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@ end %>
|
||||
<% end %>
|
||||
|
||||
<b><%=l(:field_description)%> :</b><br /><br />
|
||||
<%= textilizable @issue.description %>
|
||||
<%= textilizable @issue.description, :attachments => @issue.attachments %>
|
||||
<br />
|
||||
|
||||
<div class="contextual">
|
||||
@@ -92,24 +92,14 @@ end %>
|
||||
|
||||
<div class="box">
|
||||
<h3><%=l(:label_attachment_plural)%></h3>
|
||||
<table width="100%">
|
||||
<% for attachment in @issue.attachments %>
|
||||
<tr>
|
||||
<td><%= link_to attachment.filename, { :action => 'download', :id => @issue, :attachment_id => attachment }, :class => 'icon icon-attachment' %> (<%= number_to_human_size(attachment.filesize) %>)</td>
|
||||
<td><%= format_date(attachment.created_on) %></td>
|
||||
<td><%= attachment.author.display_name %></td>
|
||||
<td><div class="contextual"><%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy_attachment', :id => @issue, :attachment_id => attachment }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></div></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<br />
|
||||
<%= link_to_attachments @issue.attachments, :delete_url => (authorize_for('issues', 'destroy_attachment') ? {:controller => 'issues', :action => 'destroy_attachment', :id => @issue} : nil) %>
|
||||
|
||||
<% if authorize_for('issues', 'add_attachment') %>
|
||||
<% form_tag({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") do %>
|
||||
<p id="attachments_p"><label><%=l(:label_attachment_new)%>
|
||||
<%= image_to_function "add.png", "addFileField();return false" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<% end %>
|
||||
<p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p>
|
||||
<% form_tag({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %>
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,8 +10,5 @@
|
||||
<!--[eoform:message]-->
|
||||
|
||||
<span class="tabular">
|
||||
<p id="attachments_p"><label><%=l(:label_attachment)%>
|
||||
<%= image_to_function "add.png", "addFileField();return false" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
|
||||
</span>
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</div>
|
||||
|
||||
@@ -2,15 +2,10 @@
|
||||
|
||||
<p><em><%= @message.author.name %>, <%= format_time(@message.created_on) %></em></p>
|
||||
<div class="wiki">
|
||||
<%= textilizable(@message.content) %>
|
||||
<%= textilizable(@message.content, :attachments => @message.attachments) %>
|
||||
</div>
|
||||
<div class="attachments">
|
||||
<% @message.attachments.each do |attachment| %>
|
||||
<%= link_to attachment.filename, { :action => 'download', :id => @message, :attachment_id => attachment }, :class => 'icon icon-attachment' %>
|
||||
(<%= number_to_human_size(attachment.filesize) %>)<br />
|
||||
<% end %>
|
||||
</div>
|
||||
<br />
|
||||
<%= link_to_attachments @message.attachments, :no_author => true %>
|
||||
|
||||
<h3 class="icon22 icon22-comment"><%= l(:label_reply_plural) %></h3>
|
||||
<% @message.children.each do |message| %>
|
||||
<a name="<%= "message-#{message.id}" %>"></a>
|
||||
@@ -28,4 +23,4 @@
|
||||
<p><%= submit_tag l(:button_submit) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<fieldset class="preview"><legend><%= l(:label_preview) %></legend>
|
||||
<%= textilizable @text %>
|
||||
<%= textilizable @text, :attachments => @attachements %>
|
||||
</fieldset>
|
||||
|
||||
@@ -21,12 +21,22 @@
|
||||
|
||||
<div class="wiki">
|
||||
<% cache "wiki/show/#{@page.id}/#{@content.version}" do %>
|
||||
<%= textilizable @content.text %>
|
||||
<%= textilizable @content.text, :attachments => @page.attachments %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to_attachments @page.attachments, :delete_url => (authorize_for('wiki', 'destroy_attachment') ? {:controller => 'wiki', :action => 'destroy_attachment', :page => @page.title} : nil) %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= l(:label_export_to) %>
|
||||
<%= link_to 'HTML', {:export => 'html', :version => @content.version}, :class => 'icon icon-html' %>,
|
||||
<%= link_to 'TXT', {:export => 'txt', :version => @content.version}, :class => 'icon icon-txt' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if authorize_for('wiki', 'add_attachment') %>
|
||||
<p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p>
|
||||
<% form_tag({ :controller => 'wiki', :action => 'add_attachment', :page => @page.title }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %>
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user