netzke-basepack 1.0.0.0.pre3 → 1.0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad64e5a6aee6a6028818e5dc859b0bbb1dbad699
4
- data.tar.gz: 7d0f81226d8023eebc9792beb5d5dbfd5c4f2c66
3
+ metadata.gz: e7b071b17635f26304174a2ce41906a80151f5dd
4
+ data.tar.gz: 87a442885af7cdbbba3bf8c8758c687f8cf58d66
5
5
  SHA512:
6
- metadata.gz: 6a53878200a155e9d0a08937b9537746eb6d1ea3afa9e8ae6ca2e2eeae23429721fef6d074ab12973db10a6f7ff357198ed394d4b228930e9a44df18d5d6fdf9
7
- data.tar.gz: d764bb984b4d608950f13630e2aa9a63027ab40062fa1077f5876a518089644748d3dd5fe5f9268537c77360a3e37589d1530d3f1e188c496a1a1b43083e32a8
6
+ metadata.gz: a9fcdb725adaec959082a2f9b9cc638dbbd424c329f13ff2086dfdd4a710d46f359544aa9f2831f9000a2246612f3c6a80c2e53993b0156a61439f1f154ef243
7
+ data.tar.gz: 0ccc9d5f7a241e02a00de6048e0c2dc74ebb0c30fab519bc27a3ead1769d60fe6239646418ca12757ba608c858dfab709824ce7ec5b99b21d67d4106640a8019
data/CHANGELOG.md CHANGED
@@ -1,12 +1,14 @@
1
- ### Components changed/renamed
1
+ # v1.0.0.0 - 2016-01-04
2
+
3
+ ## Components changed/renamed
2
4
 
3
5
  * Base classes of main componens have been renamed from `Netzke::Basepack::{Grid|Form|Tree|Window|Viewport}` to `Netzke::{Grid|Form|Tree|Window|Viewport}::Base`.
4
6
 
5
- * `Netzke::Basepack::TapPanel` and `Netzke::Basepack::Accordion` have been removed. The only purpose for them was dynamic loading of child components, which didn't prove that useful.
7
+ * `Netzke::Basepack::TabPanel` and `Netzke::Basepack::Accordion` have been removed. The only purpose for them was dynamic loading of child components, which didn't prove that useful.
6
8
 
7
- ### Form, Grid, Tree
9
+ ## Form, Grid, Tree
8
10
 
9
- #### Breaking changes
11
+ ### Breaking changes
10
12
 
11
13
  * `strong_default_attrs` config option has been renamed to `strong_values`.
12
14
 
@@ -14,15 +16,15 @@
14
16
 
15
17
  * The new `attribute` DSL method and the accompanying `attribute_overrides` config option allow reconfiguring the way specific model attributes are presented by both the grid and the form. The `column` DSL method has been left for configuring what's specific for a column. For details, see [Netzke::Basepack::Attributes](http://www.rubydoc.info/github/netzke/netzke-basepack/Netzke/Basepack/Attributes).
16
18
 
17
- ### Form
19
+ ## Form
18
20
 
19
- #### Breaking changes
21
+ ### Breaking changes
20
22
 
21
23
  * The `netzkeSubmit` and `netzkeLoad` endpoints have been renamed to `submit` and `load` respectively; keep this in mind if you override them in your app.
22
24
 
23
- ### Grid
25
+ ## Grid
24
26
 
25
- #### Breaking changes
27
+ ### Breaking changes
26
28
 
27
29
  * Column/field label for association no longer includes association method name by default. For example, for
28
30
  `author__name` attribute it'll now be "Author", not "Author name".
@@ -44,15 +46,15 @@
44
46
 
45
47
  * The endpoints dropped their prefix `server`; additionally, `serverDelete` has become `destroy`; keep this in mind if you override endpoints in your app.
46
48
 
47
- * All scope-related configs (including those of the columns) now only accept a Proc object.
49
+ * All scope-related configs (including those of the columns) now only accept a Proc or a Hash.
48
50
 
49
- * Class-level configuration is gone (its sole purpose was to allow reducing the amount of generated JS code - not worth it).
51
+ * Class-level component configuration is gone (its sole purpose was to allow reducing the amount of generated JS code - not worth it).
50
52
 
