Class: QaServer::NavmenuPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/qa_server/navmenu_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNavmenuPresenter

Returns a new instance of NavmenuPresenter.



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/presenters/qa_server/navmenu_presenter.rb', line 25

def initialize
  @leftmenu_items = []
  @leftmenu_items << { label: I18n.t("qa_server.menu.home"), url: root_path }
  @leftmenu_items << { label: I18n.t("qa_server.menu.usage"), url: usage_index_path }
  @leftmenu_items << { label: I18n.t("qa_server.menu.authorities"), url: authority_list_index_path }
  @leftmenu_items << { label: I18n.t("qa_server.menu.check_status"), url: check_status_index_path }
  @leftmenu_items << { label: I18n.t("qa_server.menu.monitor_status"), url: monitor_status_index_path }
  @leftmenu_items << { label: I18n.t("qa_server.menu.fetch_term"), url: fetch_index_path }

  @rightmenu_items = []
  @rightmenu_items << { label: "LD4L Gateway", url: "http://ld4l.org/" }
end

Instance Attribute Details

#leftmenu_itemsArray<Hash> (readonly)

Returns label-url pairs for the navigation bar’s menu items justified left.

Examples:

[
  { label: 'Home', url: '/' },
  { label: 'Usage', url: '/usage' },
  { label: 'Authorities', url: '/authorities' },
  { label: 'Check Status', url: '/check_status' },
  { label: 'Monitor Status', url: '/monitor_status' }
]

Returns:

  • (Array<Hash>)

    label-url pairs for the navigation bar’s menu items justified left



16
17
18
# File 'app/presenters/qa_server/navmenu_presenter.rb', line 16

def leftmenu_items
  @leftmenu_items
end

#rightmenu_itemsArray<Hash> (readonly)

Returns label-url pairs for the navigation bar’s menu items justified right.

Examples:

[
  { label: 'LD4L Gateway', url: 'http://ld4l.org' }
]

Returns:

  • (Array<Hash>)

    label-url pairs for the navigation bar’s menu items justified right



23
24
25
# File 'app/presenters/qa_server/navmenu_presenter.rb', line 23

def rightmenu_items
  @rightmenu_items
end

Instance Method Details

#append_leftmenu_items(additional_items = []) ⇒ Object

Append additional left justified menu items to the main navigation menu

Examples:

[
  { label: 'New Item Label', url: 'http://new.item/one' },
  { label: '2nd New Item Label', url: 'http://new.item/two' }
]

Parameters:

  • array (Array<Hash<String,String>>)

    of menu items to append with hash key = menu item label to display and hash value = URL for the menu item link



45
46
47
48
# File 'app/presenters/qa_server/navmenu_presenter.rb', line 45

def append_leftmenu_items(additional_items = [])
  return if additional_items.nil?
  additional_items.each { |item| @leftmenu_items << item }
end