summaryrefslogtreecommitdiffstats
path: root/app/views/projects
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-12-09 18:00:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-12-09 18:00:27 +0000
commit66ff4cb7de55328ee6d9ea08d26caeb3d0a19d80 (patch)
tree0be90ee0f69c66e70ca32a6635b782eabd1bca20 /app/views/projects
parent5d2899ee1b3e00d0cf43521182b1244dfc3cfe9f (diff)
downloadredmine-66ff4cb7de55328ee6d9ea08d26caeb3d0a19d80.tar.gz
redmine-66ff4cb7de55328ee6d9ea08d26caeb3d0a19d80.zip
Files module: makes version field non required (#1053).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2117 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/projects')
-rw-r--r--app/views/projects/add_file.rhtml9
-rw-r--r--app/views/projects/list_files.rhtml21
2 files changed, 15 insertions, 15 deletions
diff --git a/app/views/projects/add_file.rhtml b/app/views/projects/add_file.rhtml
index 0ee55083d..ab9c7352d 100644
--- a/app/views/projects/add_file.rhtml
+++ b/app/views/projects/add_file.rhtml
@@ -4,10 +4,13 @@
<div class="box">
<% form_tag({ :action => 'add_file', :id => @project }, :multipart => true, :class => "tabular") do %>
-<p><label for="version_id"><%=l(:field_version)%> <span class="required">*</span></label>
-<%= select_tag "version_id", options_from_collection_for_select(@versions, "id", "name") %></p>
+<% if @versions.any? %>
+<p><label for="version_id"><%=l(:field_version)%></label>
+<%= select_tag "version_id", content_tag('option', '') +
+ options_from_collection_for_select(@versions, "id", "name") %></p>
+<% end %>
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div>
<%= submit_tag l(:button_add) %>
-<% end %> \ No newline at end of file
+<% end %>
diff --git a/app/views/projects/list_files.rhtml b/app/views/projects/list_files.rhtml
index 06f8d9b8d..2ec782c0e 100644
--- a/app/views/projects/list_files.rhtml
+++ b/app/views/projects/list_files.rhtml
@@ -8,36 +8,33 @@
<table class="list">
<thead><tr>
- <th><%=l(:field_version)%></th>
<%= sort_header_tag("#{Attachment.table_name}.filename", :caption => l(:field_filename)) %>
<%= sort_header_tag("#{Attachment.table_name}.created_on", :caption => l(:label_date), :default_order => 'desc') %>
<%= sort_header_tag("#{Attachment.table_name}.filesize", :caption => l(:field_filesize), :default_order => 'desc') %>
<%= sort_header_tag("#{Attachment.table_name}.downloads", :caption => l(:label_downloads_abbr), :default_order => 'desc') %>
<th>MD5</th>
- <% if delete_allowed %><th></th><% end %>
+ <th></th>
</tr></thead>
<tbody>
-<% for version in @versions %>
- <% unless version.attachments.empty? %>
- <tr><th colspan="7" align="left"><span class="icon icon-package"><b><%= version.name %></b></span></th></tr>
- <% for file in version.attachments %>
+<% @containers.each do |container| %>
+ <% next if container.attachments.empty? -%>
+ <% if container.is_a?(Version) -%>
+ <tr><th colspan="6" align="left"><span class="icon icon-package"><b><%=h container %></b></span></th></tr>
+ <% end -%>
+ <% container.attachments.each do |file| %>
<tr class="<%= cycle("odd", "even") %>">
- <td></td>
<td><%= link_to_attachment file, :download => true, :title => file.description %></td>
<td align="center"><%= format_time(file.created_on) %></td>
<td align="center"><%= number_to_human_size(file.filesize) %></td>
<td align="center"><%= file.downloads %></td>
<td align="center"><small><%= file.digest %></small></td>
- <% if delete_allowed %>
<td align="center">
- <%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'destroy', :id => file},
- :confirm => l(:text_are_you_sure), :method => :post %>
+ <%= link_to(image_tag('delete.png'), {:controller => 'attachments', :action => 'destroy', :id => file},
+ :confirm => l(:text_are_you_sure), :method => :post) if delete_allowed %>
</td>
- <% end %>
</tr>
<% end
reset_cycle %>
- <% end %>
<% end %>
</tbody>
</table>