修改了一些赞的bug,添加了显示所有tag的功能。

This commit is contained in:
william 2013-08-08 22:25:32 +08:00
parent 0a2b91fa17
commit 80e74e4dd7
13 changed files with 42 additions and 11 deletions

View File

@ -2,9 +2,7 @@
class TagsController < ApplicationController class TagsController < ApplicationController
before_filter :require_admin,:only => :show before_filter :require_admin,:only => :show
#Added by nie
#before_filter :require_login,:only => :add_tag
#end
include ProjectsHelper include ProjectsHelper
include IssuesHelper include IssuesHelper
include UsersHelper include UsersHelper
@ -79,4 +77,9 @@ class TagsController < ApplicationController
end end
def show_all
@tags = ActsAsTaggableOn::Tag.find(:all)
@tags = @tags.to_a
end
end end

View File

@ -21,6 +21,9 @@ class UsersController < ApplicationController
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info] before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
accept_api_auth :index, :show, :create, :update, :destroy accept_api_auth :index, :show, :create, :update, :destroy
#william
before_filter :require_login,:only=>[:tag_save]
helper :sort helper :sort
include SortHelper include SortHelper
helper :custom_fields helper :custom_fields

View File

@ -26,6 +26,7 @@ module ApplicationHelper
include GravatarHelper::PublicMethods include GravatarHelper::PublicMethods
include Redmine::Pagination::Helper include Redmine::Pagination::Helper
include AvatarHelper include AvatarHelper
## added by william
include PraiseTreadHelper include PraiseTreadHelper
extend Forwardable extend Forwardable

View File

@ -377,7 +377,7 @@ module IssuesHelper
# 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_issues_by_tag(tag_name) def get_issues_by_tag(tag_name)
Issue.tagged_with(tag_name) Issue.tagged_with(tag_name).by_join_date
end end
end end

View File

@ -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) Project.tagged_with(tag_name).by_join_date
end end
end end

View File

@ -58,7 +58,7 @@ module UsersHelper
# 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_users_by_tag(tag_name) def get_users_by_tag(tag_name)
User.tagged_with(tag_name) User.tagged_with(tag_name).by_join_date
end end
end end

View File

@ -60,7 +60,8 @@ class Issue < ActiveRecord::Base
###########################added by william ###########################added by william
acts_as_taggable acts_as_taggable
scope :by_join_date, order("created_at DESC")
##end
DONE_RATIO_OPTIONS = %w(issue_field issue_status) DONE_RATIO_OPTIONS = %w(issue_field issue_status)
attr_reader :current_journal attr_reader :current_journal

View File

@ -78,7 +78,7 @@ class Project < ActiveRecord::Base
:author => nil :author => nil
############################added by william ############################added by william
acts_as_taggable acts_as_taggable
scope :by_join_date, order("created_at DESC")
###################added by liuping 关注 ###################added by liuping 关注
acts_as_watchable acts_as_watchable

View File

@ -103,6 +103,7 @@ class User < Principal
acts_as_customizable acts_as_customizable
############################added by william ############################added by william
acts_as_taggable acts_as_taggable
scope :by_join_date, order("created_at DESC")
############################# added by liuping 关注 ############################# added by liuping 关注
acts_as_watchable acts_as_watchable

View File

@ -4,7 +4,7 @@
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 --> <!-- 1代表是user类型 2代表是project类型 3代表是issue类型 -->
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 --> <!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
<% if object_flag == '3' %> <% if object_flag == '3' %>
<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name'} %> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %>
<div id="tags_show_issue"> <div id="tags_show_issue">
<%= render :partial => "layouts/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> <%= render :partial => "layouts/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div> </div>

View File

@ -42,6 +42,7 @@
</div></td> </div></td>
</tr> </tr>
</table> </table>
<!--tags--> <!--tags-->
<div class="tags"> <div class="tags">
<!-- added by william -for tag --> <!-- added by william -for tag -->

View File

@ -0,0 +1,18 @@
<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 %>
</span>
<% end %>

View File

@ -21,6 +21,7 @@ RedmineApp::Application.routes.draw do
get "tags/index" get "tags/index"
get "tags/show" get "tags/show"
get "praise_tread/praise_plus" get "praise_tread/praise_plus"
get "praise_tread/praise_minus" get "praise_tread/praise_minus"
get "praise_tread/tread_minus" get "praise_tread/tread_minus"
@ -431,7 +432,9 @@ RedmineApp::Application.routes.draw do
########### added by liuping ########### added by liuping
match 'tags/add_tag',:to => 'tags#add_tag',:as=>"add_tag" match 'tags/add_tag',:to => 'tags#add_tag',:as=>"add_tag"
match 'tags/delete_tag',:to => 'tags#delete_tag',:as=>"add_tag" match 'tags/delete_tag',:to => 'tags#delete_tag',:as=>"add_tag"
match 'tags/show_all',:to => 'tags#show_all'
match 'parise_tread/praise_plus',:to => 'parise_tread#praise_plus',:as=>"praise" match 'parise_tread/praise_plus',:to => 'parise_tread#praise_plus',:as=>"praise"
match 'parise_tread/tread_minus',:to => 'parise_tread#tread_minus',:as=>"tread" match 'parise_tread/tread_minus',:to => 'parise_tread#tread_minus',:as=>"tread"
end end