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
@@ -6,47 +6,45 @@ module Netzke
|
|
6
6
|
|
7
7
|
include Netzke::Basepack::DataAccessor
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
js_properties(
|
12
|
-
:padding => 5,
|
13
|
-
:auto_scroll => true
|
14
|
-
)
|
15
|
-
|
16
|
-
js_include :condition_field
|
17
|
-
|
18
|
-
js_mixin :search_panel
|
19
|
-
|
20
|
-
js_property :attribute_operators_map, {
|
9
|
+
ATTRIBUTE_OPERATORS_MAP = {
|
21
10
|
:integer => [
|
22
11
|
["eq", I18n.t('netzke.basepack.search_panel.equals')],
|
23
12
|
["gt", I18n.t('netzke.basepack.search_panel.greater_than')],
|
24
13
|
["lt", I18n.t('netzke.basepack.search_panel.less_than')]
|
25
14
|
],
|
26
|
-
|
27
|
-
|
15
|
+
:text => [
|
16
|
+
["contains", I18n.t('netzke.basepack.search_panel.contains')] # same as matches => %string%
|
28
17
|
],
|
29
18
|
:string => [
|
30
19
|
["contains", I18n.t('netzke.basepack.search_panel.contains')], # same as matches => %string%
|
31
20
|
["matches", I18n.t('netzke.basepack.search_panel.matches')]
|
32
21
|
],
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
:boolean => [
|
23
|
+
["is_any", I18n.t('netzke.basepack.search_panel.is_true')],
|
24
|
+
["is_true", I18n.t('netzke.basepack.search_panel.is_true')],
|
25
|
+
["is_false", I18n.t('netzke.basepack.search_panel.is_false')]
|
37
26
|
],
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
27
|
+
:datetime => [
|
28
|
+
["eq", I18n.t('netzke.basepack.search_panel.date_equals')],
|
29
|
+
["gt", I18n.t('netzke.basepack.search_panel.after')],
|
30
|
+
["lt", I18n.t('netzke.basepack.search_panel.before')]
|
42
31
|
]
|
43
32
|
}
|
44
33
|
|
34
|
+
js_configure do |c|
|
35
|
+
c.extend = "Ext.form.FormPanel"
|
36
|
+
c.padding = 5
|
37
|
+
c.auto_scroll = true
|
38
|
+
c.require :condition_field
|
39
|
+
c.mixin
|
40
|
+
c.attribute_operators_map = ATTRIBUTE_OPERATORS_MAP
|
41
|
+
end
|
42
|
+
|
45
43
|
# Builds default query search panel, where each field is presented
|
46
44
|
def default_query
|
47
45
|
data_class.column_names.map do |c|
|
48
46
|
column_type = data_class.columns_hash[c].type
|
49
|
-
operator = (
|
47
|
+
operator = (ATTRIBUTE_OPERATORS_MAP[column_type] || []).first.try(:fetch, 0) || "matches"
|
50
48
|
{:attr => c, :attr_type => column_type, :operator => operator}
|
51
49
|
end
|
52
50
|
end
|
@@ -58,7 +56,7 @@ module Netzke
|
|
58
56
|
def js_config
|
59
57
|
super.merge(
|
60
58
|
:attrs => attributes,
|
61
|
-
:attrs_hash => data_class.column_names.inject({}){ |hsh,c|
|
59
|
+
:attrs_hash => data_class.column_names.inject({}){ |hsh,c|
|
62
60
|
hsh.merge(c => data_adapter.get_property_type(data_class.columns_hash[c])) },
|
63
61
|
:preset_query => (config[:load_last_preset] ? last_preset.try(:fetch, "query") : config[:query]) || []
|
64
62
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Ext.define('Netzke.classes.Basepack.SearchPanel.ConditionField', {
|
1
|
+
Ext.define('Netzke.classes.Netzke.Basepack.SearchPanel.ConditionField', {
|
2
2
|
extend: 'Ext.form.FieldContainer',
|
3
3
|
alias: 'widget.netzkebasepacksearchpanelconditionfield',
|
4
4
|
|
@@ -101,7 +101,7 @@ Ext.define('Netzke.classes.Basepack.SearchPanel.ConditionField', {
|
|
101
101
|
|
102
102
|
this.items = items;
|
103
103
|
|
104
|
-
// Why on Earth is this not working? Netzke.classes.Basepack.SearchPanel.ConditionField undefined???
|
104
|
+
// Why on Earth is this not working? Netzke.classes.Netzke.Basepack.SearchPanel.ConditionField undefined???
|
105
105
|
// Netzke.classes.Basepack.SearchPanel.ConditionField.superclass.initComponent.call(this);
|
106
106
|
// Ext.form.CompositeField.prototype.initComponent.call(this); // workaround
|
107
107
|
this.callParent();
|
@@ -2,65 +2,59 @@ module Netzke
|
|
2
2
|
module Basepack
|
3
3
|
class SearchWindow < Netzke::Basepack::Window
|
4
4
|
|
5
|
-
action :search
|
6
|
-
|
5
|
+
action :search
|
6
|
+
action :cancel
|
7
|
+
|
8
|
+
js_configure do |c|
|
9
|
+
c.width = "50%"
|
10
|
+
c.auto_height = true
|
11
|
+
c.close_action = "hide"
|
12
|
+
c.modal = true
|
13
|
+
c.init_component = <<-JS
|
14
|
+
function(){
|
15
|
+
this.callParent();
|
16
|
+
|
17
|
+
this.on('show', function(){
|
18
|
+
this.closeRes = 'cancel';
|
19
|
+
});
|
20
|
+
}
|
21
|
+
JS
|
22
|
+
|
23
|
+
c.get_query = <<-JS
|
24
|
+
function(){
|
25
|
+
return this.items.first().getQuery();
|
26
|
+
}
|
27
|
+
JS
|
28
|
+
|
29
|
+
c.on_search = <<-JS
|
30
|
+
function(){
|
31
|
+
this.closeRes = 'search';
|
32
|
+
this.hide();
|
33
|
+
}
|
34
|
+
JS
|
35
|
+
|
36
|
+
c.on_cancel = <<-JS
|
37
|
+
function(){
|
38
|
+
this.hide();
|
39
|
+
}
|
40
|
+
JS
|
7
41
|
end
|
8
42
|
|
9
|
-
|
10
|
-
|
43
|
+
def configure(c)
|
44
|
+
super
|
45
|
+
c.items = [:search_panel]
|
46
|
+
c.title = I18n.t('netzke.basepack.search_window.title')
|
47
|
+
c.persistence = false
|
48
|
+
c.prevent_header = true
|
49
|
+
c.buttons = [:search, :cancel]
|
11
50
|
end
|
12
51
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:modal => true
|
18
|
-
|
19
|
-
def configuration
|
20
|
-
super.tap do |s|
|
21
|
-
s[:items] = [:search_panel.component(:prevent_header => true)]
|
22
|
-
s[:title] = I18n.t('netzke.basepack.search_window.title')
|
23
|
-
s[:persistence] = false
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
component :search_panel do
|
28
|
-
{
|
29
|
-
:class_name => "Netzke::Basepack::QueryBuilder",
|
30
|
-
:model => config[:model],
|
31
|
-
:fields => config[:fields]
|
32
|
-
}
|
52
|
+
component :search_panel do |c|
|
53
|
+
c.klass = QueryBuilder
|
54
|
+
c.model = config[:model]
|
55
|
+
c.fields = config[:fields]
|
33
56
|
end
|
34
57
|
|
35
|
-
js_method :init_component, <<-JS
|
36
|
-
function(){
|
37
|
-
this.callParent();
|
38
|
-
|
39
|
-
this.on('show', function(){
|
40
|
-
this.closeRes = 'cancel';
|
41
|
-
});
|
42
|
-
}
|
43
|
-
JS
|
44
|
-
|
45
|
-
js_method :get_query, <<-JS
|
46
|
-
function(){
|
47
|
-
return this.items.first().getQuery();
|
48
|
-
}
|
49
|
-
JS
|
50
|
-
|
51
|
-
js_method :on_search, <<-JS
|
52
|
-
function(){
|
53
|
-
this.closeRes = 'search';
|
54
|
-
this.hide();
|
55
|
-
}
|
56
|
-
JS
|
57
|
-
|
58
|
-
js_method :on_cancel, <<-JS
|
59
|
-
function(){
|
60
|
-
this.hide();
|
61
|
-
}
|
62
|
-
JS
|
63
|
-
|
64
58
|
end
|
65
59
|
end
|
66
60
|
end
|
@@ -31,26 +31,23 @@ module Netzke
|
|
31
31
|
#
|
32
32
|
# The JS side of the component will have those regions referenced as this.mainPanel, this.statusBar, and this.menuBar.
|
33
33
|
class SimpleApp < Base
|
34
|
+
js_configure do |c|
|
35
|
+
c.extend = "Ext.container.Viewport"
|
36
|
+
c.layout = :border
|
37
|
+
c.require Netzke::Core.ext_path.join("examples", "ux/statusbar/StatusBar.js"), :statusbar_ext
|
38
|
+
c.mixin
|
39
|
+
end
|
34
40
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
js_include Netzke::Core.ext_path.join("examples", "ux/statusbar/StatusBar.js"), :statusbar_ext
|
40
|
-
|
41
|
-
js_mixin :simple_app
|
41
|
+
def configure(c)
|
42
|
+
super
|
43
|
+
c.items = [main_panel_config, menu_bar_config, status_bar_config]
|
44
|
+
end
|
42
45
|
|
43
46
|
# In Ext 4.1 calling `render` on a viewport causes an error
|
44
47
|
def js_component_render
|
45
48
|
""
|
46
49
|
end
|
47
50
|
|
48
|
-
def configuration
|
49
|
-
super.merge(
|
50
|
-
:items => [main_panel_config, menu_bar_config, status_bar_config]
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
51
|
# Override for custom menu
|
55
52
|
def menu
|
56
53
|
[]
|
@@ -33,7 +33,7 @@
|
|
33
33
|
processHistory: function(token){
|
34
34
|
if (token){
|
35
35
|
this.mainPanel.removeAll();
|
36
|
-
this.
|
36
|
+
this.netzkeLoadComponent(token, {container: this.mainPanel});
|
37
37
|
} else {
|
38
38
|
this.mainPanel.removeAll();
|
39
39
|
}
|
@@ -47,17 +47,11 @@
|
|
47
47
|
Ext.util.History.add(name);
|
48
48
|
},
|
49
49
|
|
50
|
-
|
50
|
+
netzkeLoadComponentByAction: function(action){
|
51
51
|
var componentName = action.component || action.name;
|
52
52
|
if (componentName) this.appLoadComponent(componentName);
|
53
53
|
},
|
54
54
|
|
55
|
-
// DEPRECATED
|
56
|
-
loadComponentByAction: function(action) {
|
57
|
-
Netzke.deprecationWarning("loadComponentByAction is deprecated in favor of loadNetzkeComponentByAction");
|
58
|
-
this.loadNetzkeComponentByAction(action);
|
59
|
-
},
|
60
|
-
|
61
55
|
onToggleConfigMode: function(params){
|
62
56
|
this.toggleConfigMode();
|
63
57
|
}
|
@@ -5,7 +5,7 @@ module Netzke
|
|
5
5
|
# Features:
|
6
6
|
# * Dynamically loads components for the tabs that get activated for the first time
|
7
7
|
# * (TODO) Provides the method markTabsOutdated to mark all inactive tabs as 'outdated', and calls "update" method on components in tabs when they get activated
|
8
|
-
# * (TODO) Stores the last active tab in
|
8
|
+
# * (TODO) Stores the last active tab in persistent config
|
9
9
|
#
|
10
10
|
# ToDo:
|
11
11
|
# * Introduce a second or two delay before informing the server about a tab switched
|
@@ -13,9 +13,10 @@ module Netzke
|
|
13
13
|
|
14
14
|
include WrapLazyLoaded
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
js_configure do |c|
|
17
|
+
c.extend = "Ext.tab.Panel"
|
18
|
+
c.mixin
|
19
|
+
end
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
initComponent: function(params){
|
3
|
-
|
4
|
-
this.on('tabchange', function(self,
|
5
|
-
if (
|
6
|
-
|
7
|
-
this.
|
3
|
+
this.callParent();
|
4
|
+
this.on('tabchange', function(self, tab){
|
5
|
+
if (tab && tab.wrappedComponent && !tab.items.first() && !tab.beingLoaded) {
|
6
|
+
tab.beingLoaded = true; // prevent more than one request per tab in case of fast clicking
|
7
|
+
this.netzkeLoadComponent(tab.wrappedComponent, {container: tab.id, callback: function(){tab.beingLoaded = false}});
|
8
8
|
}
|
9
9
|
}, this);
|
10
10
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Netzke
|
2
|
+
module Basepack
|
3
|
+
class Viewport < Netzke::Base
|
4
|
+
js_configure do |c|
|
5
|
+
c.extend = "Ext.container.Viewport"
|
6
|
+
end
|
7
|
+
|
8
|
+
# In Ext 4.1 calling `render` on a viewport causes an error:
|
9
|
+
#
|
10
|
+
# TypeError: protoEl is null
|
11
|
+
def js_component_render
|
12
|
+
""
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,29 +1,38 @@
|
|
1
1
|
module Netzke
|
2
2
|
module Basepack
|
3
|
-
#
|
4
|
-
# Ext.Window-based component able to nest other Netzke components
|
3
|
+
# Ext.window.Window-based component. With +persistence+ option set to +true+, it will remember it's size, position, and maximized state.
|
5
4
|
#
|
6
|
-
#
|
7
|
-
# * Persistent position and dimensions
|
5
|
+
# Example:
|
8
6
|
#
|
9
|
-
#
|
10
|
-
#
|
7
|
+
# class MyWindow < Netke::Basepack::Window
|
8
|
+
# def configure
|
9
|
+
# super
|
10
|
+
# c.width = 800
|
11
|
+
# c.height = 600
|
12
|
+
# c.items = [:users] # nesting the `users` component declared below
|
13
|
+
# end
|
11
14
|
#
|
12
|
-
#
|
15
|
+
# component :users
|
16
|
+
# end
|
13
17
|
class Window < Netzke::Base
|
14
|
-
|
18
|
+
js_configure do |c|
|
19
|
+
c.extend = "Ext.window.Window"
|
20
|
+
c.mixin
|
21
|
+
end
|
22
|
+
|
23
|
+
def js_configure(c)
|
24
|
+
super
|
25
|
+
[:x, :y, :width, :height].each { |p| c[p] = state[p].to_i if state[p] }
|
26
|
+
c.maximized = state[:maximized] if state[:maximized]
|
27
|
+
end
|
15
28
|
|
16
|
-
|
29
|
+
endpoint :set_size_and_position do |params, this|
|
30
|
+
[:x, :y, :width, :height].each {|p| state[p] = params[p].to_i}
|
31
|
+
end
|
17
32
|
|
18
|
-
endpoint :
|
19
|
-
|
20
|
-
:x => params[:x].to_i,
|
21
|
-
:y => params[:y].to_i,
|
22
|
-
:width => params[:w].to_i,
|
23
|
-
:height => params[:h].to_i
|
24
|
-
)
|
25
|
-
{}
|
33
|
+
endpoint :set_maximized do |maximized,this|
|
34
|
+
maximized ? state[:maximized] = true : state.delete(:maximized)
|
26
35
|
end
|
27
36
|
end
|
28
37
|
end
|
29
|
-
end
|
38
|
+
end
|
@@ -9,12 +9,18 @@
|
|
9
9
|
this.on("show", function(){
|
10
10
|
this.on("move", this.onMoveResize, this);
|
11
11
|
this.on("resize", this.onMoveResize, this);
|
12
|
+
this.on("maximize", Ext.Function.pass(this.onMaximize, [true]), this);
|
13
|
+
this.on("restore", Ext.Function.pass(this.onMaximize, [false]), this);
|
12
14
|
}, this);
|
13
15
|
}
|
14
16
|
},
|
15
17
|
|
16
18
|
onMoveResize: function(){
|
17
19
|
var x = this.getPosition()[0], y = this.getPosition()[1], w = this.getSize().width, h = this.getSize().height;
|
18
|
-
this.setSizeAndPosition({x:x, y:y,
|
20
|
+
this.setSizeAndPosition({x: x, y: y, width: w, height: h}); // API call
|
21
|
+
},
|
22
|
+
|
23
|
+
onMaximize: function(maximized) {
|
24
|
+
this.setMaximized(maximized);
|
19
25
|
}
|
20
26
|
}
|
@@ -2,27 +2,27 @@ module Netzke
|
|
2
2
|
module Basepack
|
3
3
|
# Include this module into your component component class when you want lazy-loaded component in config to be auto-replaced with
|
4
4
|
# a panel with the 'fit' layout, and a property wrappedComponent set to the name of the original component.
|
5
|
-
# Used, for instance, in TabPanel and
|
5
|
+
# Used, for instance, in TabPanel and Accordion to dynamically load components on expanding a panel or clicking
|
6
6
|
# a tab.
|
7
7
|
module WrapLazyLoaded
|
8
|
-
def
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
def extend_item(item)
|
9
|
+
item = super
|
10
|
+
|
11
|
+
c = components[item[:netzke_component]].try(:merge, item)
|
12
|
+
|
13
|
+
# when a nested component with lazy loading is detected, it gets replaced with a 'fit' panel,
|
14
|
+
# into which later the component itself is dynamically loaded on request.
|
15
|
+
if c && !c[:eager_loading]
|
16
|
+
{ layout: :fit,
|
17
|
+
wrapped_component: c[:item_id],
|
18
|
+
title: c[:title] || c[:item_id].humanize,
|
19
|
+
icon_cls: c[:icon_cls],
|
20
|
+
disabled: c[:disabled]
|
21
|
+
}
|
22
|
+
else
|
23
|
+
item
|
23
24
|
end
|
24
|
-
orig
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|