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,82 +0,0 @@
1
- /**
2
- * Ext.ux.form.XCheckbox - checkbox with configurable submit values
3
- *
4
- * @author Ing. Jozef Sakalos
5
- * @version $Id: Ext.ux.form.XCheckbox.js 441 2009-01-12 11:10:10Z jozo $
6
- * @date 10. February 2008
7
- *
8
- *
9
- * @license Ext.ux.form.XCheckbox is licensed under the terms of
10
- * the Open Source LGPL 3.0 license. Commercial use is permitted to the extent
11
- * that the code/component(s) do NOT become part of another Open Source or Commercially
12
- * licensed development library or toolkit without explicit permission.
13
- *
14
- * License details: http://www.gnu.org/licenses/lgpl.html
15
- */
16
-
17
- /*global Ext */
18
-
19
- /**
20
- * @class Ext.ux.XCheckbox
21
- * @extends Ext.form.Checkbox
22
- */
23
- Ext.ns('Ext.ux.form');
24
- Ext.ux.form.XCheckbox = Ext.extend(Ext.form.Checkbox, {
25
- submitOffValue:'false'
26
- ,submitOnValue:'true'
27
-
28
- ,onRender:function() {
29
-
30
- this.inputValue = this.submitOnValue;
31
-
32
- // call parent
33
- Ext.ux.form.XCheckbox.superclass.onRender.apply(this, arguments);
34
-
35
- // create hidden field that is submitted if checkbox is not checked
36
- this.hiddenField = this.wrap.insertFirst({tag:'input', type:'hidden'});
37
-
38
- // support tooltip
39
- if(this.tooltip) {
40
- this.imageEl.set({qtip:this.tooltip});
41
- }
42
-
43
- // update value of hidden field
44
- this.updateHidden();
45
-
46
- } // eo function onRender
47
-
48
- /**
49
- * Calls parent and updates hiddenField
50
- * @private
51
- */
52
- ,setValue:function(v) {
53
- v = this.convertValue(v);
54
- this.updateHidden(v);
55
- Ext.ux.form.XCheckbox.superclass.setValue.apply(this, arguments);
56
- } // eo function setValue
57
-
58
- /**
59
- * Updates hiddenField
60
- * @private
61
- */
62
- ,updateHidden:function(v) {
63
- v = undefined !== v ? v : this.checked;
64
- v = this.convertValue(v);
65
- if(this.hiddenField) {
66
- this.hiddenField.dom.value = v ? this.submitOnValue : this.submitOffValue;
67
- this.hiddenField.dom.name = v ? '' : this.el.dom.name;
68
- }
69
- } // eo function updateHidden
70
-
71
- /**
72
- * Converts value to boolean
73
- * @private
74
- */
75
- ,convertValue:function(v) {
76
- return (v === true || v === 'true' || v == 1 || v === this.submitOnValue || String(v).toLowerCase() === 'on');
77
- } // eo function convertValue
78
-
79
- }); // eo extend
80
-
81
- // register xtype
82
- Ext.reg('xcheckbox', Ext.ux.form.XCheckbox);
@@ -1,69 +0,0 @@
1
- module Netzke
2
- module Basepack
3
- class GridPanel < Netzke::Base
4
- # (Dynamic) JavaScript for GridPanel
5
- module Javascript
6
- extend ActiveSupport::Concern
7
-
8
- included do
9
- js_base_class "Netzke.pre.GridPanel"
10
- js_method :init_component, js_init_component
11
- end
12
-
13
- module InstanceMethods
14
- # The result of this method (a hash) is converted to a JSON object and passed as the configuration parameter
15
- # to the constructor of our JavaScript class. Override it when you want to pass any extra configuration
16
- # to the JavaScript side.
17
- def js_config
18
- super.merge({
19
- :bbar => config.has_key?(:bbar) ? config[:bbar] : default_bbar,
20
- :context_menu => config.has_key?(:context_menu) ? config[:context_menu] : default_context_menu,
21
- :columns => columns, # columns
22
- :model => config[:model], # the model name
23
- :inline_data => (get_data if config[:load_inline_data]), # inline data (loaded along with the grid panel)
24
- :pri => data_class.primary_key # table primary key name
25
- })
26
- end
27
- end
28
-
29
- module ClassMethods
30
- private
31
-
32
- # Ext.Component#initComponent, built up from pices (dependent on class-level configuration)
33
- def js_init_component
34
- # Optional "edit in form"-related events
35
- edit_in_form_events = <<-END_OF_JAVASCRIPT if edit_in_form_available
36
- if (this.enableEditInForm) {
37
- this.getSelectionModel().on('selectionchange', function(selModel){
38
- var disabled;
39
- if (!selModel.hasSelection()) {
40
- disabled = true;
41
- } else {
42
- // Disable "edit in form" button if new record is present in selection
43
- disabled = !selModel.each(function(r){
44
- if (r.isNew) { return false; }
45
- });
46
- };
47
- this.actions.editInForm.setDisabled(disabled);
48
- }, this);
49
- }
50
- END_OF_JAVASCRIPT
51
-
52
- # Result
53
- <<-END_OF_JAVASCRIPT
54
- function(){
55
- // Original initComponent
56
- #{js_full_class_name}.superclass.initComponent.call(this);
57
- #{edit_in_form_events}
58
- }
59
-
60
- END_OF_JAVASCRIPT
61
- end
62
-
63
- # end private
64
- end
65
-
66
- end
67
- end
68
- end
69
- end
data/locale/en.yml DELETED
@@ -1,16 +0,0 @@
1
- en:
2
- netzke:
3
- basepack:
4
- grid_panel:
5
- add: Add
6
- edit: Edit
7
- delete: Delete
8
- apply: Apply
9
- add_in_form: Add in form
10
- edit_in_form: Edit in form
11
- search: Search
12
-
13
- formats:
14
- date: Y-m-d
15
- datetime: Y-m-d H:i:s
16
- time: H:i:s