netzke-basepack 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/CHANGELOG.rdoc +27 -2
  2. data/TODO.rdoc +1 -5
  3. data/app/models/netzke_persistent_array_auto_model.rb +0 -1
  4. data/features/components_in_view.feature +11 -0
  5. data/features/form_panel.feature +49 -0
  6. data/features/grid_panel.feature +32 -1
  7. data/features/i18n.feature +18 -0
  8. data/features/nested_attributes.feature +23 -0
  9. data/features/search_in_grid.feature +9 -9
  10. data/features/simple_app.feature +10 -0
  11. data/features/step_definitions/grid_panel_steps.rb +23 -0
  12. data/features/support/paths.rb +6 -0
  13. data/features/support/pickle.rb +0 -1
  14. data/features/virtual_attributes.feature +20 -0
  15. data/javascripts/basepack.js +166 -243
  16. data/lib/netzke-basepack.rb +3 -3
  17. data/lib/netzke/active_record.rb +6 -7
  18. data/lib/netzke/active_record/attributes.rb +214 -143
  19. data/lib/netzke/active_record/combobox_options.rb +12 -10
  20. data/lib/netzke/basepack.rb +6 -3
  21. data/lib/netzke/basepack/accordion_panel.rb +4 -2
  22. data/lib/netzke/basepack/auth_app.rb +152 -0
  23. data/lib/netzke/basepack/basic_app.rb +2 -262
  24. data/lib/netzke/basepack/form_panel.rb +35 -27
  25. data/lib/netzke/basepack/form_panel/fields.rb +35 -17
  26. data/lib/netzke/basepack/form_panel/javascripts/comma_list_cbg.js +59 -0
  27. data/lib/netzke/basepack/form_panel/javascripts/display_mode.js +62 -0
  28. data/lib/netzke/basepack/form_panel/javascripts/main.js +138 -0
  29. data/lib/netzke/basepack/form_panel/javascripts/n_radio_group.js +25 -0
  30. data/lib/netzke/basepack/form_panel/services.rb +12 -9
  31. data/lib/netzke/basepack/grid_panel.rb +87 -53
  32. data/lib/netzke/basepack/grid_panel/columns.rb +60 -15
  33. data/lib/netzke/basepack/grid_panel/javascripts/advanced_search.js +2 -64
  34. data/lib/netzke/basepack/grid_panel/javascripts/edit_in_form.js +2 -2
  35. data/lib/netzke/basepack/grid_panel/javascripts/{pre.js → main.js} +35 -17
  36. data/lib/netzke/basepack/grid_panel/javascripts/misc.js +4 -0
  37. data/lib/netzke/basepack/grid_panel/services.rb +17 -14
  38. data/lib/netzke/basepack/paging_form_panel.rb +92 -0
  39. data/lib/netzke/basepack/simple_app.rb +71 -0
  40. data/lib/netzke/basepack/simple_app/javascripts/main.js +53 -0
  41. data/lib/netzke/basepack/{basic_app → simple_app/javascripts}/statusbar_ext.js +0 -0
  42. data/lib/netzke/basepack/tab_panel.rb +2 -12
  43. data/lib/netzke/basepack/tab_panel/javascripts/main.js +11 -0
  44. data/lib/netzke/basepack/version.rb +2 -2
  45. data/lib/netzke/basepack/window.rb +6 -7
  46. data/lib/netzke/basepack/wrap_lazy_loaded.rb +3 -1
  47. data/lib/netzke/data_accessor.rb +25 -14
  48. data/lib/netzke/ext.rb +1 -1
  49. data/locales/en.yml +22 -0
  50. data/netzke-basepack.gemspec +66 -12
  51. data/spec/active_record/attributes_spec.rb +31 -2
  52. data/spec/factories.rb +16 -1
  53. data/test/rails_app/Gemfile +2 -2
  54. data/test/rails_app/Gemfile.lock +76 -77
  55. data/test/rails_app/app/components/author_grid.rb +7 -0
  56. data/test/rails_app/app/components/book_form.rb +24 -0
  57. data/test/rails_app/app/components/book_grid.rb +6 -1
  58. data/test/rails_app/app/components/book_grid_with_default_values.rb +11 -0
  59. data/test/rails_app/app/components/book_grid_with_nested_attributes.rb +13 -0
  60. data/test/rails_app/app/components/book_grid_with_virtual_attributes.rb +22 -0
  61. data/test/rails_app/app/components/book_paging_form_panel.rb +20 -0
  62. data/test/rails_app/app/components/book_presentation.rb +18 -0
  63. data/test/rails_app/app/components/books_bound_to_author.rb +10 -0
  64. data/test/rails_app/app/components/form_without_model.rb +19 -0
  65. data/test/rails_app/app/components/lockable_book_form.rb +17 -0
  66. data/test/rails_app/app/components/lockable_user_form.rb +7 -0
  67. data/test/rails_app/app/components/simple_window.rb +10 -0
  68. data/test/rails_app/app/components/some_accordion_panel.rb +22 -0
  69. data/test/rails_app/app/components/{simple_basic_app.rb → some_auth_app.rb} +3 -3
  70. data/test/rails_app/app/components/some_border_layout.rb +10 -7
  71. data/test/rails_app/app/components/some_simple_app.rb +34 -0
  72. data/test/rails_app/app/components/some_tab_panel.rb +16 -11
  73. data/test/rails_app/app/components/user_form.rb +11 -4
  74. data/test/rails_app/app/components/user_grid.rb +7 -1
  75. data/test/rails_app/app/components/window_component_loader.rb +1 -0
  76. data/test/rails_app/app/controllers/application_controller.rb +6 -0
  77. data/test/rails_app/app/controllers/components_controller.rb +3 -3
  78. data/test/rails_app/app/controllers/welcome_controller.rb +2 -2
  79. data/test/rails_app/app/helpers/embedded_components_helper.rb +2 -0
  80. data/test/rails_app/app/models/address.rb +3 -0
  81. data/test/rails_app/app/models/author.rb +2 -0
  82. data/test/rails_app/app/models/book.rb +1 -0
  83. data/test/rails_app/app/models/user.rb +1 -2
  84. data/test/rails_app/app/views/components/simple_panel.html.erb +1 -0
  85. data/test/rails_app/app/views/layouts/nested.html.erb +5 -0
  86. data/test/rails_app/config/application.rb +1 -1
  87. data/test/rails_app/config/initializers/netzke.rb +0 -4
  88. data/test/rails_app/config/locales/es.yml +16 -0
  89. data/test/rails_app/config/routes.rb +4 -1
  90. data/test/rails_app/db/development_structure.sql +33 -4
  91. data/test/rails_app/db/migrate/20101026190021_create_books.rb +2 -0
  92. data/test/rails_app/db/migrate/20110101143818_create_addresses.rb +17 -0
  93. data/test/rails_app/db/schema.rb +33 -1
  94. data/test/rails_app/spec/controllers/embedded_components_controller_spec.rb +12 -0
  95. data/test/rails_app/spec/helpers/embedded_components_helper_spec.rb +15 -0
  96. data/test/rails_app/spec/models/address_spec.rb +5 -0
  97. data/test/rails_app/spec/views/embedded_components/index.html.erb_spec.rb +5 -0
  98. metadata +67 -13
  99. data/features/basic_app.feature +0 -12
  100. data/lib/netzke/active_record/association_attributes.rb +0 -102
  101. data/lib/netzke/basepack/form_panel/javascripts/pre.js +0 -76
  102. data/lib/netzke/basepack/form_panel/javascripts/xcheckbox.js +0 -82
  103. data/lib/netzke/basepack/grid_panel/javascript.rb +0 -69
  104. data/locale/en.yml +0 -16