51
53
  * `enable_edit_in_form`, `enable_edit_inline`, `enable_pagination` options are gone.
52
54
 
53
55
  * `enable_extended_search` option is gone.
54
56
 
55
- #### Non-breaking changes
57
+ ### New and improved
56
58
 
57
59
  * By default, Grid now uses form to add/edit records. Set `edit_inline` to true to use inline editing when possible (implicitly sets `paging` to `true`).
58
60
 
@@ -62,15 +64,11 @@
62
64
 
63
65
  * Buttons previously disabled due to permissions are now not added to the bottom bar alltogether.
64
66
 
65
- #### Added
66
-
67
67
  * Override new `configure_form` method to specify extra configuration to the forms
68
68
 
69
69
  * Warn the user at an attempt to change the page when there are unapplied changes; disable the warning by setting `disable_dirty_page_warning` to `true`.
70
70
 
71
- * Proper support for decimal datatype
72
-
73
- #### Bugfixes
71
+ * Proper support for decimal datatype was added
74
72
 
75
73
  * Multiediting of reconds now works properly with boolean fields (a tristate selector was implemented).
76
74
 
data/LICENSE CHANGED
@@ -1,3 +1,3 @@
1
1
  Copyright (c) 2009-2015 Good Bit Labs Limited
2
2
 
