diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 6d6b6f42e..fff3340d9 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -449,8 +449,6 @@ class FilesController < ApplicationController end end end - - # TODO: 临时用 nyan sort_init 'created_on', 'desc' sort_update 'created_on' => "#{Attachment.table_name}.created_on", @@ -459,13 +457,10 @@ class FilesController < ApplicationController 'downloads' => "#{Attachment.table_name}.downloads" @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] - show_attachments @containers @tag_list = attachment_tag_list @all_attachments - @attachtype = 0 @contenttype = 0 - respond_to do |format| format.js format.html { @@ -763,21 +758,33 @@ class FilesController < ApplicationController end q = "%#{@q.strip}%" - @result = find_course_attache q,@course,sort + if @project + @result = find_project_attache q, @project,sort + else + @result = find_course_attache q,@course,sort + end @result = visable_attachemnts @result if params[:other] - @result = @result.select{|attachment| - !attachment.tag_list.include?('课件') && - !attachment.tag_list.include?('软件') && - !attachment.tag_list.include?('媒体') && - !attachment.tag_list.include?('代码') && - !attachment.tag_list.include?('论文') } + if @project + @result = @result.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') } + else + @result = @result.select{|attachment| + !attachment.tag_list.include?('课件') && + !attachment.tag_list.include?('软件') && + !attachment.tag_list.include?('媒体') && + !attachment.tag_list.include?('代码') && + !attachment.tag_list.include?('论文') } + end else @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? end @searched_attach = paginateHelper @result,10 - @tag_list = get_course_tag_list @course - + if @project + @tag_list = get_project_tag_list @project + @result_search_project = @result + else + @tag_list = get_course_tag_list @course + end respond_to do |format| format.js # format.html diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index c0b239cd3..d230a3304 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -15,29 +15,6 @@ } }); } - function show_upload(obj) - { - switch(obj) - { - case 1: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 1}) %>'); - break; - case 2: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 2}) %>'); - break; - case 3: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 3}) %>'); - break; - default: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 5}) %>'); - } - showModal('ajax-modal', '513px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("popbox_polls"); - } - function closeModal() { hideModal($("#popbox_upload")); diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb index 4b1e9734d..31df68b6a 100644 --- a/app/views/files/search_tag_attachment.js.erb +++ b/app/views/files/search_tag_attachment.js.erb @@ -1,2 +1,7 @@ -$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>"); -$("#attachment_count").html("<%= @result.count%>") \ No newline at end of file +<% if @course %> + $("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>"); + $("#attachment_count").html("<%= @result.count%>") +<% else %> + $("#course_list").html("<%= escape_javascript(render :partial => 'project_list',:locals => {project:@project, all_attachments:@result_search_project, sort:@sort, order:@order, project_attachments:@searched_attach}) %>"); + $("#attachment_count").html("<%= @result_search_project.count%>") +<% end %> diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index b04802adb..0dc332ed2 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1139,4 +1139,9 @@ a.postRouteLink:hover {text-decoration:underline;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px; text-align:center;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;} -a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} \ No newline at end of file +a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} + +/*tag云*/ +a.files_tag_icon{ width:auto;background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 5px; float:left; margin-right:10px;margin-bottom:10px; } +span.files_tag_icon{ width: auto;background: #E1ECF4;color: #39739D;padding: 2px 5px;float: left;margin-right: 10px;margin-bottom: 10px;cursor: pointer; } +a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #bbe2ef; padding:1px 1px; float:left; margin-right:10px;margin-bottom:10px;}/* padding:1px 10px;*/