diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 75bf6fefd..2b65c1d78 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -49,7 +49,8 @@ class FilesController < ApplicationController 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" sort = "" - + @sort = "" + @order = "" if params[:project_id] @isproject = true @@ -73,7 +74,8 @@ class FilesController < ApplicationController when "created_on" attribute = "created_on" end - + @sort = order_by[0] + @order = order_by[1] if order_by.count == 1 sort += "#{Attachment.table_name}.#{attribute} asc " elsif order_by.count == 2 @@ -135,6 +137,10 @@ class FilesController < ApplicationController end + def upload_file_show + + end + def new @versions = @project.versions.sort @course_tag = @project.project_type diff --git a/app/views/files/_arrow_show.erb b/app/views/files/_arrow_show.erb new file mode 100644 index 000000000..0fed13e60 --- /dev/null +++ b/app/views/files/_arrow_show.erb @@ -0,0 +1,8 @@ + +<% if sort == current %> + <% if order = "" || order =="asc" %> + ↑ + <% else %> + ↓ + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/files/_attachement_list.html.erb b/app/views/files/_attachement_list.html.erb new file mode 100644 index 000000000..f65ba8d41 --- /dev/null +++ b/app/views/files/_attachement_list.html.erb @@ -0,0 +1,46 @@ +
+ +<% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> +<% end %> + +
+ + +<%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description) + } %> + + \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 089eee8ac..d9546ce4e 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -2,6 +2,22 @@ <% sufixtypes = @course.contenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @course) %> <%= stylesheet_link_tag 'resource', :media => 'all' %> +
@@ -11,14 +27,14 @@ - 上传资源 + 上传资源

共有 <%= User.current.member_of_course?(@course) ? @all_attachments.count : 0 %> 个资源

-

按 时间 / 下载次数 / 引用次数 排序

+

按 <%= link_to "时间",course_files_path(@course,:sort=>"created_on"),:class => "f_b c_grey" %><%= render partial: 'arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> / <%= link_to "下载次数",course_files_path(@course,:sort=>"downloads:desc"),:class => "f_b c_grey" %><%= render partial: 'arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> / 引用次数 排序

<% @curse_attachments.each do |file| %> @@ -82,7 +98,7 @@ <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>