From 80e74e4dd78fb8221cb5ad79a8cf70ce7e25be6e Mon Sep 17 00:00:00 2001 From: william Date: Thu, 8 Aug 2013 22:25:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E8=B5=9E=E7=9A=84bug=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=89=80=E6=9C=89tag=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tags_controller.rb | 9 ++++++--- app/controllers/users_controller.rb | 3 +++ app/helpers/application_helper.rb | 1 + app/helpers/issues_helper.rb | 2 +- app/helpers/projects_helper.rb | 2 +- app/helpers/users_helper.rb | 2 +- app/models/issue.rb | 3 ++- app/models/project.rb | 2 +- app/models/user.rb | 3 ++- app/views/layouts/_tag.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 1 + app/views/tags/show_all.html.erb | 18 ++++++++++++++++++ config/routes.rb | 5 ++++- 13 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 app/views/tags/show_all.html.erb diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 233a2b308..b725b9fc2 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -2,9 +2,7 @@ class TagsController < ApplicationController before_filter :require_admin,:only => :show - #Added by nie - #before_filter :require_login,:only => :add_tag - #end + include ProjectsHelper include IssuesHelper include UsersHelper @@ -78,5 +76,10 @@ class TagsController < ApplicationController def show end + + def show_all + @tags = ActsAsTaggableOn::Tag.find(:all) + @tags = @tags.to_a + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9c335ad6d..d415566a6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -20,6 +20,9 @@ class UsersController < ApplicationController before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist] 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 + + #william + before_filter :require_login,:only=>[:tag_save] helper :sort include SortHelper diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 343b41265..ea87f47bf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -26,6 +26,7 @@ module ApplicationHelper include GravatarHelper::PublicMethods include Redmine::Pagination::Helper include AvatarHelper + ## added by william include PraiseTreadHelper extend Forwardable diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 4ecc33690..06ea865c7 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -377,7 +377,7 @@ module IssuesHelper # this method is used to get all projects that tagged one tag # added by william def get_issues_by_tag(tag_name) - Issue.tagged_with(tag_name) + Issue.tagged_with(tag_name).by_join_date end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index cbe57d1c7..d4738a831 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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) + Project.tagged_with(tag_name).by_join_date end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 9b6f85d2a..1f32990c1 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -58,7 +58,7 @@ module UsersHelper # this method is used to get all projects that tagged one tag # added by william def get_users_by_tag(tag_name) - User.tagged_with(tag_name) + User.tagged_with(tag_name).by_join_date end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 5ecadb672..8d6f6e7c5 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -60,7 +60,8 @@ class Issue < ActiveRecord::Base ###########################added by william acts_as_taggable - + scope :by_join_date, order("created_at DESC") + ##end DONE_RATIO_OPTIONS = %w(issue_field issue_status) attr_reader :current_journal diff --git a/app/models/project.rb b/app/models/project.rb index 6c1be04af..47494ff31 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -78,7 +78,7 @@ class Project < ActiveRecord::Base :author => nil ############################added by william acts_as_taggable - + scope :by_join_date, order("created_at DESC") ###################added by liuping 关注 acts_as_watchable diff --git a/app/models/user.rb b/app/models/user.rb index 3d71394a9..373252e14 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -102,7 +102,8 @@ class User < Principal acts_as_customizable ############################added by william - acts_as_taggable + acts_as_taggable + scope :by_join_date, order("created_at DESC") ############################# added by liuping 关注 acts_as_watchable diff --git a/app/views/layouts/_tag.html.erb b/app/views/layouts/_tag.html.erb index 5873c6294..e0e2b49fd 100644 --- a/app/views/layouts/_tag.html.erb +++ b/app/views/layouts/_tag.html.erb @@ -4,7 +4,7 @@ <% 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'} %>
<%= render :partial => "layouts/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 2e00961bc..00ff23a0d 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -42,6 +42,7 @@ +
diff --git a/app/views/tags/show_all.html.erb b/app/views/tags/show_all.html.erb new file mode 100644 index 000000000..df5c851b1 --- /dev/null +++ b/app/views/tags/show_all.html.erb @@ -0,0 +1,18 @@ + +<% for tag in @tags %> + + <%= tag.name %> + +<% end %> diff --git a/config/routes.rb b/config/routes.rb index 8b74e410c..9e8279ef6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,8 +19,9 @@ RedmineApp::Application.routes.draw do resources :shares get "tags/index" - + get "tags/show" + get "praise_tread/praise_plus" get "praise_tread/praise_minus" get "praise_tread/tread_minus" @@ -431,7 +432,9 @@ RedmineApp::Application.routes.draw do ########### added by liuping match 'tags/add_tag',:to => 'tags#add_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/tread_minus',:to => 'parise_tread#tread_minus',:as=>"tread" + end