完成项目资源库tag云的查询统计

This commit is contained in:
huang 2016-01-07 10:31:22 +08:00
parent d0a8b4bc18
commit 972f2bfea8
4 changed files with 34 additions and 40 deletions

View File

@ -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

View File

@ -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("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));

View File

@ -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%>")
<% 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 %>

View File

@ -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;}
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;*/