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) %> +
+