Revision 727:e3e958595e07 vendor/plugins/redmine_tags

View differences:

vendor/plugins/redmine_tags/app/views/projects/_tags.html.erb
1
BAHAUS
2

  
3
<% unless project.tag_list.empty? %>
4
  <tr>
5
    <td><b><%=l(:tags)%>:</b></td>
6
    <td><%= project.tag_counts.collect{ |t| render_tag_link(t, :show_count => false, :open_only => false) }.join(', ') %></td>
7
  </tr>
8
<% end %>
vendor/plugins/redmine_tags/assets/javascripts/tags_input.js
92 92
function observeIssueTagsField(url) {
93 93
  new Redmine.TagsInput('issue_tag_list').autocomplete('issue_tag_candidates', url);
94 94
}
95

  
96

  
97
function observeProjectTagsField(url) {
98
  new Redmine.TagsInput('project_tag_list').autocomplete('project_tag_candidates', url);
99
}
vendor/plugins/redmine_tags/init.rb
41 41
require 'dispatcher'
42 42

  
43 43
Dispatcher.to_prepare :redmine_tags do
44
  unless Project.included_modules.include?(RedmineTags::Patches::ProjectPatch)
45
    Project.send(:include, RedmineTags::Patches::ProjectPatch)
46
  end
47

  
44 48
  unless Issue.included_modules.include?(RedmineTags::Patches::IssuePatch)
45 49
    Issue.send(:include, RedmineTags::Patches::IssuePatch)
46 50
  end
......
65 69

  
66 70
require 'redmine_tags/hooks/model_issue_hook'
67 71
require 'redmine_tags/hooks/views_issues_hook'
72
require 'redmine_tags/hooks/views_projects_hook'
73

  
vendor/plugins/redmine_tags/lib/redmine_tags/hooks/views_projects_hook.rb
1
module RedmineTags
2
  module Hooks
3
    class ViewsProjectsHook < Redmine::Hook::ViewListener
4
      render_on :view_projects_show_left, :partial => 'projects/tags'
5
#      render_on :view_issues_form_details_bottom, :partial => 'issues/tags_form'
6
#      render_on :view_issues_sidebar_planning_bottom, :partial => 'issues/tags_sidebar'
7
    end
8
  end
9
end
10

  
vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb
1
# C4DM
2

  
3
require_dependency 'project'
4

  
5
module RedmineTags
6
  module Patches
7
    module ProjectPatch
8
      def self.included(base)
9
        base.extend(ClassMethods)
10

  
11
        base.class_eval do
12
          unloadable
13
          acts_as_taggable
14
        end
15
      end
16

  
17
      module ClassMethods
18
        # Returns available issue tags
19
        # === Parameters
20
        # * <i>options</i> = (optional) Options hash of
21
        #   * project   - Project to search in.
22
        #   * open_only - Boolean. Whenever search within open issues only.
23
        #   * name_like - String. Substring to filter found tags.
24
        def available_tags(options = {})
25
          project   = options[:project]
26
          open_only = options[:open_only]
27
          name_like = options[:name_like]
28
          options   = {}
29
          visible   = ARCondition.new
30
          
31
          if project
32
            project = project.id if project.is_a? Project
33
            visible << ["#{Issue.table_name}.project_id = ?", project]
34
          end
35

  
36
          if open_only
37
            visible << ["#{Issue.table_name}.status_id IN " +
38
                        "( SELECT issue_status.id " + 
39
                        "    FROM #{IssueStatus.table_name} issue_status " +
40
                        "   WHERE issue_status.is_closed = ? )", false]
41
          end
42

  
43
          if name_like
44
            visible << ["#{ActsAsTaggableOn::Tag.table_name}.name LIKE ?", "%#{name_like.downcase}%"]
45
          end
46

  
47
          options[:conditions] = visible.conditions
48
          self.all_tag_counts(options)
49
        end
50
      end
51
    end
52
  end
53
end

Also available in: Unified diff