Project

General

Profile

RE: Redmine+Bundler - method_missing "has_key?" ยป menu_manager.patch

patch for menu_manager.rb - Lee Pope, 2011-02-11 21:28

View differences:

lib/redmine/menu_manager.rb
37 37
    # parent is set to be the receiver.  The child is added as the first child in
38 38
    # the current list of children for the receiver node.
39 39
    def prepend(child)
40
      raise "Child already added" if @children_hash.has_key?(child.name)
40
      raise "Child already added" if @childrenHash.has_key?(child.name)
41 41

  
42
      @children_hash[child.name]  = child
42
      @childrenHash[child.name]  = child
43 43
      @children = [child] + @children
44 44
      child.parent = self
45 45
      return child
......
50 50
    # parent is set to be the receiver.  The child is added at the position
51 51
    # into the current list of children for the receiver node.
52 52
    def add_at(child, position)
53
      raise "Child already added" if @children_hash.has_key?(child.name)
53
      raise "Child already added" if @childrenHash.has_key?(child.name)
54 54

  
55
      @children_hash[child.name]  = child
55
      @childrenHash[child.name]  = child
56 56
      @children = @children.insert(position, child)
57 57
      child.parent = self
58 58
      return child
......
60 60
    end
61 61

  
62 62
    def add_last(child)
63
      raise "Child already added" if @children_hash.has_key?(child.name)
63
      raise "Child already added" if @childrenHash.has_key?(child.name)
64 64

  
65
      @children_hash[child.name]  = child
65
      @childrenHash[child.name]  = child
66 66
      @children <<  child
67 67
      @last_items_count += 1
68 68
      child.parent = self
......
74 74
    # parent is set to be the receiver.  The child is added as the last child in
75 75
    # the current list of children for the receiver node.
76 76
    def add(child)
77
      raise "Child already added" if @children_hash.has_key?(child.name)
77
      raise "Child already added" if @childrenHash.has_key?(child.name)
78 78

  
79
      @children_hash[child.name]  = child
79
      @childrenHash[child.name]  = child
80 80
      position = @children.size - @last_items_count
81 81
      @children.insert(position, child)
82 82
      child.parent = self
......
180 180
      end
181 181

  
182 182
      def render_menu_node(node, project=nil)
183
        if node.has_children? || !node.child_menus.nil?
183
        if node.hasChildren? || !node.child_menus.nil?
184 184
          return render_menu_node_with_children(node, project)
185 185
        else
186 186
          caption, url, selected = extract_node_details(node, project)
    (1-1/1)