修复了tag查询的问题;tag样式的显示
This commit is contained in:
parent
4663751e7e
commit
6f54e1680d
|
@ -53,6 +53,7 @@ class TagsController < ApplicationController
|
||||||
|
|
||||||
def add_tag
|
def add_tag
|
||||||
@tag = params[:tag]
|
@tag = params[:tag]
|
||||||
|
@show_flag = params[:show_flag]
|
||||||
$selected_tags << @tag
|
$selected_tags << @tag
|
||||||
$related_tags.delete(@tag)
|
$related_tags.delete(@tag)
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ class TagsController < ApplicationController
|
||||||
|
|
||||||
def delete_tag
|
def delete_tag
|
||||||
@tag = params[:tag]
|
@tag = params[:tag]
|
||||||
|
@show_flag = params[:show_flag]
|
||||||
$related_tags << @tag
|
$related_tags << @tag
|
||||||
$selected_tags.delete(@tag)
|
$selected_tags.delete(@tag)
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ module ProjectsHelper
|
||||||
# this method is used to get all projects that tagged one tag
|
# this method is used to get all projects that tagged one tag
|
||||||
# added by william
|
# added by william
|
||||||
def get_projects_by_tag(tag_name)
|
def get_projects_by_tag(tag_name)
|
||||||
Project.tagged_with(tag_name).by_join_date
|
Project.tagged_with(tag_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<% if related_tags %>
|
<% if related_tags %>
|
||||||
<ul>
|
<ul>
|
||||||
<% for rt in related_tags %>
|
<% for rt in related_tags %>
|
||||||
<li>
|
<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 %>
|
<%= rt %>
|
||||||
|
</span>
|
||||||
<% @issue_size = Issue.tagged_with("#{rt}").size %>
|
<% @issue_size = Issue.tagged_with("#{rt}").size %>
|
||||||
<% @project_size = Project.tagged_with(rt).size %>
|
<% @project_size = Project.tagged_with(rt).size %>
|
||||||
<% @user_size = User.tagged_with("#{rt}").size %>
|
<% @user_size = User.tagged_with("#{rt}").size %>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<ul>
|
<ul>
|
||||||
<% for sg in selected_tags %>
|
<% for sg in selected_tags %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to image_tag("/images/sidebar/minus.png"),:action => "delete_tag",:remote=>true,:tag => sg %>
|
<%= link_to image_tag("/images/sidebar/minus.png"),:action => "delete_tag",:remote=>true,:tag => sg,:show_flag => show_flag %>
|
||||||
<%= sg %>
|
<span id="tag"><%= sg %> </span>
|
||||||
<% @issue_size = Issue.tagged_with("#{sg}").size %>
|
<% @issue_size = Issue.tagged_with("#{sg}").size %>
|
||||||
<% @project_size = Project.tagged_with(sg).size %>
|
<% @project_size = Project.tagged_with(sg).size %>
|
||||||
<% @user_size = User.tagged_with("#{sg}").size %>
|
<% @user_size = User.tagged_with("#{sg}").size %>
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
<hr />
|
<hr />
|
||||||
<h3>Projects:</h3>
|
<h3>Projects:</h3>
|
||||||
|
|
||||||
<% projects_results.each do |project| %>
|
<% projects_results.each do |prj| %>
|
||||||
<li>
|
<li>
|
||||||
项目名称:<%= link_to project.name,:controller => "projects",:action => "show",:id => project.id %>
|
项目名称:<%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %>
|
||||||
<br />
|
<br />
|
||||||
项目描述:<%= project.description %>;
|
项目描述:<%= prj.description %>;
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<% users_results.each do |user| %>
|
<% users_results.each do |user| %>
|
||||||
<li>
|
<li>
|
||||||
用户名:<%= link_to ("#{user.firstname+user.lastname}"),
|
用户名:<%= link_to ("#{user.firstname+user.lastname}"),
|
||||||
:controller => "users",:action => "show",:id => user.id %>
|
:controller => "users",:action => "show",:id => user.id%>
|
||||||
<br />
|
<br />
|
||||||
用户邮箱:<%= mail_to(h(user.mail)) %>
|
用户邮箱:<%= mail_to(h(user.mail)) %>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -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代表需求-->
|
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求-->
|
||||||
<% @tags = obj.reload.tag_list %>
|
<% @tags = obj.reload.tag_list %>
|
||||||
|
|
||||||
|
@ -31,7 +7,7 @@
|
||||||
<% if @tags.size > Setting.show_tags_length.to_i then %>
|
<% if @tags.size > Setting.show_tags_length.to_i then %>
|
||||||
<% i = 0 %>
|
<% i = 0 %>
|
||||||
<% until i>Setting.show_tags_length.to_i do %>
|
<% 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 %>
|
<%= link_to @tags[i], :controller => "tags",:action => "index",:q => @tags[i],:object_flag => object_flag,:obj_id => obj.id %>
|
||||||
</div>
|
</div>
|
||||||
<% i += 1%>
|
<% i += 1%>
|
||||||
|
@ -41,7 +17,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<% @tags.each do |tag| %>
|
<% @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
|
<%= link_to tag,:controller => "tags",:action => "index",:q=>tag,:object_flag => object_flag,:obj_id => obj.id
|
||||||
%>
|
%>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,7 +28,7 @@
|
||||||
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
|
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
|
||||||
<% if @tags.size > 0 %>
|
<% if @tags.size > 0 %>
|
||||||
<% @tags.each do |tag| %>
|
<% @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 %>
|
<%= link_to tag,:controller => "tags",:action => "index",:q=>tag ,:object_flag => object_flag,:obj_id => obj.id %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
$('#selected_tags').html('<%= j(render :partial => "selected_tags",
|
$('#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",
|
$('#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,
|
$('#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 })%>')
|
:projects_results => @projects_results,:users_results => @users_results,:show_flag => @show_flag })%>')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
$('#selected_tags').html('<%= j(render :partial => "selected_tags",
|
$('#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",
|
$('#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,
|
$('#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 })%>')
|
:projects_results => @projects_results,:users_results => @users_results,:show_flag => @show_flag })%>')
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
Selected Tags
|
Selected Tags
|
||||||
</li>
|
</li>
|
||||||
<div id="selected_tags">
|
<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>
|
</div>
|
||||||
<li>
|
<li>
|
||||||
Related Tags
|
Related Tags
|
||||||
</li>
|
</li>
|
||||||
<div id="related_tags">
|
<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>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,9 +18,10 @@
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
<h2>Search Results</h2>
|
<h2>Search Results</h2>
|
||||||
<div id="filter-menu" align="right">
|
<div id="filter-menu" align="right">
|
||||||
<%= link_to "Issue",:action => "index"%>(<%= @issues_tags_num %>)|
|
Tag统计:
|
||||||
<%= link_to "Project",:action => "index"%>(<%= @projects_tags_num %>) |
|
Issue(<%= @issues_tags_num %>)|
|
||||||
<%= link_to "User",:action => "index"%>(<%= @users_tags_num %>)
|
Project(<%= @projects_tags_num %>)|
|
||||||
|
User(<%= @users_tags_num %>)
|
||||||
</div>
|
</div>
|
||||||
<div id="show_results">
|
<div id="show_results">
|
||||||
<%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
|
<%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
|
||||||
|
|
|
@ -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 %>
|
<% for tag in @tags %>
|
||||||
<span id="tag">
|
<span id="tag">
|
||||||
<%= tag.name %>
|
<%= tag.name %>
|
||||||
|
|
|
@ -1865,3 +1865,15 @@ h2 img { vertical-align:middle; }
|
||||||
overflow:hidden;
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue