Mercurial > hg > soundsoftware-site
changeset 745:4acfc770e79f feature_14
Added method that returns all projects tags.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 08 Nov 2011 11:37:37 +0000 |
parents | b7ac21913927 |
children | 2ced57750157 |
files | vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb |
diffstat | 1 files changed, 7 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Fri Nov 04 17:50:35 2011 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Tue Nov 08 11:37:37 2011 +0000 @@ -48,8 +48,6 @@ end module ClassMethods - - def search_by_question(question) if question.length > 1 search(RedmineProjectFiltering.calculate_tokens(question), nil, :all_words => true).first.sort_by(&:lft) @@ -59,37 +57,15 @@ end - # Returns available issue tags - # === Parameters - # * <i>options</i> = (optional) Options hash of - # * project - Project to search in. - # * open_only - Boolean. Whenever search within open issues only. - # * name_like - String. Substring to filter found tags. - def available_tags(options = {}) - project = options[:project] - open_only = options[:open_only] - name_like = options[:name_like] - options = {} + # Returns available project tags + # does not show tags from private projects + def available_tags + options = {} visible = ARCondition.new - - if project - project = project.id if project.is_a? Project - visible << ["#{Issue.table_name}.project_id = ?", project] - end - - if open_only - visible << ["#{Project.table_name}.status_id IN " + - "( SELECT issue_status.id " + - " FROM #{IssueStatus.table_name} issue_status " + - " WHERE issue_status.is_closed = ? )", false] - end - - if name_like - visible << ["#{ActsAsTaggableOn::Tag.table_name}.name LIKE ?", "%#{name_like.downcase}%"] - end - + + visible << ["#{Project.table_name}.is_public = \"1\""] options[:conditions] = visible.conditions - self.all_tag_counts(options) + self.all_tag_counts(options) end end end