# HG changeset patch
# User Chris Cannam <%=l(:label_attachment_plural)%>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
-<% active_change_allowed = delete_allowed %>
-<%= l(:text_files_active_change) if active_change_allowed and have_file %>
-
<% html_title(l(:label_attachment_plural)) -%>
diff -r 3ebf9b76e57f -r 251b380117ce config/locales/en.yml
--- a/config/locales/en.yml Fri Aug 12 14:52:07 2011 +0100
+++ b/config/locales/en.yml Tue Aug 16 17:01:19 2011 +0100
@@ -990,7 +990,6 @@
text_zoom_in: Zoom in
text_zoom_out: Zoom out
text_warn_on_leaving_unsaved: "The current page contains unsaved text that will be lost if you leave this page."
- text_files_active_change:
- <%= sort_header_tag('active', :caption => l(:field_active)) %>
<%= 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') %>
@@ -29,26 +27,8 @@
<% end -%>
<% container.attachments.each do |file| %>
- <%= "active" if file.active? %>">
-
- <% have_file = true %>
- <% if active_change_allowed
- active_id = "active-" + file.id.to_s -%>
-
- <% if file.active? %>
- <%= link_to_attachment file, :download => true %>
- <% else %>
-
<%= h(file.description) %><%= link_to_attachment file, :download => true, :title => file.description %>
- <% end %>
+ ">
+ <%= link_to_attachment file, :download => true, :title => file.description %>
<%= format_time(file.created_on) %>
<%= number_to_human_size(file.filesize) %>
@@ -65,6 +45,4 @@
Click the star to switch active status for a download on or off.
Active files will be shown more prominently in the download page.
text_settings_repo_creation: Creating repository...
The source code repository for a project will be set up automatically within a few minutes of the project being created.
Please check again in five minutes, and contact us if there is any problem.
If you wish to use this project to track a repository that is already hosted somewhere else, please wait until the repository has been created here and then return to this settings page to configure it.
If you don't want a repository at all, go to the Modules tab and switch it off there.
text_scm_path_encoding_note: "Default: UTF-8"
text_git_repository_note: "Bare and local repository (e.g. /gitrepo, c:\gitrepo)"
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/README.rdoc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/README.rdoc Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,3 @@
+= latest_downloads
+
+Description goes here
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/app/controllers/attachments_controller.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/app/controllers/attachments_controller.rb Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,16 @@
+
+class AttachmentsController < ApplicationController
+
+ before_filter :active_authorize, :only => :toggle_active
+
+ def toggle_active
+ @attachment.active = !@attachment.active?
+ @attachment.save!
+ render :layout => false
+ end
+
+private
+ def active_authorize
+ true
+ end
+end
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/app/controllers/files_controller.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/app/controllers/files_controller.rb Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,15 @@
+class FilesController < ApplicationController
+
+ def index
+ sort_init 'active', 'desc'
+ sort_update 'filename' => "#{Attachment.table_name}.filename",
+ 'active' => "#{Attachment.table_name}.active",
+ 'created_on' => "#{Attachment.table_name}.created_on",
+ 'size' => "#{Attachment.table_name}.filesize",
+ 'downloads' => "#{Attachment.table_name}.downloads"
+
+ @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
+ @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
+ render :layout => !request.xhr?
+ end
+end
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/config/locales/en.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/config/locales/en.yml Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,3 @@
+en:
+ field_active: Active
+ text_files_active_change:
Click the star to switch active status for a download on or off.
Active files will be shown more prominently in the download page.
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/db/migrate/001_create_attachment_shortcuts.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/db/migrate/001_create_attachment_shortcuts.rb Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,13 @@
+class CreateAttachmentShortcuts < ActiveRecord::Migration
+ def self.up
+ create_table :attachment_shortcuts do |t|
+ t.column :attachment_id, :integer
+ t.column :active, :boolean
+ t.column :shortcut, :string
+ end
+ end
+
+ def self.down
+ drop_table :attachment_shortcuts
+ end
+end
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/init.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/init.rb Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,10 @@
+require 'redmine'
+
+Redmine::Plugin.register :redmine_latest_downloads do
+ name 'Redmine Latest Downloads plugin'
+ author 'Author name'
+ description 'This is a plugin for Redmine'
+ version '0.0.1'
+ url 'http://example.com/path/to/plugin'
+ author_url 'http://example.com/about'
+end
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/lang/en.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/lang/en.yml Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,2 @@
+# English strings go here
+my_label: "My label"
diff -r 3ebf9b76e57f -r 251b380117ce vendor/plugins/redmine_latest_downloads/test/test_helper.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_latest_downloads/test/test_helper.rb Tue Aug 16 17:01:19 2011 +0100
@@ -0,0 +1,5 @@
+# Load the normal Rails helper
+require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
+
+# Ensure that we are using the temporary fixture path
+Engines::Testing.set_fixture_path