@@ -1,4 +1,4 @@
1
- Ext.override(Netzke.pre.GridPanel, {
1
+ {
2
2
  onEditInForm: function(){
3
3
  var selModel = this.getSelectionModel();
4
4
  if (selModel.getCount() > 1) {
@@ -45,4 +45,4 @@ Ext.override(Netzke.pre.GridPanel, {
45
45
  }, this);
46
46
  }, scope: this});
47
47
  }
48
- });
48
+ }
@@ -1,11 +1,11 @@
1
- /*
2
- Static part of GridPanel's JavaScript class.
3
- */
4
- Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
1
+ {
5
2
  trackMouseOver: true,
6
3
  loadMask: true,
7
4
  autoScroll: true,
8
5
 
6
+ componentLoadMask: {msg: "Loading..."},
7
+ deleteMaskMsg: "Deleting...",
8
+
9
9
  initComponent: function(){
10
10
  this.plugins = []; // checkbox colums is a special case, being a plugin
11
11
 
@@ -144,6 +144,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
144
144
 
145
145
  // Data store
146
146
  this.store = new Ext.data.Store({
147
+ pruneModifiedRecords: true,
147
148
  proxy: this.proxy = httpProxy,
148
149
  reader: new Ext.data.ArrayReader({root: "data", totalProperty: "total", successProperty: "success", id:0}, this.Row),
149
150
  remoteSort: true,
@@ -167,7 +168,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
167
168
 
168
169
  // Now let Ext.grid.EditorGridPanel do the rest
169
170
  // Original initComponent
170
- Netzke.pre.GridPanel.superclass.initComponent.call(this);
171
+ Netzke.classes.Basepack.GridPanel.superclass.initComponent.call(this);
171
172
 
172
173
  // Hidden change event
173
174
  if (this.persistentConfig) {this.getColumnModel().on('hiddenchange', this.onColumnHiddenChange, this);}
@@ -183,6 +184,22 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
183
184
  this.on('rowcontextmenu', this.onRowContextMenu, this);
184
185
  }
185
186
 
187
+ // Disabling/enabling editInForm button according to current selection
188
+ if (this.enableEditInForm) {
189
+ this.getSelectionModel().on('selectionchange', function(selModel){
190
+ var disabled;
191
+ if (!selModel.hasSelection()) {
192
+ disabled = true;
193
+ } else {
194
+ // Disable "edit in form" button if new record is present in selection
195
+ disabled = !selModel.each(function(r){
196
+ if (r.isNew) { return false; }
197
+ });
198
+ };
199
+ this.actions.editInForm.setDisabled(disabled);
200
+ }, this);
201
+ }
202
+
186
203
  // Load data AFTER the toolbar is bound to the store, which will provide for correct page number
187
204
  if (this.loadInlineData) {
188
205
  this.getStore().loadData(this.inlineData);
@@ -253,7 +270,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
253
270
  },
254
271
 
255
272
  onDel: function() {
256
- Ext.Msg.confirm('Confirm', 'Are you sure?', function(btn){
273
+ Ext.Msg.confirm(this.i18n.confirm, this.i18n.areYouSure, function(btn){
257
274
  if (btn == 'yes') {
258
275
  var records = [];
259
276
  this.getSelectionModel().each(function(r){
@@ -266,8 +283,12 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
266
283
  }, this);
267
284
 
268
285
  if (records.length > 0){
286
+ if (!this.deleteMask) this.deleteMask = new Ext.LoadMask(this.bwrap, {msg: this.deleteMaskMsg});
287
+ this.deleteMask.show();
269
288
  // call API
270
- this.deleteData({records: Ext.encode(records)});
289
+ this.deleteData({records: Ext.encode(records)}, function(){
290
+ this.deleteMask.hide();
291
+ }, this);
271
292
  }
272
293
  }
273
294
  }, this);
@@ -361,11 +382,11 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
361
382
  },
362
383
 
363
384
  onAfterRowMove: function(dt, oldIndex, newIndex, records){
364
- var ids = [];
365
- // collect records ids
366
- Ext.each(records, function(r){ids.push(r.id)});
367
- // call GridPanel's API
368
- this.moveRows({ids:Ext.encode(ids), new_index: newIndex});
385
+ var ids = [];
386
+ // collect records ids
387
+ Ext.each(records, function(r){ids.push(r.id)});
388
+ // call GridPanel's API
389
+ this.moveRows({ids:Ext.encode(ids), new_index: newIndex});
369
390
  },
370
391
 
371
392
  // Other methods
@@ -425,12 +446,10 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
425
446
  updateRecords: function(records, mod){
426
447
  if (!mod) {mod = false;}
427
448
  var modRecordsInGrid = [].concat(this.store.getModifiedRecords()); // there must be a better way to clone an array...
428
-
429
449
  // replace arrays of data in the args object with Ext.data.Record objects
430
450
  for (var k in records){
431
- records[k] = this.store.reader.readRecords([records[k]]).records[0];
451
+ records[k] = this.store.reader.readRecords({data:[records[k]]}).records[0];
432
452
  }
433
-
434
453
  // for each new record write the data returned by the server, and commit the record
435
454
  Ext.each(modRecordsInGrid, function(recordInGrid){
436
455
  if (mod ^ recordInGrid.isNew) {
@@ -521,7 +540,6 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
521
540
  }
522
541
  },
523
542
 
524
-
525
543
  onEdit: function(){
526
544
  var row = this.getSelectionModel().getSelected();
527
545
  if (row){
@@ -540,4 +558,4 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
540
558
  // }
541
559
  // END_OF_JAVASCRIPT
542
560
 
543
- });
561
+ }
@@ -0,0 +1,4 @@
1
+ // Make DateFilter send data in the required format
2
+ Ext.apply(Ext.ux.grid.filter.DateFilter.prototype, {
3
+ dateFormat: 'Y-m-d'
4
+ });
@@ -38,9 +38,9 @@ module Netzke
38
38
  record_ids = ActiveSupport::JSON.decode(params[:records])
39
39
  data_class.destroy(record_ids)
40
40
  on_data_changed
41
- {:feedback => "Deleted #{record_ids.size} record(s)", :load_store_data => get_data}
41
+ {:feedback => I18n.t('netzke.basepack.grid_panel.deleted_n_records', :n => record_ids.size), :load_store_data => get_data}
42
42
  else
43
- {:feedback => "You don't have permissions to delete data"}
43
+ {:feedback => I18n.t('netzke.basepack.grid_panel.cannot_delete')}
44
44
  end
45
45
  end
46
46
 
@@ -77,7 +77,7 @@ module Netzke
77
77
  query = params[:query]
78
78
 
79
79
  column = columns.detect{ |c| c[:name] == params[:column] }
80
- scope = column.to_options[:scope]
80
+ scope = column.to_options[:scope] || column.to_options[:editor].try(:fetch, :scope)
81
81
  query = params[:query]
82
82
 
83
83
  {:data => combobox_options_for_column(column, :query => query, :scope => scope, :record_id => params[:id])}
@@ -192,8 +192,8 @@ module Netzke
192
192
  # if a sorting scope is set, call the scope with the given direction
193
193
  column = columns.detect { |c| c[:name] == params[:sort] }
194
194
  if column.has_key?(:sorting_scope)
195
- relation = relation.send(column[:sorting_scope].to_sym, dir.to_sym)
196
- else
195
+ relation = relation.send(column[:sorting_scope].to_sym, dir.to_sym)
196
+ else
197
197
  relation = if method.nil?
198
198
  relation.order(assoc.to_sym.send(dir))
199
199
  else
@@ -249,7 +249,6 @@ module Netzke
249
249
  # <tt>:operation</tt>: :update or :create
250
250
  def process_data(data, operation)
251
251
  success = true
252
- # mod_record_ids = []
253
252
  mod_records = {}
254
253
  if !config[:"prohibit_#{operation}"]
255
254
  modified_records = 0
@@ -261,17 +260,21 @@ module Netzke
261
260
  # merge with strong default attirbutes
262
261
  record_hash.merge!(config[:strong_default_attrs]) if config[:strong_default_attrs]
263
262
 
264
- # process all attirubutes for this record
265
263
  record_hash.each_pair do |k,v|
266
- begin
267
- record.send("#{k}=",v)
268
- rescue ArgumentError => exc
269
- flash :error => exc.message
270
- success = false
271
- break
272
- end
264
+ record.set_value_for_attribute(columns_hash[k.to_sym].nil? ? {:name => k} : columns_hash[k.to_sym], v)
273
265
  end
274
266
 
267
+ # process all attirubutes for this record
268
+ #record_hash.each_pair do |k,v|
269
+ #begin
270
+ #record.send("#{k}=",v)
271
+ #rescue ArgumentError => exc
272
+ #flash :error => exc.message
273
+ #success = false
274
+ #break
275
+ #end
276
+ #end
277
+
275
278
  # try to save
276
279
  # modified_records += 1 if success && record.save
277
280
  mod_records[id] = record.to_array(columns) if success && record.save
@@ -0,0 +1,92 @@
1
+ module Netzke
2
+ module Basepack
3
+ # A FormPanel with paging toolbar. Allows browsing and editing records one-by-one.
4
+ #
5
+ # == Configuration
6
+ # Besides +Netzke::Basepack::FormPanel+ config options, accepts:
7
+ # * +scope+ - specifies how the data should be filtered.
8
+ # When it's a symbol, it's used as a scope name.
9
+ # When it's a string, it's a SQL statement (passed directly to +ActiveRecord::Relation#where+).
10
+ # When it's a hash, it's a conditions hash (passed directly to +ActiveRecord::Relation#where+).
11
+ # When it's an array, it's expanded into an SQL statement with arguments (passed directly to +ActiveRecord::Relation#where+), e.g.:
12
+ #
13
+ # :scope => ["id > ?", 100])
14
+ #
15
+ # When it's a Proc, it's passed the model class, and is expected to return an ActiveRecord::Relation, e.g.:
16
+ #
17
+ # :scope => { |rel| rel.where(:id.gt => 100).order(:created_at) }
18
+ class PagingFormPanel < FormPanel
19
+
20
+ # override
21
+ def record
22
+ @record ||= get_relation.first
23
+ end
24
+
25
+ # Pass total records amount and the first record to the JS constructor
26
+ def js_config
27
+ super.merge({
28
+ :total_records => total_records,
29
+ :record => record.to_hash(fields)
30
+ })
31
+ end
32
+
33
+ endpoint :get_data do |params|
34
+ record = get_relation.offset(params[:start].to_i).limit(1).first
35
+ record_hash = record && record.to_hash(fields).each_pair.inject({}){ |r,(k,v)| r.merge(k.l => v) }
36
+ {:records => record_hash && [record_hash] || [], :total => total_records}
37
+ end
38
+
39
+ js_method :init_component, <<-JS
40
+ function(){
41
+
42
+ // Extract field names from items recursively. We have to do it before calling superclass.initComponent,
43
+ // because we need to build the store for PagingToolbar that cannot be created after superclass.initComponent
44
+ // Otherwise, the things would be simpler, because this.getForm().items would already has all the fields in one place for us
45
+ this.fieldNames = [];
46
+ this.extractFields(this.items);
47
+ var fieldNames = this.fieldNames;
48
+
49
+ var store = new Ext.data.JsonStore({
50
+ url: this.endpointUrl('get_data'),
51
+ root: 'records',
52
+ fields: fieldNames,
53
+ data: {records: [this.record], total: this.totalRecords}
54
+ });
55
+
56
+ store.on('beforeload', function(){
57
+ if (!this.loadMaskCmp) this.loadMaskCmp = new Ext.LoadMask(this.bwrap, this.applyMask);
58
+ this.loadMaskCmp.show();
59
+ }, this);
60
+
61
+ store.on('load', function(st, r){
62
+ this.setFormValues(r[0].data);
63
+ if (this.loadMaskCmp) this.loadMaskCmp.hide();
64
+ }, this);
65
+
66
+ this.bbar = new Ext.PagingToolbar({
67
+ beforePageText: "Record",
68
+ store: store,
69
+ pageSize: 1,
70
+ items: ["-"].concat(this.bbar || [])
71
+ });
72
+
73
+ Netzke.classes.Basepack.PagingFormPanel.superclass.initComponent.call(this);
74
+ }
75
+ JS
76
+
77
+ protected
78
+
79
+ # Returns ActiveRecord::Relation for the data
80
+ def get_relation
81
+ relation = data_class.scoped
82
+ relation = relation.extend_with(config[:scope]) if config[:scope]
83
+ relation
84
+ end
85
+
86
+ def total_records
87
+ @total_records ||= get_relation.count
88
+ end
89
+
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,71 @@
1
+ module Netzke
2
+ module Basepack
3
+ # Basis for a Ext.Viewport-based one-page application
4
+ #
5
+ # Features:
6
+ # * dynamic loading of components
7
+ # * browser history support (press the "Back"-button to go to the previously loaded component)
8
+ # * AJAX activity indicator
9
+ class SimpleApp < Base
10
+
11
+ js_base_class "Ext.Viewport"
12
+
13
+ js_property :layout, :border
14
+
15
+ js_include Netzke::Core.ext_location.join("examples", "ux/statusbar/StatusBar.js"), :statusbar_ext
16
+
17
+ js_mixin :main
18
+
19
+ def configuration
20
+ super.merge(
21
+ :items => [main_panel_config, menu_bar_config, status_bar_config]
22
+ )
23
+ end
24
+
25
+ def menu
26
+ []
27
+ end
28
+
29
+ def main_panel_config(overrides = {})
30
+ {
31
+ :id => 'main-panel',
32
+ :region => 'center',
33
+ :layout => 'fit'
34
+ }.merge(overrides)
35
+ end
36
+
37
+ def status_bar_config(overrides = {})
38
+ {
39
+ :id => 'main-statusbar',
40
+ :xtype => 'statusbar',
41
+ :region => 'south',
42
+ :height => 22,
43
+ :statusAlign => 'right',
44
+ :busyText => 'Busy...',
45
+ :default_text => "Ready",
46
+ :default_icon_cls => ""
47
+ }.merge(overrides)
48
+ end
49
+
50
+ def menu_bar_config(overrides = {})
51
+ {
52
+ :id => 'main-toolbar',
53
+ :xtype => 'toolbar',
54
+ :region => 'north',
55
+ :height => 28,
56
+ :items => menu
57
+ }.merge(overrides)
58
+ end
59
+
60
+ # Html required for Ext.History to work
61
+ def js_component_html
62
+ super << %Q{
63
+ <form id="history-form" class="x-hidden">
64
+ <input type="hidden" id="x-history-field" />
65
+ <iframe id="x-history-frame"></iframe>
66
+ </form>
67
+ }
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,53 @@
1
+ {
2
+ initComponent: function(){
3
+ Netzke.classes.Basepack.SimpleApp.superclass.initComponent.call(this);
4
+
5
+ Ext.History.on('change', this.processHistory, this);
6
+
7
+ // Setting the "busy" indicator for Ajax requests
8
+ Ext.Ajax.on('beforerequest', function(){this.findById('main-statusbar').showBusy()}, this);
9
+ Ext.Ajax.on('requestcomplete', function(){this.findById('main-statusbar').hideBusy()}, this);
10
+ Ext.Ajax.on('requestexception', function(){this.findById('main-statusbar').hideBusy()}, this);
11
+
12
+ // Initialize history
13
+ Ext.History.init();
14
+ },
15
+
16
+ afterRender: function(){
17
+ Netzke.classes.Basepack.SimpleApp.superclass.afterRender.call(this);
18
+
19
+ // If we are given a token, load the corresponding component, otherwise load the last loaded component
20
+ var currentToken = Ext.History.getToken();
21
+ if (currentToken != "") {
22
+ this.processHistory(currentToken);
23
+ } else {
24
+ var lastLoaded = this.initialConfig.componentToLoad; // passed from the server
25
+ if (lastLoaded) Ext.History.add(lastLoaded);
26
+ }
27
+ },
28
+
29
+ processHistory: function(token){
30
+ if (token){
31
+ this.loadComponent({name:token, container:'main-panel'});
32
+ } else {
33
+ Ext.getCmp('main-panel').removeChild();
34
+ }
35
+ },
36
+
37
+ instantiateComponent: function(config){
38
+ this.findById('main-panel').instantiateChild(config);
39
+ },
40
+
41
+ appLoadComponent: function(name){
42
+ Ext.History.add(name);
43
+ },
44
+
45
+ loadComponentByAction: function(action){
46
+ var componentName = action.component || action.name;
47
+ if (componentName) this.appLoadComponent(componentName);
48
+ },
49
+
50
+ onToggleConfigMode: function(params){
51
+ this.toggleConfigMode();
52
+ }
53
+ }
@@ -16,17 +16,7 @@ module Netzke
16
16
 
17
17
  js_base_class "Ext.TabPanel"
18
18
 
19
- js_method :init_component, <<-JS
20
- function(params){
21
- #{js_full_class_name}.superclass.initComponent.call(this);
22
- this.on('tabchange', function(self, i){
23
- if (i && i.wrappedComponent && !i.items.first()) {
24
- this.loadComponent({name: i.wrappedComponent, container: i.id});
25
- }
26
- }, this);
27
- }
28
- JS
29
-
19
+ js_mixin :main
30
20
  end
31
21
  end
32
- end
22
+ end