Class: Goldberg::Menu::Node

Inherits:
Object show all
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



9
10
11
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 9

def initialize()
  @parent = nil
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



5
6
7
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 5

def children
  @children
end

#content_page_idObject

Returns the value of attribute content_page_id.



6
7
8
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 6

def content_page_id
  @content_page_id
end

#controller_action_idObject

Returns the value of attribute controller_action_id.



6
7
8
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 6

def controller_action_id
  @controller_action_id
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 7

def id
  @id
end

#labelObject

Returns the value of attribute label.



7
8
9
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 7

def label
  @label
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 7

def name
  @name
end

#parentObject

Returns the value of attribute parent.



5
6
7
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 5

def parent
  @parent
end

#parent_idObject

Returns the value of attribute parent_id.



5
6
7
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 5

def parent_id
  @parent_id
end

#site_controller_idObject

Returns the value of attribute site_controller_id.



6
7
8
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 6

def site_controller_id
  @site_controller_id
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 7

def url
  @url
end

Instance Method Details

#add_child(child) ⇒ Object



71
72
73
74
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 71

def add_child(child)
  @children ||= Array.new
  @children << child.id
end

#content_pageObject



63
64
65
66
67
68
69
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 63

def content_page
  if not @content_page
    if @content_page_id
      @content_page = ContentPage.find(@content_page_id)
    end
  end
end

#controller_actionObject



55
56
57
58
59
60
61
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 55

def controller_action
  if not @controller_action
    if @controller_action_id
      @controller_action = ControllerAction.find(@controller_action_id)
    end
  end
end

#setup(item) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 13

def setup(item)
  @parent_id = item.parent_id
  @name = item.name
  @id = item.id
  @label = item.label
  
  if item.controller_action
    @site_controller_id = item.controller_action.site_controller.id
    @controller_action_id = item.controller_action.id
  else
    @site_controller_id = nil
    @controller_action_id = nil
  end

  if item.content_page
    @content_page_id = item.content_page.id
  else
    @content_page_id = nil
  end

  @url = String.new
  if item.controller_action
    if item.controller_action.url_to_use and 
        item.controller_action.url_to_use.length > 0
      @url = item.controller_action.url_to_use
    else
      @url = "/#{item.controller_action.site_controller.name}/#{item.controller_action.name}"
    end
  else
    @url = "/#{item.content_page.name}"
  end
  
end

#site_controllerObject



47
48
49
50
51
52
53
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/menu.rb', line 47

def site_controller
  if not @site_controller
    if @site_controller_id
      @site_controller = SiteController.find(@site_controller_id)
    end
  end
end