netzke-basepack 0.12.9 → 1.0.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +75 -44
- data/Gemfile +4 -2
- data/LICENSE +2 -6
- data/README.md +22 -24
- data/javascripts/basepack.js +0 -8
- data/javascripts/{columns.js → grid/columns.js} +59 -71
- data/javascripts/grid/event_handlers.js +218 -0
- data/javascripts/netzkeremotecombo.js +5 -13
- data/javascripts/tristate.js +62 -0
- data/javascripts/xdatetime.js +8 -37
- data/lib/netzke-basepack.rb +3 -2
- data/lib/netzke/basepack.rb +1 -1
- data/lib/netzke/basepack/action_column.rb +6 -23
- data/lib/netzke/basepack/active_record.rb +0 -6
- data/lib/netzke/basepack/attr_config.rb +20 -11
- data/lib/netzke/basepack/attribute_config.rb +10 -0
- data/lib/netzke/basepack/attributes.rb +196 -0
- data/lib/netzke/basepack/column_config.rb +47 -39
- data/lib/netzke/basepack/columns.rb +127 -97
- data/lib/netzke/basepack/data_accessor.rb +7 -48
- data/lib/netzke/basepack/data_adapters/abstract_adapter.rb +15 -17
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +111 -90
- data/lib/netzke/basepack/dynamic_tab_panel.rb +3 -5
- data/lib/netzke/basepack/dynamic_tab_panel/{javascripts → client}/dynamic_tab_panel.js +6 -5
- data/lib/netzke/basepack/field_config.rb +30 -19
- data/lib/netzke/basepack/fields.rb +22 -12
- data/lib/netzke/basepack/grid_live_search.rb +1 -4
- data/lib/netzke/basepack/grid_live_search/{javascripts → client}/grid_live_search.js +9 -7
- data/lib/netzke/basepack/item_persistence.rb +3 -3
- data/lib/netzke/basepack/item_persistence/events_plugin.rb +8 -10
- data/lib/netzke/basepack/paging_form.rb +7 -11
- data/lib/netzke/basepack/paging_form/{javascripts → client}/paging_form.js +4 -4
- data/lib/netzke/basepack/query_builder.rb +12 -10
- data/lib/netzke/basepack/query_builder/{javascripts → client}/query_builder.js +14 -12
- data/lib/netzke/basepack/record_form_window.rb +8 -8
- data/lib/netzke/basepack/search_panel.rb +4 -6
- data/lib/netzke/basepack/search_panel/{javascripts → client}/condition_field.js +13 -16
- data/lib/netzke/basepack/search_panel/{javascripts → client}/search_panel.js +7 -7
- data/lib/netzke/basepack/search_window.rb +6 -6
- data/lib/netzke/basepack/simple_app/{javascripts → client}/statusbar_ext.js +0 -0
- data/lib/netzke/basepack/version.rb +1 -1
- data/lib/netzke/form/base.rb +166 -0
- data/lib/netzke/{basepack/form/javascripts/form.js → form/base/client/base.js} +77 -38
- data/lib/netzke/form/base/client/readonly_mode.css +4 -0
- data/lib/netzke/{basepack/form/javascripts → form/base/client}/readonly_mode.js +5 -5
- data/lib/netzke/form/endpoints.rb +33 -0
- data/lib/netzke/form/services.rb +74 -0
- data/lib/netzke/grid/actions.rb +52 -0
- data/lib/netzke/grid/base.rb +289 -0
- data/lib/netzke/{basepack/grid/javascripts → grid/base/client}/advanced_search.js +5 -1
- data/lib/netzke/{basepack/grid/javascripts/grid.js → grid/base/client/base.js} +61 -53
- data/lib/netzke/{basepack/grid/javascripts → grid/base/client}/extensions.js +19 -13
- data/lib/netzke/{basepack/grid/javascripts → grid/base/client}/remember_selection.js +0 -1
- data/lib/netzke/grid/client.rb +8 -0
- data/lib/netzke/grid/components.rb +55 -0
- data/lib/netzke/grid/configuration.rb +72 -0
- data/lib/netzke/grid/endpoints.rb +99 -0
- data/lib/netzke/grid/permissions.rb +18 -0
- data/lib/netzke/grid/services.rb +141 -0
- data/lib/netzke/tree/base.rb +173 -0
- data/lib/netzke/{basepack/tree/javascripts/tree.js → tree/base/client/base.js} +55 -26
- data/lib/netzke/{basepack/tree/javascripts → tree/base/client}/extensions.js +7 -7
- data/lib/netzke/tree/endpoints.rb +34 -0
- data/lib/netzke/{basepack/viewport.rb → viewport/base.rb} +3 -3
- data/lib/netzke/{basepack/window.rb → window/base.rb} +7 -8
- data/lib/netzke/window/base/client/base.js +26 -0
- data/locales/de.yml +49 -33
- data/locales/en.yml +32 -39
- data/locales/es.yml +39 -25
- data/locales/nl.yml +39 -25
- data/locales/ru.yml +38 -25
- data/locales/uk.yml +40 -26
- data/stylesheets/basepack.css +10 -0
- metadata +48 -45
- data/javascripts/mixins/grid_event_handlers.js +0 -139
- data/lib/netzke/basepack/accordion.rb +0 -45
- data/lib/netzke/basepack/active_record/relation_extensions.rb +0 -27
- data/lib/netzke/basepack/form.rb +0 -131
- data/lib/netzke/basepack/form/endpoints.rb +0 -35
- data/lib/netzke/basepack/form/services.rb +0 -74
- data/lib/netzke/basepack/form/stylesheets/readonly_mode.css +0 -14
- data/lib/netzke/basepack/grid.rb +0 -570
- data/lib/netzke/basepack/grid/endpoints.rb +0 -111
- data/lib/netzke/basepack/grid/javascripts/edit_in_form.js +0 -51
- data/lib/netzke/basepack/grid/services.rb +0 -148
- data/lib/netzke/basepack/tab_panel.rb +0 -22
- data/lib/netzke/basepack/tab_panel/javascripts/tab_panel.js +0 -11
- data/lib/netzke/basepack/tree.rb +0 -269
- data/lib/netzke/basepack/window/javascripts/window.js +0 -26
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +0 -29
data/CHANGELOG.md
CHANGED
@@ -1,44 +1,75 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
*
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
*
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
*
|
35
|
-
|
36
|
-
*
|
37
|
-
|
38
|
-
*
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
*
|
43
|
-
|
44
|
-
|
1
|
+
### Components changed/renamed
|
2
|
+
|
3
|
+
* 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
|
+
|
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.
|
6
|
+
|
7
|
+
### Form, Grid, Tree
|
8
|
+
|
9
|
+
#### Breaking changes
|
10
|
+
|
11
|
+
* `strong_default_attrs` config option has been renamed to `strong_values`.
|
12
|
+
|
13
|
+
* `attr_type` config option for columns/fields has been renamed to `type`.
|
14
|
+
|
15
|
+
* 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
|
+
|
17
|
+
### Form
|
18
|
+
|
19
|
+
#### Breaking changes
|
20
|
+
|
21
|
+
* 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
|
+
|
23
|
+
### Grid
|
24
|
+
|
25
|
+
#### Breaking changes
|
26
|
+
|
27
|
+
* Column/field label for association no longer includes association method name by default. For example, for
|
28
|
+
`author__name` attribute it'll now be "Author", not "Author name".
|
29
|
+
|
30
|
+
* `preconfigure_record_window` has been renamed to `configure_form_window`
|
31
|
+
|
32
|
+
* The `default_fields_for_forms` method has been renamed to `default_form_items`.
|
33
|
+
|
34
|
+
* The `data_store` config option has been renamed to `store_config`.
|
35
|
+
|
36
|
+
* Permissions configuration got consolidated into single `permissions` config option. See [Netzke::Grid::Base](http://www.rubydoc.info/github/netzke/netzke-basepack/Netzke/Grid/Base)
|
37
|
+
|
38
|
+
* The `del` action has been renamed to `delete`.
|
39
|
+
|
40
|
+
* Columns configuration (by using the `Grid.column` DSL method, or the `columns` configuration option) no longer has effect on corresponding form fields. Use the new `attribute` DSL method or the `attribute_overrides` config option (see above) to set the common configuration option for both column and form field.
|
41
|
+
|
42
|
+
* Virtual columns declared with the `column` DSL method are no longer automatically appended to the end of the column
|
43
|
+
list; use the `columns` config option or override the `Grid#columns` method to explicitely list them.
|
44
|
+
|
45
|
+
* The endpoints dropped their prefix `server`; additionally, `serverDelete` has become `destroy`; keep this in mind if you override endpoints in your app.
|
46
|
+
|
47
|
+
* All scope-related configs (including those of the columns) now only accept a Proc object.
|
48
|
+
|
49
|
+
* Class-level configuration is gone (its sole purpose was to allow reducing the amount of generated JS code - not worth it).
|
50
|
+
|
51
|
+
* `enable_edit_in_form`, `enable_edit_inline`, `enable_pagination` options are gone.
|
52
|
+
|
53
|
+
* `enable_extended_search` option is gone.
|
54
|
+
|
55
|
+
#### Non-breaking changes
|
56
|
+
|
57
|
+
* 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
|
+
|
59
|
+
* By default, Grid now handles large number of records by using a buffered store (allows for "infinite scrolling"). Set `paging` to `true` if you want pagination instead.
|
60
|
+
|
61
|
+
* The toolbar was reduced to 'add', 'edit', 'delete', and 'search' buttons by default. Additionally, the 'apply' button is added when `edit_inline` is set to `true`.
|
62
|
+
|
63
|
+
* Buttons previously disabled due to permissions are now not added to the bottom bar alltogether.
|
64
|
+
|
65
|
+
#### Added
|
66
|
+
|
67
|
+
* Override new `configure_form` method to specify extra configuration to the forms
|
68
|
+
|
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
|
+
|
71
|
+
#### Bugfixes
|
72
|
+
|
73
|
+
* Multiediting of reconds now works properly with boolean fields (a tristate selector was implemented).
|
74
|
+
|
75
|
+
Please check [0-12](https://github.com/netzke/netzke-basepack/blob/0-12/CHANGELOG.md) for previous changes.
|
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ gem 'yard'
|
|
8
8
|
gem 'rake'
|
9
9
|
|
10
10
|
gem 'awesome_nested_set'
|
11
|
+
gem 'carrierwave'
|
11
12
|
|
12
13
|
group :test do
|
13
14
|
gem 'rspec'
|
@@ -22,6 +23,7 @@ group :development, :test do
|
|
22
23
|
gem 'web-console', '~> 2.0'
|
23
24
|
# gem 'spring' # troubles...
|
24
25
|
gem 'pry-rails'
|
25
|
-
gem 'netzke-core', github: 'netzke/netzke-core', branch: '
|
26
|
-
gem 'netzke-testing', github: 'netzke/netzke-testing', branch: '
|
26
|
+
gem 'netzke-core', github: 'netzke/netzke-core', branch: 'master'
|
27
|
+
gem 'netzke-testing', github: 'netzke/netzke-testing', branch: 'master'
|
28
|
+
gem 'faker'
|
27
29
|
end
|
data/LICENSE
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2009-2015 Good Bit Labs Limited
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
-
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
3
|
+
GPLv3 License: http://www.gnu.org/licenses/gpl-3.0.en.html
|
data/README.md
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
# Netzke Basepack [![Build Status](https://travis-ci.org/netzke/netzke-basepack.
|
1
|
+
# Netzke Basepack [![Build Status](https://travis-ci.org/netzke/netzke-basepack.svg?branch=master)](https://travis-ci.org/netzke/netzke-basepack) [![Code Climate](https://codeclimate.com/github/netzke/netzke-basepack/badges/gpa.svg)](https://codeclimate.com/github/netzke/netzke-basepack)
|
2
2
|
|
3
3
|
[RDocs](http://rdoc.info/github/netzke/netzke-basepack)
|
4
4
|
|
5
5
|
A pack of pre-built [Netzke](http://netzke.org) components that can be used as building blocks for your webapps.
|
6
6
|
|
7
7
|
*Notes on versioning:*
|
8
|
-
|
9
|
-
*
|
10
|
-
*
|
8
|
+
|
9
|
+
* The latest *released* version is: [![Gem Version](https://badge.fury.io/rb/netzke-basepack.svg)](https://badge.fury.io/rb/netzke-basepack)
|
10
|
+
* The version under development (master): [version.rb](https://github.com/netzke/netzke-core/blob/master/lib/netzke/core/version.rb)
|
11
|
+
* For other versions check corresponding [branches](https://github.com/netzke/netzke-core/branches)
|
11
12
|
|
12
13
|
## Included components
|
13
14
|
|
14
15
|
Basepack includes the following components:
|
15
16
|
|
16
|
-
* [Grid](http://rdoc.info/github/netzke/netzke-basepack/Netzke/
|
17
|
-
* [Tree](http://rdoc.info/github/netzke/netzke-basepack/Netzke/
|
18
|
-
* [Form](http://rdoc.info/github/netzke/netzke-basepack/Netzke/
|
19
|
-
* [
|
20
|
-
* [
|
21
|
-
* [Window](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/Window) - a window which stores its size, position, and maximized state
|
17
|
+
* [Grid](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Grid/Base) - a grid panel with a thick bag of features
|
18
|
+
* [Tree](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Tree/Base) - a tree panel with features similar to the Grid
|
19
|
+
* [Form](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Form/Base) - a form panel with automatic binding of fields
|
20
|
+
* [Window](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Window/Base) - a window which stores its size, position, and maximized state
|
21
|
+
* [Viewport](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Viewport/Base) - a full-window component usually used as one-page application base
|
22
22
|
|
23
23
|
Besides, Basepack implements:
|
24
24
|
|
25
25
|
* persistence of region sizes and collapsed states of an arbitrary component that uses
|
26
|
-
|
26
|
+
Ext's border layout (see [ItemPersistence](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/ItemPersistence))
|
27
27
|
* [GridLiveSearch](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/GridLiveSearch) - a plugin that allows
|
28
28
|
enhancing any grid with live search functionality
|
29
29
|
|
30
30
|
## Requirements
|
31
31
|
|
32
|
-
* Ruby
|
32
|
+
* Ruby >= 1.9.3
|
33
33
|
* Rails ~> 4.2.0
|
34
|
-
* Ext JS = 5.1.
|
34
|
+
* Ext JS = 5.1.1
|
35
35
|
|
36
36
|
## Installation
|
37
37
|
|
@@ -48,11 +48,12 @@ For the "edge" stuff, instruct bundler to get the gem straight from GitHub:
|
|
48
48
|
Embed a basepack component into a view as any other Netzke component, e.g.:
|
49
49
|
|
50
50
|
```erb
|
51
|
-
<%= netzke :books, class_name: 'Netzke::
|
51
|
+
<%= netzke :books, class_name: 'Netzke::Grid::Base', model: 'Book' %>
|
52
52
|
```
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
This will give you a grid with all the many features, configured to use your `Book` model.
|
55
|
+
|
56
|
+
For detailed examples with code see http://demo.netzke.org
|
56
57
|
|
57
58
|
## Running tests
|
58
59
|
|
@@ -66,13 +67,13 @@ good source of concise, focused examples. After starting the application, access
|
|
66
67
|
|
67
68
|
http://localhost:3000/netzke/components/{name of the component's class}
|
68
69
|
|
69
|
-
For example [http://localhost:3000/netzke/components/
|
70
|
+
For example [http://localhost:3000/netzke/components/Grid::Books](http://localhost:3000/netzke/components/Grid::Books)
|
70
71
|
|
71
72
|
To run all the tests (from the gem's root):
|
72
73
|
|
73
74
|
$ rake
|
74
75
|
|
75
|
-
*Sourcing Ext JS files from Sencha CDN is
|
76
|
+
*Sourcing Ext JS files from Sencha CDN is not possible with Basepack at the moment*.
|
76
77
|
|
77
78
|
## Using ORM other than ActiveRecord
|
78
79
|
|
@@ -94,15 +95,12 @@ application.
|
|
94
95
|
|
95
96
|
Help developing Netzke by submitting a pull request when you think others can benefit from it.
|
96
97
|
|
97
|
-
If you feel particularily generous, you can donate a couple of bucks weekly at [Gratipay](https://
|
98
|
+
If you feel particularily generous, you can donate a couple of bucks weekly at [Gratipay](https://gratipay.com/~mxgrn/).
|
98
99
|
|
99
100
|
## Useful links
|
100
101
|
* [Project website](http://netzke.org)
|
101
|
-
* [Live
|
102
|
+
* [Live demo](http://demo.netzke.org)
|
102
103
|
* [Twitter](http://twitter.com/netzke) - latest news about the framework
|
103
104
|
|
104
105
|
---
|
105
|
-
Copyright (c)
|
106
|
-
|
107
|
-
**Note** that Ext JS is licensed [differently](http://www.sencha.com/products/extjs/license/), and you may need to
|
108
|
-
purchase a commercial license in order to use it in your projects.
|
106
|
+
Copyright (c) 2009-2015 [Good Bit Labs](http://goodbitlabs.com/), released under the GPLv3 license
|
data/javascripts/basepack.js
CHANGED
@@ -26,14 +26,6 @@ Ext.override(Ext.view.BoundList, {
|
|
26
26
|
},
|
27
27
|
});
|
28
28
|
|
29
|
-
Netzke.isModelDefined = function(name) {
|
30
|
-
return !!(Netzke.models || {})[name];
|
31
|
-
};
|
32
|
-
|
33
|
-
Netzke.modelName = function(name){
|
34
|
-
return "Netzke.models." + name;
|
35
|
-
};
|
36
|
-
|
37
29
|
// Fix 2-digit precision in the numeric filter
|
38
30
|
Ext.define('Ext.grid.filters.filter.Number', {
|
39
31
|
override: 'Ext.grid.filters.filter.Number',
|
@@ -1,84 +1,73 @@
|
|
1
1
|
/* Shared column-related functionality, used in Tree and Grid */
|
2
|
-
Ext.define("Netzke.
|
3
|
-
netzkeBuildModel: function(modelClass) {
|
4
|
-
if (!Netzke.isModelDefined(this.id)) {
|
5
|
-
Ext.define(Netzke.modelName(this.id), {
|
6
|
-
extend: modelClass,
|
7
|
-
idProperty: this.pri, // Primary key
|
8
|
-
fields: this.fields
|
9
|
-
});
|
10
|
-
}
|
11
|
-
delete this.pri;
|
12
|
-
},
|
13
|
-
|
2
|
+
Ext.define("Netzke.Grid.Columns", {
|
14
3
|
netzkeProcessColumns: function() {
|
15
4
|
this.fields = [];
|
16
5
|
|
17
6
|
// Run through columns and set up different configuration for each
|
18
|
-
Ext.each(this.columns.items, function(c
|
19
|
-
|
7
|
+
Ext.each(this.columns.items, function(c){
|
20
8
|
this.netzkeNormalizeRenderer(c);
|
9
|
+
this.fields.push(this.netzkeExtractFieldConfig(c));
|
21
10
|
|
22
|
-
//
|
23
|
-
|
11
|
+
// We will not use meta columns as actual columns (not even hidden) - only to create the records
|
12
|
+
if (!c.meta) {
|
13
|
+
this.netzkeExtendColumnConfig(c);
|
14
|
+
}
|
15
|
+
}, this);
|
24
16
|
|
25
|
-
|
17
|
+
// Now reorder columns as specified in this.columnsOrder
|
18
|
+
this.orderColumns();
|
19
|
+
},
|
26
20
|
|
27
|
-
|
28
|
-
|
21
|
+
netzkeExtractFieldConfig: function(c){
|
22
|
+
// Build the field configuration for this column
|
23
|
+
var fieldConfig = {name: c.name, defaultValue: c.defaultValue, allowNull: true};
|
29
24
|
|
30
|
-
|
31
|
-
// Thus, we need to set the renderer manually.
|
32
|
-
// NOTE: for Ext there's no distinction b/w date and datetime; date fields can include time.
|
33
|
-
if (!c.renderer) {
|
34
|
-
// format in which the data will be rendered; if c.format is nil, Ext.Date.defaultFormat extended with time will be used
|
35
|
-
c.renderer = Ext.util.Format.dateRenderer(c.format || Ext.Date.defaultFormat + " H:i:s");
|
36
|
-
}
|
37
|
-
};
|
25
|
+
if (!c.meta) fieldConfig.type = this.netzkeFieldTypeForAttrType(c.type); // field type (grid editors need this to function well)
|
38
26
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
};
|
27
|
+
if (c.type == 'datetime') {
|
28
|
+
fieldConfig.dateFormat = 'Y-m-d H:i:s'; // set the format in which we receive datetime from the server (so that the model can parse it)
|
29
|
+
};
|
43
30
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
31
|
+
if (c.type == 'date') {
|
32
|
+
// If no dateFormat given for date type, Timezone translation can subtract zone offset from 00:00:00 causing previous day.
|
33
|
+
fieldConfig.dateFormat = 'Y-m-d';
|
34
|
+
};
|
48
35
|
|
49
|
-
|
36
|
+
return fieldConfig;
|
37
|
+
},
|
50
38
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
39
|
+
netzkeExtendColumnConfig: function(c){
|
40
|
+
// Set rendeder for association columns (the one displaying associations by the specified method instead of id)
|
41
|
+
if (c.assoc) {
|
42
|
+
// Editor for association column
|
43
|
+
if (c.editor) c.editor = Ext.apply({ name: c.name, netzkeParent: this }, c.editor);
|
56
44
|
|
57
|
-
//
|
58
|
-
|
59
|
-
|
60
|
-
if (c.editor) c.editor = Ext.apply({ name: c.name }, c.editor);
|
45
|
+
// Renderer for association column
|
46
|
+
this.netzkeNormalizeAssociationRenderer(c);
|
47
|
+
}
|
61
48
|
|
62
|
-
|
63
|
-
|
64
|
-
}
|
49
|
+
// extend editor with editorConfig passed from the server
|
50
|
+
if (c.editor) {
|
51
|
+
Ext.apply(c.editor, (c.editorConfig || {}), {selectOnFocus: true});
|
52
|
+
}
|
65
53
|
|
66
|
-
|
67
|
-
|
68
|
-
}
|
54
|
+
// Setting the default filter type
|
55
|
+
if (c.filterable != false && !c.filter) {
|
56
|
+
c.filter = {type: this.netzkeFilterTypeForAttrType(c.type)};
|
57
|
+
}
|
69
58
|
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
if (c.type == 'datetime') {
|
60
|
+
// While for 'date' columns the renderer is set up automatically (through using column's xtype), there's no appropriate xtype for our custom datetime column.
|
61
|
+
// Thus, we need to set the renderer manually.
|
62
|
+
// NOTE: for Ext there's no distinction b/w date and datetime; date fields can include time.
|
63
|
+
if (!c.renderer) {
|
64
|
+
// format in which the data will be rendered; if c.format is nil, Ext.Date.defaultFormat extended with time will be used
|
65
|
+
c.renderer = Ext.util.Format.dateRenderer(c.format || Ext.Date.defaultFormat + " H:i:s");
|
73
66
|
}
|
67
|
+
};
|
74
68
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
}, this);
|
79
|
-
|
80
|
-
// Now reorder columns as specified in this.columnsOrder
|
81
|
-
this.orderColumns();
|
69
|
+
// setting dataIndex
|
70
|
+
c.dataIndex = c.name;
|
82
71
|
},
|
83
72
|
|
84
73
|
// Build column model config with columns in the correct order; columns out of order go to the end.
|
@@ -101,7 +90,7 @@ Ext.define("Netzke.mixins.Basepack.Columns", {
|
|
101
90
|
// We don't need original columns any longer
|
102
91
|
delete this.columns.items;
|
103
92
|
|
104
|
-
// ... instead,
|
93
|
+
// ... instead, use own column model
|
105
94
|
this.columns.items = colModelConfig;
|
106
95
|
},
|
107
96
|
|
@@ -150,7 +139,7 @@ Ext.define("Netzke.mixins.Basepack.Columns", {
|
|
150
139
|
*/
|
151
140
|
netzkeNormalizeAssociationRenderer: function(c) {
|
152
141
|
var passedRenderer = c.renderer, // renderer we got from netzkeNormalizeRenderer
|
153
|
-
|
142
|
+
assocValue;
|
154
143
|
c.scope = this;
|
155
144
|
c.renderer = function(value, a, r, ri, ci, store, view){
|
156
145
|
var column = view.headerCt.items.getAt(ci),
|
@@ -160,8 +149,7 @@ Ext.define("Netzke.mixins.Basepack.Columns", {
|
|
160
149
|
|
161
150
|
if (recordFromStore) {
|
162
151
|
renderedValue = recordFromStore.get('text');
|
163
|
-
} else if (
|
164
|
-
assocValue = metaData.associationValues[c.name];
|
152
|
+
} else if ((assocValue = (r.get('association_values') || {})[c.name]) !== undefined) {
|
165
153
|
renderedValue = (assocValue == undefined) ? c.emptyText : assocValue;
|
166
154
|
} else {
|
167
155
|
renderedValue = value;
|
@@ -177,19 +165,19 @@ Ext.define("Netzke.mixins.Basepack.Columns", {
|
|
177
165
|
cols.push({name: c.name, width: c.width, hidden: c.hidden});
|
178
166
|
});
|
179
167
|
|
180
|
-
this.
|
168
|
+
this.server.saveColumns(cols);
|
181
169
|
},
|
182
170
|
|
183
171
|
// Tries editing the first editable (i.e. not hidden, not read-only) sell
|
184
172
|
netzkeTryStartEditing: function(r){
|
185
173
|
var column = Ext.Array.findBy(this.columns, function(c){
|
186
|
-
return !(c.hidden || c.readOnly || c.
|
174
|
+
return !(c.hidden || c.readOnly || c.type == 'boolean')
|
187
175
|
});
|
188
176
|
|
189
177
|
if (column) {this.getPlugin('celleditor').startEdit(r, column);}
|
190
178
|
},
|
191
179
|
|
192
|
-
netzkeFilterTypeForAttrType: function(
|
180
|
+
netzkeFilterTypeForAttrType: function(type){
|
193
181
|
var map = {
|
194
182
|
integer : 'number',
|
195
183
|
decimal : 'number',
|
@@ -200,10 +188,10 @@ Ext.define("Netzke.mixins.Basepack.Columns", {
|
|
200
188
|
text : 'string',
|
201
189
|
'boolean' : 'boolean'
|
202
190
|
};
|
203
|
-
return map[
|
191
|
+
return map[type] || 'string';
|
204
192
|
},
|
205
193
|
|
206
|
-
netzkeFieldTypeForAttrType: function(
|
194
|
+
netzkeFieldTypeForAttrType: function(type){
|
207
195
|
var map = {
|
208
196
|
integer : 'int',
|
209
197
|
decimal : 'float',
|
@@ -214,6 +202,6 @@ Ext.define("Netzke.mixins.Basepack.Columns", {
|
|
214
202
|
text : 'string',
|
215
203
|
'boolean' : 'boolean'
|
216
204
|
};
|
217
|
-
return map[
|
205
|
+
return map[type] || 'string';
|
218
206
|
}
|
219
207
|
});
|