Project

General

Profile

Feature #2194 ยป menu_manager.diff

Jean-Baptiste Barth, 2008-11-15 05:45

View differences:

lib/redmine/menu_manager.rb (working copy)
91 91
            end
92 92
            caption = item.caption(project)
93 93
            caption = l(caption) if caption.is_a?(Symbol)
94
            #warning: this "==" is re-defined in "MenuItem" class
94 95
            if block_given?
95
              yield item, caption, url, (current_menu_item == item.name)
96
              yield item, caption, url, (item == current_menu_item)
96 97
            else
97
              items << [item, caption, url, (current_menu_item == item.name)]
98
              items << [item, caption, url, (item == current_menu_item)]
98 99
            end
99 100
          end
100 101
        end
......
179 180
        @param = options[:param] || :id
180 181
        @caption = options[:caption]
181 182
        @html_options = options[:html] || {}
183
        @for = options[:for] || []
182 184
      end
183 185
      
186
      def ==(other)
187
        @for.blank? ? @name == other : @for.include?(other.to_sym)
188
      end
189

  
184 190
      def caption(project=nil)
185 191
        if @caption.is_a?(Proc)
186 192
          c = @caption.call(project).to_s
    (1-1/1)