Class: Netzke::Basepack::SimpleApp
- Inherits:
-
Base
- Object
- Base
- Netzke::Basepack::SimpleApp
- Defined in:
- lib/netzke/basepack/simple_app.rb
Overview
Basis for a Ext.container.Viewport-based one-page application.
Features:
-
dynamic loading of components
-
browser history support (press the “Back”-button to go to the previously loaded component)
-
AJAX activity indicator
Extending SimpleApp
You may want to extend SimpleApp to provide a custom layout. Make sure you create three regions with predefined itemId’s that will be used by SimpleApp. You can use the following methods defined by SimpleApp: main_panel_config, status_bar_config, and menu_bar_config, e.g.:
class MySimpleApp < Netzke::Basepack::SimpleApp
def configuration
super.merge(
:items => [my_custom_navigation_config, main_panel_config, menu_bar_config, status_bar_config]
)
end
def my_custom_navigation_config
{
:item_id => 'navigation',
:region => :east,
:width => 200
}
end
...
end
The JS side of the component will have those regions referenced as this.mainPanel, this.statusBar, and this.menuBar.
Direct Known Subclasses
Instance Method Summary collapse
- #configuration ⇒ Object
-
#js_component_html ⇒ Object
Html required for Ext.History to work.
-
#js_component_render ⇒ Object
In Ext 4.1 calling ‘render` on a viewport causes an error.
-
#main_panel_config(overrides = {}) ⇒ Object
Config for the main panel, which will contain dynamically loaded components.
-
#menu ⇒ Object
Override for custom menu.
-
#menu_bar_config(overrides = {}) ⇒ Object
Config for the menu bar.
-
#status_bar_config(overrides = {}) ⇒ Object
Config for the status bar.
Instance Method Details
#configuration ⇒ Object
48 49 50 51 52 |
# File 'lib/netzke/basepack/simple_app.rb', line 48 def configuration super.merge( :items => [main_panel_config, , ] ) end |
#js_component_html ⇒ Object
Html required for Ext.History to work
94 95 96 97 98 99 100 101 |
# File 'lib/netzke/basepack/simple_app.rb', line 94 def js_component_html super << %Q{ <form id="history-form" class="x-hidden"> <input type="hidden" id="x-history-field" /> <iframe id="x-history-frame"></iframe> </form> } end |
#js_component_render ⇒ Object
In Ext 4.1 calling ‘render` on a viewport causes an error
44 45 46 |
# File 'lib/netzke/basepack/simple_app.rb', line 44 def js_component_render "" end |
#main_panel_config(overrides = {}) ⇒ Object
Config for the main panel, which will contain dynamically loaded components.
60 61 62 63 64 65 66 |
# File 'lib/netzke/basepack/simple_app.rb', line 60 def main_panel_config(overrides = {}) { :itemId => 'main_panel', :region => 'center', :layout => 'fit' }.merge(overrides) end |
#menu ⇒ Object
Override for custom menu
55 56 57 |
# File 'lib/netzke/basepack/simple_app.rb', line 55 def [] end |
#menu_bar_config(overrides = {}) ⇒ Object
Config for the menu bar
83 84 85 86 87 88 89 90 91 |
# File 'lib/netzke/basepack/simple_app.rb', line 83 def (overrides = {}) { :itemId => 'menu_bar', :xtype => 'toolbar', :region => 'north', :height => 28, :items => }.merge(overrides) end |
#status_bar_config(overrides = {}) ⇒ Object
Config for the status bar
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/netzke/basepack/simple_app.rb', line 69 def (overrides = {}) { :itemId => 'status_bar', :xtype => 'statusbar', :region => 'south', :height => 22, :statusAlign => 'right', :busyText => 'Busy...', :default_text => "Ready", :default_icon_cls => "" }.merge(overrides) end |