changeset 255:a7002a8f0eca feature_80

Show a star (or similar) by active files, or a checkbox if permitted to edit them. Checkbox doesn't do anything yet
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 03 Mar 2011 19:35:02 +0000
parents 0c9da2b87ad6
children e0dc03c8d745
files app/views/files/index.html.erb public/themes/soundsoftware/stylesheets/application.css
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/views/files/index.html.erb	Thu Mar 03 18:31:22 2011 +0000
+++ b/app/views/files/index.html.erb	Thu Mar 03 19:35:02 2011 +0000
@@ -5,14 +5,15 @@
 <h2><%=l(:label_attachment_plural)%></h2>
 
 <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
+<% active_change_allowed = delete_allowed %>
 
 <table class="list files">
   <thead><tr>
-    <%= sort_header_tag('active', :caption => l(:field_current)) %>
+    <%= sort_header_tag('active', :caption => l(:label_new)) %>
     <%= sort_header_tag('filename', :caption => l(:field_filename)) %>
     <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %>
     <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %>
-    <%= sort_header_tag('downloads', :caption => l(:label_downloads_abbr), :default_order => 'desc') %>
+    <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc') %>
     <th>MD5</th>
     <th></th>
   </tr></thead>
@@ -21,15 +22,21 @@
   <% next if container.attachments.empty? -%>
 	<% if container.is_a?(Version) -%>
   <tr>
-  	<th colspan="6" align="left">
+  	<th colspan="7" align="left">
   		<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
 		</th>
 	</tr>
 	<% end -%>
   <% container.attachments.each do |file| %>		
   <tr class="file <%= cycle("odd", "even") %>">
-    <td class="active"><%= file.active? %></td>
-    <td class="filename"><%= link_to_attachment file, :download => true, :title => file.description %></td>
+    <td class="active">
+      <% if active_change_allowed -%>
+        <%= check_box_tag 'active', file.id, file.active? %>
+      <% else -%> 
+        <%= image_tag('fav.png') if file.active? %>
+      <% end -%>
+    </td>
+    <td class="filename <%= "active" if file.active? %>"><%= link_to_attachment file, :download => true, :title => file.description %></td>
     <td class="created_on"><%= format_time(file.created_on) %></td>
     <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
     <td class="downloads"><%= file.downloads %></td>
--- a/public/themes/soundsoftware/stylesheets/application.css	Thu Mar 03 18:31:22 2011 +0000
+++ b/public/themes/soundsoftware/stylesheets/application.css	Thu Mar 03 19:35:02 2011 +0000
@@ -141,6 +141,8 @@
 #top-menu a.administration { background-image: url(../images/wrench.png); }
 #top-menu a.help { background-image: url(../../../images/help.png); }
 
+.file .active { font-weight: bold; }
+
 /* for Javadoc in Embedded context: */
 
 .TableHeadingColor { background-color: #fdf7e4; color: #3e442c; border: 0px solid #fff; }