ÍêÉÆTagÄ£¿é¡£
This commit is contained in:
parent
bf1f9b8e19
commit
4c5ba2b6df
|
@ -31,6 +31,8 @@ class TagsController < ApplicationController
|
|||
@obj = Project.find_by_id(@obj_id)
|
||||
when '3' then
|
||||
@obj = Issue.find_by_id(@obj_id)
|
||||
when '4' then
|
||||
@obj = Bid.find_by_id(@obj_id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
class Tag < ActiveRecord::Base
|
||||
attr_accessible :content
|
||||
#æ·»åŠ ä»£ç
|
||||
has_many :projects, :through => :project_tags
|
||||
has_many :project_tags, :class_name => 'ProjectTags'
|
||||
|
||||
#确定contentä¸ä¼šè¢«é‡å¤å†™å…¥
|
||||
validates_uniqueness_of :content
|
||||
validates_presence_of :content
|
||||
|
||||
#æ·»åŠ tag内容
|
||||
def self.add_content(content)
|
||||
@tag=Tag.new
|
||||
@tag.content = content
|
||||
@tag.save
|
||||
true
|
||||
end
|
||||
end
|
||||
#æ·»åŠ ç»“æŸ
|
|
@ -30,7 +30,6 @@
|
|||
<% if @issue.created_on != @issue.updated_on %>
|
||||
<%= l(:label_updated_time, time_tag(@issue.updated_on)).html_safe %>.
|
||||
<% end %>
|
||||
|
||||
</p>
|
||||
<!-- added by william -for tag -->
|
||||
<div id="tags">
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
<label><%= l(:label_tag) %>:</label>
|
||||
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 -->
|
||||
<!-- 3 代表的是issue 当是issue是 处ç†æ–¹å¼ä¸Žå‰2个对象ä¸åŒ -->
|
||||
<div id="tags" class="inf_user_context">
|
||||
<label><%= l(:label_tag) %>:</label>
|
||||
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 -->
|
||||
<!-- 3 代表的是issue 当是issue是 处ç†æ–¹å¼ä¸Žå‰2个对象ä¸åŒ -->
|
||||
<% if object_flag == '3' %>
|
||||
<%= toggle_link (image_tag "/images/add.png"), 'put-tag-form-issue', {:focus => 'name'} %>
|
||||
<div id="tags_show_issue">
|
||||
<%= render :partial => "layouts/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<div id="put-tag-form-issue" style="display: none">
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => '$("#put-tag-form-issue").hide();' do |f| %>
|
||||
<%= f.text_field :name ,:id => "name-issue"%>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<%= f.submit "add"%>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<%= toggle_link (image_tag "/images/add.png"), 'put-tag-form', {:focus => 'name'} %>
|
||||
<div id="tags_show">
|
||||
<%= render :partial => "layouts/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
|
@ -17,4 +36,5 @@
|
|||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<%= render :partial => 'layouts/base_header'%>
|
||||
|
||||
<div id="main" class="">
|
||||
<div id="sidebar">
|
||||
|
@ -29,9 +28,7 @@
|
|||
<div class="inf_user_image">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" valign="middle">
|
||||
<%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user), :class => "avatar" %>
|
||||
</td>
|
||||
<td align="left" valign="middle"> <%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user), :class => "avatar" %> </td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -59,20 +56,9 @@
|
|||
关注 (<%= link_to @bid.watcher_users.count, home_path %>) åº”æ ‡é¡¹ç›® (<%= link_to @bid.biding_projects.count, home_path %>)å馈(<%= @bid.commit%>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="inf_user_context">
|
||||
<table style="font-family:微软雅黑">
|
||||
<tr>
|
||||
<th>æ ‡ç¾äº‘:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><!-- added by william -for tag -->
|
||||
<div id="tags">
|
||||
<%= render :partial => 'layouts/tag', :locals => {:obj => @bid,:object_flag => "4"}%>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- added by william -for tag -->
|
||||
<%= render :partial => 'layouts/tag', :locals => {:obj => @bid,:object_flag => "4"}%>
|
||||
|
||||
</div>
|
||||
<div class="user_fans">
|
||||
<div class="font_title_left">
|
||||
<strong>关注</strong>
|
||||
|
@ -81,11 +67,9 @@
|
|||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px">
|
||||
<% for user in @bid.watcher_users%>
|
||||
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %>
|
||||
<% end%>
|
||||
</td>
|
||||
<td style="padding-top: 5px"> <% for user in @bid.watcher_users%>
|
||||
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %>
|
||||
<% end%> </td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td align="right"><%= link_to "显示所有关注",home_path %>(<%= link_to @bid.watcher_users.count, home_path %>)</td>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if users_results.size > 0 %>
|
||||
<hr />
|
||||
<h3>Users:</h3>
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
<div class="splitcontentleft">
|
||||
<style type="text/css">
|
||||
.tags_left{
|
||||
width: 30%;
|
||||
float:left;
|
||||
}
|
||||
.tags_right{
|
||||
padding-top:18px;
|
||||
width: 68%;
|
||||
float:right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="tags_left">
|
||||
<ul>
|
||||
<li>
|
||||
Selected Tags
|
||||
|
@ -15,7 +27,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<div class="tags_right">
|
||||
<h2>Search Results</h2>
|
||||
<div id="filter-menu" align="right">
|
||||
<%= link_to "Issue",:action => "index"%>(<%= @issues_tags_num %>)|
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
$('#tags_show').html('<%= escape_javascript(render :partial => 'layouts/tag_name',:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
|
||||
|
||||
<% if @obj_flag == '3'%>
|
||||
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'layouts/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$('#put-tag-form-issue').hide();
|
||||
$('#name-issue').val("");
|
||||
<% else %>
|
||||
$('#tags_show').html('<%= escape_javascript(render :partial => 'layouts/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$('#put-tag-form').hide();
|
||||
$('#name').val("");
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue