Class: TrustyCms::AdminUI

Inherits:
Object
  • Object
show all
Includes:
Simpleton
Defined in:
lib/trusty_cms/admin_ui.rb

Defined Under Namespace

Classes: DuplicateTabNameError, NavSubItem, NavTab, RegionPartials, RegionSet

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Simpleton

included

Constructor Details

#initializeAdminUI

Returns a new instance of AdminUI.



131
132
133
134
# File 'lib/trusty_cms/admin_ui.rb', line 131

def initialize
  initialize_nav
  load_default_regions
end

Instance Attribute Details

Returns the value of attribute nav.



111
112
113
# File 'lib/trusty_cms/admin_ui.rb', line 111

def nav
  @nav
end

Instance Method Details

#initialize_navObject



136
137
138
139
# File 'lib/trusty_cms/admin_ui.rb', line 136

def initialize_nav
  @nav = NavTab.new('Tab Container')
  load_default_nav
end

#load_default_navObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/trusty_cms/admin_ui.rb', line 141

def load_default_nav
  content = nav_tab('Content')
  content << nav_item('Pages', '/admin/pages')
  nav << content

  design = nav_tab('Design')
  design << nav_item('Layouts', '/admin/layouts')
  nav << design

  settings = nav_tab('Settings')
  settings << nav_item('General', '/admin/configuration')
  settings << nav_item('Personal', '/admin/preferences')
  settings << nav_item('Users', '/admin/users')
  settings << nav_item('Extensions', '/admin/extensions')
  nav << settings
end

#load_default_regionsObject



158
159
160
161
162
163
164
# File 'lib/trusty_cms/admin_ui.rb', line 158

def load_default_regions
  @page = load_default_page_regions
  @layout = load_default_layout_regions
  @user = load_default_user_regions
  @configuration = load_default_configuration_regions
  @extension = load_default_extension_regions
end


117
118
119
# File 'lib/trusty_cms/admin_ui.rb', line 117

def nav_item(*args)
  NavSubItem.new(*args)
end


113
114
115
# File 'lib/trusty_cms/admin_ui.rb', line 113

def nav_tab(*args)
  NavTab.new(*args)
end

#tabsObject



121
122
123
# File 'lib/trusty_cms/admin_ui.rb', line 121

def tabs
  nav['Content']
end