pwice_grid 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +68 -0
- data/.circleci/run-build-locally.sh +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- data/.gitignore +22 -0
- data/.inch.yml +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +186 -0
- data/Appraisals +11 -0
- data/CHANGELOG.md +758 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +298 -0
- data/MIT-LICENSE +20 -0
- data/README.md +1561 -0
- data/Rakefile +49 -0
- data/SAVED_QUERIES_HOWTO.md +113 -0
- data/app/views/kaminari/wice_grid/_gap.html.erb +1 -0
- data/app/views/kaminari/wice_grid/_next_page.html.erb +1 -0
- data/app/views/kaminari/wice_grid/_page.html.erb +1 -0
- data/app/views/kaminari/wice_grid/_paginator.html.erb +19 -0
- data/app/views/kaminari/wice_grid/_prev_page.html.erb +1 -0
- data/config/locales/cz.yml +40 -0
- data/config/locales/de.yml +42 -0
- data/config/locales/en.yml +42 -0
- data/config/locales/es.yml +42 -0
- data/config/locales/fr.yml +40 -0
- data/config/locales/is.yml +41 -0
- data/config/locales/it.yml +33 -0
- data/config/locales/ja.yml +42 -0
- data/config/locales/nl.yml +40 -0
- data/config/locales/pt-BR.yml +31 -0
- data/config/locales/pt.yml +40 -0
- data/config/locales/ru.yml +40 -0
- data/config/locales/sk.yml +40 -0
- data/config/locales/uk.yml +40 -0
- data/config/locales/zh.yml +40 -0
- data/gemfiles/rails_5.0.gemfile +7 -0
- data/gemfiles/rails_5.0.gemfile.lock +299 -0
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/gemfiles/rails_5.1.gemfile.lock +299 -0
- data/gemfiles/rails_5.2.gemfile +7 -0
- data/gemfiles/rails_5.2.gemfile.lock +307 -0
- data/lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb +19 -0
- data/lib/generators/wice_grid/install_generator.rb +13 -0
- data/lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb +13 -0
- data/lib/generators/wice_grid/templates/wice_grid_config.rb +191 -0
- data/lib/wice/active_record_column_wrapper.rb +122 -0
- data/lib/wice/columns.rb +282 -0
- data/lib/wice/columns/column_action.rb +51 -0
- data/lib/wice/columns/column_boolean.rb +39 -0
- data/lib/wice/columns/column_bootstrap_datepicker.rb +47 -0
- data/lib/wice/columns/column_custom_dropdown.rb +114 -0
- data/lib/wice/columns/column_float.rb +8 -0
- data/lib/wice/columns/column_html5_datepicker.rb +30 -0
- data/lib/wice/columns/column_integer.rb +87 -0
- data/lib/wice/columns/column_jquery_datepicker.rb +48 -0
- data/lib/wice/columns/column_processor_index.rb +22 -0
- data/lib/wice/columns/column_rails_date_helper.rb +40 -0
- data/lib/wice/columns/column_rails_datetime_helper.rb +40 -0
- data/lib/wice/columns/column_range.rb +73 -0
- data/lib/wice/columns/column_string.rb +91 -0
- data/lib/wice/columns/common_date_datetime_mixin.rb +19 -0
- data/lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb +38 -0
- data/lib/wice/columns/common_js_date_datetime_mixin.rb +14 -0
- data/lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb +25 -0
- data/lib/wice/columns/common_standard_helper_date_datetime_mixin.rb +21 -0
- data/lib/wice/grid_output_buffer.rb +48 -0
- data/lib/wice/grid_renderer.rb +624 -0
- data/lib/wice/helpers/bs_calendar_helpers.rb +73 -0
- data/lib/wice/helpers/js_calendar_helpers.rb +82 -0
- data/lib/wice/helpers/wice_grid_misc_view_helpers.rb +74 -0
- data/lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb +94 -0
- data/lib/wice/helpers/wice_grid_view_helpers.rb +719 -0
- data/lib/wice/kaminari_monkey_patching.rb +12 -0
- data/lib/wice/table_column_matrix.rb +64 -0
- data/lib/wice/wice_grid_controller.rb +174 -0
- data/lib/wice/wice_grid_core_ext.rb +145 -0
- data/lib/wice/wice_grid_misc.rb +208 -0
- data/lib/wice/wice_grid_serialized_queries_controller.rb +86 -0
- data/lib/wice/wice_grid_serialized_query.rb +13 -0
- data/lib/wice/wice_grid_spreadsheet.rb +19 -0
- data/lib/wice_grid.rb +702 -0
- data/spec/acceptance_helper.rb +59 -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 +366 -0
- data/spec/features/auto_reloads3_request_spec.rb +130 -0
- data/spec/features/auto_reloads_request_spec.rb +364 -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 +136 -0
- data/spec/features/custom_filters2_request_spec.rb +31 -0
- data/spec/features/custom_filters3_request_spec.rb +34 -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 +135 -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 +175 -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/schema.rb +8 -0
- data/spec/spec_helper.rb +75 -0
- data/spec/support/active_record.rb +10 -0
- 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 +39 -0
- data/spec/wice/table_column_matrix_spec.rb +36 -0
- data/spec/wice/wice_grid_misc_spec.rb +157 -0
- data/spec/wice/wice_grid_spreadsheet_spec.rb +12 -0
- data/vendor/assets/javascripts/wice_grid.js +3 -0
- data/vendor/assets/javascripts/wice_grid_init.js.coffee +351 -0
- data/vendor/assets/javascripts/wice_grid_processor.js.coffee +133 -0
- data/vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee +104 -0
- data/vendor/assets/stylesheets/wice_grid.scss +81 -0
- data/wice_grid.gemspec +54 -0
- metadata +861 -0
@@ -0,0 +1,351 @@
|
|
1
|
+
$ -> initWiceGrid()
|
2
|
+
$(document).on 'turbolinks:render', -> initWiceGrid()
|
3
|
+
|
4
|
+
globalVarForAllGrids = 'wiceGrids'
|
5
|
+
|
6
|
+
initWiceGrid = ->
|
7
|
+
|
8
|
+
$(".wice-grid-container").each (index, wiceGridContainer) ->
|
9
|
+
|
10
|
+
gridName = wiceGridContainer.id
|
11
|
+
dataDiv = $(".wg-data", wiceGridContainer)
|
12
|
+
|
13
|
+
processorInitializerArguments = dataDiv.data("processor-initializer-arguments")
|
14
|
+
|
15
|
+
filterDeclarations = dataDiv.data("filter-declarations")
|
16
|
+
|
17
|
+
focusElementIfNeeded dataDiv.data("foc")
|
18
|
+
|
19
|
+
gridProcessor = new WiceGridProcessor(gridName,
|
20
|
+
processorInitializerArguments[0], processorInitializerArguments[1],
|
21
|
+
processorInitializerArguments[2], processorInitializerArguments[3],
|
22
|
+
processorInitializerArguments[4], processorInitializerArguments[5])
|
23
|
+
|
24
|
+
for filterDeclaration in filterDeclarations
|
25
|
+
do (filterDeclaration) ->
|
26
|
+
if filterDeclaration?
|
27
|
+
gridProcessor.register
|
28
|
+
filterName : filterDeclaration.filterName
|
29
|
+
detached : filterDeclaration.detached
|
30
|
+
templates : filterDeclaration.declaration.templates
|
31
|
+
ids : filterDeclaration.declaration.ids
|
32
|
+
|
33
|
+
unless window[globalVarForAllGrids]
|
34
|
+
window[globalVarForAllGrids] = {}
|
35
|
+
|
36
|
+
window[globalVarForAllGrids][gridName] = gridProcessor
|
37
|
+
|
38
|
+
# setting up stuff for in the context of each grid
|
39
|
+
setupSubmitReset wiceGridContainer, gridProcessor
|
40
|
+
setupCsvExport wiceGridContainer, gridProcessor
|
41
|
+
setupHidingShowingOfFilterRow wiceGridContainer
|
42
|
+
setupShowingAllRecords wiceGridContainer, gridProcessor
|
43
|
+
setupMultiSelectToggle wiceGridContainer
|
44
|
+
setupAutoreloadsForInternalFilters wiceGridContainer, gridProcessor
|
45
|
+
setupBulkToggleForActionColumn wiceGridContainer
|
46
|
+
|
47
|
+
setupAutoreloadsForExternalFilters()
|
48
|
+
setupExternalSubmitReset()
|
49
|
+
setupExternalCsvExport()
|
50
|
+
setupDatepicker()
|
51
|
+
|
52
|
+
# for all grids on oage because it does not matter which grid it is
|
53
|
+
setupMultiSelectToggle $('.wg-detached-filter')
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
moveDateBoundIfInvalidPeriod = (dataFieldNameWithTheOtherDatepicker, datepickerHiddenField, selectedDate, dateFormat, predicate) ->
|
58
|
+
if (datepickerId = datepickerHiddenField.data(dataFieldNameWithTheOtherDatepicker)) &&
|
59
|
+
(theOtherDatepicker = $(_datepickerId = "#" + datepickerId)) &&
|
60
|
+
(theOtherDate = theOtherDatepicker.datepicker('getDate')) &&
|
61
|
+
|
62
|
+
predicate(theOtherDate, selectedDate)
|
63
|
+
theOtherDatepicker.datepicker("setDate", selectedDate)
|
64
|
+
theOtherDatepicker.next().next().html $.datepicker.formatDate(dateFormat, selectedDate)
|
65
|
+
|
66
|
+
|
67
|
+
setupDatepicker = ->
|
68
|
+
if $('.date-filter.wg-jquery-datepicker').length != 0
|
69
|
+
setupJqueryUiDatepicker()
|
70
|
+
|
71
|
+
if $('.date-filter.wg-bootstrap-datepicker').length != 0
|
72
|
+
setupBootstrapDatepicker()
|
73
|
+
|
74
|
+
|
75
|
+
setupBootstrapDatepicker = ->
|
76
|
+
# check for bootstrap datepicker
|
77
|
+
unless $.fn.datepicker
|
78
|
+
alert """Seems like you do not have Bootstrap datepicker gem (https://github.com/Nerian/bootstrap-datepicker-rails)
|
79
|
+
installed. Either install it pick another filter with :filter_type.
|
80
|
+
"""
|
81
|
+
return
|
82
|
+
|
83
|
+
$('.date-filter.wg-bootstrap-datepicker input:text[data-provide=datepicker]').each (index, dateField) ->
|
84
|
+
|
85
|
+
$(dateField).datepicker().on 'hide', (event) ->
|
86
|
+
$self = $(event.currentTarget)
|
87
|
+
|
88
|
+
eventToTriggerOnChange = $self.data('close-calendar-event-name')
|
89
|
+
|
90
|
+
if eventToTriggerOnChange
|
91
|
+
$self.trigger(eventToTriggerOnChange)
|
92
|
+
|
93
|
+
else if $self.attr('id').split('_').pop() == 'fr'
|
94
|
+
$to = $self.parent().next().find('input:text.check-for-bsdatepicker')
|
95
|
+
if $to.length > 0
|
96
|
+
$to.datepicker 'show'
|
97
|
+
|
98
|
+
|
99
|
+
setupJqueryUiDatepicker = ->
|
100
|
+
# check jquery ui datepickeer
|
101
|
+
unless $.datepicker
|
102
|
+
alert """Seems like you do not have jQuery datepicker (http://jqueryui.com/demos/datepicker/)
|
103
|
+
installed. Either install it pick another filter with :filter_type.
|
104
|
+
"""
|
105
|
+
# setting up the locale for datepicker
|
106
|
+
if locale = $('.date-filter.wg-jquery-datepicker input[type=hidden]').data('locale')
|
107
|
+
$.datepicker.setDefaults($.datepicker.regional[locale]);
|
108
|
+
|
109
|
+
|
110
|
+
$('.date-filter.wg-jquery-datepicker .date-label').each (index, removeLink) ->
|
111
|
+
datepickerHiddenField = $('#' + $(removeLink).data('dom-id'))
|
112
|
+
|
113
|
+
eventToTriggerOnChange = datepickerHiddenField.data('close-calendar-event-name')
|
114
|
+
|
115
|
+
# setting up the remove link for datepicker
|
116
|
+
$(removeLink).click (event) ->
|
117
|
+
$(this).html('')
|
118
|
+
datepickerHiddenField.val('')
|
119
|
+
if eventToTriggerOnChange
|
120
|
+
datepickerHiddenField.trigger(eventToTriggerOnChange)
|
121
|
+
event.preventDefault()
|
122
|
+
false
|
123
|
+
that = this
|
124
|
+
|
125
|
+
dateFormat = datepickerHiddenField.data('date-format')
|
126
|
+
|
127
|
+
yearRange = datepickerHiddenField.data('date-year-range')
|
128
|
+
|
129
|
+
labelText = datepickerHiddenField.data('button-text')
|
130
|
+
|
131
|
+
# datepicker constructor
|
132
|
+
datepickerHiddenField.datepicker
|
133
|
+
firstDay: 1
|
134
|
+
dateFormat: dateFormat
|
135
|
+
changeMonth: true
|
136
|
+
changeYear: true
|
137
|
+
yearRange: yearRange
|
138
|
+
|
139
|
+
onSelect: (dateText, inst) ->
|
140
|
+
|
141
|
+
selectedDate = $(this).datepicker("getDate")
|
142
|
+
|
143
|
+
moveDateBoundIfInvalidPeriod(
|
144
|
+
'the-other-datepicker-id-to',
|
145
|
+
datepickerHiddenField,
|
146
|
+
selectedDate,
|
147
|
+
dateFormat,
|
148
|
+
(theOther, selected)-> theOther < selected
|
149
|
+
)
|
150
|
+
|
151
|
+
moveDateBoundIfInvalidPeriod(
|
152
|
+
'the-other-datepicker-id-from',
|
153
|
+
datepickerHiddenField,
|
154
|
+
selectedDate,
|
155
|
+
dateFormat,
|
156
|
+
(theOther, selected)-> theOther > selected
|
157
|
+
)
|
158
|
+
|
159
|
+
$(that).html(dateText)
|
160
|
+
if eventToTriggerOnChange
|
161
|
+
datepickerHiddenField.trigger(eventToTriggerOnChange)
|
162
|
+
|
163
|
+
datepickerContainer = datepickerHiddenField.parent()
|
164
|
+
|
165
|
+
$(removeLink).before(" <i class=\"fa fa-calendar ui-datepicker-trigger\" title=\"#{labelText}\" ></i> ")
|
166
|
+
|
167
|
+
newlyAdded = $('.fa-calendar', datepickerContainer)
|
168
|
+
|
169
|
+
newlyAdded.click ->
|
170
|
+
|
171
|
+
datepickerHiddenField.datepicker("show")
|
172
|
+
|
173
|
+
|
174
|
+
# hiding and showing the row with filters
|
175
|
+
setupHidingShowingOfFilterRow = (wiceGridContainer) ->
|
176
|
+
hideFilter = '.wg-hide-filter'
|
177
|
+
showFilter = '.wg-show-filter'
|
178
|
+
filterRow = '.wg-filter-row'
|
179
|
+
|
180
|
+
$(hideFilter, wiceGridContainer).click ->
|
181
|
+
$(this).hide()
|
182
|
+
$(showFilter, wiceGridContainer).show()
|
183
|
+
$(filterRow, wiceGridContainer).hide()
|
184
|
+
|
185
|
+
$(showFilter, wiceGridContainer).click ->
|
186
|
+
$(this).hide()
|
187
|
+
$(hideFilter, wiceGridContainer).show()
|
188
|
+
$(filterRow, wiceGridContainer).show()
|
189
|
+
|
190
|
+
|
191
|
+
setupCsvExport = (wiceGridContainer, gridProcessor) ->
|
192
|
+
$('.export-to-csv-button', wiceGridContainer).click ->
|
193
|
+
gridProcessor.exportToCsv()
|
194
|
+
|
195
|
+
|
196
|
+
# trigger submit/reset from within the grid
|
197
|
+
setupSubmitReset = (wiceGridContainer, gridProcessor) ->
|
198
|
+
$('.submit', wiceGridContainer).click ->
|
199
|
+
gridProcessor.process()
|
200
|
+
|
201
|
+
$('.reset', wiceGridContainer).click ->
|
202
|
+
gridProcessor.reset()
|
203
|
+
|
204
|
+
$('.wg-filter-row input[type=text], .wg-filter-row input:text[data-provide=datepicker]', wiceGridContainer).keydown (event) ->
|
205
|
+
if event.keyCode == 13
|
206
|
+
event.preventDefault()
|
207
|
+
gridProcessor.process()
|
208
|
+
|
209
|
+
SetEnd = (txt) ->
|
210
|
+
if txt.createTextRange
|
211
|
+
#IE
|
212
|
+
FieldRange = txt.createTextRange()
|
213
|
+
FieldRange.moveStart 'character', txt.value.length
|
214
|
+
FieldRange.collapse()
|
215
|
+
FieldRange.select()
|
216
|
+
else
|
217
|
+
#Firefox and Opera
|
218
|
+
txt.focus()
|
219
|
+
length = txt.value.length
|
220
|
+
txt.setSelectionRange length, length
|
221
|
+
return
|
222
|
+
|
223
|
+
focusElementIfNeeded = (focusId) ->
|
224
|
+
elements = $('#' + focusId)
|
225
|
+
if elToFocus = elements[0]
|
226
|
+
SetEnd elToFocus
|
227
|
+
|
228
|
+
# autoreload for internal filters
|
229
|
+
setupAutoreloadsForInternalFilters = (wiceGridContainer, gridProcessor) ->
|
230
|
+
$('select.auto-reload, input.native-datepicker.auto-reload', wiceGridContainer).change ->
|
231
|
+
gridProcessor.process()
|
232
|
+
|
233
|
+
$('input.auto-reload', wiceGridContainer).keyup (event)->
|
234
|
+
if isKeySignificant event.which
|
235
|
+
gridProcessor.setProcessTimer(this.id)
|
236
|
+
|
237
|
+
$('input.negation-checkbox.auto-reload', wiceGridContainer).click ->
|
238
|
+
gridProcessor.process()
|
239
|
+
|
240
|
+
$(document).bind 'wg:calendarChanged_' + gridProcessor.name, ->
|
241
|
+
gridProcessor.process()
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
isKeySignificant = (keyCode, func)->
|
246
|
+
[37, 38, 39, 40, 9, 27].indexOf(keyCode) == -1
|
247
|
+
|
248
|
+
# autoreload for internal filters
|
249
|
+
setupAutoreloadsForExternalFilters = ->
|
250
|
+
|
251
|
+
$('.wg-detached-filter').each (index, detachedFilterContainer) ->
|
252
|
+
gridProcessor = getGridProcessorForElement(detachedFilterContainer)
|
253
|
+
if gridProcessor
|
254
|
+
$('select.auto-reload, input.native-datepicker.auto-reload', detachedFilterContainer).change ->
|
255
|
+
gridProcessor.process()
|
256
|
+
|
257
|
+
$('input.auto-reload', detachedFilterContainer).keyup (event)->
|
258
|
+
if isKeySignificant event.which
|
259
|
+
gridProcessor.setProcessTimer(this.id)
|
260
|
+
|
261
|
+
$('input.negation-checkbox.auto-reload', detachedFilterContainer).click ->
|
262
|
+
gridProcessor.process()
|
263
|
+
|
264
|
+
|
265
|
+
# trigger the all records mode
|
266
|
+
setupShowingAllRecords = (wiceGridContainer, gridProcessor) ->
|
267
|
+
$('.wg-show-all-link, .wg-back-to-pagination-link', wiceGridContainer).click (event) ->
|
268
|
+
event.preventDefault()
|
269
|
+
gridState = $(this).data("grid-state")
|
270
|
+
confirmationMessage = $(this).data("confim-message")
|
271
|
+
reloadGrid = ->
|
272
|
+
gridProcessor.reloadPageForGivenGridState gridState
|
273
|
+
if confirmationMessage
|
274
|
+
if confirm(confirmationMessage)
|
275
|
+
reloadGrid()
|
276
|
+
else
|
277
|
+
reloadGrid()
|
278
|
+
|
279
|
+
# dropdown filter multiselect
|
280
|
+
setupMultiSelectToggle = (wiceGridContainer)->
|
281
|
+
$('.expand-multi-select-icon', wiceGridContainer).click ->
|
282
|
+
$(this).prev().each (index, select) ->
|
283
|
+
select.multiple = true
|
284
|
+
$(this).next().show()
|
285
|
+
$(this).hide()
|
286
|
+
|
287
|
+
$('.collapse-multi-select-icon', wiceGridContainer).click ->
|
288
|
+
$(this).prev().prev().each (index, select) ->
|
289
|
+
select.multiple = false
|
290
|
+
$(this).prev().show()
|
291
|
+
$(this).hide()
|
292
|
+
|
293
|
+
|
294
|
+
setupBulkToggleForActionColumn = (wiceGridContainer) ->
|
295
|
+
$('.select-all', wiceGridContainer).click ->
|
296
|
+
$('.sel input', wiceGridContainer).prop('checked', true).trigger('change')
|
297
|
+
|
298
|
+
$('.deselect-all', wiceGridContainer).click ->
|
299
|
+
$('.sel input', wiceGridContainer).prop('checked', false).trigger('change')
|
300
|
+
|
301
|
+
$('.wg-select-all', wiceGridContainer).click ->
|
302
|
+
$('.sel input', wiceGridContainer).prop('checked', $(this).prop('checked')).trigger('change')
|
303
|
+
|
304
|
+
|
305
|
+
getGridProcessorForElement = (element) ->
|
306
|
+
gridName = $(element).data('grid-name')
|
307
|
+
if gridName && window[globalVarForAllGrids]
|
308
|
+
window[globalVarForAllGrids][gridName]
|
309
|
+
else
|
310
|
+
null
|
311
|
+
|
312
|
+
|
313
|
+
setupExternalCsvExport = ->
|
314
|
+
|
315
|
+
$(".wg-external-csv-export-button").each (index, externalCsvExportButton) ->
|
316
|
+
gridProcessor = getGridProcessorForElement(externalCsvExportButton)
|
317
|
+
if gridProcessor
|
318
|
+
$(externalCsvExportButton).click (event) ->
|
319
|
+
gridProcessor.exportToCsv()
|
320
|
+
|
321
|
+
|
322
|
+
setupExternalSubmitReset = ->
|
323
|
+
|
324
|
+
$(".wg-external-submit-button").each (index, externalSubmitButton) ->
|
325
|
+
gridProcessor = getGridProcessorForElement(externalSubmitButton)
|
326
|
+
if gridProcessor
|
327
|
+
$(externalSubmitButton).click (event) ->
|
328
|
+
gridProcessor.process()
|
329
|
+
event.preventDefault()
|
330
|
+
false
|
331
|
+
|
332
|
+
$(".wg-external-reset-button").each (index, externalResetButton) ->
|
333
|
+
gridProcessor = getGridProcessorForElement(externalResetButton)
|
334
|
+
if gridProcessor
|
335
|
+
$(externalResetButton).click (event) ->
|
336
|
+
gridProcessor.reset()
|
337
|
+
event.preventDefault()
|
338
|
+
false
|
339
|
+
|
340
|
+
|
341
|
+
$('.wg-detached-filter').each (index, detachedFilterContainer) ->
|
342
|
+
gridProcessor = getGridProcessorForElement(detachedFilterContainer)
|
343
|
+
if gridProcessor
|
344
|
+
$('input[type=text], input:text[data-provide=datepicker]', this).keydown (event) ->
|
345
|
+
if event.keyCode == 13
|
346
|
+
gridProcessor.process()
|
347
|
+
event.preventDefault()
|
348
|
+
false
|
349
|
+
|
350
|
+
window['getGridProcessorForElement'] = getGridProcessorForElement
|
351
|
+
window['initWiceGrid'] = initWiceGrid
|
@@ -0,0 +1,133 @@
|
|
1
|
+
class WiceGridProcessor
|
2
|
+
constructor: (@name, @baseRequestForFilter, @baseLinkForShowAllRecords, @linkForExport, @parameterNameForQueryLoading, @parameterNameForFocus, @environment) ->
|
3
|
+
@filterDeclarations = new Array();
|
4
|
+
@checkIfJsFrameworkIsLoaded()
|
5
|
+
|
6
|
+
checkIfJsFrameworkIsLoaded : ->
|
7
|
+
if ! jQuery
|
8
|
+
alert "jQuery not loaded, WiceGrid cannot proceed!"
|
9
|
+
|
10
|
+
toString : ->
|
11
|
+
"<WiceGridProcessor instance for grid '" + @name + "'>"
|
12
|
+
|
13
|
+
|
14
|
+
process : (domIdToFocus)->
|
15
|
+
@visit @buildUrlWithParams(domIdToFocus)
|
16
|
+
|
17
|
+
visit : (path) ->
|
18
|
+
if Turbolinks?
|
19
|
+
Turbolinks.visit path
|
20
|
+
else
|
21
|
+
window.location = path
|
22
|
+
|
23
|
+
setProcessTimer : (domIdToFocus)->
|
24
|
+
|
25
|
+
if @timer
|
26
|
+
clearTimeout(@timer)
|
27
|
+
@timer = null
|
28
|
+
|
29
|
+
processor = this
|
30
|
+
|
31
|
+
@timer = setTimeout(
|
32
|
+
-> processor.process(domIdToFocus)
|
33
|
+
1000
|
34
|
+
)
|
35
|
+
|
36
|
+
reloadPageForGivenGridState : (gridState)->
|
37
|
+
requestPath = @gridStateToRequest(gridState)
|
38
|
+
@visit @appendToUrl(@baseLinkForShowAllRecords, requestPath)
|
39
|
+
|
40
|
+
|
41
|
+
gridStateToRequest : (gridState)->
|
42
|
+
jQuery.map(
|
43
|
+
gridState
|
44
|
+
(pair) -> encodeURIComponent(pair[0]) + '=' + encodeURIComponent(pair[1])
|
45
|
+
).join('&')
|
46
|
+
|
47
|
+
|
48
|
+
appendToUrl : (url, str)->
|
49
|
+
|
50
|
+
sep = if url.indexOf('?') != -1
|
51
|
+
if /[&\?]$/.exec(url)
|
52
|
+
''
|
53
|
+
else
|
54
|
+
'&'
|
55
|
+
else
|
56
|
+
'?'
|
57
|
+
url + sep + str
|
58
|
+
|
59
|
+
buildUrlWithParams : (domIdToFocus)->
|
60
|
+
results = new Array()
|
61
|
+
jQuery.each(
|
62
|
+
@filterDeclarations
|
63
|
+
(i, filterDeclaration)=>
|
64
|
+
param = @readValuesAndFormQueryString(filterDeclaration.filterName, filterDeclaration.detached, filterDeclaration.templates, filterDeclaration.ids)
|
65
|
+
|
66
|
+
if param && param != ''
|
67
|
+
results.push(param)
|
68
|
+
)
|
69
|
+
|
70
|
+
res = @baseRequestForFilter
|
71
|
+
if results.length != 0
|
72
|
+
allFilterParams = results.join('&')
|
73
|
+
res = @appendToUrl(res, allFilterParams)
|
74
|
+
|
75
|
+
if domIdToFocus
|
76
|
+
res = @appendToUrl(res, @parameterNameForFocus + domIdToFocus)
|
77
|
+
|
78
|
+
res
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
reset : ->
|
83
|
+
@visit @baseRequestForFilter
|
84
|
+
|
85
|
+
|
86
|
+
exportToCsv : ->
|
87
|
+
window.location = @linkForExport
|
88
|
+
|
89
|
+
|
90
|
+
register : (func)->
|
91
|
+
@filterDeclarations.push(func)
|
92
|
+
|
93
|
+
|
94
|
+
readValuesAndFormQueryString : (filterName, detached, templates, ids)->
|
95
|
+
res = new Array()
|
96
|
+
|
97
|
+
for i in [0 .. templates.length-1]
|
98
|
+
|
99
|
+
if $(ids[i]) == null
|
100
|
+
if this.environment == "development"
|
101
|
+
message = 'WiceGrid: Error reading state of filter "' + filterName + '". No DOM element with id "' + ids[i] + '" found.'
|
102
|
+
if detached
|
103
|
+
message += 'You have declared "' + filterName + '" as a detached filter but have not output it anywhere in the template. Read documentation about detached filters.'
|
104
|
+
|
105
|
+
alert(message);
|
106
|
+
|
107
|
+
return ''
|
108
|
+
|
109
|
+
el = $('#' + ids[i])
|
110
|
+
|
111
|
+
if el[0] && el[0].type == 'checkbox'
|
112
|
+
if el[0].checked
|
113
|
+
val = 1;
|
114
|
+
else
|
115
|
+
val = el.val()
|
116
|
+
|
117
|
+
if val instanceof Array
|
118
|
+
for j in [0 .. val.length-1]
|
119
|
+
if val[j] && val[j] != ""
|
120
|
+
res.push(templates[i] + encodeURIComponent(val[j]))
|
121
|
+
|
122
|
+
else if val && val != ''
|
123
|
+
res.push(templates[i] + encodeURIComponent(val));
|
124
|
+
|
125
|
+
|
126
|
+
res.join('&');
|
127
|
+
|
128
|
+
this
|
129
|
+
|
130
|
+
|
131
|
+
WiceGridProcessor._version = '3.4'
|
132
|
+
|
133
|
+
window['WiceGridProcessor'] = WiceGridProcessor
|