netzke-basepack-zh 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.rdoc +445 -0
- data/LICENSE +1 -0
- data/README.md +94 -0
- data/Rakefile +44 -0
- data/TODO.rdoc +8 -0
- data/config/ci/before-travis.sh +28 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/javascripts/basepack.js +139 -0
- data/javascripts/xdatetime.js +196 -0
- data/lib/generators/netzke/basepack_generator.rb +10 -0
- data/lib/generators/netzke/templates/assets/ts-checkbox.gif +0 -0
- data/lib/generators/netzke/templates/create_netzke_field_lists.rb +18 -0
- data/lib/netzke-basepack.rb +26 -0
- data/lib/netzke/active_record.rb +20 -0
- data/lib/netzke/active_record/attributes.rb +256 -0
- data/lib/netzke/active_record/combobox_options.rb +16 -0
- data/lib/netzke/active_record/relation_extensions.rb +37 -0
- data/lib/netzke/basepack.rb +45 -0
- data/lib/netzke/basepack/accordion_panel.rb +39 -0
- data/lib/netzke/basepack/action_column.rb +68 -0
- data/lib/netzke/basepack/action_column/javascripts/action_column.js +61 -0
- data/lib/netzke/basepack/auth_app.rb +159 -0
- data/lib/netzke/basepack/basic_app.rb +7 -0
- data/lib/netzke/basepack/border_layout_panel.rb +53 -0
- data/lib/netzke/basepack/border_layout_panel/javascripts/border_layout_panel.js +40 -0
- data/lib/netzke/basepack/data_accessor.rb +53 -0
- data/lib/netzke/basepack/data_adapters/abstract_adapter.rb +164 -0
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +279 -0
- data/lib/netzke/basepack/data_adapters/data_mapper_adapter.rb +264 -0
- data/lib/netzke/basepack/data_adapters/sequel_adapter.rb +260 -0
- data/lib/netzke/basepack/form_panel.rb +144 -0
- data/lib/netzke/basepack/form_panel/fields.rb +208 -0
- data/lib/netzke/basepack/form_panel/javascripts/comma_list_cbg.js +51 -0
- data/lib/netzke/basepack/form_panel/javascripts/form_panel.js +225 -0
- data/lib/netzke/basepack/form_panel/javascripts/misc.js +4 -0
- data/lib/netzke/basepack/form_panel/javascripts/n_radio_group.js +43 -0
- data/lib/netzke/basepack/form_panel/javascripts/readonly_mode.js +35 -0
- data/lib/netzke/basepack/form_panel/services.rb +142 -0
- data/lib/netzke/basepack/form_panel/stylesheets/readonly_mode.css +14 -0
- data/lib/netzke/basepack/grid_panel.rb +440 -0
- data/lib/netzke/basepack/grid_panel/columns.rb +394 -0
- data/lib/netzke/basepack/grid_panel/javascripts/advanced_search.js +27 -0
- data/lib/netzke/basepack/grid_panel/javascripts/check_column_fix.js +6 -0
- data/lib/netzke/basepack/grid_panel/javascripts/edit_in_form.js +51 -0
- data/lib/netzke/basepack/grid_panel/javascripts/event_handling.js +179 -0
- data/lib/netzke/basepack/grid_panel/javascripts/grid_panel.js +438 -0
- data/lib/netzke/basepack/grid_panel/javascripts/misc.js +4 -0
- data/lib/netzke/basepack/grid_panel/javascripts/rows-dd.js +281 -0
- data/lib/netzke/basepack/grid_panel/record_form_window.rb +41 -0
- data/lib/netzke/basepack/grid_panel/services.rb +235 -0
- data/lib/netzke/basepack/paging_form_panel.rb +72 -0
- data/lib/netzke/basepack/paging_form_panel/javascripts/paging_form_panel.js +76 -0
- data/lib/netzke/basepack/panel.rb +11 -0
- data/lib/netzke/basepack/query_builder.rb +107 -0
- data/lib/netzke/basepack/query_builder/javascripts/query_builder.js +153 -0
- data/lib/netzke/basepack/search_panel.rb +79 -0
- data/lib/netzke/basepack/search_panel/javascripts/condition_field.js +160 -0
- data/lib/netzke/basepack/search_panel/javascripts/search_panel.js +65 -0
- data/lib/netzke/basepack/search_window.rb +66 -0
- data/lib/netzke/basepack/simple_app.rb +104 -0
- data/lib/netzke/basepack/simple_app/javascripts/simple_app.js +64 -0
- data/lib/netzke/basepack/simple_app/javascripts/statusbar_ext.js +8 -0
- data/lib/netzke/basepack/tab_panel.rb +21 -0
- data/lib/netzke/basepack/tab_panel/javascripts/tab_panel.js +11 -0
- data/lib/netzke/basepack/version.rb +11 -0
- data/lib/netzke/basepack/window.rb +29 -0
- data/lib/netzke/basepack/window/javascripts/window.js +20 -0
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +28 -0
- data/lib/netzke/basepack/wrapper.rb +28 -0
- data/lib/netzke/data_mapper.rb +18 -0
- data/lib/netzke/data_mapper/attributes.rb +273 -0
- data/lib/netzke/data_mapper/combobox_options.rb +11 -0
- data/lib/netzke/data_mapper/relation_extensions.rb +38 -0
- data/lib/netzke/sequel.rb +18 -0
- data/lib/netzke/sequel/attributes.rb +274 -0
- data/lib/netzke/sequel/combobox_options.rb +10 -0
- data/lib/netzke/sequel/relation_extensions.rb +40 -0
- data/lib/tasks/netzke_basepack_tasks.rake +4 -0
- data/locales/de.yml +79 -0
- data/locales/en.yml +79 -0
- data/netzke-basepack.gemspec +306 -0
- data/stylesheets/basepack.css +72 -0
- data/stylesheets/datetimefield.css +54 -0
- data/test/basepack_test_app/.gitignore +6 -0
- data/test/basepack_test_app/.rvmrc +1 -0
- data/test/basepack_test_app/Gemfile +59 -0
- data/test/basepack_test_app/Gemfile.lock +196 -0
- data/test/basepack_test_app/Guardfile +46 -0
- data/test/basepack_test_app/README +1 -0
- data/test/basepack_test_app/Rakefile +7 -0
- data/test/basepack_test_app/app/components/author_form.rb +32 -0
- data/test/basepack_test_app/app/components/author_grid.rb +3 -0
- data/test/basepack_test_app/app/components/book_form.rb +38 -0
- data/test/basepack_test_app/app/components/book_form_with_custom_fields.rb +21 -0
- data/test/basepack_test_app/app/components/book_form_with_defaults.rb +8 -0
- data/test/basepack_test_app/app/components/book_form_with_nested_attributes.rb +18 -0
- data/test/basepack_test_app/app/components/book_grid.rb +12 -0
- data/test/basepack_test_app/app/components/book_grid_filtering.rb +10 -0
- data/test/basepack_test_app/app/components/book_grid_loader.rb +24 -0
- data/test/basepack_test_app/app/components/book_grid_with_column_actions.rb +15 -0
- data/test/basepack_test_app/app/components/book_grid_with_custom_columns.rb +27 -0
- data/test/basepack_test_app/app/components/book_grid_with_default_values.rb +9 -0
- data/test/basepack_test_app/app/components/book_grid_with_extra_feedback.rb +8 -0
- data/test/basepack_test_app/app/components/book_grid_with_extra_filters.rb +14 -0
- data/test/basepack_test_app/app/components/book_grid_with_nested_attributes.rb +13 -0
- data/test/basepack_test_app/app/components/book_grid_with_overridden_columns.rb +15 -0
- data/test/basepack_test_app/app/components/book_grid_with_paging.rb +10 -0
- data/test/basepack_test_app/app/components/book_grid_with_persistence.rb +8 -0
- data/test/basepack_test_app/app/components/book_grid_with_scoped_authors.rb +8 -0
- data/test/basepack_test_app/app/components/book_grid_with_virtual_attributes.rb +21 -0
- data/test/basepack_test_app/app/components/book_paging_form_panel.rb +22 -0
- data/test/basepack_test_app/app/components/book_query_builder.rb +8 -0
- data/test/basepack_test_app/app/components/book_search_panel.rb +5 -0
- data/test/basepack_test_app/app/components/book_search_panel/javascripts/i18n_de.js +6 -0
- data/test/basepack_test_app/app/components/book_with_custom_primary_key_grid.rb +10 -0
- data/test/basepack_test_app/app/components/books_bound_to_author.rb +10 -0
- data/test/basepack_test_app/app/components/double_book_grid.rb +18 -0
- data/test/basepack_test_app/app/components/extras/book_presentation.rb +27 -0
- data/test/basepack_test_app/app/components/form_without_model.rb +21 -0
- data/test/basepack_test_app/app/components/generic_user_form.rb +12 -0
- data/test/basepack_test_app/app/components/lockable_book_form.rb +17 -0
- data/test/basepack_test_app/app/components/lockable_user_form.rb +7 -0
- data/test/basepack_test_app/app/components/paging_form_with_search.rb +40 -0
- data/test/basepack_test_app/app/components/simple_accordion.rb +11 -0
- data/test/basepack_test_app/app/components/simple_panel.rb +17 -0
- data/test/basepack_test_app/app/components/simple_tab_panel.rb +11 -0
- data/test/basepack_test_app/app/components/simple_window.rb +10 -0
- data/test/basepack_test_app/app/components/simple_wrapper.rb +7 -0
- data/test/basepack_test_app/app/components/some_accordion_panel.rb +22 -0
- data/test/basepack_test_app/app/components/some_auth_app.rb +32 -0
- data/test/basepack_test_app/app/components/some_border_layout.rb +28 -0
- data/test/basepack_test_app/app/components/some_simple_app.rb +35 -0
- data/test/basepack_test_app/app/components/some_tab_panel.rb +20 -0
- data/test/basepack_test_app/app/components/user_form.rb +25 -0
- data/test/basepack_test_app/app/components/user_form_with_default_fields.rb +8 -0
- data/test/basepack_test_app/app/components/user_grid.rb +8 -0
- data/test/basepack_test_app/app/components/user_grid_with_customized_form_fields.rb +18 -0
- data/test/basepack_test_app/app/components/window_component_loader.rb +27 -0
- data/test/basepack_test_app/app/controllers/application_controller.rb +9 -0
- data/test/basepack_test_app/app/controllers/components_controller.rb +10 -0
- data/test/basepack_test_app/app/controllers/welcome_controller.rb +9 -0
- data/test/basepack_test_app/app/helpers/application_helper.rb +8 -0
- data/test/basepack_test_app/app/helpers/embedded_components_helper.rb +2 -0
- data/test/basepack_test_app/app/models/address.rb +29 -0
- data/test/basepack_test_app/app/models/author.rb +38 -0
- data/test/basepack_test_app/app/models/book.rb +49 -0
- data/test/basepack_test_app/app/models/book_with_custom_primary_key.rb +26 -0
- data/test/basepack_test_app/app/models/role.rb +24 -0
- data/test/basepack_test_app/app/models/user.rb +29 -0
- data/test/basepack_test_app/app/presenters/forms/generic_user.rb +6 -0
- data/test/basepack_test_app/app/views/components/loadable_window.html.erb +9 -0
- data/test/basepack_test_app/app/views/components/simple_panel.html.erb +1 -0
- data/test/basepack_test_app/app/views/layouts/application.html.erb +12 -0
- data/test/basepack_test_app/app/views/layouts/components.html.erb +13 -0
- data/test/basepack_test_app/app/views/layouts/nested.html.erb +5 -0
- data/test/basepack_test_app/app/views/welcome/index.html.erb +10 -0
- data/test/basepack_test_app/config.ru +4 -0
- data/test/basepack_test_app/config/application.rb +57 -0
- data/test/basepack_test_app/config/boot.rb +13 -0
- data/test/basepack_test_app/config/cucumber.yml +8 -0
- data/test/basepack_test_app/config/database.yml.sample +41 -0
- data/test/basepack_test_app/config/database.yml.travis +15 -0
- data/test/basepack_test_app/config/environment.rb +6 -0
- data/test/basepack_test_app/config/environments/development.rb +22 -0
- data/test/basepack_test_app/config/environments/production.rb +49 -0
- data/test/basepack_test_app/config/environments/test.rb +35 -0
- data/test/basepack_test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/basepack_test_app/config/initializers/data_mapper_logging.rb +3 -0
- data/test/basepack_test_app/config/initializers/inflections.rb +10 -0
- data/test/basepack_test_app/config/initializers/mime_types.rb +5 -0
- data/test/basepack_test_app/config/initializers/netzke.rb +9 -0
- data/test/basepack_test_app/config/initializers/secret_token.rb +7 -0
- data/test/basepack_test_app/config/initializers/sequel.rb +26 -0
- data/test/basepack_test_app/config/initializers/session_store.rb +8 -0
- data/test/basepack_test_app/config/locales/de.yml +35 -0
- data/test/basepack_test_app/config/locales/es.yml +96 -0
- data/test/basepack_test_app/config/routes.rb +68 -0
- data/test/basepack_test_app/db/development_structure.sql +88 -0
- data/test/basepack_test_app/db/migrate/20100914104207_create_users.rb +15 -0
- data/test/basepack_test_app/db/migrate/20100914104236_create_roles.rb +13 -0
- data/test/basepack_test_app/db/migrate/20101026185816_create_authors.rb +14 -0
- data/test/basepack_test_app/db/migrate/20101026190021_create_books.rb +19 -0
- data/test/basepack_test_app/db/migrate/20110101143818_create_addresses.rb +17 -0
- data/test/basepack_test_app/db/migrate/20110213213050_create_netzke_component_states.rb +20 -0
- data/test/basepack_test_app/db/migrate/20110701070052_create_book_with_custom_primary_keys.rb +15 -0
- data/test/basepack_test_app/db/migrate/20110901114016_add_last_read_at_to_books.rb +9 -0
- data/test/basepack_test_app/db/migrate/20110909071740_add_published_on_to_books.rb +5 -0
- data/test/basepack_test_app/db/schema.rb +81 -0
- data/test/basepack_test_app/db/seeds.rb +44 -0
- data/test/basepack_test_app/features/accordion_panel.feature +12 -0
- data/test/basepack_test_app/features/components_in_view.feature +11 -0
- data/test/basepack_test_app/features/form_panel.feature +142 -0
- data/test/basepack_test_app/features/grid_panel.feature +277 -0
- data/test/basepack_test_app/features/grid_panel_filters.feature +73 -0
- data/test/basepack_test_app/features/grid_panel_with_custom_primary_key.feature +15 -0
- data/test/basepack_test_app/features/grid_sorting.feature +47 -0
- data/test/basepack_test_app/features/i18n.feature +18 -0
- data/test/basepack_test_app/features/nested_attributes.feature +26 -0
- data/test/basepack_test_app/features/paging_form_panel.feature +43 -0
- data/test/basepack_test_app/features/search_in_grid.feature +49 -0
- data/test/basepack_test_app/features/simple_app.feature +15 -0
- data/test/basepack_test_app/features/simple_panel.feature +11 -0
- data/test/basepack_test_app/features/step_definitions/accordion_steps.rb +5 -0
- data/test/basepack_test_app/features/step_definitions/ext_steps.rb +16 -0
- data/test/basepack_test_app/features/step_definitions/form_panel_steps.rb +46 -0
- data/test/basepack_test_app/features/step_definitions/generic_steps.rb +44 -0
- data/test/basepack_test_app/features/step_definitions/grid_panel_steps.rb +186 -0
- data/test/basepack_test_app/features/step_definitions/pickle_steps.rb +100 -0
- data/test/basepack_test_app/features/step_definitions/web_steps.rb +219 -0
- data/test/basepack_test_app/features/support/env.rb +81 -0
- data/test/basepack_test_app/features/support/paths.rb +65 -0
- data/test/basepack_test_app/features/support/pickle.rb +24 -0
- data/test/basepack_test_app/features/support/selectors.rb +39 -0
- data/test/basepack_test_app/features/tab_panel.feature +12 -0
- data/test/basepack_test_app/features/validations_in_grid.feature +13 -0
- data/test/basepack_test_app/features/virtual_attributes.feature +16 -0
- data/test/basepack_test_app/features/window.feature +11 -0
- data/test/basepack_test_app/lib/tasks/.gitkeep +0 -0
- data/test/basepack_test_app/lib/tasks/cucumber.rake +71 -0
- data/test/basepack_test_app/lib/tasks/travis.rake +7 -0
- data/test/basepack_test_app/public/404.html +26 -0
- data/test/basepack_test_app/public/422.html +26 -0
- data/test/basepack_test_app/public/500.html +26 -0
- data/test/basepack_test_app/public/favicon.ico +0 -0
- data/test/basepack_test_app/public/images/header-deco.gif +0 -0
- data/test/basepack_test_app/public/images/rails.png +0 -0
- data/test/basepack_test_app/public/javascripts/application.js +2 -0
- data/test/basepack_test_app/public/javascripts/controls.js +965 -0
- data/test/basepack_test_app/public/javascripts/dragdrop.js +974 -0
- data/test/basepack_test_app/public/javascripts/effects.js +1123 -0
- data/test/basepack_test_app/public/javascripts/prototype.js +6001 -0
- data/test/basepack_test_app/public/javascripts/rails.js +175 -0
- data/test/basepack_test_app/public/robots.txt +5 -0
- data/test/basepack_test_app/public/stylesheets/.gitkeep +0 -0
- data/test/basepack_test_app/script/cucumber +10 -0
- data/test/basepack_test_app/script/rails +6 -0
- data/test/basepack_test_app/spec/components/form_panel_spec.rb +53 -0
- data/test/basepack_test_app/spec/components/grid_panel_spec.rb +10 -0
- data/test/basepack_test_app/spec/data_adapter/adapter_spec.rb +68 -0
- data/test/basepack_test_app/spec/data_adapter/attributes_spec.rb +56 -0
- data/test/basepack_test_app/spec/data_adapter/relation_extensions_spec.rb +125 -0
- data/test/basepack_test_app/spec/factories.rb +28 -0
- data/test/basepack_test_app/spec/spec_helper.rb +39 -0
- data/test/basepack_test_app/test/performance/browsing_test.rb +9 -0
- data/test/basepack_test_app/test/test_helper.rb +13 -0
- data/test/basepack_test_app/vendor/plugins/.gitkeep +0 -0
- data/test/console_with_fixtures.rb +4 -0
- data/test/fixtures/books.yml +11 -0
- data/test/fixtures/categories.yml +7 -0
- data/test/fixtures/cities.yml +21 -0
- data/test/fixtures/continents.yml +7 -0
- data/test/fixtures/countries.yml +9 -0
- data/test/fixtures/genres.yml +9 -0
- data/test/fixtures/roles.yml +8 -0
- data/test/fixtures/users.yml +11 -0
- data/test/schema.rb +10 -0
- data/test/test_helper.rb +21 -0
- data/test/unit/accordion_panel_test.rb +20 -0
- data/test/unit/active_record_basepack_test.rb +54 -0
- data/test/unit/fields_configuration_test.rb +18 -0
- data/test/unit/grid_panel_test.rb +52 -0
- data/test/unit/netzke_basepack_test.rb +4 -0
- data/test/unit/tab_panel_test.rb +21 -0
- data/uninstall.rb +1 -0
- metadata +332 -0
data/LICENSE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Copyright (c) 2008-2009 Sergei Kozlov, released under the MIT license
|
data/README.md
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# Netzke Basepack
|
2
|
+
|
3
|
+
A pack of pre-built [Netzke](http://netzke.org) components - such as grid, form, tab panel, etc.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
* Ruby 1.9.2
|
8
|
+
* Rails ~> 3.1.0
|
9
|
+
* Ext JS ~> 4.1.x
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
In your Gemfile:
|
14
|
+
|
15
|
+
gem 'netzke-basepack'
|
16
|
+
|
17
|
+
For the "edge" stuff, tell bundler to get the gem straight from GitHub:
|
18
|
+
|
19
|
+
gem 'netzke-basepack', :git => "git://github.com/skozlov/netzke-basepack.git"
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Embed a basepack component into a view as any other Netzke component, e.g.:
|
24
|
+
|
25
|
+
<%= netzke :books, :class_name => 'Netzke::Basepack::GridPanel', :model => 'Book' %>
|
26
|
+
|
27
|
+
For more examples, see http://demo.netzke.com, and look into test/basepack_test_app.
|
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/skozlov/netzke-core/wiki/Automated-testing).
|
32
|
+
|
33
|
+
Besides, the bundled test application is a convenient [playground](https://github.com/skozlov/netzke-core/wiki/Playground) for those who search to experiment with the framework.
|
34
|
+
|
35
|
+
After starting up the test app, you can see the list of functional test components on the index page (along with links to the source code):
|
36
|
+
|
37
|
+
http://localhost:3000/
|
38
|
+
|
39
|
+
## Note on testing with DataMapper/Sequel Support
|
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
|
43
|
+
|
44
|
+
# in test/basepack_test_app
|
45
|
+
ORM=dm bundle install
|
46
|
+
|
47
|
+
To run the test app in DataMapper-Mode (will use DataMapper models instead of ActiveRecord models)
|
48
|
+
|
49
|
+
# in test/basepack_test_app
|
50
|
+
ORM=dm rails s
|
51
|
+
|
52
|
+
To run the test suite
|
53
|
+
|
54
|
+
# in test/basepack_test_app
|
55
|
+
ORM=dm bundle exec rake
|
56
|
+
|
57
|
+
etc.
|
58
|
+
|
59
|
+
NOTE: netzke-basepack is not dependant on neither DataMapper nor Sequel. It will pick the right DataAdapter for your models automatically.
|
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.
|
62
|
+
|
63
|
+
## DataMapper support
|
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).
|
65
|
+
|
66
|
+
## Sequel support
|
67
|
+
|
68
|
+
CAVEATS:
|
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.
|
72
|
+
|
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
|
+
|
82
|
+
## More info
|
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
|
89
|
+
|
90
|
+
Many (if a bit outdated) tutorials: http://blog.writelesscode.com
|
91
|
+
|
92
|
+
---
|
93
|
+
Copyright (c) 2008-2011 NomadCoder, released under the MIT license
|
94
|
+
Note, that Ext JS itself is licensed [differently](http://www.sencha.com/products/extjs/license/)
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
require './lib/netzke/basepack/version'
|
4
|
+
Jeweler::Tasks.new do |gemspec|
|
5
|
+
gemspec.version = Netzke::Basepack::Version::STRING
|
6
|
+
gemspec.name = "netzke-basepack"
|
7
|
+
gemspec.summary = "Pre-built Rails + ExtJS components for your RIA"
|
8
|
+
gemspec.description = "A set of full-featured extendible Netzke components (such as FormPanel, GridPanel, Window, BorderLayoutPanel, etc) which can be used as building block for your RIA"
|
9
|
+
gemspec.email = "nmcoder@gmail.com"
|
10
|
+
gemspec.homepage = "http://netzke.org"
|
11
|
+
gemspec.authors = ["Denis Gorin"]
|
12
|
+
gemspec.add_dependency("netzke-core", "~>0.7.6")
|
13
|
+
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rake/rdoctask'
|
27
|
+
Rake::RDocTask.new do |rdoc|
|
28
|
+
require './lib/netzke/basepack/version'
|
29
|
+
version = Netzke::Basepack::Version::STRING
|
30
|
+
|
31
|
+
rdoc.rdoc_dir = 'rdoc'
|
32
|
+
rdoc.title = "netzke-basepack #{version}"
|
33
|
+
# rdoc.main = "README.rdoc"
|
34
|
+
rdoc.rdoc_files.include('README*')
|
35
|
+
rdoc.rdoc_files.include('CHANGELOG*')
|
36
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
+
end
|
38
|
+
|
39
|
+
namespace :rdoc do
|
40
|
+
desc "Publish rdocs"
|
41
|
+
task :publish => :rdoc do
|
42
|
+
`scp -r rdoc/* fl:www/api.netzke.org/basepack`
|
43
|
+
end
|
44
|
+
end
|
data/TODO.rdoc
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
== Priority
|
2
|
+
* Commit persistence migrations in the test app
|
3
|
+
* DataAccessor#to_array should not rescue exceptions, but rather check the availability of the attributes; `respond_to_with_basepack?` should be extended to also return true for association columns
|
4
|
+
* GridPanel's read_only vs editable (doesn't work now) options
|
5
|
+
* Find a way to print the grid nicely (along with the column and rows that don't fit on the screen)
|
6
|
+
|
7
|
+
== Foolproof
|
8
|
+
* Should not be possible to put the "ID" field on any place but first for grids (otherwise record ID is not correct)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Start xvfb in preparation for cucumber
|
2
|
+
sh -e /etc/init.d/xvfb start
|
3
|
+
|
4
|
+
# fetch extjs
|
5
|
+
wget http://extjs.cachefly.net/ext-4.0.2a-gpl.zip
|
6
|
+
unzip -q -d test/basepack_test_app/public/ -n ext-4.0.2a-gpl.zip
|
7
|
+
mv test/basepack_test_app/public/ext-4.0.2a 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
|
11
|
+
|
12
|
+
# create mysql database
|
13
|
+
mysql -e 'create database nbt_test;'
|
14
|
+
|
15
|
+
# clone netzke-core and netzke-persistence gems into test project
|
16
|
+
mkdir -p test/basepack_test_app/vendor/gems
|
17
|
+
cd test/basepack_test_app/vendor/gems
|
18
|
+
git clone git://github.com/skozlov/netzke-core.git
|
19
|
+
cd netzke-core
|
20
|
+
git checkout tags/v0.7.4
|
21
|
+
cd ..
|
22
|
+
git clone git://github.com/skozlov/netzke-persistence.git
|
23
|
+
cd netzke-persistence
|
24
|
+
git checkout tags/v0.1.0
|
25
|
+
cd ../../..
|
26
|
+
bundle install
|
27
|
+
bundle exec rake db:migrate RAILS_ENV=test
|
28
|
+
cd ../..
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'netzke-basepack'
|
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
@@ -0,0 +1,139 @@
|
|
1
|
+
Ext.ns("Netzke.pre");
|
2
|
+
Ext.ns("Netzke.pre.Basepack");
|
3
|
+
Ext.ns("Ext.ux.grid");
|
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 : 'field1',
|
26
|
+
displayField : 'field2',
|
27
|
+
triggerAction : 'all',
|
28
|
+
// WIP: Breaking - should not be 'true' if combobox is not editable
|
29
|
+
// typeAhead : true,
|
30
|
+
|
31
|
+
initComponent : function(){
|
32
|
+
var modelName = this.parentId + "_" + this.name;
|
33
|
+
|
34
|
+
Ext.define(modelName, {
|
35
|
+
extend: 'Ext.data.Model',
|
36
|
+
fields: ['field1', 'field2']
|
37
|
+
});
|
38
|
+
|
39
|
+
var store = new Ext.data.Store({
|
40
|
+
model: modelName,
|
41
|
+
proxy: {
|
42
|
+
type: 'direct',
|
43
|
+
directFn: Netzke.providers[this.parentId].getComboboxOptions,
|
44
|
+
reader: {
|
45
|
+
type: 'array',
|
46
|
+
root: 'data'
|
47
|
+
}
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
// TODO: find a cleaner way to pass this.name to the server
|
52
|
+
store.on('beforeload', function(self, params) {
|
53
|
+
params.params.column = this.name;
|
54
|
+
},this);
|
55
|
+
|
56
|
+
store.on('load', function(self, params) {
|
57
|
+
self.insert(0, Ext.create(modelName, {field1: 0, field2: this.emptyText}));
|
58
|
+
}, this);
|
59
|
+
|
60
|
+
// If inline data was passed (TODO: is this actually working?)
|
61
|
+
if (this.store) store.loadData({data: this.store});
|
62
|
+
|
63
|
+
this.store = store;
|
64
|
+
|
65
|
+
this.callParent();
|
66
|
+
},
|
67
|
+
|
68
|
+
collapse: function(){
|
69
|
+
// HACK: do not hide dropdown menu while loading items
|
70
|
+
if( !this.store.loading ) this.callParent();
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
Ext.util.Format.mask = function(v){
|
75
|
+
return "********";
|
76
|
+
};
|
77
|
+
|
78
|
+
// Ext.netzke.JsonField = Ext.extend(Ext.form.TextField, {
|
79
|
+
// validator: function(value) {
|
80
|
+
// try{
|
81
|
+
// var d = Ext.decode(value);
|
82
|
+
// return true;
|
83
|
+
// } catch(e) {
|
84
|
+
// return "Invalid JSON"
|
85
|
+
// }
|
86
|
+
// }
|
87
|
+
//
|
88
|
+
// ,setValue: function(value) {
|
89
|
+
// this.setRawValue(Ext.encode(value));
|
90
|
+
// }
|
91
|
+
//
|
92
|
+
// });
|
93
|
+
//
|
94
|
+
// Ext.reg('jsonfield', Ext.netzke.JsonField);
|
95
|
+
//
|
96
|
+
// WIP: todo - rewrite Ext.lib calls below
|
97
|
+
// Ext.grid.HeaderDropZone.prototype.onNodeDrop = function(n, dd, e, data){
|
98
|
+
// var h = data.header;
|
99
|
+
// if(h != n){
|
100
|
+
// var cm = this.grid.colModel;
|
101
|
+
// var x = Ext.lib.Event.getPageX(e);
|
102
|
+
// var r = Ext.lib.Dom.getRegion(n.firstChild);
|
103
|
+
// var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";
|
104
|
+
// var oldIndex = this.view.getCellIndex(h);
|
105
|
+
// var newIndex = this.view.getCellIndex(n);
|
106
|
+
// if(pt == "after"){
|
107
|
+
// newIndex++;
|
108
|
+
// }
|
109
|
+
// if(oldIndex < newIndex){
|
110
|
+
// newIndex--;
|
111
|
+
// }
|
112
|
+
// cm.moveColumn(oldIndex, newIndex);
|
113
|
+
// return true;
|
114
|
+
// }
|
115
|
+
// return false;
|
116
|
+
// };
|
117
|
+
//
|
118
|
+
//
|
119
|
+
// Ext.ns('Ext.ux.form');
|
120
|
+
|
121
|
+
Ext.define('Ext.ux.form.TriCheckbox', {
|
122
|
+
extend: 'Ext.form.field.ComboBox',
|
123
|
+
alias: 'widget.tricheckbox',
|
124
|
+
store: [[true, "Yes"], [false, "No"]],
|
125
|
+
forceSelection: true
|
126
|
+
});
|
127
|
+
|
128
|
+
// Enabling checkbox submission when unchecked
|
129
|
+
// TODO: it would be nice to standardize return values
|
130
|
+
// because currently checkboxes return "on", if checked,
|
131
|
+
// and boolean 'false' otherwise. It's not nice
|
132
|
+
// MAV
|
133
|
+
// TODO: maybe we should simply initialize 'uncheckedValue' somewhere else,
|
134
|
+
// instead
|
135
|
+
Ext.override( Ext.form.field.Checkbox, {
|
136
|
+
getSubmitValue: function() {
|
137
|
+
return this.callOverridden() || false; // 'off';
|
138
|
+
}
|
139
|
+
});
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/**
|
2
|
+
* @class Ext.ux.form.field.DateTime
|
3
|
+
* @extends Ext.form.FieldContainer
|
4
|
+
* @version 0.2 (July 20th, 2011)
|
5
|
+
* @author atian25 (http://www.sencha.com/forum/member.php?51682-atian25)
|
6
|
+
* @author ontho (http://www.sencha.com/forum/member.php?285806-ontho)
|
7
|
+
* @author jakob.ketterl (http://www.sencha.com/forum/member.php?25102-jakob.ketterl)
|
8
|
+
* @link http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime
|
9
|
+
* from http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime&p=863449&viewfull=1#post863449
|
10
|
+
*/
|
11
|
+
Ext.define('Ext.ux.form.field.DateTime', {
|
12
|
+
extend:'Ext.form.FieldContainer',
|
13
|
+
mixins:{
|
14
|
+
field:'Ext.form.field.Field'
|
15
|
+
},
|
16
|
+
alias: 'widget.xdatetime',
|
17
|
+
|
18
|
+
//configurables
|
19
|
+
|
20
|
+
combineErrors: true,
|
21
|
+
msgTarget: 'under',
|
22
|
+
layout: 'hbox',
|
23
|
+
readOnly: false,
|
24
|
+
|
25
|
+
/**
|
26
|
+
* @cfg {String} dateFormat
|
27
|
+
* Convenience config for specifying the format of the date portion.
|
28
|
+
* This value is overridden if format is specified in the dateConfig.
|
29
|
+
* The default is 'Y-m-d'
|
30
|
+
*/
|
31
|
+
dateFormat: 'Y-m-d',
|
32
|
+
/**
|
33
|
+
* @cfg {String} timeFormat
|
34
|
+
* Convenience config for specifying the format of the time portion.
|
35
|
+
* This value is overridden if format is specified in the timeConfig.
|
36
|
+
* The default is 'H:i:s'
|
37
|
+
*/
|
38
|
+
timeFormat: 'H:i:s',
|
39
|
+
// /**
|
40
|
+
// * @cfg {String} dateTimeFormat
|
41
|
+
// * The format used when submitting the combined value.
|
42
|
+
// * Defaults to 'Y-m-d H:i:s'
|
43
|
+
// */
|
44
|
+
// dateTimeFormat: 'Y-m-d H:i:s',
|
45
|
+
/**
|
46
|
+
* @cfg {Object} dateConfig
|
47
|
+
* Additional config options for the date field.
|
48
|
+
*/
|
49
|
+
dateConfig:{},
|
50
|
+
/**
|
51
|
+
* @cfg {Object} timeConfig
|
52
|
+
* Additional config options for the time field.
|
53
|
+
*/
|
54
|
+
timeConfig:{},
|
55
|
+
|
56
|
+
|
57
|
+
// properties
|
58
|
+
|
59
|
+
dateValue: null, // Holds the actual date
|
60
|
+
/**
|
61
|
+
* @property dateField
|
62
|
+
* @type Ext.form.field.Date
|
63
|
+
*/
|
64
|
+
dateField: null,
|
65
|
+
/**
|
66
|
+
* @property timeField
|
67
|
+
* @type Ext.form.field.Time
|
68
|
+
*/
|
69
|
+
timeField: null,
|
70
|
+
|
71
|
+
initComponent: function(){
|
72
|
+
var me = this
|
73
|
+
,i = 0
|
74
|
+
,key
|
75
|
+
,tab;
|
76
|
+
|
77
|
+
me.items = me.items || [];
|
78
|
+
|
79
|
+
me.dateField = Ext.create('Ext.form.field.Date', Ext.apply({
|
80
|
+
format:me.dateFormat,
|
81
|
+
flex:1,
|
82
|
+
isFormField:false, //exclude from field query's
|
83
|
+
submitValue:false
|
84
|
+
}, me.dateConfig));
|
85
|
+
me.items.push(me.dateField);
|
86
|
+
|
87
|
+
me.timeField = Ext.create('Ext.form.field.Time', Ext.apply({
|
88
|
+
format:me.timeFormat,
|
89
|
+
flex:1,
|
90
|
+
isFormField:false, //exclude from field query's
|
91
|
+
submitValue:false
|
92
|
+
}, me.timeConfig));
|
93
|
+
me.items.push(me.timeField);
|
94
|
+
|
95
|
+
for (; i < me.items.length; i++) {
|
96
|
+
me.items[i].on('focus', Ext.bind(me.onItemFocus, me));
|
97
|
+
me.items[i].on('blur', Ext.bind(me.onItemBlur, me));
|
98
|
+
me.items[i].on('specialkey', function(field, event){
|
99
|
+
key = event.getKey();
|
100
|
+
tab = key == event.TAB;
|
101
|
+
|
102
|
+
if (tab && me.focussedItem == me.dateField) {
|
103
|
+
event.stopEvent();
|
104
|
+
me.timeField.focus();
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
|
108
|
+
me.fireEvent('specialkey', field, event);
|
109
|
+
});
|
110
|
+
}
|
111
|
+
|
112
|
+
me.callParent();
|
113
|
+
|
114
|
+
// this dummy is necessary because Ext.Editor will not check whether an inputEl is present or not
|
115
|
+
this.inputEl = {
|
116
|
+
dom: document.createElement('div'),
|
117
|
+
swallowEvent:function(){}
|
118
|
+
};
|
119
|
+
|
120
|
+
me.initField();
|
121
|
+
},
|
122
|
+
|
123
|
+
focus:function(){
|
124
|
+
this.callParent(arguments);
|
125
|
+
this.dateField.focus();
|
126
|
+
},
|
127
|
+
|
128
|
+
onItemFocus:function(item){
|
129
|
+
if (this.blurTask){
|
130
|
+
this.blurTask.cancel();
|
131
|
+
}
|
132
|
+
this.focussedItem = item;
|
133
|
+
},
|
134
|
+
|
135
|
+
onItemBlur:function(item, e){
|
136
|
+
var me = this;
|
137
|
+
if (item != me.focussedItem){ return; }
|
138
|
+
// 100ms to focus a new item that belongs to us, otherwise we will assume the user left the field
|
139
|
+
me.blurTask = new Ext.util.DelayedTask(function(){
|
140
|
+
me.fireEvent('blur', me, e);
|
141
|
+
});
|
142
|
+
me.blurTask.delay(100);
|
143
|
+
},
|
144
|
+
|
145
|
+
getValue: function(){
|
146
|
+
var value = null
|
147
|
+
,date = this.dateField.getSubmitValue()
|
148
|
+
,time = this.timeField.getSubmitValue()
|
149
|
+
,format;
|
150
|
+
|
151
|
+
if (date){
|
152
|
+
if (time){
|
153
|
+
format = this.getFormat();
|
154
|
+
value = Ext.Date.parse(date + ' ' + time, format);
|
155
|
+
} else {
|
156
|
+
value = this.dateField.getValue();
|
157
|
+
}
|
158
|
+
}
|
159
|
+
return value;
|
160
|
+
},
|
161
|
+
|
162
|
+
getSubmitValue: function(){
|
163
|
+
// var value = this.getValue();
|
164
|
+
// return value ? Ext.Date.format(value, this.dateTimeFormat) : null;
|
165
|
+
|
166
|
+
var me = this
|
167
|
+
,format = me.getFormat()
|
168
|
+
,value = me.getValue();
|
169
|
+
|
170
|
+
return value ? Ext.Date.format(value, format) : null;
|
171
|
+
},
|
172
|
+
|
173
|
+
setValue: function(value){
|
174
|
+
if (Ext.isString(value)){
|
175
|
+
value = Ext.Date.parse(value, this.getFormat()); //this.dateTimeFormat
|
176
|
+
}
|
177
|
+
this.dateField.setValue(value);
|
178
|
+
this.timeField.setValue(value);
|
179
|
+
},
|
180
|
+
|
181
|
+
getFormat: function(){
|
182
|
+
return (this.dateField.submitFormat || this.dateField.format) + " " + (this.timeField.submitFormat || this.timeField.format);
|
183
|
+
},
|
184
|
+
|
185
|
+
// Bug? A field-mixin submits the data from getValue, not getSubmitValue
|
186
|
+
getSubmitData: function(){
|
187
|
+
var me = this
|
188
|
+
,data = null;
|
189
|
+
|
190
|
+
if (!me.disabled && me.submitValue && !me.isFileUpload()) {
|
191
|
+
data = {};
|
192
|
+
data[me.getName()] = '' + me.getSubmitValue();
|
193
|
+
}
|
194
|
+
return data;
|
195
|
+
}
|
196
|
+
});
|