To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / vendor / plugins / redmine_tags / lib / redmine_tags / patches / issues_helper_patch.rb @ 745:4acfc770e79f

History | View | Annotate | Download (1.95 KB)

1
# This file is a part of redmine_tags
2
# redMine plugin, that adds tagging support.
3
#
4
# Copyright (c) 2010 Aleksey V Zapparov AKA ixti
5
#
6
# redmine_tags is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# redmine_tags is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with redmine_tags.  If not, see <http://www.gnu.org/licenses/>.
18

    
19
require_dependency 'issues_helper'
20

    
21
module RedmineTags
22
  module Patches
23
    module IssuesHelperPatch
24
      def self.included(base)
25
        base.send(:include, InstanceMethods)
26
      end
27

    
28
      module InstanceMethods
29
        include TagsHelper
30

    
31
        def redmine_tags_settings
32
            @redmine_tags_settings = Setting.plugin_redmine_tags unless @redmine_tags_settings
33
            @redmine_tags_settings
34
        end
35

    
36
        def sidebar_tags
37
          unless @sidebar_tags
38
            @sidebar_tags = []
39
            if :none != redmine_tags_settings[:issues_sidebar].to_sym
40
              @sidebar_tags = Issue.available_tags(:project => @project,
41
                                                   :open_only => (redmine_tags_settings[:issues_open_only].to_i == 1))
42
            end
43
          end
44
          @sidebar_tags
45
        end
46

    
47
        def render_sidebar_tags
48
          render_tags_list(sidebar_tags,
49
                          :show_count => (redmine_tags_settings[:issues_show_count].to_i == 1),
50
                          :open_only => (redmine_tags_settings[:issues_open_only].to_i == 1),
51
                          :style => redmine_tags_settings[:issues_sidebar].to_sym)
52
        end
53
      end
54
    end
55
  end
56
end