修复了tag查询的问题;tag样式的显示

This commit is contained in:
william 2013-08-13 15:20:48 +08:00
parent 4663751e7e
commit 6f54e1680d
12 changed files with 39 additions and 59 deletions

View File

@ -53,6 +53,7 @@ class TagsController < ApplicationController
def add_tag
@tag = params[:tag]
@show_flag = params[:show_flag]
$selected_tags << @tag
$related_tags.delete(@tag)
@ -63,6 +64,7 @@ class TagsController < ApplicationController
def delete_tag
@tag = params[:tag]
@show_flag = params[:show_flag]
$related_tags << @tag
$selected_tags.delete(@tag)

View File

@ -85,7 +85,7 @@ module ProjectsHelper
# this method is used to get all projects that tagged one tag
# added by william
def get_projects_by_tag(tag_name)
Project.tagged_with(tag_name).by_join_date
Project.tagged_with(tag_name)
end
end

View File

@ -2,8 +2,10 @@
<ul>
<% for rt in related_tags %>
<li>
<%= link_to image_tag("/images/sidebar/add.png"),:action => "add_tag",:remote => true,:tag => rt %>
<%= link_to image_tag("/images/sidebar/add.png"),:action => "add_tag",:remote => true,:tag => rt,:show_flag => show_flag %>
<span id="tag">
<%= rt %>
</span>
<% @issue_size = Issue.tagged_with("#{rt}").size %>
<% @project_size = Project.tagged_with(rt).size %>
<% @user_size = User.tagged_with("#{rt}").size %>

View File

@ -2,8 +2,8 @@
<ul>
<% for sg in selected_tags %>
<li>
<%= link_to image_tag("/images/sidebar/minus.png"),:action => "delete_tag",:remote=>true,:tag => sg %>
<%= sg %>
<%= link_to image_tag("/images/sidebar/minus.png"),:action => "delete_tag",:remote=>true,:tag => sg,:show_flag => show_flag %>
<span id="tag"><%= sg %> </span>
<% @issue_size = Issue.tagged_with("#{sg}").size %>
<% @project_size = Project.tagged_with(sg).size %>
<% @user_size = User.tagged_with("#{sg}").size %>

View File

@ -3,11 +3,11 @@
<hr />
<h3>Projects:</h3>
<% projects_results.each do |project| %>
<% projects_results.each do |prj| %>
<li>
项目名称:<%= link_to project.name,:controller => "projects",:action => "show",:id => project.id %>
项目名称:<%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %>
<br />
项目描述:<%= project.description %>;
项目描述:<%= prj.description %>;
</li>
<% end %>

View File

@ -1,28 +1,4 @@
<style type="text/css">
.click {
background: #b77b1b;
}
.unclick {
background: #b77b1b;
}
#tag {
background: url(/images/issue_tag.png) no-repeat right -19px;
border-radius: 5px 5px 5px 5px;
color: #3a587d !important;
padding: 0px 4px;
margin: 3px;
display: inline-block;
font-size: 11px;
text-decoration: none;
cursor: pointer;
}
#tag:hover {
color: #fff;
}
a:visited {
text-decoration: none;
}
</style>
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求-->
<% @tags = obj.reload.tag_list %>
@ -31,7 +7,7 @@
<% if @tags.size > Setting.show_tags_length.to_i then %>
<% i = 0 %>
<% until i>Setting.show_tags_length.to_i do %>
<div id="tag" class="click unclick">
<div id="tag">
<%= link_to @tags[i], :controller => "tags",:action => "index",:q => @tags[i],:object_flag => object_flag,:obj_id => obj.id %>
</div>
<% i += 1%>
@ -41,7 +17,7 @@
<% else %>
<% @tags.each do |tag| %>
<div id="tag" class="click unclick">
<div id="tag">
<%= link_to tag,:controller => "tags",:action => "index",:q=>tag,:object_flag => object_flag,:obj_id => obj.id
%>
</div>
@ -52,7 +28,7 @@
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
<% if @tags.size > 0 %>
<% @tags.each do |tag| %>
<div id="tag" class="click unclick">
<div id="tag">
<%= link_to tag,:controller => "tags",:action => "index",:q=>tag ,:object_flag => object_flag,:obj_id => obj.id %>
</div>
<% end %>

View File

@ -1,7 +1,7 @@
$('#selected_tags').html('<%= j(render :partial => "selected_tags",
:locals => {:selected_tags => $selected_tags })%>');
:locals => {:selected_tags => $selected_tags ,:show_flag => @show_flag })%>');
$('#related_tags').html('<%= j(render :partial => "related_tags",
:locals => {:related_tags => $related_tags })%>')
:locals => {:related_tags => $related_tags ,:show_flag => @show_flag })%>')
$('#show_results').html('<%= j(render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
:projects_results => @projects_results,:users_results => @users_results,:show_flag => @show_flag })%>')

View File

@ -1,7 +1,7 @@
$('#selected_tags').html('<%= j(render :partial => "selected_tags",
:locals => {:selected_tags => $selected_tags })%>');
:locals => {:selected_tags => $selected_tags ,:show_flag => @show_flag })%>');
$('#related_tags').html('<%= j(render :partial => "related_tags",
:locals => {:related_tags => $related_tags })%>')
:locals => {:related_tags => $related_tags,:show_flag => @show_flag })%>')
$('#show_results').html('<%= j(render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
:projects_results => @projects_results,:users_results => @users_results,:show_flag => @show_flag })%>')

View File

@ -4,13 +4,13 @@
Selected Tags
</li>
<div id="selected_tags">
<%= render :partial => "selected_tags",:locals => {:selected_tags => $selected_tags }%>
<%= render :partial => "selected_tags",:locals => {:selected_tags => $selected_tags,:show_flag => @obj_flag}%>
</div>
<li>
Related Tags
</li>
<div id="related_tags">
<%= render :partial => "related_tags",:locals => {:related_tags => $related_tags }%>
<%= render :partial => "related_tags",:locals => {:related_tags => $related_tags,:show_flag => @obj_flag }%>
</div>
</ul>
</div>
@ -18,9 +18,10 @@
<div class="splitcontentright">
<h2>Search Results</h2>
<div id="filter-menu" align="right">
<%= link_to "Issue",:action => "index"%>(<%= @issues_tags_num %>)|
<%= link_to "Project",:action => "index"%>(<%= @projects_tags_num %>) |
<%= link_to "User",:action => "index"%>(<%= @users_tags_num %>)
Tag统计
Issue(<%= @issues_tags_num %>)|
Project(<%= @projects_tags_num %>)|
User(<%= @users_tags_num %>)
</div>
<div id="show_results">
<%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,

View File

@ -1,16 +1,3 @@
<style type="text/css">
#tag {
background-color: #dbe4ee;
border-radius: 5px 5px 5px 5px;
color: #3a587d !important;
padding: 0px 4px;
margin: 3px;
display: inline-block;
font-size: 11px;
text-decoration: none;
cursor: pointer;
}
</style>
<% for tag in @tags %>
<span id="tag">
<%= tag.name %>

View File

@ -1865,3 +1865,15 @@ h2 img { vertical-align:middle; }
overflow:hidden;
}
/*added by william*/
#tag {
background: url(/images/issue_tag.png) no-repeat right -19px;
border-radius: 5px 5px 5px 5px;
color: #3a587d !important;
padding: 0px 4px;
margin: 3px;
display: inline-block;
font-size: 11px;
text-decoration: none;
cursor: pointer;
}