diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 031f78277..ef6e20644 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -45,11 +45,45 @@ class FilesController < ApplicationController 'filename' => "#{Attachment.table_name}.filename", 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" + sort = "" if params[:project_id] @isproject = true - @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] - @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + if params[:sort] + params[:sort].split(",").each do |sort_type| + order_by = sort_type.split(":") + + case order_by[0] + when "filename" + attribute = "filename" + when "size" + attribute = "filesize" + when "attach_type" + attribute = "attachtype" + when "content_type" + attribute = "created_on" + when "field_file_dense" + attribute = "is_public" + when "downloads" + attribute = "downloads" + when "created_on" + attribute = "created_on" + end + + if order_by.count == 1 + sort += "#{Attachment.table_name}.#{attribute} desc " + elsif order_by.count == 2 + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + end + if sort_type != params[:sort].split(",").last + sort += "," + end + end + end + + @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] + @containers += @project.versions.includes(:attachments).reorder(sort).all.sort show_attachments @containers @@ -57,7 +91,6 @@ class FilesController < ApplicationController elsif params[:course_id] @isproject = false - sort = "" if params[:sort] params[:sort].split(",").each do |sort_type| order_by = sort_type.split(":") diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1f6091f12..807d851be 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -737,7 +737,7 @@ module ApplicationHelper text = text.dup macros = catch_macros(text) - text = Redmine::WikiFormatting.to_html("CKEditor", text, :object => obj, :attribute => attr) + #text = Redmine::WikiFormatting.to_html("CKEditor", text, :object => obj, :attribute => attr) @parsed_headings = [] @heading_anchors = {} @@ -1555,6 +1555,25 @@ module ApplicationHelper date = time.strftime("%Y年%m月%d日") end + #当TAG数量过多时,更多链接 + #1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 9代表课程 + def more_tags id,object_flag + a= 1 + case object_flag + when "1" + s = link_to l(:label_more_tags),:controller => "users", :action => "show", :id => id + when "2" + s = link_to l(:label_more_tags),:controller => "projects", :action => "show", :id => id + when "3" + s = link_to l(:label_more_tags),:controller => "issues", :action => "show", :id => id + when "4" + s = link_to l(:label_more_tags),:controller => "bids", :action => "show", :id => id + when "9" + s = link_to l(:label_more_tags),:controller => "courses", :action => "show", :id => id + end + s + end + private def wiki_helper diff --git a/app/models/issue.rb b/app/models/issue.rb index 3a14d288d..6bbcd727f 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -240,11 +240,14 @@ class Issue < ActiveRecord::Base self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} self.status = issue.status self.author = User.current - unless options[:attachments] == false - self.attachments = issue.attachments.map do |attachement| - attachement.copy(:container => self) - end - end + #赞不提供附件复制功能 + #unless options[:attachments] == false + #self.attachments = issue.attachments.map do |attachement| + # a = attachement.copy(:container => self) + # #a.save + # a + #end + #end @copied_from = issue @copy_options = options self diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 097539888..bb043cd70 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -4,7 +4,11 @@ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + - link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + 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"} %> <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> diff --git a/app/views/attachments/autocomplete.js.erb b/app/views/attachments/autocomplete.js.erb index abe2c3757..691454feb 100644 --- a/app/views/attachments/autocomplete.js.erb +++ b/app/views/attachments/autocomplete.js.erb @@ -4,5 +4,5 @@ $('#relation_file').html('<%=render_attachments_for_new_project(@project, nil)%> <% elsif @course%> $('#relation_file').html('<%=render_attachments_for_new_course(@course, nil)%>'); <% end%> -$('#attachments').children().css("width","100%").css("word-break","break-all"); +$('#attachments').children().css("width","100%").css("word-break","break-all").css("word-wrap", "break-word"); diff --git a/app/views/attachments/file.html.erb b/app/views/attachments/file.html.erb index 186b85c69..6c23c638f 100644 --- a/app/views/attachments/file.html.erb +++ b/app/views/attachments/file.html.erb @@ -6,8 +6,9 @@

<%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%> (<%= number_to_human_size @attachment.filesize %>)    - <% if @attachment!=nil&&@attachment.container_type == 'Document'&&User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %> - <%= link = link_to(l(:button_add), {:controller => 'code_review', + + <% if @attachment!=nil&&User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %> + <%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review', :action => 'assign', :action_type => 'attachment', :id=>@attachment.project, :change_id => '', :attachment_id => @attachment.id, diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 8cd46c35b..a14e32d6d 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -53,7 +53,7 @@ <% end %> -

+
<% if @topics.any? %> -
+
+ <%= textilizable issue, :description %> +