wice_grid 3.6.2 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +41 -0
- data/.circleci/run-build-locally.sh +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- data/.gitignore +5 -2
- data/Appraisals +11 -0
- data/CHANGELOG.md +38 -1
- data/Gemfile.lock +299 -0
- data/README.md +77 -34
- data/config/locales/ja.yml +3 -3
- data/gemfiles/rails_5.0.gemfile +7 -0
- data/gemfiles/rails_5.0.gemfile.lock +291 -0
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/gemfiles/rails_5.1.gemfile.lock +291 -0
- data/gemfiles/rails_5.2.gemfile +7 -0
- data/gemfiles/rails_5.2.gemfile.lock +299 -0
- data/lib/wice/columns.rb +13 -6
- data/lib/wice/columns/column_integer.rb +11 -1
- data/lib/wice/columns/column_rails_datetime_helper.rb +3 -2
- data/lib/wice/columns/column_range.rb +6 -4
- data/lib/wice/grid_renderer.rb +23 -7
- data/lib/wice/helpers/bs_calendar_helpers.rb +9 -1
- data/lib/wice/helpers/wice_grid_view_helpers.rb +6 -6
- data/lib/wice/wice_grid_controller.rb +7 -5
- data/lib/wice/wice_grid_core_ext.rb +5 -1
- data/lib/wice/wice_grid_misc.rb +1 -1
- data/lib/wice_grid.rb +86 -59
- data/spec/acceptance_helper.rb +58 -0
- data/spec/features/action_column_request_spec.rb +280 -0
- data/spec/features/adding_rows_request_spec.rb +21 -0
- data/spec/features/all_records_request_spec.rb +18 -0
- data/spec/features/auto_reloads2_request_spec.rb +349 -0
- data/spec/features/auto_reloads3_request_spec.rb +130 -0
- data/spec/features/auto_reloads_request_spec.rb +348 -0
- data/spec/features/basics1_request_spec.rb +11 -0
- data/spec/features/basics2_request_spec.rb +10 -0
- data/spec/features/basics3_request_spec.rb +29 -0
- data/spec/features/basics4_request_spec.rb +19 -0
- data/spec/features/basics5_request_spec.rb +13 -0
- data/spec/features/basics6_request_spec.rb +22 -0
- data/spec/features/blockless_column_definition_spec.rb +27 -0
- data/spec/features/buttons_request_spec.rb +172 -0
- data/spec/features/csv_and_detached_filters_spec.rb +10 -0
- data/spec/features/csv_export_request_spec.rb +13 -0
- data/spec/features/custom_filter_params_request_spec.rb +29 -0
- data/spec/features/custom_filters1_request_spec.rb +155 -0
- data/spec/features/custom_filters2_request_spec.rb +53 -0
- data/spec/features/custom_filters3_request_spec.rb +50 -0
- data/spec/features/custom_filters4_request_spec.rb +13 -0
- data/spec/features/custom_ordering_on_calculated_request_spec.rb +30 -0
- data/spec/features/custom_ordering_request_spec.rb +36 -0
- data/spec/features/custom_ordering_with_arel_request_spec.rb +36 -0
- data/spec/features/custom_ordering_with_proc_request_spec.rb +44 -0
- data/spec/features/custom_ordering_with_ruby_request_spec.rb +30 -0
- data/spec/features/dates_request_spec.rb +56 -0
- data/spec/features/detached_filters_spec.rb +10 -0
- data/spec/features/detached_filters_two_grids_spec.rb +127 -0
- data/spec/features/disable_all_filters_spec.rb +22 -0
- data/spec/features/hiding_checkboxes_in_action_column_request_spec.rb +294 -0
- data/spec/features/integration_with_application_view_request_spec.rb +43 -0
- data/spec/features/integration_with_forms_request_spec.rb +141 -0
- data/spec/features/joining_tables_spec.rb +40 -0
- data/spec/features/localization_request_spec.rb +24 -0
- data/spec/features/many_grids_on_page_request_spec.rb +104 -0
- data/spec/features/negation_request_spec.rb +25 -0
- data/spec/features/no_records_request_spec.rb +26 -0
- data/spec/features/numeric_filters_request_spec.rb +10 -0
- data/spec/features/resultset_processings2_request_spec.rb +27 -0
- data/spec/features/resultset_processings_request_spec.rb +30 -0
- data/spec/features/saved_queries_request_spec.rb +120 -0
- data/spec/features/shared.rb +1005 -0
- data/spec/features/shared_detached_filters.rb +158 -0
- data/spec/features/styling_spec.rb +15 -0
- data/spec/features/two_associations_spec.rb +48 -0
- data/spec/features/upper_pagination_panel_request_spec.rb +23 -0
- data/spec/features/when_filtered_spec.rb +209 -0
- data/spec/fixtures/.gitkeep +0 -0
- data/spec/fixtures/companies.yml +21 -0
- data/spec/fixtures/priorities.yml +31 -0
- data/spec/fixtures/project_roles.yml +25 -0
- data/spec/fixtures/projects.yml +22 -0
- data/spec/fixtures/statuses.yml +55 -0
- data/spec/fixtures/tasks.yml +751 -0
- data/spec/fixtures/tasks_users.yml +2089 -0
- data/spec/fixtures/users.yml +61 -0
- data/spec/fixtures/versions.yml +78 -0
- data/spec/models/company_spec.rb +6 -0
- data/spec/models/priority_spec.rb +6 -0
- data/spec/models/project_spec.rb +11 -0
- data/spec/models/status_spec.rb +6 -0
- data/spec/models/task_spec.rb +12 -0
- data/spec/models/user_project_participation_spec.rb +7 -0
- data/spec/models/user_spec.rb +12 -0
- data/spec/models/version_spec.rb +5 -0
- data/spec/rails_helper.rb +15 -0
- data/spec/spec_helper.rb +10 -9
- data/spec/support/test_app/Rakefile +3 -0
- data/spec/support/test_app/app/assets/javascripts/application.js +20 -0
- data/spec/support/test_app/app/assets/javascripts/common.js.coffee +6 -0
- data/spec/support/test_app/app/assets/javascripts/jquery.ui.datepicker.locales.js +56 -0
- data/spec/support/test_app/app/assets/stylesheets/adding_rows.scss +3 -0
- data/spec/support/test_app/app/assets/stylesheets/application.scss +46 -0
- data/spec/support/test_app/app/assets/stylesheets/csv_and_detached_filters.scss +3 -0
- data/spec/support/test_app/app/assets/stylesheets/many_grids_on_page.scss +3 -0
- data/spec/support/test_app/app/controllers/action_column_controller.rb +15 -0
- data/spec/support/test_app/app/controllers/adding_rows_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/all_records_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/application_controller.rb +99 -0
- data/spec/support/test_app/app/controllers/auto_reloads2_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/auto_reloads3_controller.rb +20 -0
- data/spec/support/test_app/app/controllers/auto_reloads_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/basics1_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/basics2_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/basics3_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/basics4_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/basics5_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/basics6_controller.rb +11 -0
- data/spec/support/test_app/app/controllers/blockless_column_definition_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/buttons_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/csv_and_detached_filters_controller.rb +13 -0
- data/spec/support/test_app/app/controllers/csv_export_controller.rb +28 -0
- data/spec/support/test_app/app/controllers/custom_filter_params_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/custom_filters1_controller.rb +9 -0
- data/spec/support/test_app/app/controllers/custom_filters2_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/custom_filters3_controller.rb +12 -0
- data/spec/support/test_app/app/controllers/custom_filters4_controller.rb +12 -0
- data/spec/support/test_app/app/controllers/custom_ordering_controller.rb +18 -0
- data/spec/support/test_app/app/controllers/custom_ordering_on_calculated_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/custom_ordering_with_arel_controller.rb +18 -0
- data/spec/support/test_app/app/controllers/custom_ordering_with_proc_controller.rb +11 -0
- data/spec/support/test_app/app/controllers/custom_ordering_with_ruby_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/dates_controller.rb +8 -0
- data/spec/support/test_app/app/controllers/detached_filters_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/detached_filters_two_grids_controller.rb +7 -0
- data/spec/support/test_app/app/controllers/disable_all_filters_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/hiding_checkboxes_in_action_column_controller.rb +13 -0
- data/spec/support/test_app/app/controllers/home_controller.rb +3 -0
- data/spec/support/test_app/app/controllers/integration_with_application_view_controller.rb +16 -0
- data/spec/support/test_app/app/controllers/integration_with_forms_controller.rb +11 -0
- data/spec/support/test_app/app/controllers/joining_tables_controller.rb +11 -0
- data/spec/support/test_app/app/controllers/localization_controller.rb +26 -0
- data/spec/support/test_app/app/controllers/many_grids_on_page_controller.rb +7 -0
- data/spec/support/test_app/app/controllers/negation_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/no_records_controller.rb +8 -0
- data/spec/support/test_app/app/controllers/null_values_controller.rb +10 -0
- data/spec/support/test_app/app/controllers/numeric_filters_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/queries_controller.rb +4 -0
- data/spec/support/test_app/app/controllers/resultset_processings2_controller.rb +29 -0
- data/spec/support/test_app/app/controllers/resultset_processings_controller.rb +30 -0
- data/spec/support/test_app/app/controllers/saved_queries_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/styling_controller.rb +7 -0
- data/spec/support/test_app/app/controllers/tasks_controller.rb +14 -0
- data/spec/support/test_app/app/controllers/two_associations_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/upper_pagination_panel_controller.rb +6 -0
- data/spec/support/test_app/app/controllers/when_filtered_controller.rb +6 -0
- data/spec/support/test_app/app/helpers/application_helper.rb +82 -0
- data/spec/support/test_app/app/mailers/.gitkeep +0 -0
- data/spec/support/test_app/app/models/.gitkeep +0 -0
- data/spec/support/test_app/app/models/company.rb +5 -0
- data/spec/support/test_app/app/models/populate.rb +84 -0
- data/spec/support/test_app/app/models/priority.rb +10 -0
- data/spec/support/test_app/app/models/project.rb +14 -0
- data/spec/support/test_app/app/models/project_role.rb +3 -0
- data/spec/support/test_app/app/models/status.rb +10 -0
- data/spec/support/test_app/app/models/task.rb +11 -0
- data/spec/support/test_app/app/models/to_dropdown_mixin.rb +16 -0
- data/spec/support/test_app/app/models/user.rb +8 -0
- data/spec/support/test_app/app/models/user_project_participation.rb +6 -0
- data/spec/support/test_app/app/models/version.rb +6 -0
- data/spec/support/test_app/app/views/action_column/_grid.html.erb +35 -0
- data/spec/support/test_app/app/views/action_column/index.html.haml +45 -0
- data/spec/support/test_app/app/views/adding_rows/_grid.html.erb +58 -0
- data/spec/support/test_app/app/views/adding_rows/index.html.haml +37 -0
- data/spec/support/test_app/app/views/all_records/_grid.html.erb +30 -0
- data/spec/support/test_app/app/views/all_records/index.html.haml +12 -0
- data/spec/support/test_app/app/views/auto_reloads/_grid.html.erb +32 -0
- data/spec/support/test_app/app/views/auto_reloads/index.html.haml +15 -0
- data/spec/support/test_app/app/views/auto_reloads2/_grid.html.erb +32 -0
- data/spec/support/test_app/app/views/auto_reloads2/index.html.haml +65 -0
- data/spec/support/test_app/app/views/auto_reloads3/_grid.html.erb +25 -0
- data/spec/support/test_app/app/views/auto_reloads3/index.html.haml +78 -0
- data/spec/support/test_app/app/views/basics1/_grid.html.erb +26 -0
- data/spec/support/test_app/app/views/basics1/index.html.haml +13 -0
- data/spec/support/test_app/app/views/basics2/_grid.html.erb +27 -0
- data/spec/support/test_app/app/views/basics2/index.html.haml +12 -0
- data/spec/support/test_app/app/views/basics3/_grid.html.erb +28 -0
- data/spec/support/test_app/app/views/basics3/index.html.haml +13 -0
- data/spec/support/test_app/app/views/basics4/_grid.html.erb +21 -0
- data/spec/support/test_app/app/views/basics4/index.html.haml +12 -0
- data/spec/support/test_app/app/views/basics5/_grid.html.erb +19 -0
- data/spec/support/test_app/app/views/basics5/index.html.haml +12 -0
- data/spec/support/test_app/app/views/basics6/_grid.html.erb +19 -0
- data/spec/support/test_app/app/views/basics6/index.html.haml +23 -0
- data/spec/support/test_app/app/views/blockless_column_definition/_grid.html.erb +19 -0
- data/spec/support/test_app/app/views/blockless_column_definition/index.html.haml +15 -0
- data/spec/support/test_app/app/views/buttons/_grid.html.erb +20 -0
- data/spec/support/test_app/app/views/buttons/index.html.haml +30 -0
- data/spec/support/test_app/app/views/csv_and_detached_filters/_grid.html.erb +23 -0
- data/spec/support/test_app/app/views/csv_and_detached_filters/index.html.haml +58 -0
- data/spec/support/test_app/app/views/csv_export/_projects_grid.html.erb +17 -0
- data/spec/support/test_app/app/views/csv_export/_tasks_grid.html.erb +43 -0
- data/spec/support/test_app/app/views/csv_export/index.html.haml +90 -0
- data/spec/support/test_app/app/views/custom_filter_params/_grid.html.erb +12 -0
- data/spec/support/test_app/app/views/custom_filter_params/index.html.haml +12 -0
- data/spec/support/test_app/app/views/custom_filters1/_g1.html.erb +8 -0
- data/spec/support/test_app/app/views/custom_filters1/_g2.html.erb +9 -0
- data/spec/support/test_app/app/views/custom_filters1/_g3.html.erb +9 -0
- data/spec/support/test_app/app/views/custom_filters1/_g4.html.erb +8 -0
- data/spec/support/test_app/app/views/custom_filters1/index.html.haml +30 -0
- data/spec/support/test_app/app/views/custom_filters2/_grid.html.erb +30 -0
- data/spec/support/test_app/app/views/custom_filters2/index.html.haml +41 -0
- data/spec/support/test_app/app/views/custom_filters3/_grid.html.erb +18 -0
- data/spec/support/test_app/app/views/custom_filters3/index.html.haml +16 -0
- data/spec/support/test_app/app/views/custom_filters4/_grid.html.erb +20 -0
- data/spec/support/test_app/app/views/custom_filters4/index.html.haml +12 -0
- data/spec/support/test_app/app/views/custom_ordering/_grid.html.erb +10 -0
- data/spec/support/test_app/app/views/custom_ordering/index.html.haml +24 -0
- data/spec/support/test_app/app/views/custom_ordering_on_calculated/_grid.html.erb +14 -0
- data/spec/support/test_app/app/views/custom_ordering_on_calculated/index.html.haml +23 -0
- data/spec/support/test_app/app/views/custom_ordering_with_arel/_grid.html.erb +10 -0
- data/spec/support/test_app/app/views/custom_ordering_with_arel/index.html.haml +24 -0
- data/spec/support/test_app/app/views/custom_ordering_with_proc/_grid.html.erb +10 -0
- data/spec/support/test_app/app/views/custom_ordering_with_proc/index.html.haml +21 -0
- data/spec/support/test_app/app/views/custom_ordering_with_ruby/_grid.html.erb +10 -0
- data/spec/support/test_app/app/views/custom_ordering_with_ruby/index.html.haml +23 -0
- data/spec/support/test_app/app/views/dates/_grid.html.erb +25 -0
- data/spec/support/test_app/app/views/dates/index.html.haml +52 -0
- data/spec/support/test_app/app/views/detached_filters/_grid.html.erb +23 -0
- data/spec/support/test_app/app/views/detached_filters/index.html.haml +79 -0
- data/spec/support/test_app/app/views/detached_filters_two_grids/_grid.html.erb +23 -0
- data/spec/support/test_app/app/views/detached_filters_two_grids/index.html.haml +85 -0
- data/spec/support/test_app/app/views/disable_all_filters/_grid.html.erb +21 -0
- data/spec/support/test_app/app/views/disable_all_filters/index.html.haml +14 -0
- data/spec/support/test_app/app/views/hiding_checkboxes_in_action_column/_grid.html.erb +34 -0
- data/spec/support/test_app/app/views/hiding_checkboxes_in_action_column/index.html.haml +32 -0
- data/spec/support/test_app/app/views/integration_with_application_view/_grid.html.erb +27 -0
- data/spec/support/test_app/app/views/integration_with_application_view/index.html.haml +33 -0
- data/spec/support/test_app/app/views/integration_with_forms/_grid.html.erb +23 -0
- data/spec/support/test_app/app/views/integration_with_forms/index.html.haml +18 -0
- data/spec/support/test_app/app/views/joining_tables/_grid.html.erb +23 -0
- data/spec/support/test_app/app/views/joining_tables/index.html.haml +26 -0
- data/spec/support/test_app/app/views/layouts/application.html.haml +61 -0
- data/spec/support/test_app/app/views/localization/_grid.html.erb +36 -0
- data/spec/support/test_app/app/views/localization/index.html.haml +20 -0
- data/spec/support/test_app/app/views/many_grids_on_page/_tasks_grid1.html.erb +12 -0
- data/spec/support/test_app/app/views/many_grids_on_page/_tasks_grid2.html.erb +12 -0
- data/spec/support/test_app/app/views/many_grids_on_page/index.html.haml +26 -0
- data/spec/support/test_app/app/views/negation/_grid.html.erb +30 -0
- data/spec/support/test_app/app/views/negation/index.html.haml +15 -0
- data/spec/support/test_app/app/views/no_records/_empty_grid.html.haml +1 -0
- data/spec/support/test_app/app/views/no_records/_grid1.html.erb +11 -0
- data/spec/support/test_app/app/views/no_records/_grid2.html.erb +9 -0
- data/spec/support/test_app/app/views/no_records/_grid3.html.erb +9 -0
- data/spec/support/test_app/app/views/no_records/index.html.haml +24 -0
- data/spec/support/test_app/app/views/null_values/_grid.html.erb +17 -0
- data/spec/support/test_app/app/views/null_values/index.html.haml +21 -0
- data/spec/support/test_app/app/views/numeric_filters/_grid.html.erb +19 -0
- data/spec/support/test_app/app/views/numeric_filters/index.html.haml +12 -0
- data/spec/support/test_app/app/views/resultset_processings/_grid.html.erb +27 -0
- data/spec/support/test_app/app/views/resultset_processings/index.html.haml +50 -0
- data/spec/support/test_app/app/views/resultset_processings2/_grid.html.erb +27 -0
- data/spec/support/test_app/app/views/resultset_processings2/index.html.haml +48 -0
- data/spec/support/test_app/app/views/saved_queries/_grid.html.erb +30 -0
- data/spec/support/test_app/app/views/saved_queries/index.html.haml +15 -0
- data/spec/support/test_app/app/views/styling/_grid1.html.erb +12 -0
- data/spec/support/test_app/app/views/styling/_grid2.html.erb +31 -0
- data/spec/support/test_app/app/views/styling/index.html.haml +65 -0
- data/spec/support/test_app/app/views/tasks/_grid.html.erb +19 -0
- data/spec/support/test_app/app/views/tasks/index.html.haml +1 -0
- data/spec/support/test_app/app/views/two_associations/_grid.html.erb +13 -0
- data/spec/support/test_app/app/views/two_associations/index.html.haml +13 -0
- data/spec/support/test_app/app/views/upper_pagination_panel/_grid.html.erb +27 -0
- data/spec/support/test_app/app/views/upper_pagination_panel/index.html.haml +14 -0
- data/spec/support/test_app/app/views/when_filtered/_grid.html.erb +19 -0
- data/spec/support/test_app/app/views/when_filtered/index.html.haml +15 -0
- data/spec/support/test_app/bin/rails +4 -0
- data/spec/support/test_app/bin/rake +4 -0
- data/spec/support/test_app/config.ru +5 -0
- data/spec/support/test_app/config/application.rb +70 -0
- data/spec/support/test_app/config/boot.rb +7 -0
- data/spec/support/test_app/config/database.travis.yml +27 -0
- data/spec/support/test_app/config/database.yml +16 -0
- data/spec/support/test_app/config/database.yml.mysql +19 -0
- data/spec/support/test_app/config/database.yml.postgresql +18 -0
- data/spec/support/test_app/config/environment.rb +6 -0
- data/spec/support/test_app/config/environments/development.rb +34 -0
- data/spec/support/test_app/config/environments/production.rb +66 -0
- data/spec/support/test_app/config/environments/test.rb +34 -0
- data/spec/support/test_app/config/initializers/backtrace_silencers.rb +8 -0
- data/spec/support/test_app/config/initializers/inflections.rb +16 -0
- data/spec/support/test_app/config/initializers/mime_types.rb +6 -0
- data/spec/support/test_app/config/initializers/secret_token.rb +12 -0
- data/spec/support/test_app/config/initializers/session_store.rb +9 -0
- data/spec/support/test_app/config/initializers/wice_grid_config.rb +163 -0
- data/spec/support/test_app/config/initializers/wrap_parameters.rb +15 -0
- data/spec/support/test_app/config/locales/en.yml +5 -0
- data/spec/support/test_app/config/locales/wice_grid.yml +550 -0
- data/spec/support/test_app/config/puma.rb +15 -0
- data/spec/support/test_app/config/routes.rb +125 -0
- data/spec/support/test_app/db/migrate/20120224193505_create_tasks.rb +27 -0
- data/spec/support/test_app/db/migrate/20120224193517_create_users.rb +12 -0
- data/spec/support/test_app/db/migrate/20120224193522_create_projects.rb +14 -0
- data/spec/support/test_app/db/migrate/20120224193529_create_priorities.rb +13 -0
- data/spec/support/test_app/db/migrate/20120224193537_create_statuses.rb +13 -0
- data/spec/support/test_app/db/migrate/20120224193543_create_versions.rb +15 -0
- data/spec/support/test_app/db/migrate/20120224193550_create_project_roles.rb +12 -0
- data/spec/support/test_app/db/migrate/20120224193610_create_companies.rb +12 -0
- data/spec/support/test_app/db/migrate/20120224195351_create_user_project_participations.rb +16 -0
- data/spec/support/test_app/db/migrate/20120224195521_add_tasks_users.rb +11 -0
- data/spec/support/test_app/db/migrate/20120610091944_create_wice_grid_serialized_queries.rb +14 -0
- data/spec/support/test_app/db/schema.rb +139 -0
- data/spec/support/test_app/db/seeds.rb +10 -0
- data/spec/support/test_app/lib/ar_fixtures.rb +100 -0
- data/spec/support/test_app/lib/assets/.gitkeep +0 -0
- data/spec/support/test_app/lib/tasks/.gitkeep +0 -0
- data/spec/support/test_app/lib/tasks/ar_fixtures.rake +45 -0
- data/spec/support/test_app/public/404.html +26 -0
- data/spec/support/test_app/public/422.html +26 -0
- data/spec/support/test_app/public/500.html +25 -0
- data/spec/support/test_app/public/favicon.ico +0 -0
- data/spec/support/test_app/public/robots.txt +5 -0
- data/spec/wice/grid_output_buffer_spec.rb +2 -2
- data/spec/wice/table_column_matrix_spec.rb +1 -1
- data/vendor/assets/javascripts/wice_grid_init.js.coffee +16 -4
- data/vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee +1 -0
- data/wice_grid.gemspec +29 -9
- metadata +606 -62
- data/release_notes/RELEASE_NOTES_3.2.pre1.rdoc +0 -81
- data/release_notes/RELEASE_NOTES_3.2.pre2.rdoc +0 -6
- data/release_notes/RELEASE_NOTES_3.3.0.rdoc +0 -21
- data/spec/support/wice_grid_test_config.rb +0 -173
- data/test/readme.txt +0 -1
@@ -0,0 +1,58 @@
|
|
1
|
+
.well
|
2
|
+
%h2= current_page_title
|
3
|
+
%p
|
4
|
+
CSV export works with
|
5
|
+
%code define_grid
|
6
|
+
and external filters, too.
|
7
|
+
|
8
|
+
= show_code
|
9
|
+
|
10
|
+
= render 'grid'
|
11
|
+
|
12
|
+
|
13
|
+
.row
|
14
|
+
.col-md-2
|
15
|
+
ID:
|
16
|
+
.col-md-10
|
17
|
+
= grid_filter @tasks_grid, :id_filter
|
18
|
+
|
19
|
+
.row
|
20
|
+
.col-md-2
|
21
|
+
Title:
|
22
|
+
.col-md-10
|
23
|
+
= grid_filter @tasks_grid, :title_filter
|
24
|
+
|
25
|
+
.row
|
26
|
+
.col-md-2
|
27
|
+
Description:
|
28
|
+
.col-md-10
|
29
|
+
= grid_filter @tasks_grid, :description_filter
|
30
|
+
|
31
|
+
.row
|
32
|
+
.col-md-2
|
33
|
+
Archived:
|
34
|
+
.col-md-10
|
35
|
+
= grid_filter @tasks_grid, :archived_filter
|
36
|
+
|
37
|
+
|
38
|
+
.row
|
39
|
+
.col-md-2
|
40
|
+
Due date:
|
41
|
+
.col-md-10
|
42
|
+
= grid_filter @tasks_grid, :due_date
|
43
|
+
|
44
|
+
|
45
|
+
.row
|
46
|
+
.col-md-12
|
47
|
+
%button.btn.btn-primary.wg-external-submit-button{'data-grid-name' => 'grid'} Submit
|
48
|
+
%button.btn.btn-default.wg-external-reset-button{'data-grid-name' => 'grid'} Reset
|
49
|
+
%button.btn.btn-primary.wg-external-csv-export-button{'data-grid-name' => 'grid'} Export To CSV
|
50
|
+
|
51
|
+
%p
|
52
|
+
|
53
|
+
.row
|
54
|
+
.col-md-12
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
= render_grid(@tasks_grid)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= grid(@projects_grid, show_filters: :always, hide_csv_button: true) do |g|
|
2
|
+
|
3
|
+
g.column name: 'ID', attribute: 'id', filter: false
|
4
|
+
|
5
|
+
g.column name: 'Project Name', attribute: 'name'
|
6
|
+
|
7
|
+
|
8
|
+
g.column name: 'Customer company', assoc: :customer, attribute: 'name' do |task|
|
9
|
+
task.customer.name if task.customer
|
10
|
+
end
|
11
|
+
|
12
|
+
g.column name: 'Supplier company',
|
13
|
+
assoc: :supplier, attribute: 'name', table_alias: 'suppliers_projects' do |task|
|
14
|
+
task.supplier.name if task.supplier
|
15
|
+
end
|
16
|
+
|
17
|
+
end -%>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= grid(@tasks_grid, upper_pagination_panel: true) do |g|
|
2
|
+
|
3
|
+
g.column name: 'ID', attribute: 'id', filter: false
|
4
|
+
|
5
|
+
# html version
|
6
|
+
g.column name: 'Title', attribute: 'title', in_csv: false do |task|
|
7
|
+
link_to('Edit', edit_task_path(task.title))
|
8
|
+
end
|
9
|
+
# plain text version
|
10
|
+
g.column name: 'Title', in_html: false do |task|
|
11
|
+
task.title
|
12
|
+
end
|
13
|
+
|
14
|
+
g.column name: 'Priority', attribute: 'priority_id', custom_filter: Priority.to_dropdown do |task|
|
15
|
+
task.priority.name if task.priority
|
16
|
+
end
|
17
|
+
|
18
|
+
g.column name: 'Status', attribute: 'status_id', custom_filter: Status.to_dropdown do |task|
|
19
|
+
task.status.name if task.status
|
20
|
+
end
|
21
|
+
|
22
|
+
# html version
|
23
|
+
g.column name: 'Project Name', attribute: 'project_id', custom_filter: Project.to_dropdown, in_csv: false do |task|
|
24
|
+
link_to_if(task.project, task.project.name, project_path(task.project) )
|
25
|
+
end
|
26
|
+
# plain text version
|
27
|
+
g.column name: 'Project Name', in_html: false do |task|
|
28
|
+
task.project.name if task.project
|
29
|
+
end
|
30
|
+
|
31
|
+
g.column name: 'Archived', attribute: 'archived' do |task|
|
32
|
+
task.archived? ? 'Yes' : 'No'
|
33
|
+
end
|
34
|
+
|
35
|
+
g.column name: 'Added', attribute: 'created_at' do |task|
|
36
|
+
task.created_at.to_s(:short)
|
37
|
+
end
|
38
|
+
|
39
|
+
# is not included into csv
|
40
|
+
g.column in_csv: false do |task|
|
41
|
+
link_to('Edit', edit_task_path(task))
|
42
|
+
end
|
43
|
+
end -%>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
.well
|
2
|
+
%h2= current_page_title
|
3
|
+
%p
|
4
|
+
A grid can export itself in the form of a CSV file. The contents of the file corresponds to the selected subset of all records,
|
5
|
+
that is, the CSV export follows the state of filters and sorting.
|
6
|
+
%p
|
7
|
+
To enable CSV export for a grid please do the following:
|
8
|
+
%ol
|
9
|
+
%li Make sure that the grid helper is in its own partial and there are no other elements in that partial including whitespaces
|
10
|
+
%li
|
11
|
+
Enable CSV export by adding
|
12
|
+
%code enable_export_to_csv: true
|
13
|
+
to
|
14
|
+
%code initialize_grid
|
15
|
+
%li
|
16
|
+
Set the name of the exported file using option
|
17
|
+
%code :csv_file_name
|
18
|
+
in
|
19
|
+
%code initialize_grid
|
20
|
+
%li
|
21
|
+
Change the CSV field separator by adding
|
22
|
+
%code csv_field_separator: 'your-separator'
|
23
|
+
to
|
24
|
+
%code initialize_grid
|
25
|
+
\.
|
26
|
+
The default field separator is the comma, and you can change the default by editing the value of
|
27
|
+
%code Wice::Defaults::CSV_FIELD_SEPARATOR
|
28
|
+
in the config file
|
29
|
+
|
30
|
+
%li
|
31
|
+
The action code should be finished by a call to
|
32
|
+
%code export_grid_if_requested
|
33
|
+
\:
|
34
|
+
:plain
|
35
|
+
<pre>
|
36
|
+
export_grid_if_requested('g1' => 'tasks_grid', 'g2' => 'projects_grid') do
|
37
|
+
# usual render or redirect code executed if the request is not a CSV export request
|
38
|
+
end
|
39
|
+
</pre>
|
40
|
+
The block is executed if the call is not a request for a CSV file, so place your usual
|
41
|
+
%code redirect_to
|
42
|
+
,
|
43
|
+
%code render
|
44
|
+
inside the block, or just skip it if your action does not have an explicit render:
|
45
|
+
:plain
|
46
|
+
<pre>
|
47
|
+
export_grid_if_requested('g1' => 'tasks_grid', 'g2' => 'projects_grid')
|
48
|
+
</pre>
|
49
|
+
|
50
|
+
The keys of the hash submitted as an argument to
|
51
|
+
%code export_grid_if_requested
|
52
|
+
are names of grids, and the values are names of partials where the grids are defined.
|
53
|
+
|
54
|
+
%li
|
55
|
+
If a column definition contains markup, first disable its export to CSV adding
|
56
|
+
%code in_csv: false
|
57
|
+
to the column definition, and then duplicate the column definition without the markup in the block while adding
|
58
|
+
%code in_html: false
|
59
|
+
to the column definition. Any filter related parameters like
|
60
|
+
%code :attribute
|
61
|
+
,
|
62
|
+
%code :assoc
|
63
|
+
, or
|
64
|
+
%code :custom_filter
|
65
|
+
can be skipped in a CSV-only column.
|
66
|
+
%li
|
67
|
+
If you need an external CSV export button , add class
|
68
|
+
%code wg-external-csv-export-button
|
69
|
+
to any clickable element on page
|
70
|
+
and set its attribute
|
71
|
+
%code data-grid-name
|
72
|
+
to the name of the grid. If you need to disable the default export icon in the grid, add
|
73
|
+
%code hide_csv_button: true
|
74
|
+
to the
|
75
|
+
%code grid
|
76
|
+
helper.
|
77
|
+
|
78
|
+
= show_code
|
79
|
+
|
80
|
+
%p
|
81
|
+
%button.btn.btn-primary.wg-external-csv-export-button{'data-grid-name' => 'g1'} Export To CSV
|
82
|
+
|
83
|
+
|
84
|
+
.row-fluid
|
85
|
+
.col-md-12
|
86
|
+
=render 'projects_grid'
|
87
|
+
|
88
|
+
.row-fluid
|
89
|
+
.col-md-12
|
90
|
+
=render 'tasks_grid'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= grid(@projects_grid) do |g|
|
2
|
+
|
3
|
+
g.column name: 'Project Name', attribute: 'name' do |project|
|
4
|
+
link_to(project.name,
|
5
|
+
tasks_path(
|
6
|
+
wice_grid_custom_filter_params(
|
7
|
+
grid_name: 'grid',
|
8
|
+
attribute: 'project_id',
|
9
|
+
value: project.id )))
|
10
|
+
end
|
11
|
+
|
12
|
+
end -%>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= grid(@versions_grid1) do |g|
|
2
|
+
|
3
|
+
g.column name: 'Project', attribute: 'name', assoc: :project, filter: false
|
4
|
+
|
5
|
+
g.column name: 'Version name', attribute: 'name', filter: false
|
6
|
+
|
7
|
+
g.column name: 'Status', attribute: 'status', custom_filter: {'Development' => 'development', 'Testing' => 'testing', 'Production' => 'production'}
|
8
|
+
end -%>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= grid(@versions_grid2) do |g|
|
2
|
+
|
3
|
+
g.column name: 'Project', attribute: 'name', assoc: :project, filter: false
|
4
|
+
|
5
|
+
g.column name: 'Version name', attribute: 'name', filter: false
|
6
|
+
|
7
|
+
g.column name: 'Status', attribute: 'status',
|
8
|
+
custom_filter: [['Development', 'development'], ['Testing', 'testing'], ['Production', 'production']]
|
9
|
+
end -%>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= grid(@versions_grid3) do |g|
|
2
|
+
|
3
|
+
g.column name: 'Project', attribute: 'name', assoc: :project, filter: false
|
4
|
+
|
5
|
+
g.column name: 'Version name', attribute: 'name', filter: false
|
6
|
+
|
7
|
+
g.column name: 'Status', attribute: 'status',
|
8
|
+
custom_filter: ['development', 'testing', 'production']
|
9
|
+
end -%>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
.well
|
2
|
+
%h2= current_page_title
|
3
|
+
%p
|
4
|
+
Just like
|
5
|
+
%code options_for_select
|
6
|
+
,
|
7
|
+
%code :custom_filter
|
8
|
+
can take arguments in the form of a hash, an array of two element arrays, or just an array.
|
9
|
+
%p
|
10
|
+
%code custom_filter: :auto
|
11
|
+
will instruct WiceGrid to figure out the list of possible values by running a
|
12
|
+
%code SELECT DISTINCT `column` FROM `table`
|
13
|
+
query on the table.
|
14
|
+
|
15
|
+
= show_code
|
16
|
+
|
17
|
+
.row-fluid
|
18
|
+
.col-md-6
|
19
|
+
= render 'g1'
|
20
|
+
|
21
|
+
.col-md-6
|
22
|
+
= render 'g2'
|
23
|
+
|
24
|
+
|
25
|
+
.row-fluid
|
26
|
+
.col-md-6
|
27
|
+
= render 'g3'
|
28
|
+
|
29
|
+
.col-md-6
|
30
|
+
= render 'g4'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= grid(@tasks_grid) do |g|
|
2
|
+
|
3
|
+
g.column name: 'ID', attribute: 'id', filter: false
|
4
|
+
|
5
|
+
g.column name: 'Title', attribute: 'title'
|
6
|
+
|
7
|
+
g.column name: 'Priority', attribute: 'name', assoc: :priority, custom_filter: %w(Anecdotic High Low Normal Urgent) do |task|
|
8
|
+
task.priority.name if task.priority
|
9
|
+
end
|
10
|
+
|
11
|
+
g.column name: 'Status', attribute: 'status_id', custom_filter: Status.to_dropdown do |task|
|
12
|
+
task.status.name if task.status
|
13
|
+
end
|
14
|
+
|
15
|
+
g.column name: 'Project Name', attribute: 'project_id', custom_filter: Project.to_dropdown do |task|
|
16
|
+
task.project.name if task.project
|
17
|
+
end
|
18
|
+
|
19
|
+
g.column name: 'Archived', attribute: 'archived' do |task|
|
20
|
+
task.archived? ? 'Yes' : 'No'
|
21
|
+
end
|
22
|
+
|
23
|
+
g.column name: 'Added', attribute: 'created_at' do |task|
|
24
|
+
task.created_at.to_s(:short)
|
25
|
+
end
|
26
|
+
|
27
|
+
g.column do |task|
|
28
|
+
link_to('Edit', edit_task_path(task))
|
29
|
+
end
|
30
|
+
end -%>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.well
|
2
|
+
%h2= current_page_title
|
3
|
+
%p
|
4
|
+
There are two approaches to custom filters with joined tables. The first thing that comes to mind is to define
|
5
|
+
a column of a joined table with
|
6
|
+
%code :attribute
|
7
|
+
and
|
8
|
+
%code :assoc
|
9
|
+
, and submit a list of all possible values of this column to
|
10
|
+
%code :custom_filter
|
11
|
+
, like it is done in the example below in the Priority column:
|
12
|
+
%p
|
13
|
+
%code g.column name: 'Priority', attribute: 'name', assoc: :priority, custom_filter: %w(Anecdotic High Low Normal Urgent) do |task|
|
14
|
+
|
15
|
+
%p
|
16
|
+
This works but such a filter produces a query with a
|
17
|
+
%code WHERE
|
18
|
+
clause comparing a varchar field with one of the string values submitted to
|
19
|
+
%code :custom_filter
|
20
|
+
\.
|
21
|
+
This is not guaranteed to be as efficient as comparing an indexed integer foreign key with an integer primary key, thus, this approach is highly advised against.
|
22
|
+
%p
|
23
|
+
To implement filtering by foreign keys, define the column with the foreign key in
|
24
|
+
%code :attribute
|
25
|
+
and submit a hash or a two element array containing the IDs and labels of the joined table to
|
26
|
+
%code :attribute
|
27
|
+
\.
|
28
|
+
This has a negative side effect on sorting - the column will now be sorted according to the numerical value of the foreign key.
|
29
|
+
It can be dealt with by overiding sorting by
|
30
|
+
%code :custom_order
|
31
|
+
in
|
32
|
+
%code initialize_grid
|
33
|
+
\:
|
34
|
+
%p
|
35
|
+
%code custom_order: {'tasks.status_id' => 'statuses.position', 'tasks.project_id' => 'projects.name'}
|
36
|
+
|
37
|
+
= show_code
|
38
|
+
|
39
|
+
.row-fluid
|
40
|
+
.col-md-12
|
41
|
+
= render 'grid'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= grid(@tasks_grid) do |g|
|
2
|
+
|
3
|
+
g.column name: 'ID', attribute: 'id', filter: false
|
4
|
+
|
5
|
+
g.column name: 'Title', attribute: 'title'
|
6
|
+
|
7
|
+
g.column name: 'Found in version', assoc: :relevant_version, attribute: 'name', custom_filter: :auto do |task|
|
8
|
+
task.relevant_version.name if task.relevant_version
|
9
|
+
end
|
10
|
+
|
11
|
+
g.column name: 'Expected in version', attribute: 'expected_version_id', custom_filter: [:expected_version, :to_option] do |task|
|
12
|
+
task.expected_version.name if task.expected_version
|
13
|
+
end
|
14
|
+
|
15
|
+
g.column do |task|
|
16
|
+
link_to('Edit', edit_task_path(task))
|
17
|
+
end
|
18
|
+
end -%>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.well
|
2
|
+
%h2= current_page_title
|
3
|
+
%p
|
4
|
+
An array of symbols submitted to
|
5
|
+
%code :custom_filter
|
6
|
+
has a special meaning. The first symbol is sent as a method name to EVERY ActiveRecord object.
|
7
|
+
If an object responds to this method, the second method name is sent to the returned value unless it is nil, and so on.
|
8
|
+
The dropdown is populated by the list unique values.
|
9
|
+
The conditions set up by the user are ignored, that is, the records used are all those found on all pages without any active filters.
|
10
|
+
Naturally this can be extremely inneffective and should be used with caution.
|
11
|
+
|
12
|
+
= show_code
|
13
|
+
|
14
|
+
.row-fluid
|
15
|
+
.col-md-12
|
16
|
+
= render 'grid'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= grid(@tasks_grid) do |g|
|
2
|
+
|
3
|
+
g.column name: 'ID', attribute: 'id', filter: false
|
4
|
+
|
5
|
+
g.column name: 'Title', attribute: 'title'
|
6
|
+
|
7
|
+
g.column name: 'Found in version', assoc: :relevant_version,
|
8
|
+
attribute: 'name', custom_filter: :auto, allow_multiple_selection: false do |task|
|
9
|
+
task.relevant_version.name if task.relevant_version
|
10
|
+
end
|
11
|
+
|
12
|
+
g.column name: 'Expected in version', attribute: 'expected_version_id',
|
13
|
+
custom_filter: [:expected_version, :to_option], allow_multiple_selection: false do |task|
|
14
|
+
task.expected_version.name if task.expected_version
|
15
|
+
end
|
16
|
+
|
17
|
+
g.column do |task|
|
18
|
+
link_to('Edit', edit_task_path(task))
|
19
|
+
end
|
20
|
+
end -%>
|