netzke-basepack 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +15 -10
- data/{CHANGELOG.rdoc → CHANGELOG.md} +146 -110
- data/LICENSE +7 -1
- data/README.md +47 -56
- data/Rakefile +5 -5
- data/config/before-travis.sh +10 -0
- data/javascripts/basepack.js +0 -130
- data/javascripts/netzkeremotecombo.js +59 -0
- data/lib/netzke/basepack.rb +9 -14
- data/lib/netzke/basepack/accordion.rb +45 -0
- data/lib/netzke/basepack/active_record.rb +12 -0
- data/lib/netzke/basepack/active_record/relation_extensions.rb +27 -0
- data/lib/netzke/basepack/columns.rb +309 -0
- data/lib/netzke/basepack/data_accessor.rb +22 -12
- data/lib/netzke/basepack/data_adapters/abstract_adapter.rb +75 -11
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +154 -49
- data/lib/netzke/basepack/fields.rb +162 -0
- data/lib/netzke/basepack/form.rb +136 -0
- data/lib/netzke/basepack/{form_panel → form}/javascripts/comma_list_cbg.js +0 -1
- data/lib/netzke/basepack/{form_panel/javascripts/form_panel.js → form/javascripts/form.js} +20 -26
- data/lib/netzke/basepack/{form_panel → form}/javascripts/n_radio_group.js +0 -1
- data/lib/netzke/basepack/{form_panel → form}/javascripts/readonly_mode.js +0 -0
- data/lib/netzke/basepack/form/services.rb +115 -0
- data/lib/netzke/basepack/{form_panel → form}/stylesheets/readonly_mode.css +0 -0
- data/lib/netzke/basepack/grid.rb +355 -0
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/advanced_search.js +1 -1
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/check_column_fix.js +0 -0
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/edit_in_form.js +3 -3
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/event_handling.js +5 -2
- data/lib/netzke/basepack/{grid_panel/javascripts/grid_panel.js → grid/javascripts/grid.js} +120 -132
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/misc.js +0 -0
- data/lib/netzke/basepack/grid/services.rb +216 -0
- data/lib/netzke/basepack/item_persistence.rb +44 -0
- data/lib/netzke/basepack/item_persistence/events_plugin.rb +47 -0
- data/lib/netzke/basepack/{paging_form_panel.rb → paging_form.rb} +24 -30
- data/lib/netzke/basepack/{paging_form_panel/javascripts/paging_form_panel.js → paging_form/javascripts/paging_form.js} +2 -4
- data/lib/netzke/basepack/query_builder.rb +44 -73
- data/lib/netzke/basepack/query_builder/javascripts/query_builder.js +16 -2
- data/lib/netzke/basepack/record_form_window.rb +67 -0
- data/lib/netzke/basepack/search_panel.rb +22 -24
- data/lib/netzke/basepack/search_panel/javascripts/condition_field.js +2 -2
- data/lib/netzke/basepack/search_window.rb +47 -53
- data/lib/netzke/basepack/simple_app.rb +10 -13
- data/lib/netzke/basepack/simple_app/javascripts/simple_app.js +2 -8
- data/lib/netzke/basepack/tab_panel.rb +5 -4
- data/lib/netzke/basepack/tab_panel/javascripts/tab_panel.js +5 -5
- data/lib/netzke/basepack/version.rb +2 -2
- data/lib/netzke/basepack/viewport.rb +16 -0
- data/lib/netzke/basepack/window.rb +27 -18
- data/lib/netzke/basepack/window/javascripts/window.js +7 -1
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +18 -18
- data/locales/en.yml +40 -24
- data/netzke-basepack.gemspec +51 -82
- data/stylesheets/basepack.css +0 -41
- data/test/basepack_test_app/Gemfile +9 -46
- data/test/basepack_test_app/Gemfile.lock +61 -96
- data/test/basepack_test_app/app/components/author_form.rb +8 -5
- data/test/basepack_test_app/app/components/author_grid.rb +2 -2
- data/test/basepack_test_app/app/components/book_form.rb +34 -31
- data/test/basepack_test_app/app/components/book_form_with_defaults.rb +6 -7
- data/test/basepack_test_app/app/components/book_form_with_file_upload.rb +10 -0
- data/test/basepack_test_app/app/components/book_form_with_nested_attributes.rb +5 -6
- data/test/basepack_test_app/app/components/book_grid.rb +19 -8
- data/test/basepack_test_app/app/components/book_grid_filtering.rb +4 -7
- data/test/basepack_test_app/app/components/book_grid_loader.rb +28 -15
- data/test/basepack_test_app/app/components/book_grid_with_custom_columns.rb +45 -21
- data/test/basepack_test_app/app/components/book_grid_with_default_values.rb +26 -8
- data/test/basepack_test_app/app/components/book_grid_with_excluded_columns.rb +11 -0
- data/test/basepack_test_app/app/components/book_grid_with_extra_feedback.rb +2 -2
- data/test/basepack_test_app/app/components/book_grid_with_extra_filters.rb +7 -6
- data/test/basepack_test_app/app/components/book_grid_with_mass_assignment_security.rb +9 -0
- data/test/basepack_test_app/app/components/book_grid_with_nested_attributes.rb +9 -9
- data/test/basepack_test_app/app/components/book_grid_with_overridden_columns.rb +5 -3
- data/test/basepack_test_app/app/components/book_grid_with_paging.rb +6 -8
- data/test/basepack_test_app/app/components/book_grid_with_persistence.rb +6 -4
- data/test/basepack_test_app/app/components/book_grid_with_scope.rb +6 -0
- data/test/basepack_test_app/app/components/book_grid_with_scoped_authors.rb +10 -7
- data/test/basepack_test_app/app/components/book_grid_with_virtual_attributes.rb +21 -13
- data/test/basepack_test_app/app/components/book_paging_form.rb +21 -0
- data/test/basepack_test_app/app/components/book_query_builder.rb +7 -6
- data/test/basepack_test_app/app/components/book_with_custom_primary_key_grid.rb +6 -7
- data/test/basepack_test_app/app/components/books_bound_to_author.rb +9 -7
- data/test/basepack_test_app/app/components/border_layout_panel_with_persistence.rb +12 -0
- data/test/basepack_test_app/app/components/double_book_grid.rb +19 -14
- data/test/basepack_test_app/app/components/form_without_model.rb +15 -16
- data/test/basepack_test_app/app/components/grid_with_initial_sorting.rb +7 -0
- data/test/basepack_test_app/app/components/grid_with_inline_data.rb +7 -0
- data/test/basepack_test_app/app/components/paging_form_with_search.rb +2 -2
- data/test/basepack_test_app/app/components/panel_with_persistent_regions.rb +35 -0
- data/test/basepack_test_app/app/components/query_builder.rb +7 -0
- data/test/basepack_test_app/app/components/simple_panel.rb +16 -11
- data/test/basepack_test_app/app/components/simple_window.rb +7 -6
- data/test/basepack_test_app/app/components/some_accordion.rb +18 -0
- data/test/basepack_test_app/app/components/some_auth_app.rb +5 -5
- data/test/basepack_test_app/app/components/some_border_layout.rb +20 -20
- data/test/basepack_test_app/app/components/some_search_panel.rb +6 -0
- data/test/basepack_test_app/app/components/some_simple_app.rb +30 -16
- data/test/basepack_test_app/app/components/some_tab_panel.rb +18 -15
- data/test/basepack_test_app/app/components/user_form.rb +18 -16
- data/test/basepack_test_app/app/components/user_form_with_default_fields.rb +5 -6
- data/test/basepack_test_app/app/components/user_grid.rb +11 -6
- data/test/basepack_test_app/app/components/user_grid_with_customized_form_fields.rb +5 -3
- data/test/basepack_test_app/app/components/window_component_loader.rb +25 -21
- data/test/basepack_test_app/app/models/address.rb +0 -26
- data/test/basepack_test_app/app/models/author.rb +0 -31
- data/test/basepack_test_app/app/models/book.rb +1 -42
- data/test/basepack_test_app/app/models/book_with_custom_primary_key.rb +1 -23
- data/test/basepack_test_app/app/models/role.rb +0 -21
- data/test/basepack_test_app/app/models/user.rb +0 -24
- data/test/basepack_test_app/app/views/layouts/components.html.erb +1 -1
- data/test/basepack_test_app/config/application.rb +1 -1
- data/test/basepack_test_app/config/database.yml.travis +2 -6
- data/test/basepack_test_app/config/initializers/netzke.rb +1 -6
- data/test/basepack_test_app/db/schema.rb +14 -14
- data/test/basepack_test_app/features/accordion_panel.feature +2 -2
- data/test/basepack_test_app/features/form_panel.feature +7 -7
- data/test/basepack_test_app/features/grid_panel.feature +93 -39
- data/test/basepack_test_app/features/grid_panel_with_custom_primary_key.feature +2 -1
- data/test/basepack_test_app/features/grid_sorting.feature +30 -6
- data/test/basepack_test_app/features/paging_form_panel.feature +7 -7
- data/test/basepack_test_app/features/persistent_regions.feature +30 -0
- data/test/basepack_test_app/features/search_in_grid.feature +5 -5
- data/test/basepack_test_app/features/simple_app.feature +6 -7
- data/test/basepack_test_app/features/step_definitions/form_panel_steps.rb +1 -1
- data/test/basepack_test_app/features/step_definitions/generic_steps.rb +109 -4
- data/test/basepack_test_app/features/step_definitions/grid_panel_steps.rb +8 -10
- data/test/basepack_test_app/features/step_definitions/window_steps.rb +27 -0
- data/test/basepack_test_app/features/tab_panel.feature +1 -1
- data/test/basepack_test_app/features/window.feature +17 -0
- data/test/unit/accordion_panel_test.rb +2 -2
- data/test/unit/grid_panel_test.rb +4 -4
- metadata +57 -83
- data/TODO.rdoc +0 -8
- data/lib/generators/netzke/basepack_generator.rb +0 -10
- data/lib/generators/netzke/templates/assets/ts-checkbox.gif +0 -0
- data/lib/generators/netzke/templates/create_netzke_field_lists.rb +0 -18
- data/lib/netzke/active_record.rb +0 -20
- data/lib/netzke/active_record/attributes.rb +0 -259
- data/lib/netzke/active_record/combobox_options.rb +0 -16
- data/lib/netzke/active_record/relation_extensions.rb +0 -37
- data/lib/netzke/basepack/accordion_panel.rb +0 -39
- data/lib/netzke/basepack/action_column.rb +0 -68
- data/lib/netzke/basepack/action_column/javascripts/action_column.js +0 -61
- data/lib/netzke/basepack/auth_app.rb +0 -159
- data/lib/netzke/basepack/basic_app.rb +0 -7
- data/lib/netzke/basepack/border_layout_panel.rb +0 -53
- data/lib/netzke/basepack/border_layout_panel/javascripts/border_layout_panel.js +0 -40
- data/lib/netzke/basepack/data_adapters/data_mapper_adapter.rb +0 -264
- data/lib/netzke/basepack/data_adapters/sequel_adapter.rb +0 -260
- data/lib/netzke/basepack/form_panel.rb +0 -144
- data/lib/netzke/basepack/form_panel/fields.rb +0 -208
- data/lib/netzke/basepack/form_panel/javascripts/misc.js +0 -4
- data/lib/netzke/basepack/form_panel/services.rb +0 -142
- data/lib/netzke/basepack/grid_panel.rb +0 -441
- data/lib/netzke/basepack/grid_panel/columns.rb +0 -400
- data/lib/netzke/basepack/grid_panel/javascripts/rows-dd.js +0 -281
- data/lib/netzke/basepack/grid_panel/record_form_window.rb +0 -41
- data/lib/netzke/basepack/grid_panel/services.rb +0 -235
- data/lib/netzke/basepack/panel.rb +0 -11
- data/lib/netzke/basepack/wrapper.rb +0 -28
- data/lib/netzke/data_mapper.rb +0 -18
- data/lib/netzke/data_mapper/attributes.rb +0 -273
- data/lib/netzke/data_mapper/combobox_options.rb +0 -11
- data/lib/netzke/data_mapper/relation_extensions.rb +0 -38
- data/lib/netzke/sequel.rb +0 -18
- data/lib/netzke/sequel/attributes.rb +0 -274
- data/lib/netzke/sequel/combobox_options.rb +0 -10
- data/lib/netzke/sequel/relation_extensions.rb +0 -40
- data/locales/zh-cn.yml +0 -79
- data/test/basepack_test_app/app/components/book_form_with_custom_fields.rb +0 -21
- data/test/basepack_test_app/app/components/book_grid_with_column_actions.rb +0 -15
- data/test/basepack_test_app/app/components/book_grid_with_defaults.rb +0 -6
- data/test/basepack_test_app/app/components/book_paging_form_panel.rb +0 -22
- data/test/basepack_test_app/app/components/generic_user_form.rb +0 -12
- data/test/basepack_test_app/app/components/simple_accordion.rb +0 -11
- data/test/basepack_test_app/app/components/simple_tab_panel.rb +0 -11
- data/test/basepack_test_app/app/components/simple_wrapper.rb +0 -7
- data/test/basepack_test_app/app/components/some_accordion_panel.rb +0 -22
- data/test/basepack_test_app/app/presenters/forms/generic_user.rb +0 -6
- data/test/basepack_test_app/app/views/components/loadable_window.html.erb +0 -9
- data/test/basepack_test_app/app/views/components/simple_panel.html.erb +0 -1
- data/test/basepack_test_app/features/components_in_view.feature +0 -11
- data/test/basepack_test_app/features/simple_panel.feature +0 -11
- data/test/basepack_test_app/features/validations_in_grid.feature +0 -13
- data/test/basepack_test_app/features/virtual_attributes.feature +0 -16
- data/test/basepack_test_app/spec/components/form_panel_spec.rb +0 -53
- data/test/basepack_test_app/spec/components/grid_panel_spec.rb +0 -10
- data/test/basepack_test_app/spec/data_adapter/adapter_spec.rb +0 -68
- data/test/basepack_test_app/spec/data_adapter/attributes_spec.rb +0 -56
- data/test/basepack_test_app/spec/data_adapter/relation_extensions_spec.rb +0 -125
- data/test/basepack_test_app/spec/factories.rb +0 -28
- data/test/basepack_test_app/spec/spec_helper.rb +0 -39
@@ -0,0 +1,12 @@
|
|
1
|
+
class BorderLayoutPanelWithPersistence < Netzke::Basepack::BorderLayoutPanel
|
2
|
+
items [
|
3
|
+
{title: "Center", region: :center},
|
4
|
+
{title: "West", region: :west, width: 200, split: true, collapsible: true},
|
5
|
+
{title: "North", region: :north, height: 100, split: true, collapsible: true}
|
6
|
+
]
|
7
|
+
|
8
|
+
def configure(c)
|
9
|
+
super
|
10
|
+
c.persistence = true
|
11
|
+
end
|
12
|
+
end
|
@@ -1,18 +1,23 @@
|
|
1
1
|
class DoubleBookGrid < Netzke::Base
|
2
|
-
|
2
|
+
js_configure do |c|
|
3
|
+
c.layout = :border
|
4
|
+
end
|
5
|
+
|
6
|
+
def configure(c)
|
7
|
+
super
|
8
|
+
c.items = [:first_grid, :second_grid]
|
9
|
+
end
|
10
|
+
|
11
|
+
component :first_grid do |c|
|
12
|
+
c.klass = Netzke::Basepack::Grid
|
13
|
+
c.region = :center
|
14
|
+
c.model = "Book"
|
15
|
+
end
|
3
16
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:model => "Book"
|
10
|
-
},{
|
11
|
-
:region => :south,
|
12
|
-
:height => 200,
|
13
|
-
:class_name => "Netzke::Basepack::GridPanel",
|
14
|
-
:model => "Book"
|
15
|
-
}]
|
16
|
-
end
|
17
|
+
component :second_grid do |c|
|
18
|
+
c.klass = Netzke::Basepack::Grid
|
19
|
+
c.region = :south
|
20
|
+
c.height = 200
|
21
|
+
c.model = "Book"
|
17
22
|
end
|
18
23
|
end
|
@@ -1,21 +1,20 @@
|
|
1
|
-
class FormWithoutModel < Netzke::Basepack::
|
2
|
-
def
|
3
|
-
|
4
|
-
|
5
|
-
:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
)
|
1
|
+
class FormWithoutModel < Netzke::Basepack::Form
|
2
|
+
def configure(c)
|
3
|
+
c.items = [
|
4
|
+
:text_field,
|
5
|
+
{:name => :number_field, :attr_type => :integer},
|
6
|
+
{:name => :boolean_field, :attr_type => :boolean, :input_value => true},
|
7
|
+
{:name => :date_field, :attr_type => :date},
|
8
|
+
# {:name => :datetime_field, :attr_type => :datetime}, #incompatible: no xtype
|
9
|
+
{:name => :combobox_field, :xtype => :combo, :store => [[1, "One"], [2, "Two"], [3, "Three"]]},
|
10
|
+
{:name => :time_field, :attr_type => :time },
|
11
|
+
]
|
12
|
+
|
13
|
+
super
|
15
14
|
end
|
16
15
|
|
17
|
-
|
16
|
+
endpoint :netzke_submit do |params, this|
|
18
17
|
data = ActiveSupport::JSON.decode(params[:data])
|
19
|
-
|
18
|
+
this.netzke_feedback data.each_pair.map{ |k,v| "#{k.humanize}: #{v}" }.join("<br/>")
|
20
19
|
end
|
21
20
|
end
|
@@ -12,7 +12,7 @@ class PagingFormWithSearch < Netzke::Basepack::BorderLayoutPanel
|
|
12
12
|
|
13
13
|
component :paging_form_panel do
|
14
14
|
{
|
15
|
-
:class_name => "Netzke::Basepack::
|
15
|
+
:class_name => "Netzke::Basepack::PagingForm",
|
16
16
|
:model => config[:model]
|
17
17
|
}
|
18
18
|
end
|
@@ -21,7 +21,7 @@ class PagingFormWithSearch < Netzke::Basepack::BorderLayoutPanel
|
|
21
21
|
{
|
22
22
|
:class_name => "Netzke::Basepack::SearchPanel",
|
23
23
|
:model => config[:model],
|
24
|
-
:bbar => [:apply
|
24
|
+
:bbar => [:apply],
|
25
25
|
:preset_query => []
|
26
26
|
}
|
27
27
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class PanelWithPersistentRegions < Netzke::Base
|
2
|
+
include Netzke::Basepack::ItemPersistence
|
3
|
+
|
4
|
+
js_configure do |c|
|
5
|
+
c.layout = :border
|
6
|
+
end
|
7
|
+
|
8
|
+
component :west do |c|
|
9
|
+
c.klass = Netzke::Core::Panel
|
10
|
+
c.width = 100
|
11
|
+
c.collapsible = true
|
12
|
+
c.region = :west
|
13
|
+
c.split = true
|
14
|
+
end
|
15
|
+
|
16
|
+
component :south do |c|
|
17
|
+
c.klass = Netzke::Core::Panel
|
18
|
+
c.height = 100
|
19
|
+
c.collapsible = true
|
20
|
+
c.region = :south
|
21
|
+
c.split = true
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure(c)
|
25
|
+
super
|
26
|
+
c.items = [
|
27
|
+
:west,
|
28
|
+
:south,
|
29
|
+
{region: :center, title: "An Ext panel"},
|
30
|
+
|
31
|
+
# not that for a regular region (which is not a Netzke component), item_id has to be set to enable this region's persistence
|
32
|
+
{region: :east, width: 200, split: true, title: "Another Ext panel", item_id: :east}
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
@@ -1,17 +1,22 @@
|
|
1
|
-
class SimplePanel < Netzke::
|
1
|
+
class SimplePanel < Netzke::Base
|
2
2
|
action :update_html
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
js_configure do |c|
|
5
|
+
c.title = "SimplePanel"
|
6
|
+
c.html = "Original HTML"
|
7
|
+
c.on_update_html = <<-JS
|
8
|
+
function(){
|
9
|
+
this.updateHtmlFromServer();
|
10
|
+
}
|
11
|
+
JS
|
12
|
+
end
|
7
13
|
|
8
|
-
|
9
|
-
|
14
|
+
def configure(c)
|
15
|
+
super
|
16
|
+
c.bbar = [:update_html]
|
10
17
|
end
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
JS
|
19
|
+
endpoint :update_html_from_server do |params, this|
|
20
|
+
this[:update] = [config[:update_text] || "HTML received from server"]
|
21
|
+
end
|
17
22
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class SimpleWindow < Netzke::Basepack::Window
|
2
|
-
|
2
|
+
js_configure do |c|
|
3
|
+
c.title = "My simple window"
|
4
|
+
end
|
3
5
|
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
6
|
+
def configure(c)
|
7
|
+
super
|
8
|
+
c.width = 400
|
9
|
+
c.height = 300
|
9
10
|
end
|
10
11
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class SomeAccordion < Netzke::Basepack::Accordion
|
2
|
+
# This component will be dynamically loaded on expanding the second accordion pane
|
3
|
+
component :simple_panel do |c|
|
4
|
+
c.update_text = "Update for Panel Two"
|
5
|
+
c.title = "Panel Two"
|
6
|
+
c.border = false
|
7
|
+
c.header = false
|
8
|
+
end
|
9
|
+
|
10
|
+
def configure(c)
|
11
|
+
c.title = "Some Accordion"
|
12
|
+
c.items = [
|
13
|
+
{ :html => "I'm a simple Ext.Panel", :title => "Panel One" },
|
14
|
+
:simple_panel
|
15
|
+
]
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class SomeAuthApp < Netzke::Basepack::AuthApp
|
2
2
|
def menu
|
3
|
-
[:simple_accordion
|
3
|
+
[:simple_accordion, :user_grid, :simple_tab_panel] + super
|
4
4
|
end
|
5
5
|
|
6
|
-
action :simple_accordion, :icon => :application_tile_vertical, :handler => :
|
7
|
-
action :user_grid, :icon => :table, :handler => :
|
8
|
-
action :simple_tab_panel, :icon => :table_multiple, :handler => :
|
6
|
+
action :simple_accordion, :icon => :application_tile_vertical, :handler => :netzke_load_component_by_action
|
7
|
+
action :user_grid, :icon => :table, :handler => :netzke_load_component_by_action
|
8
|
+
action :simple_tab_panel, :icon => :table_multiple, :handler => :netzke_load_component_by_action
|
9
9
|
|
10
10
|
component :user_grid
|
11
11
|
component :simple_accordion
|
@@ -29,4 +29,4 @@ class SomeAuthApp < Netzke::Basepack::AuthApp
|
|
29
29
|
:items => orig[:items]
|
30
30
|
}])
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
1
|
class SomeBorderLayout < Netzke::Basepack::BorderLayoutPanel
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
js_configure do |c|
|
3
|
+
c.on_update_west_region = <<-JS
|
4
|
+
function(){
|
5
|
+
this.child('component[name="user_grid"]').body.update('Updated West Region Content');
|
6
|
+
}
|
7
|
+
JS
|
8
|
+
|
9
|
+
c.on_update_center_region = <<-JS
|
10
|
+
function(){
|
11
|
+
this.child('component[name="role_grid"]').body.update('Updated Center Region Content');
|
12
|
+
}
|
13
|
+
JS
|
9
14
|
end
|
10
15
|
|
11
|
-
|
16
|
+
def configure(c)
|
17
|
+
super
|
18
|
+
c.items = [
|
19
|
+
{:title => "Who", :class_name => "Netzke::Basepack::Grid", :region => :center, :model => "User", :name => :user_grid},
|
20
|
+
{:title => "Item Two", :class_name => "Netzke::Basepack::Grid", :region => :west, :width => 500, :split => true, :collapsible => true, :model => "Role", :name => :role_grid}
|
21
|
+
]
|
22
|
+
c.bbar = [:update_center_region, :update_west_region]
|
23
|
+
end
|
12
24
|
|
13
25
|
action :update_center_region
|
14
26
|
action :update_west_region
|
15
27
|
|
16
|
-
js_method :on_update_west_region, <<-JS
|
17
|
-
function(){
|
18
|
-
this.child('component[name="user_grid"]').body.update('Updated West Region Content');
|
19
|
-
}
|
20
|
-
JS
|
21
|
-
|
22
|
-
js_method :on_update_center_region, <<-JS
|
23
|
-
function(){
|
24
|
-
this.child('component[name="role_grid"]').body.update('Updated Center Region Content');
|
25
|
-
}
|
26
|
-
JS
|
27
|
-
|
28
28
|
end
|
@@ -1,35 +1,49 @@
|
|
1
1
|
class SomeSimpleApp < Netzke::Basepack::SimpleApp
|
2
2
|
def menu
|
3
|
-
[:
|
3
|
+
[:load_simple_accordion, :load_book_grid, :load_simple_tab_panel] + super
|
4
4
|
end
|
5
5
|
|
6
|
-
action :
|
7
|
-
|
8
|
-
|
6
|
+
action :load_simple_accordion do |a|
|
7
|
+
a.icon = :application_tile_vertical
|
8
|
+
a.handler = :netzke_load_component_by_action
|
9
|
+
a.component = :some_accordion
|
10
|
+
a.text = "Some accordion"
|
11
|
+
end
|
12
|
+
|
13
|
+
action :load_book_grid do |a|
|
14
|
+
a.icon = :table
|
15
|
+
a.handler = :netzke_load_component_by_action
|
16
|
+
a.component = :book_grid
|
17
|
+
a.text = "Book grid"
|
18
|
+
end
|
9
19
|
|
10
|
-
|
11
|
-
|
12
|
-
|
20
|
+
action :load_simple_tab_panel do |a|
|
21
|
+
a.icon = :table_multiple
|
22
|
+
a.handler = :netzke_load_component_by_action
|
23
|
+
a.component = :some_tab_panel
|
24
|
+
a.text = "Some tab panel"
|
25
|
+
end
|
13
26
|
|
14
|
-
|
27
|
+
component :book_grid
|
28
|
+
component :some_accordion
|
29
|
+
component :some_tab_panel
|
15
30
|
|
16
31
|
# Wrapping up original layout into a border-layout with the north panel being a fancy header
|
17
|
-
def
|
18
|
-
|
19
|
-
|
32
|
+
def configure(c)
|
33
|
+
super
|
34
|
+
c.border = false
|
35
|
+
c.items = [{
|
20
36
|
:region => :north,
|
21
37
|
:height => 35,
|
22
38
|
:html => %Q{
|
23
39
|
<div style="margin:10px; color:#333; text-align:center; font-family: Helvetica;">
|
24
40
|
Simple <span style="color:#B32D15">Netzke</span> app
|
25
41
|
</div>
|
26
|
-
}
|
27
|
-
# TODO: this has no effect anymore:
|
28
|
-
# :bodyStyle => {:background => "#AAA url(\"/images/header-deco.gif\") top left repeat-x"}
|
42
|
+
},
|
29
43
|
},{
|
30
44
|
:region => :center,
|
31
45
|
:layout => 'border',
|
32
|
-
:items =>
|
33
|
-
}]
|
46
|
+
:items => config.items
|
47
|
+
}]
|
34
48
|
end
|
35
49
|
end
|
@@ -1,20 +1,23 @@
|
|
1
1
|
class SomeTabPanel < Netzke::Basepack::TabPanel
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
# This component will be dynamically loaded on expanding the second accordion pane
|
3
|
+
component :simple_panel do |c|
|
4
|
+
c.update_text = "Update for Panel Two"
|
5
|
+
c.title = "Panel Two"
|
6
|
+
c.prevent_header = true
|
7
|
+
c.border = false
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
9
|
+
# optionally, you can force a certain component to be eagerly loaded:
|
10
|
+
# c.eager_loading = true
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:lazy_loading => true # Dynamically loaded when the tab gets open
|
18
|
-
}
|
13
|
+
def configure(c)
|
14
|
+
c.title = "Some Tab Panel"
|
15
|
+
c.active_tab = 0
|
19
16
|
|
17
|
+
c.items = [
|
18
|
+
{ :html => "I'm a simple Ext.Panel", :title => "Panel One" },
|
19
|
+
:simple_panel
|
20
|
+
]
|
21
|
+
super
|
22
|
+
end
|
20
23
|
end
|
@@ -1,21 +1,23 @@
|
|
1
|
-
class UserForm < Netzke::Basepack::
|
2
|
-
|
1
|
+
class UserForm < Netzke::Basepack::Form
|
2
|
+
def configure(c)
|
3
|
+
c.record = User.first
|
3
4
|
|
4
|
-
|
5
|
+
super
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
c.model = "User"
|
8
|
+
c.title = User.model_name.human
|
9
|
+
c.items = [
|
10
|
+
{:xtype => 'fieldset', :title => "Basic Info", :checkboxToggle => true, :items => [
|
11
|
+
:first_name,
|
12
|
+
{:name => :last_name}
|
13
|
+
]},
|
14
|
+
{:xtype => 'fieldset', :title => "Timestamps", :items => [
|
15
|
+
{:name => :created_at, :disabled => true},
|
16
|
+
{:name => :updated_at, :disabled => true}
|
17
|
+
]},
|
18
|
+
{ name: :role__name, empty_text: "Select a role" }
|
19
|
+
]
|
20
|
+
end
|
19
21
|
|
20
22
|
# Uncomment for visual mask testing
|
21
23
|
# def netzke_submit_endpoint(params)
|