From 6e14e0b262c4e16629d92c3d4dbabcbdad3c6b8a Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 13 May 2014 12:01:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=88=A0=E9=99=A4=E5=85=A8=E9=83=A8=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=BD=8D=E7=BD=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 723b93bd6..7b0a0099c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1840,7 +1840,7 @@ a.remove-upload:hover {text-decoration:none !important;} /*gcm upload file count and deleteall*/ #upload_file_count #count {color:red; font-size:1.5em;} -span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:21px;text-decoration:none;} +span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:61px;text-decoration:none;} div.fileover { background-color: lavender; } From 73dcf3679d5125d4b07d517bff661cdfb02dd12c Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 13 May 2014 15:11:37 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E9=85=8D=E7=BD=AE=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/projects_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5bd677bdf..708c23cac 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -32,7 +32,7 @@ module ProjectsHelper {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural}, # {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki}, {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, - {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, + #{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} ] tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} @@ -145,7 +145,7 @@ module ProjectsHelper #Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, - {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1}, + #{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1}, # {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural} ] From 25dba88a083d37e74695460894a9d856701d871b Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 13 May 2014 16:34:53 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2=202.?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8B=E8=BD=BD=E7=95=8C=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8C=89=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=B5=8F=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 1 + app/helpers/files_helper.rb | 19 ++++++++++++++++--- app/views/files/_new.html.erb | 2 +- app/views/files/_sort_by_attachtypel.html.erb | 3 ++- app/views/files/getattachtype.js.erb | 2 +- app/views/files/index.html.erb | 18 +++++++++++------- config/locales/en.yml | 1 + config/locales/zh.yml | 1 + 8 files changed, 34 insertions(+), 13 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 075a54f65..a2dd8c869 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -74,6 +74,7 @@ class FilesController < ApplicationController @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s respond_to do |format| format.js diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index ffa1348fd..16a3d8b58 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -44,9 +44,22 @@ module FilesHelper File.new(zipfile_name,'w+') end - def browseByCategory - isCategoryBrowser = 1 - #isCategoryBrowser + # 判断指定的资源时候符合类型 + def isTypeOk(attachment, type, contentType) + result = false + if type != 0 + if attachment.attachtype == type + result = true + end + else + result = true + end + if result + if contentType != l(:attachment_all) && contentType != attachment.suffix_type + result = false + end + end + result end diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb index fcb916e3b..4c1b97fa1 100644 --- a/app/views/files/_new.html.erb +++ b/app/views/files/_new.html.erb @@ -13,7 +13,7 @@ <% if attachmenttypes.any? %>

- <%= select_tag "attachment_type", content_tag('option', '') + + <%= select_tag "attachment_type", options_from_collection_for_select(attachmenttypes, "id", "typeName") %>

diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 82d2a7b87..5d5f28653 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -1,4 +1,5 @@ <% selAttachType =@attachtype %> +<% selContentType =@contenttype %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
@@ -27,7 +28,7 @@ <% @containers.each do |container| %> <% next if container.attachments.empty? -%> <% container.attachments.each do |file| %> - <% if file.attachtype==selAttachType %> + <% if isTypeOk(file,selAttachType,selContentType) %> "> <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> <%= format_time(file.created_on) %> diff --git a/app/views/files/getattachtype.js.erb b/app/views/files/getattachtype.js.erb index 4f13cc883..fe8458e20 100644 --- a/app/views/files/getattachtype.js.erb +++ b/app/views/files/getattachtype.js.erb @@ -1,4 +1,4 @@ - <% if @attachtype==0%> + <% if @attachtype==0 && @contenttype==l(:attachment_all)%> $("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); <%else%> $("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>'); diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 5abacf294..7c8129c59 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -184,13 +184,15 @@ <%= 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, @project) %> <% if attachmenttypes.any? %> - - <%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), +       + + <%= select_tag "attachment_browse", content_tag('option',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"), :onchange=>"attachmenttypes_searchex(this.value)"%> <% end %> <% if sufixtypes.any? %> - - <%= select_tag "attach_sufix_browse", content_tag('option', '') +options_for_select(sufixtypes), +   + + <%= select_tag "attach_sufix_browse", content_tag('option', l(:attachment_all)) +options_for_select(sufixtypes), :onchange=>"attachment_contenttypes_searchex(this.value)"%> <% end %> @@ -286,7 +288,8 @@