This commit is contained in:
nwb 2014-07-03 17:28:20 +08:00
commit 98ba57b819
13 changed files with 58 additions and 24 deletions

View File

@ -64,15 +64,18 @@ class TagsController < ApplicationController
@forum_tags_num, @attachments_tags_num, @open_source_projects_num = get_tags_size @forum_tags_num, @attachments_tags_num, @open_source_projects_num = get_tags_size
# 获取搜索结果 # 获取搜索结果
@obj,@obj_pages,@results_count,@users_results, @obj,
@obj_pages,
@results_count,
@users_results,
@projects_results, @projects_results,
@@courses_results,
@issues_results, @issues_results,
@bids_results, @bids_results,
@forums_results, @forums_results,
@attachments_results, attachments_results,
@contests_tags, @contests_results,
@open_source_projects_results = refresh_results(@obj_id,@obj_flag,@selected_tags) @courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
# 这里是做tag推荐用的 用来生产推荐的tags # 这里是做tag推荐用的 用来生产推荐的tags
unless @obj.nil? unless @obj.nil?
@ -97,14 +100,18 @@ class TagsController < ApplicationController
$related_tags.delete(@tag) $related_tags.delete(@tag)
# 获取搜索结果 # 获取搜索结果
@obj,@obj_pages,@results_count,@users_results, @obj,
@obj_pages,
@results_count,
@users_results,
@projects_results, @projects_results,
@@courses_results,
@issues_results, @issues_results,
@bids_results, @bids_results,
@forums_results, @forums_results,
@attachments_results, attachments_results,
@contests_results = refresh_results(@obj_id,@show_flag) @contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
end end
# 删除已选tag # 删除已选tag
@ -116,14 +123,18 @@ class TagsController < ApplicationController
$selected_tags.delete(@tag) $selected_tags.delete(@tag)
# 获取搜索结果 # 获取搜索结果
@obj,@obj_pages,@results_count,@users_results, @obj,
@obj_pages,
@results_count,
@users_results,
@projects_results, @projects_results,
@@courses_results,
@issues_results, @issues_results,
@bids_results, @bids_results,
@forums_results, @forums_results,
@attachments_results, attachments_results,
@contests_results = refresh_results(@obj_id,@show_flag) @contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
end end
def show_all def show_all

View File

@ -370,4 +370,9 @@ module CoursesHelper
end end
return homework_users return homework_users
end end
def get_courses_by_tag(tag_name)
Course.tagged_with(tag_name).order('updated_at desc')
end
end end

View File

@ -1,5 +1,5 @@
<div id="issues"> <div id="issues">
<% if attachments_results.size < 0 %> <% if attachments_results.try(:size).to_i < 0 %>
<% else %> <% else %>
<hr /> <hr />
<% attachments_results.each do |file| %> <% attachments_results.each do |file| %>

View File

@ -1,5 +1,5 @@
<div id="issues"> <div id="issues">
<% if bids_results.size > 0 %> <% if bids_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% bids_results.each do |bid| %> <% bids_results.each do |bid| %>
<p class="font_description2"> <p class="font_description2">

View File

@ -1,5 +1,5 @@
<div id="issues"> <div id="issues">
<% if contests_results.size > 0 %> <% if contests_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% contests_results.each do |contest| %> <% contests_results.each do |contest| %>
<p class="font_description2"> <p class="font_description2">

View File

@ -0,0 +1,14 @@
<div id="issues">
<% if courses_results.try(:size).to_i > 0 %>
<hr />
<% courses_results.each do |course| %>
<p class="font_description2">
<strong><%= l(:label_course) %>:<%= link_to "#{course.name}",course_path(course) %></strong>
<br />
<strong><%= l(:label_new_course_description) %>:</strong><%= course.description %>
<%= course.updated_at %>
</p>
<div class="line_under"></div>
<% end %>
<% end %>
</div>

View File

@ -1,5 +1,5 @@
<div id="issues"> <div id="issues">
<% if forums_results.size > 0 %> <% if forums_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% forums_results.each do |forum| %> <% forums_results.each do |forum| %>
<p class="font_description2"> <p class="font_description2">

View File

@ -1,5 +1,5 @@
<div id="issues"> <div id="issues">
<% if issues_results.size > 0 %> <% if issues_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% issues_results.each do |issue| %> <% issues_results.each do |issue| %>
<p class="font_description2"> <p class="font_description2">

View File

@ -1,5 +1,5 @@
<div id="projects"> <div id="projects">
<% if projects_results.size > 0 %> <% if projects_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% projects_results.each do |prj| %> <% projects_results.each do |prj| %>
<div> <div>

View File

@ -1,5 +1,5 @@
<div id="projects"> <div id="projects">
<% if projects_results.size > 0 %> <% if projects_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% projects_results.each do |prj| %> <% projects_results.each do |prj| %>
<div> <div>

View File

@ -1,5 +1,5 @@
<div id="users"> <div id="users">
<% if users_results.size > 0 %> <% if users_results.try(:size).to_i > 0 %>
<hr /> <hr />
<% users_results.each do |user| %> <% users_results.each do |user| %>
<p class="font_description2"> <p class="font_description2">

View File

@ -26,6 +26,9 @@
<strong><%#= l(:label_attachment)%> <strong><%#= l(:label_attachment)%>
开源项目:(<%= @results_count %>)</strong> 开源项目:(<%= @results_count %>)</strong>
<%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%> <%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%>
<% when show_flag == '9'%>
<strong><%= l(:label_course)%>(<%= @results_count %>)</strong>
<%= render :partial => "show_courses",:locals => {:courses_results => courses_results}%>
<% else %> <% else %>
<strong><%= l(:label_tags_all_objects)%></strong> <strong><%= l(:label_tags_all_objects)%></strong>
<!-- 这里为显示搜有过滤结果预留了默认设置 --> <!-- 这里为显示搜有过滤结果预留了默认设置 -->

View File

@ -23,7 +23,7 @@
<%= l(:label_user_plural) %>(<%= @users_tags_num %>) | <%= l(:label_user_plural) %>(<%= @users_tags_num %>) |
<%= l(:label_tags_call)%>(<%= @bids_tags_num %>) | <%= l(:label_tags_call)%>(<%= @bids_tags_num %>) |
<%= l(:field_filename)%>(<%= @attachments_tags_num %>) | <%= l(:field_filename)%>(<%= @attachments_tags_num %>) |
开源项目(<%= @open_source_projects_num %>) 开源项目(<%= @open_source_projects_num %>) |
<%= l(:label_tags_contest)%>(<%= @contests_tags_num %>) | <%= l(:label_tags_contest)%>(<%= @contests_tags_num %>) |
</div> </div>
<div id="show_results"> <div id="show_results">
@ -37,6 +37,7 @@
:attachments_results=> @attachments_results, :attachments_results=> @attachments_results,
:contests_results => @contests_results, :contests_results => @contests_results,
:open_source_projects_results => @open_source_projects_results, :open_source_projects_results => @open_source_projects_results,
:courses_results => @courses_results,
:show_flag => @obj_flag} :show_flag => @obj_flag}
%> %>
</div> </div>