3
- GPLv3 License: http://www.gnu.org/licenses/gpl-3.0.en.html
3
+ The same license as Ext JS: https://www.sencha.com/legal/#Sencha_Ext_JS
data/README.md CHANGED
@@ -103,4 +103,4 @@ If you feel particularily generous, you can donate a couple of bucks weekly at [
103
103
  * [Twitter](http://twitter.com/netzke) - latest news about the framework
104
104
 
105
105
  ---
106
- Copyright (c) 2009-2015 [Good Bit Labs](http://goodbitlabs.com/), released under the GPLv3 license
106
+ Copyright (c) 2009-2016 [Good Bit Labs](http://goodbitlabs.com/), released under the same license as [Ext JS](https://www.sencha.com/legal/#Sencha_Ext_JS)
@@ -92,16 +92,6 @@ Ext.define("Netzke.Grid.EventHandlers", {
92
92
  }
93
93
  },
94
94
 
95
- // Not a very clean approach to clean-up. The problem is that this way the advanced search functionality stops being really pluggable. With Ext JS 4 find the way to make it truely so.
96
- netzkeOnDestroy: function(){
97
- this.callParent();
98
-
99
- // Destroy the search window (here's the problem: we are not supposed to know it exists)
100
- if (this.searchWindow) {
101
- this.searchWindow.destroy();
102
- }
103
- },
104
-
105
95
  netzkeOnAddInForm: function(){
106
96
  this.netzkeLoadComponent("add_window", {
107
97
  callback: function(w) {
@@ -167,6 +157,10 @@ Ext.define("Netzke.Grid.EventHandlers", {
167
157
  }});
168
158
  },
169
159
 
160
+ /**
161
+ * Reloads store
162
+ * @method netzkeReloadStore
163
+ */
170
164
  netzkeReloadStore: function(){
171
165
  var store = this.getStore();
172
166
 
@@ -177,7 +171,7 @@ Ext.define("Netzke.Grid.EventHandlers", {
177
171
  },
178
172
 
179
173
  /**
180
- * Process selectionchange event to enable/disable actions.
174
+ * Processes selectionchange event to enable/disable actions.
181
175
  * @method netzkeSetActionEvents
182
176
  * @private
183
177
  */
@@ -70,13 +70,13 @@ module Netzke
70
70
  #
71
71
  # [scope]
72
72
  #
73
- # The scope for association attribute. Same syntax applies as for scoping out records for the grid.
73
+ # A Proc or a Hash used to scope out one-to-many association options. Same syntax applies as for scoping out records in the grid.
74
74
  #
75
75
  # [filter_association_with]
76
76
  #
77
77
  # A Proc object that receives the relation and the value to filter by. Example:
78
78
  #
79
- # column :author__name do |c|
79
+ # attribute :author__name do |c|
80
80
  # c.filter_association_with = lambda {|rel, value| rel.where("first_name like ? or last_name like ?", "%#{value}%", "%#{value}%" ) }
81
81
  # end
82
82
  #
@@ -89,7 +89,8 @@ module Netzke::Basepack::DataAdapters
89
89
  # Options for an asssociation attribute
90
90
 
91
91
  relation = assoc.klass.all
92
- relation = attr[:scope].call(relation) if attr[:scope].is_a?(Proc)
92
+
93
+ relation = extend_relation_with_scope(relation, attr[:scope])
93
94
 
94
95
  if attr[:filter_association_with]
95
96
  relation = attr[:filter_association_with].call(relation, query).to_a
@@ -316,11 +317,7 @@ module Netzke::Basepack::DataAdapters
316
317
  relation = relation.where(predicates_for_and_conditions(and_query))
317
318
  end
318
319
 
319
- if params[:scope].is_a?(Proc)
320
- relation = params[:scope].call(relation)
321
- else
322
- raise ArgumentError, "Expected scope to be a Proc, got #{params[:scope].class}" unless params[:scope].nil?
323
- end
320
+ relation = extend_relation_with_scope(relation, params[:scope])
324
321
 
325
322
  @relation = relation
326
323
  end
@@ -443,6 +440,19 @@ module Netzke::Basepack::DataAdapters
443
440
 
444
441
  private
445
442
 
443
+ def extend_relation_with_scope(relation, scope)
444
+ case scope
445
+ when Proc
446
+ scope.call(relation)
447
+ when Hash
448
+ relation.where(scope)
449
+ when NilClass
450
+ relation
451
+ else
452
+ raise ArgumentError, "Expected scope to be a Proc or a Hash, got #{scope.class}"
453
+ end
454
+ end
455
+
446
456
  def logger
447
457
  Netzke::Base.logger
448
458
  end
@@ -1,5 +1,5 @@
1
1
  module Netzke
2
2
  module Basepack
3
- VERSION = "1.0.0.0.pre3"
3
+ VERSION = "1.0.0.0"
4
4
  end
5
5
  end
@@ -79,17 +79,27 @@ module Netzke
79
79
  #
80
80
  # [scope]
81
81
  #
82
- # A Proc object used to scope out grid data. Receives the current relation as a parameter and must return the
83
- # modified relation. For example:
82
+ # A Proc or a Hash used to scope out grid data. The Proc will receive the current relation as a parameter and must
83
+ # return the modified relation. For example:
84
84
  #
85
85
  # class Books < Netzke::Basepack::Grid
86
86
  # def configure(c)
87
- # c.model = "Book"
88
87
  # super
88
+ # c.model = Book
89
89
  # c.scope = lambda {|r| r.where(author_id: 1) }
90
90
  # end
91
91
  # end
92
92
  #
93
+ # Hash is being accepted for conivience, it will be directly passed to `where`. So the above can be rewritten as:
94
+ #
95
+ # class Books < Netzke::Basepack::Grid
96
+ # def configure(c)
97
+ # super
98
+ # c.model = Book
99
+ # c.scope = {author_id: 1}
100
+ # end
101
+ # end
102
+ #
93
103
  # [strong_values]
94
104
  #
95
105
  # A hash of attributes to be merged atop of every created/updated record, e.g. +role_id: 1+
@@ -84,7 +84,7 @@ module Netzke
84
84
 
85
85
  # Attempts a given operation on the data. Checks permissions first.
86
86
  # @param [Symbol] Operation: :create, :read, :update, or :delete
87
- # @param [Array] Workload of operation data
87
+ # @param [Array|Hash] Workload of operation data
88
88
  # @param [Netzke::Core::EndpointResponse] Object collecting response to the client
89
89
  def attempt_operation(op, data, client)
90
90
  if allowed_to?(op)
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-basepack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.0.pre3
4
+ version: 1.0.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Gorin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A set of feature-rich extendible Netzke components (such as Form, Grid,
14
- Window, TabPanel, etc) and component extensions which can be used as building blocks
15
- for your RIA
13
+ description: A set of feature-rich extendible Netzke components (such as Grid, Tree,
14
+ Form, Window) and component extensions which can be used as building blocks for
15
+ your apps
16
16
  email: max@goodbitlabs.com
17
17
  executables: []
18
18
  extensions: []