From 9c24102e654569390ab6a68adda0f584eabfa4af Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 08:50:28 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B8=85=E7=90=86=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachment_type_edit_controller.rb | 6 ------ app/models/attachment.rb | 1 + .../attachment_type_edit/_show_attchment_type.html.erb | 0 3 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 app/controllers/attachment_type_edit_controller.rb delete mode 100644 app/views/attachment_type_edit/_show_attchment_type.html.erb diff --git a/app/controllers/attachment_type_edit_controller.rb b/app/controllers/attachment_type_edit_controller.rb deleted file mode 100644 index 91e14f65a..000000000 --- a/app/controllers/attachment_type_edit_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ - #资源类型编辑control -class AttachmentTypeEditController < ApplicationController - def index - - end -end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 3bfd705f9..661762e5c 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -285,6 +285,7 @@ class Attachment < ActiveRecord::Base result end + def self.attach_filesex(obj, attachments,attachment_type) result = obj.save_attachmentsex(attachments, User.current,attachment_type) obj.attach_saved_attachments diff --git a/app/views/attachment_type_edit/_show_attchment_type.html.erb b/app/views/attachment_type_edit/_show_attchment_type.html.erb deleted file mode 100644 index e69de29bb..000000000 From 8badbb1e7861851b1de13db209dc9eb9190d1df0 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 15:03:04 +0800 Subject: [PATCH 2/9] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=B1=BB=E5=9E=8B=E7=BC=96=E8=BE=91=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E4=B8=8E=E9=80=BB=E8=BE=91=202.=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E8=B5=84=E6=BA=90=E7=B1=BB=E5=9E=8B=E7=BC=96?= =?UTF-8?q?=E8=BE=91js=E3=80=81control=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 11 ++++++ app/views/attachments/_type_edit.html.erb | 14 +++++++ app/views/files/_show_all_attachment.html.erb | 1 + app/views/files/_sort_by_attachtypel.html.erb | 14 ++++++- app/views/files/index.html.erb | 37 ++++++++++++++++++ config/routes.rb | 7 +++- public/images/Edit/edit.png | Bin 0 -> 522 bytes 7 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 app/views/attachments/_type_edit.html.erb create mode 100644 public/images/Edit/edit.png diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d341f0f6e..900487364 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -62,6 +62,17 @@ class AttachmentsController < ApplicationController end end + #更新资源文件类型 + def updateType + @attachment = Attachment.find(params[:attachmentid]) + if @attachment != nil + @attachment.attachtype = params[:newtype] + @attachment.save + render :text =>'success' + else + render :text=>'error' + end + end def thumbnail if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) diff --git a/app/views/attachments/_type_edit.html.erb b/app/views/attachments/_type_edit.html.erb new file mode 100644 index 000000000..79d0da0bb --- /dev/null +++ b/app/views/attachments/_type_edit.html.erb @@ -0,0 +1,14 @@ +<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> +<% if attachmenttypes.any? %> + + <%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box"+attachment.id.to_s , + :onclick =>"$('#put-tag-form-" +attachment.id.to_s+ "').show(); + $('#attach_type_id_label" +attachment.id.to_s+ "').hide(); + $('#edit_box" +attachment.id.to_s+ "').hide();") if edit_allowed %> + +<% end %> + diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index 57ac897d2..98e31f874 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -1,3 +1,4 @@ +<% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> - \ No newline at end of file + + diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index a43b2ae07..c71a1483e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -317,4 +317,41 @@ ; }); } + + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index a5dc322cf..c743c2151 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -456,7 +456,12 @@ RedmineApp::Application.routes.draw do get 'attachments/autocomplete' match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post] post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' - resources :attachments, :only => [:show, :destroy] + post 'attachments/updateType/:attachmentid/:newtype' ,:to => 'attachments#updateType', :attachmentid => /\d+/, :newtype => /.*/ + resources :attachments, :only => [:show, :destroy] do + collection do + match "updateType" , via: [:get, :post] + end + end resources :groups do member do diff --git a/public/images/Edit/edit.png b/public/images/Edit/edit.png new file mode 100644 index 0000000000000000000000000000000000000000..8335716fd5f9994eca802b8b14fb43c667bcc034 GIT binary patch literal 522 zcmV+l0`>igP)Pft(g&!0d4|DQhl|Nrg@{~ubrZp3Q+~ymoxxm8*H4N^pv1Yip)*8iT zxaN1O|Nnnp_5bP)+t({+c&Ek2#xlS#b^{t;j635SH*4VjT z*<#CZXO|5F$dCp79t`2(;b06m;ObIawo8j`bN;_O^Zx&%B%tP+|GVZnojSDGvFh|1 zI|h&eGrK(D8Zitwy}-`$|HbSB|394j|NrT#ubU=2AKo#?$-T4Mhhb8qH-<(G1NP2z zY6WXP6?Ab`x9hCl3ZDR=0#P6q#-$m>03hf8sxH@A9c8}B$+01(K)x;zYXPwd5c2~u zFA#G9F$WN{0Wk{@GZRe8Kt+l`EDOYvKr8~p0zk|SGl-(B3^afV01ba!p4w(>hyVZp M07*qoM6N<$f^G@~i~s-t literal 0 HcmV?d00001 From 1caa7940dc7d9a30c70b4722c2a576abc0de2b60 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 15:08:06 +0800 Subject: [PATCH 3/9] =?UTF-8?q?1=E3=80=81=E8=B5=84=E6=BA=90=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=80=85=E7=9A=84=E5=88=86=E7=B1=BB=E5=92=8Ctag?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=9B=202=E3=80=81=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=80=85=E5=AF=B9=E8=B5=84=E6=BA=90=E7=9A=84?= =?UTF-8?q?=E5=86=8D=E5=88=86=E7=B1=BB=E5=92=8Ctag=E5=86=8D=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_type_edit.html.erb | 2 +- config/routes.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/views/attachments/_type_edit.html.erb b/app/views/attachments/_type_edit.html.erb index 79d0da0bb..5d9278823 100644 --- a/app/views/attachments/_type_edit.html.erb +++ b/app/views/attachments/_type_edit.html.erb @@ -3,7 +3,7 @@ <%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box"+attachment.id.to_s , :onclick =>"$('#put-tag-form-" +attachment.id.to_s+ "').show(); diff --git a/config/routes.rb b/config/routes.rb index c743c2151..b7e6dcebc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -457,11 +457,7 @@ RedmineApp::Application.routes.draw do match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post] post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' post 'attachments/updateType/:attachmentid/:newtype' ,:to => 'attachments#updateType', :attachmentid => /\d+/, :newtype => /.*/ - resources :attachments, :only => [:show, :destroy] do - collection do - match "updateType" , via: [:get, :post] - end - end + resources :attachments, :only => [:show, :destroy] resources :groups do member do From c0c184d8bf319787c10e012890b30594b29f23db Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 15:16:11 +0800 Subject: [PATCH 4/9] =?UTF-8?q?1.=E4=BF=AE=E6=AD=A3=E9=94=99=E8=AF=AF=202.?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E9=83=A8=E8=B5=84=E6=BA=90=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=97=B6=E7=9A=84=E5=AF=B9=E8=B5=84=E6=BA=90=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_show_all_attachment.html.erb | 11 ++++++++++- app/views/files/_sort_by_attachtypel.html.erb | 1 - config/routes.rb | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index 98e31f874..ad207adf2 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -1,3 +1,5 @@ +<% selAttachType =@attachtype %> +<% selContentType =@contenttype %> <% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> @@ -35,7 +37,14 @@ <%= 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) %> <%= number_to_human_size(file.filesize) %> - <%= file.attachmentstype.typeName %> + +
<%= file.attachmentstype.typeName %>
+   +
+ <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, + :attachment => file,:contentype=>selContentType} %> +
+ <%= file.show_suffix_type %> <%= file.downloads %> diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 852502501..06aae4044 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -41,7 +41,6 @@ <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file,:contentype=>selContentType} %> - <%= file.show_suffix_type %> <%= file.downloads %> diff --git a/config/routes.rb b/config/routes.rb index b7e6dcebc..c743c2151 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -457,7 +457,11 @@ RedmineApp::Application.routes.draw do match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post] post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' post 'attachments/updateType/:attachmentid/:newtype' ,:to => 'attachments#updateType', :attachmentid => /\d+/, :newtype => /.*/ - resources :attachments, :only => [:show, :destroy] + resources :attachments, :only => [:show, :destroy] do + collection do + match "updateType" , via: [:get, :post] + end + end resources :groups do member do From 4235ca89847b6c39a4615ccbff671748bab572f2 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 15:23:26 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E6=AD=A3BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/index.html.erb | 4 ++-- config/routes.rb | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index c71a1483e..0d9a3a21f 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -206,8 +206,8 @@ attachments_autocomplete_path(:format => 'js'), :remote => true, :method => :post) do %> - <%= label_tag(:atext_field_tagttach_search, "按关键字搜索:") %> - <%= (:attach_search) %> + <%= label_tag(:attach_search, "按关键字搜索:") %> + <%= text_field_tag(:attach_search) %> <%#= submit_tag("Search") %> <% end -%> <%= form_tag attach_relation_path(:format => 'js'), diff --git a/config/routes.rb b/config/routes.rb index c743c2151..7d7cb2bbf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -456,7 +456,6 @@ RedmineApp::Application.routes.draw do get 'attachments/autocomplete' match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post] post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' - post 'attachments/updateType/:attachmentid/:newtype' ,:to => 'attachments#updateType', :attachmentid => /\d+/, :newtype => /.*/ resources :attachments, :only => [:show, :destroy] do collection do match "updateType" , via: [:get, :post] From 6f0e621f3c54deb743661ba418a6e8222ff4563b Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 16:06:29 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=88=90=E5=91=98=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84account?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 10 ++++++++++ app/helpers/members_helper.rb | 2 +- app/models/user.rb | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aeacae866..6b8525a00 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -390,6 +390,16 @@ module ApplicationHelper s.html_safe end + #扩展的checkbox生成 + def principals_check_box_tags_ex(name, principals) + s = '' + principals.each do |principal| + s << "\n" + end + s.html_safe + end + + # Returns a string for users/groups option tags def principals_options_for_select(collection, selected=nil) s = '' diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 915e02627..75676f475 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -24,7 +24,7 @@ module MembersHelper principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all - s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals') + s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals') links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true diff --git a/app/models/user.rb b/app/models/user.rb index 20624888a..d16d790d2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -190,7 +190,11 @@ class User < Principal where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) end } - + + #选择项目成员时显示的用户信息文字 + def userInfo + info=self.name + ' (' + self.login + ')'; + end ###添加留言 fq def add_jour(user, notes, reference_user_id = 0, options = {}) From b733f5c2b90aaa6d8c18d860c4d4e52f0839b008 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 14 May 2014 17:11:22 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E7=94=A8=E6=88=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d4248e3cc..b18497548 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -548,6 +548,14 @@ class UsersController < ApplicationController format.api { render_validation_errors(@user) } end end + + unless @user.id.nil? + #后台注册的用户默认权限为男性开发员 + ue = UserExtensions.create(:identity => 3, + :gender => 0, + :user_id => @user.id) + ue.save + end end def edit From 829c77879a360aa2a06a6dcea1a37c9ef481b3bc Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 14 May 2014 17:12:04 +0800 Subject: [PATCH 8/9] typo --- app/helpers/files_helper.rb | 4 +- app/views/files/_show_all_attachment.html.erb | 134 +- app/views/files/_sort_by_attachtypel.html.erb | 132 +- app/views/files/getattachtype.js.erb | 10 +- app/views/files/index.html.erb | 307 +--- public/stylesheets/nyan.css | 1465 ++++++++++------- 6 files changed, 1080 insertions(+), 972 deletions(-) diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 16a3d8b58..052aae468 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -55,9 +55,9 @@ module FilesHelper result = true end if result - if contentType != l(:attachment_all) && contentType != attachment.suffix_type + if contentType != '0' && contentType != attachment.suffix_type result = false - end + end end result end diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index ad207adf2..6a2d6e545 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -3,72 +3,72 @@ <% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> -
    - - - - - - - - - - <%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%> - <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope =>"col" , :id => "vzebra-comedy")%> - <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope =>"col", :id=> "vzebra-children")%> - <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%> - <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> - <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %> - <%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %> - - - - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - - - - <% end -%> - <% container.attachments.each do |file| %> - "> - - - - - - - - - - - - - <% end -%> - <% reset_cycle %> +
    - <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> -
    <%= 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) %><%= number_to_human_size(file.filesize) %> -
    <%= file.attachmentstype.typeName %>
    -   -
    - <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, - :attachment => file,:contentype=>selContentType} %> -
    -
    <%= file.show_suffix_type %><%= file.downloads %> - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> -
    -
    - <% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%> -
    -
    - -
    + + + + + + + + + + <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> + <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> + <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> + <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> + <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %> + <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> + <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> + + + + + <% @containers.each do |container| %> + <% next if container.attachments.empty? -%> + <% if container.is_a?(Version) -%> + + + <% end -%> - - + <% container.attachments.each do |file| %> + "> + + + + + + + + + + + + + <% end -%> + <% reset_cycle %> + <% end -%> + + - -
    + <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> +
    <%= 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;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName %> +   + + <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, + :attachment => file, :contentype => selContentType} %> + + <%= file.show_suffix_type %><%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
    +
    + <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
    +
    + +
    -
+ + diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 06aae4044..01c57c490 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -3,73 +3,69 @@ <% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> -
-
    - - - - - - - - - - - <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> - <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> - <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> - <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> - <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> - <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> - <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> - - - - - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% container.attachments.each do |file| %> - <% if isTypeOk(file,selAttachType,selContentType) %> - "> - - - - - - - - - - - - - <% end -%> - <% end -%> - <% reset_cycle %> - <% end -%> - - +
    <%= 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) %><%= number_to_human_size(file.filesize) %> -
    <%= file.attachmentstype.typeName %>
    -   -
    - <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, - :attachment => file,:contentype=>selContentType} %> -
    -
    <%= file.show_suffix_type %><%= file.downloads %> - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> -
    -
    - <% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> -
    -
    - -
    + + + + + + + + + + <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> + <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> + <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> + <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> + <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> + <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> + <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> + + + + + <% @containers.each do |container| %> + <% next if container.attachments.empty? -%> + <% container.attachments.each do |file| %> + <% if isTypeOk(file,selAttachType,selContentType) %> + "> + + + + + + + + + + + + + <% end -%> + <% end -%> + <% reset_cycle %> + <% end -%> + + - -
    <%= 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;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName %> +   + + <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, + :attachment => file,:contentype=>selContentType} %> + + <%= file.show_suffix_type %><%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
    +
    + <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
    +
    + +
    -
-
+ + diff --git a/app/views/files/getattachtype.js.erb b/app/views/files/getattachtype.js.erb index fe8458e20..3bc9863b2 100644 --- a/app/views/files/getattachtype.js.erb +++ b/app/views/files/getattachtype.js.erb @@ -1,5 +1,5 @@ - <% 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")%>'); - <%end%> +<% if @attachtype==0 && @contenttype=='0' %> +$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); +<%else%> +$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>'); +<%end%> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 0d9a3a21f..978b4420a 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,205 +1,34 @@ <% attachmenttypes = @project.attachmenttypes %> <% sufixtypes = @project.contenttypes %> - - -<%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区 +<%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> - <%= link_to( l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> + <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> <%= 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',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"), - :onchange=>"attachmenttypes_searchex(this.value)"%> - <% end %> - <% if sufixtypes.any? %> + + <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +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', l(:attachment_all)) +options_for_select(sufixtypes), - :onchange=>"attachment_contenttypes_searchex(this.value)"%> + + <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes), + :onchange => "attachment_contenttypes_searchex(this.value)" %> <% end %> -