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
data/LICENSE
CHANGED
@@ -1 +1,7 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2012 nomadcoder
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
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.
|
data/README.md
CHANGED
@@ -1,12 +1,28 @@
|
|
1
|
-
# Netzke Basepack
|
1
|
+
# Netzke Basepack [![Build Status](https://secure.travis-ci.org/nomadcoder/netzke-basepack.png?branch=master)](http://travis-ci.org/nomadcoder/netzke-basepack) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/netzke/netzke-basepack)
|
2
2
|
|
3
|
-
|
3
|
+
[RDocs](http://rdoc.info/github/netzke/netzke-basepack)
|
4
|
+
|
5
|
+
A pack of pre-built [Netzke](http://netzke.org) components that can be used as building blocks for your webapps.
|
6
|
+
|
7
|
+
## Included components
|
8
|
+
|
9
|
+
Basepack includes the following components:
|
10
|
+
|
11
|
+
* [Grid](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/Grid) - a grid panel with a thick bag of features
|
12
|
+
* [Form](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/Form) - a form panel with automatic binding of fields
|
13
|
+
* [TabPanel](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/TabPanel) - a tab panel with support for lazy loading of nested components
|
14
|
+
* [Accordion](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/Accordion) - an accordion panel with support for lazy loading of nested components
|
15
|
+
* [Window](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/Window) - a window which stores its size, position, and maximized state
|
16
|
+
|
17
|
+
Besides, Basepack implements persistence of region sizes and collapsed states of an arbitrary component that uses [border layout](http://docs.sencha.com/ext-js/4-1/#!/api/Ext.layout.container.Border) (see [ItemPersistence](http://rdoc.info/github/netzke/netzke-basepack/Netzke/Basepack/ItemPersistence)).
|
18
|
+
|
19
|
+
For more pre-built components refer to [Netzke Community-pack](https://github.com/netzke/netzke-communitypack).
|
4
20
|
|
5
21
|
## Requirements
|
6
22
|
|
7
|
-
* Ruby 1.9.2
|
8
|
-
* Rails ~> 3.
|
9
|
-
* Ext JS ~> 4.1.
|
23
|
+
* Ruby ~> 1.9.2
|
24
|
+
* Rails ~> 3.2.0
|
25
|
+
* Ext JS ~> 4.1.0
|
10
26
|
|
11
27
|
## Installation
|
12
28
|
|
@@ -16,79 +32,54 @@ In your Gemfile:
|
|
16
32
|
|
17
33
|
For the "edge" stuff, tell bundler to get the gem straight from GitHub:
|
18
34
|
|
19
|
-
gem 'netzke-basepack', :git => "git://github.com/
|
35
|
+
gem 'netzke-basepack', :git => "git://github.com/netzke/netzke-basepack.git"
|
20
36
|
|
21
37
|
## Usage
|
22
38
|
|
23
39
|
Embed a basepack component into a view as any other Netzke component, e.g.:
|
24
40
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
## Testing and playing with Netzke Basepack
|
30
|
-
|
31
|
-
Netzke Basepack is bundled with Cucumber and RSpec tests. If you would like to contribute to the project, you may want to learn how to [run the tests](https://github.com/nomadcoder/netzke-core/wiki/Automated-testing).
|
41
|
+
```erb
|
42
|
+
<%= netzke :books, :class_name => 'Netzke::Basepack::Grid', :model => 'Book' %>
|
43
|
+
```
|
32
44
|
|
33
|
-
|
45
|
+
For more examples, see http://netzke-demo.herokuapp.com ([source code](https://github.com/netzke/netzke-demo)), and look into `test/basepack_test_app`.
|
34
46
|
|
35
|
-
|
47
|
+
## Running tests
|
36
48
|
|
37
|
-
|
49
|
+
The bundled `test/basepack_test_app` application used for automated testing can be easily run as a stand-alone Rails app. It's a good source of concise, focused examples. After starting the application, access any of the test components (located in `app/components`) by using the following url:
|
38
50
|
|
39
|
-
|
40
|
-
To install the test app with DataMapper or Sequel, put ORM=dm or ORM=sq
|
41
|
-
into your environment.
|
42
|
-
For example to set-up DataMapper support run
|
51
|
+
http://localhost:3000/components/{name of the component's class}
|
43
52
|
|
44
|
-
|
45
|
-
ORM=dm bundle install
|
53
|
+
For example [http://localhost:3000/components/BookGrid](http://localhost:3000/components/BookGrid)
|
46
54
|
|
47
|
-
|
55
|
+
Also, you can see the list of test components on the index page (along with links to the source code):
|
48
56
|
|
49
|
-
|
50
|
-
ORM=dm rails s
|
57
|
+
http://localhost:3000/
|
51
58
|
|
52
|
-
|
59
|
+
Before being able run the test app and the tests themselves, you must link your Ext JS library to `test/basepack_test_app/public`, e.g. (from the gems's root):
|
53
60
|
|
54
|
-
|
55
|
-
ORM=dm bundle exec rake
|
61
|
+
$ ln -s ~/code/sencha/ext-4.1.1 test/basepack_test_app/public/extjs
|
56
62
|
|
57
|
-
|
63
|
+
For cucumber tests (from `test/basepack_test_app`):
|
58
64
|
|
59
|
-
|
60
|
-
ActiveRecord is still included in Gemfile of the test app, as netzke-persistance is used which uses ActiveRecord.
|
61
|
-
If you don't use netzke-persistence, then you don't need to include ActiveRecord.
|
65
|
+
$ cucumber features
|
62
66
|
|
63
|
-
##
|
64
|
-
DataMapper support is *incomplete*, as I didn't find a good way to sort by an association's column when the association needs a LEFT OUTER JOIN (i.e. nullable foreign key in many_to_one).
|
67
|
+
## Using ORM other than ActiveRecord
|
65
68
|
|
66
|
-
|
69
|
+
Using ActiveRecord as its default ORM, Basepack is designed to be extendable with data adapters for other ORMs. If you're thinking about implementing an adapter, `AbstractAdapter` and `ActiveRecordAdapter` classes can be used as a reference.
|
67
70
|
|
68
|
-
|
69
|
-
- you can't use polymorphic associations for the time being, as the sequel_polymorphic plugin is not supported by netzke-basepack
|
70
|
-
- SearchPanel is broken atm. When it's fixed, Sequel support for
|
71
|
-
SearchPanel triggered queries should be implemented.
|
71
|
+
There's some work being done in the direction of implementing [DataMapper](https://github.com/nomadcoder/netzke-basepack-dm) and [Sequel](https://github.com/nomadcoder/netzke-basepack-sequel) adapters, but at this moment the code is broken.
|
72
72
|
|
73
73
|
## Icons support
|
74
|
-
Netzke Basepack can make use of FamFamFam Silk icon set (http://www.famfamfam.com/archive/silk-icons-thats-your-lot/). To enable this, download the icons and put the "icons" folder into your app's public/images folder. Then restart your application.
|
75
|
-
|
76
|
-
## Ext 3 support
|
77
|
-
Versions 0.6.x are for you if you're using Ext 3 (*hardly maintained*)
|
78
|
-
|
79
|
-
## Rails 2 support
|
80
|
-
With Rails 2 (and Ext 3 only), use versions 0.5.x (*not maintained*)
|
81
74
|
|
82
|
-
|
83
|
-
Official project site: http://netzke.org
|
84
|
-
|
85
|
-
Twitter:
|
86
|
-
|
87
|
-
* latest news about Netzke: http://twitter.com/netzke
|
88
|
-
* author's tweets on osx, productivity and what not: http://twitter.com/nomadcoder
|
75
|
+
Netzke Basepack can make use of FamFamFam Silk icon set (http://www.famfamfam.com/archive/silk-icons-thats-your-lot/). To enable this, download the icons and put the "icons" folder into your app's public/images folder. Then restart your application.
|
89
76
|
|
90
|
-
|
77
|
+
## Useful links
|
78
|
+
* [Project website](http://netzke.org)
|
79
|
+
* [Live-demo](http://netzke-demo.herokuapp.com)
|
80
|
+
* [Twitter](http://twitter.com/netzke) - latest news about the framework
|
91
81
|
|
92
82
|
---
|
93
|
-
Copyright (c) 2008-
|
94
|
-
|
83
|
+
Copyright (c) 2008-2012 [nomadcoder](https://twitter.com/nomadcoder), released under the MIT license (see LICENSE).
|
84
|
+
|
85
|
+
**Note** that Ext JS is licensed [differently](http://www.sencha.com/products/extjs/license/), and you may need to purchase a commercial license in order to use it in your projects!
|
data/Rakefile
CHANGED
@@ -4,12 +4,12 @@ begin
|
|
4
4
|
Jeweler::Tasks.new do |gemspec|
|
5
5
|
gemspec.version = Netzke::Basepack::Version::STRING
|
6
6
|
gemspec.name = "netzke-basepack"
|
7
|
-
gemspec.summary = "Pre-built Netzke
|
8
|
-
gemspec.description = "A set of
|
7
|
+
gemspec.summary = "Pre-built Netzke components"
|
8
|
+
gemspec.description = "A set of feature-rich extendible Netzke components (such as Form, Grid, Window, TabPanel, etc) which can be used as building block for your RIA"
|
9
9
|
gemspec.email = "nmcoder@gmail.com"
|
10
10
|
gemspec.homepage = "http://netzke.org"
|
11
|
+
gemspec.add_dependency("netzke-core", "~>0.8.0")
|
11
12
|
gemspec.authors = ["nomadcoder"]
|
12
|
-
gemspec.add_dependency("netzke-core", "~>0.7.7")
|
13
13
|
end
|
14
14
|
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
@@ -32,13 +32,13 @@ begin
|
|
32
32
|
|
33
33
|
namespace :yard do
|
34
34
|
desc "Publish docs to api.netzke.org"
|
35
|
-
task :
|
35
|
+
task publish: :yard do
|
36
36
|
dir = 'www/api.netzke.org/basepack'
|
37
37
|
puts "Publishing to fl:#{dir}..."
|
38
38
|
`ssh fl "mkdir -p #{dir}"`
|
39
39
|
`scp -r doc/* fl:#{dir}`
|
40
40
|
end
|
41
41
|
end
|
42
|
-
rescue
|
42
|
+
rescue
|
43
43
|
puts "To enable yard do 'gem install yard'"
|
44
44
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Start xvfb in preparation for cucumber
|
2
|
+
sh -e /etc/init.d/xvfb start
|
3
|
+
|
4
|
+
# fetch extjs
|
5
|
+
wget http://cdn.sencha.io/ext-4.1.1a-gpl.zip
|
6
|
+
unzip -q -d test/basepack_test_app/public/ -n ext-4.1.1a-gpl.zip
|
7
|
+
mv test/basepack_test_app/public/ext-4.1.1a test/basepack_test_app/public/extjs
|
8
|
+
|
9
|
+
# cp db configuration
|
10
|
+
cp test/basepack_test_app/config/database.yml.travis test/basepack_test_app/config/database.yml
|
data/javascripts/basepack.js
CHANGED
@@ -2,143 +2,13 @@ Ext.ns("Netzke.pre");
|
|
2
2
|
Ext.ns("Netzke.pre.Basepack");
|
3
3
|
Ext.ns("Ext.ux.grid");
|
4
4
|
|
5
|
-
Ext.apply(Ext.History, new Ext.util.Observable());
|
6
|
-
|
7
|
-
// A convenient passfield
|
8
|
-
// Ext.netzke.PassField = Ext.extend(Ext.form.TextField, {
|
9
|
-
// inputType: 'password'
|
10
|
-
// });
|
11
|
-
// Ext.reg('passfield', Ext.netzke.PassField);
|
12
|
-
|
13
|
-
// Ext.override(Ext.ux.form.DateTimeField, {
|
14
|
-
// format: "Y-m-d",
|
15
|
-
// timeFormat: "g:i:s",
|
16
|
-
// picker: {
|
17
|
-
// minIncremenet: 15
|
18
|
-
// }
|
19
|
-
// });
|
20
|
-
|
21
|
-
// ComboBox that gets options from the server (used in both grids and panels)
|
22
|
-
Ext.define('Ext.netzke.ComboBox', {
|
23
|
-
extend : 'Ext.form.field.ComboBox',
|
24
|
-
alias : 'widget.netzkeremotecombo',
|
25
|
-
valueField : 'value',
|
26
|
-
displayField : 'text',
|
27
|
-
triggerAction : 'all',
|
28
|
-
// WIP: Breaking - should not be 'true' if combobox is not editable
|
29
|
-
// typeAhead : true,
|
30
|
-
|
31
|
-
// getDisplayValue: function() {
|
32
|
-
// return this.getValue() == 0 ? this.emptyText : this.callOverridden();
|
33
|
-
// },
|
34
|
-
|
35
|
-
initComponent : function(){
|
36
|
-
var modelName = this.parentId + "_" + this.name;
|
37
|
-
|
38
|
-
if (this.blankLine == undefined) this.blankLine = "---";
|
39
|
-
|
40
|
-
Ext.define(modelName, {
|
41
|
-
extend: 'Ext.data.Model',
|
42
|
-
fields: ['value', 'text']
|
43
|
-
});
|
44
|
-
|
45
|
-
var store = new Ext.data.Store({
|
46
|
-
model: modelName,
|
47
|
-
proxy: {
|
48
|
-
type: 'direct',
|
49
|
-
directFn: Netzke.providers[this.parentId].getComboboxOptions,
|
50
|
-
reader: {
|
51
|
-
type: 'array',
|
52
|
-
root: 'data'
|
53
|
-
}
|
54
|
-
}
|
55
|
-
});
|
56
|
-
|
57
|
-
store.on('beforeload', function(self, params) {
|
58
|
-
params.params.column = this.name;
|
59
|
-
},this);
|
60
|
-
|
61
|
-
// insert a selectable "blank line" which allows to remove the associated record
|
62
|
-
if (this.blankLine) {
|
63
|
-
store.on('load', function(self, params) {
|
64
|
-
// append a selectable "empty line" which will allow remove the association
|
65
|
-
self.add(Ext.create(modelName, {value: -1, text: this.blankLine}));
|
66
|
-
}, this);
|
67
|
-
}
|
68
|
-
|
69
|
-
// If inline data was passed (TODO: is this actually working?)
|
70
|
-
if (this.store) store.loadData({data: this.store});
|
71
|
-
|
72
|
-
this.store = store;
|
73
|
-
|
74
|
-
this.callParent();
|
75
|
-
},
|
76
|
-
|
77
|
-
});
|
78
|
-
|
79
5
|
Ext.util.Format.mask = function(v){
|
80
6
|
return "********";
|
81
7
|
};
|
82
8
|
|
83
|
-
// Ext.netzke.JsonField = Ext.extend(Ext.form.TextField, {
|
84
|
-
// validator: function(value) {
|
85
|
-
// try{
|
86
|
-
// var d = Ext.decode(value);
|
87
|
-
// return true;
|
88
|
-
// } catch(e) {
|
89
|
-
// return "Invalid JSON"
|
90
|
-
// }
|
91
|
-
// }
|
92
|
-
//
|
93
|
-
// ,setValue: function(value) {
|
94
|
-
// this.setRawValue(Ext.encode(value));
|
95
|
-
// }
|
96
|
-
//
|
97
|
-
// });
|
98
|
-
//
|
99
|
-
// Ext.reg('jsonfield', Ext.netzke.JsonField);
|
100
|
-
//
|
101
|
-
// WIP: todo - rewrite Ext.lib calls below
|
102
|
-
// Ext.grid.HeaderDropZone.prototype.onNodeDrop = function(n, dd, e, data){
|
103
|
-
// var h = data.header;
|
104
|
-
// if(h != n){
|
105
|
-
// var cm = this.grid.colModel;
|
106
|
-
// var x = Ext.lib.Event.getPageX(e);
|
107
|
-
// var r = Ext.lib.Dom.getRegion(n.firstChild);
|
108
|
-
// var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";
|
109
|
-
// var oldIndex = this.view.getCellIndex(h);
|
110
|
-
// var newIndex = this.view.getCellIndex(n);
|
111
|
-
// if(pt == "after"){
|
112
|
-
// newIndex++;
|
113
|
-
// }
|
114
|
-
// if(oldIndex < newIndex){
|
115
|
-
// newIndex--;
|
116
|
-
// }
|
117
|
-
// cm.moveColumn(oldIndex, newIndex);
|
118
|
-
// return true;
|
119
|
-
// }
|
120
|
-
// return false;
|
121
|
-
// };
|
122
|
-
//
|
123
|
-
//
|
124
|
-
// Ext.ns('Ext.ux.form');
|
125
|
-
|
126
9
|
Ext.define('Ext.ux.form.TriCheckbox', {
|
127
10
|
extend: 'Ext.form.field.ComboBox',
|
128
11
|
alias: 'widget.tricheckbox',
|
129
12
|
store: [[true, "Yes"], [false, "No"]],
|
130
13
|
forceSelection: true
|
131
14
|
});
|
132
|
-
|
133
|
-
// Enabling checkbox submission when unchecked
|
134
|
-
// TODO: it would be nice to standardize return values
|
135
|
-
// because currently checkboxes return "on", if checked,
|
136
|
-
// and boolean 'false' otherwise. It's not nice
|
137
|
-
// MAV
|
138
|
-
// TODO: maybe we should simply initialize 'uncheckedValue' somewhere else,
|
139
|
-
// instead
|
140
|
-
Ext.override( Ext.form.field.Checkbox, {
|
141
|
-
getSubmitValue: function() {
|
142
|
-
return this.callOverridden() || false; // 'off';
|
143
|
-
}
|
144
|
-
});
|
@@ -0,0 +1,59 @@
|
|
1
|
+
// ComboBox that gets options from the server (used in both grids and panels)
|
2
|
+
Ext.define('Ext.netzke.ComboBox', {
|
3
|
+
extend : 'Ext.form.field.ComboBox',
|
4
|
+
alias : 'widget.netzkeremotecombo',
|
5
|
+
valueField : 'value',
|
6
|
+
displayField : 'text',
|
7
|
+
triggerAction : 'all',
|
8
|
+
forceSelection: true,
|
9
|
+
|
10
|
+
// WIP: Breaking - should not be 'true' if combobox is not editable
|
11
|
+
// typeAhead : true,
|
12
|
+
|
13
|
+
// getDisplayValue: function() {
|
14
|
+
// return this.getValue() == 0 ? this.emptyText : this.callOverridden();
|
15
|
+
// },
|
16
|
+
|
17
|
+
initComponent : function(){
|
18
|
+
var modelName = this.parentId + "_" + this.name;
|
19
|
+
|
20
|
+
if (this.blankLine == undefined) this.blankLine = "---";
|
21
|
+
|
22
|
+
Ext.define(modelName, {
|
23
|
+
extend: 'Ext.data.Model',
|
24
|
+
fields: ['value', 'text']
|
25
|
+
});
|
26
|
+
|
27
|
+
var store = new Ext.data.Store({
|
28
|
+
model: modelName,
|
29
|
+
proxy: {
|
30
|
+
type: 'direct',
|
31
|
+
directFn: Netzke.providers[this.parentId].getComboboxOptions,
|
32
|
+
reader: {
|
33
|
+
type: 'array',
|
34
|
+
root: 'data'
|
35
|
+
}
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
store.on('beforeload', function(self, params) {
|
40
|
+
params.params.attr = this.name;
|
41
|
+
},this);
|
42
|
+
|
43
|
+
// insert a selectable "blank line" which allows to remove the associated record
|
44
|
+
if (this.blankLine) {
|
45
|
+
store.on('load', function(self, params) {
|
46
|
+
// append a selectable "empty line" which will allow remove the association
|
47
|
+
self.add(Ext.create(modelName, {value: -1, text: this.blankLine}));
|
48
|
+
}, this);
|
49
|
+
}
|
50
|
+
|
51
|
+
// If inline data was passed (TODO: is this actually working?)
|
52
|
+
if (this.store) store.loadData({data: this.store});
|
53
|
+
|
54
|
+
this.store = store;
|
55
|
+
|
56
|
+
this.callParent();
|
57
|
+
},
|
58
|
+
|
59
|
+
});
|
data/lib/netzke/basepack.rb
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
require 'netzke/basepack/version'
|
2
2
|
|
3
|
+
require 'netzke/basepack/data_adapters/abstract_adapter'
|
4
|
+
|
3
5
|
if defined? ActiveRecord
|
4
|
-
require 'netzke/active_record'
|
5
|
-
|
6
|
-
if defined? DataMapper
|
7
|
-
require 'netzke/data_mapper'
|
8
|
-
end
|
9
|
-
if defined? Sequel
|
10
|
-
require 'netzke/sequel'
|
6
|
+
require 'netzke/basepack/active_record'
|
7
|
+
require 'netzke/basepack/data_adapters/active_record_adapter'
|
11
8
|
end
|
12
9
|
|
13
|
-
require 'netzke/basepack/
|
14
|
-
require 'netzke/basepack/data_adapters/active_record_adapter' if defined? ActiveRecord
|
15
|
-
require 'netzke/basepack/data_adapters/data_mapper_adapter' if defined? DataMapper
|
16
|
-
require 'netzke/basepack/data_adapters/sequel_adapter' if defined? Sequel
|
10
|
+
require 'netzke/basepack/item_persistence'
|
17
11
|
|
18
12
|
module Netzke
|
19
13
|
module Basepack
|
@@ -25,13 +19,14 @@ module Netzke
|
|
25
19
|
|
26
20
|
# Called from netzke-basepack.rb
|
27
21
|
def init
|
28
|
-
|
29
|
-
|
22
|
+
%w[netzkeremotecombo xdatetime basepack].each do |name|
|
23
|
+
Netzke::Core.ext_javascripts << "#{File.dirname(__FILE__)}/../../javascripts/#{name}.js"
|
24
|
+
end
|
30
25
|
|
31
26
|
Netzke::Core.ext_stylesheets << "#{File.dirname(__FILE__)}/../../stylesheets/basepack.css"
|
32
27
|
end
|
33
28
|
|
34
|
-
# Use
|
29
|
+
# Use this to confirure Basepack in the initializers, e.g.:
|
35
30
|
#
|
36
31
|
# Netzke::Basepack.setup do |config|
|
37
32
|
# config.icons_uri = "/images/famfamfam/icons"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Netzke
|
2
|
+
module Basepack
|
3
|
+
# A panel with the 'accordion' layout. By default, lazily loads its nested components. For example:
|
4
|
+
#
|
5
|
+
# class MyAccordion < Netzke::Basepack::Accordion
|
6
|
+
# def configure(c)
|
7
|
+
# super
|
8
|
+
# c.items = [{
|
9
|
+
# # just an Ext panel
|
10
|
+
# :html => "I'm a simple Ext.Panel",
|
11
|
+
# :title => "Panel One"
|
12
|
+
# },{
|
13
|
+
# # a Netzke component
|
14
|
+
# :component => :my_component,
|
15
|
+
# :title => "Panel Two"
|
16
|
+
# }]
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# component :my_component
|
20
|
+
# end
|
21
|
+
class Accordion < Netzke::Base
|
22
|
+
|
23
|
+
include WrapLazyLoaded
|
24
|
+
|
25
|
+
js_configure do |c|
|
26
|
+
c.layout = :accordion
|
27
|
+
|
28
|
+
c.init_component = <<-JS
|
29
|
+
function(params){
|
30
|
+
this.callParent();
|
31
|
+
this.items.each(function(item){
|
32
|
+
item.on('expand', function(i){
|
33
|
+
if (i && i.wrappedComponent && !i.items.first() && !i.beingLoaded) {
|
34
|
+
i.beingLoaded = true; // prevent more than one request per panel in case of fast clicking
|
35
|
+
this.netzkeLoadComponent(i.wrappedComponent, {container: i.id, callback: function(){i.beingLoaded = false}});
|
36
|
+
}
|
37
|
+
}, this);
|
38
|
+
}, this);
|
39
|
+
}
|
40
|
+
JS
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|