From 75f584a6e25b2f69891ac07aaf0538d3829c40ee Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 13 May 2014 11:54:21 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E6=88=90=E5=88=86=E7=B1=BB=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E4=B8=8B=E8=BD=BD=E8=A7=86=E5=9B=BE=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=202.=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 21 +- app/controllers/school_controller.rb | 2 +- app/views/files/_show_all_attachment.html.erb | 61 +++ app/views/files/_show_by_attachtype.html.erb | 421 ------------------ app/views/files/_sort_by_attachtypel.html.erb | 57 +++ app/views/files/getattachtype.js.erb | 5 + app/views/files/index.html.erb | 149 +------ app/views/files/show_by_attachtype.html.erb | 421 ------------------ config/routes.rb | 9 +- 9 files changed, 157 insertions(+), 989 deletions(-) create mode 100644 app/views/files/_show_all_attachment.html.erb delete mode 100644 app/views/files/_show_by_attachtype.html.erb create mode 100644 app/views/files/_sort_by_attachtypel.html.erb create mode 100644 app/views/files/getattachtype.js.erb delete mode 100644 app/views/files/show_by_attachtype.html.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c67310f6f..075a54f65 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -19,8 +19,8 @@ class FilesController < ApplicationController layout 'base_projects'#by young menu_item :files - before_filter :find_project_by_project_id - before_filter :authorize + before_filter :find_project_by_project_id#, :except => [:getattachtype] + before_filter :authorize, :except => [:getattachtype] helper :sort include SortHelper @@ -62,20 +62,21 @@ class FilesController < ApplicationController redirect_to project_files_path(@project) end - def showbyattachtype - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", + # 返回制定资源类型的资源列表 + def getattachtype + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", 'filename' => "#{Attachment.table_name}.filename", 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" - + @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + @attachtype = params[:type].to_i - if @project.project_type == 1 - render :layout => 'base_courses' - else - render :layout => !request.xhr? + respond_to do |format| + format.js end end end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index b4f5b0468..b8fb7a6f6 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -23,7 +23,7 @@ class SchoolController < ApplicationController end end - + def upload_logo end diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb new file mode 100644 index 000000000..c65f58cc5 --- /dev/null +++ b/app/views/files/_show_all_attachment.html.erb @@ -0,0 +1,61 @@ +<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> + diff --git a/app/views/files/_show_by_attachtype.html.erb b/app/views/files/_show_by_attachtype.html.erb deleted file mode 100644 index eedc90684..000000000 --- a/app/views/files/_show_by_attachtype.html.erb +++ /dev/null @@ -1,421 +0,0 @@ - -<%isCategoryBrowser=true%> -<% selAttachType =1%> -<% attachmenttypes = @project.attachmenttypes %> - - - -<%=(@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_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"), - :onchange=>"attachmenttypes_search(this.value)"%> - <% end %> - - - -
- -
-<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %> - - -<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> - -<%if !isCategoryBrowser%> -
- -
-<%else%> -
- -
-<%end%> -<% html_title(l(:label_attachment_plural)) -%> - - - -<%inited=false%> - \ No newline at end of file diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb new file mode 100644 index 000000000..d07ed399c --- /dev/null +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -0,0 +1,57 @@ +<% selAttachType =@attachtype%> +<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> +
+