tenon 1.1.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +768 -69
- data/Rakefile +7 -13
- data/app/assets/javascripts/tenon/application.js +4 -0
- data/app/controllers/tenon/assets_controller.rb +22 -23
- data/app/controllers/tenon/base_controller.rb +22 -13
- data/app/controllers/tenon/index_controller.rb +0 -4
- data/app/controllers/tenon/item_versions_controller.rb +20 -8
- data/app/controllers/tenon/resources_controller.rb +100 -30
- data/app/controllers/tenon/simple_resources_controller.rb +7 -7
- data/app/controllers/tenon/styleguides_controller.rb +10 -0
- data/app/decorators/tenon/application_decorator.rb +4 -8
- data/app/decorators/tenon/asset_decorator.rb +0 -25
- data/app/filterers/tenon/generic_filterer.rb +24 -0
- data/app/form_builders/tenon/form_builder.rb +189 -19
- data/app/helpers/tenon/active_link_to_helper.rb +9 -0
- data/app/helpers/tenon/application_helper.rb +4 -23
- data/app/helpers/tenon/asset_helper.rb +2 -2
- data/app/helpers/tenon/back_to_index_path_helper.rb +13 -0
- data/app/helpers/tenon/breadcrumbs_helper.rb +33 -0
- data/app/helpers/tenon/flash_helper.rb +14 -0
- data/app/helpers/tenon/icon_helper.rb +7 -0
- data/app/helpers/tenon/input_block_helper.rb +25 -0
- data/app/helpers/tenon/item_version_helper.rb +22 -9
- data/app/helpers/tenon/nav_helper.rb +21 -17
- data/app/helpers/tenon/piece_helper.rb +2 -7
- data/app/helpers/tenon/platform_hints_helper.rb +3 -5
- data/app/helpers/tenon/styleguide_helper.rb +15 -0
- data/app/helpers/tenon/tenon_content_helper.rb +11 -6
- data/app/helpers/tenon/tenon_helper.rb +19 -9
- data/app/models/tenon/application_record.rb +5 -0
- data/app/models/tenon/asset.rb +2 -2
- data/app/models/tenon/item_asset.rb +1 -1
- data/app/models/tenon/item_version.rb +1 -1
- data/app/models/tenon/styleguide.rb +11 -0
- data/app/models/tenon/tenon_content/piece.rb +13 -13
- data/app/models/tenon/tenon_content/row.rb +1 -1
- data/app/models/tenon/tenon_content/row_types/four_column_image.rb +4 -4
- data/app/models/tenon/tenon_content/row_types/four_column_image_and_text.rb +8 -8
- data/app/models/tenon/tenon_content/row_types/four_column_text.rb +4 -4
- data/app/models/tenon/tenon_content/row_types/full_width_embedded_content.rb +1 -1
- data/app/models/tenon/tenon_content/row_types/full_width_image.rb +1 -1
- data/app/models/tenon/tenon_content/row_types/full_width_text.rb +1 -1
- data/app/models/tenon/tenon_content/row_types/left_image_right_text.rb +2 -2
- data/app/models/tenon/tenon_content/row_types/left_text_right_image.rb +2 -2
- data/app/models/tenon/tenon_content/row_types/left_wrapped_image_with_text.rb +2 -2
- data/app/models/tenon/tenon_content/row_types/right_wrapped_image_with_text.rb +2 -2
- data/app/models/tenon/tenon_content/row_types/six_column_image.rb +6 -6
- data/app/models/tenon/tenon_content/row_types/six_column_image_and_text.rb +12 -12
- data/app/models/tenon/tenon_content/row_types/three_column_image.rb +3 -3
- data/app/models/tenon/tenon_content/row_types/three_column_image_and_text.rb +6 -6
- data/app/models/tenon/tenon_content/row_types/three_column_text.rb +3 -3
- data/app/models/tenon/tenon_content/row_types/two_column_image.rb +2 -2
- data/app/models/tenon/tenon_content/row_types/two_column_image_and_text.rb +4 -4
- data/app/models/tenon/tenon_content/row_types/two_column_text.rb +2 -2
- data/app/models/tenon/tenon_content/row_types/two_column_with_background_image.rb +3 -3
- data/app/models/tenon/tenon_content/row_types.rb +17 -17
- data/app/policies/my_settings_policy.rb +2 -0
- data/app/policies/tenon/application_policy.rb +63 -0
- data/app/policies/tenon/asset_policy.rb +4 -0
- data/app/policies/tenon/item_version_policy.rb +4 -0
- data/app/serializers/item_version_serializer.rb +23 -0
- data/app/serializers/tenon/application_serializer.rb +37 -0
- data/app/serializers/tenon/asset_serializer.rb +5 -0
- data/app/serializers/tenon/paginating_serializer.rb +18 -0
- data/app/views/layouts/tenon/application.html.haml +28 -18
- data/app/views/tenon/assets/_form.html.haml +29 -12
- data/app/views/tenon/assets/crop.html.haml +13 -13
- data/app/views/tenon/assets/edit.html.haml +1 -12
- data/app/views/tenon/assets/index.html.haml +5 -19
- data/app/views/tenon/assets/new.html.haml +1 -0
- data/app/views/tenon/fields/_asset.html.haml +26 -27
- data/app/views/tenon/fields/_base.html.haml +7 -0
- data/app/views/tenon/fields/_base_inline.html.haml +4 -0
- data/app/views/tenon/fields/_check_box.html.haml +9 -0
- data/app/views/tenon/fields/_collection_select.html.haml +4 -0
- data/app/views/tenon/fields/_color_field.html.haml +3 -0
- data/app/views/tenon/fields/_date_picker.html.haml +2 -0
- data/app/views/tenon/fields/_date_time_picker.html.haml +6 -0
- data/app/views/tenon/fields/_email_field.html.haml +2 -0
- data/app/views/tenon/fields/_inline_check_box.html.haml +5 -0
- data/app/views/tenon/fields/_inline_radio_button.html.haml +5 -0
- data/app/views/tenon/fields/_number_field.html.haml +2 -0
- data/app/views/tenon/fields/_password_field.html.haml +2 -0
- data/app/views/tenon/fields/_phone_field.html.haml +2 -0
- data/app/views/tenon/fields/_radio_button.html.haml +9 -0
- data/app/views/tenon/fields/_rich_text.html.haml +3 -6
- data/app/views/tenon/fields/_select.html.haml +3 -0
- data/app/views/tenon/fields/_text_area.html.haml +2 -0
- data/app/views/tenon/fields/_text_field.html.haml +2 -0
- data/app/views/tenon/fields/_title_text_field.html.haml +2 -0
- data/app/views/tenon/fields/_url_field.html.haml +2 -0
- data/app/views/tenon/index/index.html.haml +8 -29
- data/app/views/tenon/item_assets/new.html.haml +20 -22
- data/app/views/tenon/item_versions/_item_version.json.jbuilder +4 -4
- data/app/views/tenon/item_versions/index.html.haml +14 -6
- data/app/views/tenon/item_versions/new.html.haml +8 -10
- data/app/views/tenon/settings/_contact.html.haml +14 -19
- data/app/views/tenon/settings/_general.html.haml +15 -11
- data/app/views/tenon/settings/_seo.html.haml +10 -9
- data/app/views/tenon/settings/show.html.haml +12 -31
- data/app/views/tenon/shared/_account_dropdown.html.haml +6 -0
- data/app/views/tenon/shared/_app_info.html.haml +5 -0
- data/app/views/tenon/shared/_breadcrumbs.html.haml +1 -0
- data/app/views/tenon/shared/_burger.html.haml +5 -0
- data/app/views/tenon/shared/_default_form_toolbar.html.haml +26 -0
- data/app/views/tenon/shared/_draft_controls.html.haml +18 -0
- data/app/views/tenon/shared/_i18n_language_nav.html.haml +2 -2
- data/app/views/tenon/shared/_main_nav.html.haml +3 -14
- data/app/views/tenon/shared/_platform_hints.html.haml +15 -15
- data/app/views/tenon/shared/_seo_fields.html.haml +8 -6
- data/app/views/tenon/shared/_site_title.html.haml +6 -0
- data/app/views/tenon/shared/_util_nav.html.haml +4 -27
- data/app/views/tenon/shared/_version_warning.html.haml +11 -11
- data/app/views/tenon/styleguides/_buttons.html.haml +118 -0
- data/app/views/tenon/styleguides/_colors.html.haml +59 -0
- data/app/views/tenon/styleguides/_forms.html.haml +4 -0
- data/app/views/tenon/styleguides/_icons.html.haml +21 -0
- data/app/views/tenon/styleguides/_typography.html.haml +27 -0
- data/app/views/tenon/styleguides/buttons/_colors.html.haml +43 -0
- data/app/views/tenon/styleguides/buttons/_styles.html.haml +59 -0
- data/app/views/tenon/styleguides/colors/_helpers.html.haml +48 -0
- data/app/views/tenon/styleguides/colors/_variables.html.haml +31 -0
- data/app/views/tenon/styleguides/forms/_default.html.haml +92 -0
- data/app/views/tenon/styleguides/forms/_html5.html.haml +31 -0
- data/app/views/tenon/styleguides/forms/_tenon_content.html.haml +15 -0
- data/app/views/tenon/styleguides/index.html.haml +52 -0
- data/app/views/tenon/styleguides/typography/_blockquote.html.haml +7 -0
- data/app/views/tenon/styleguides/typography/_inline.html.haml +8 -0
- data/app/views/tenon/styleguides/typography/_lists.html.haml +40 -0
- data/app/views/tenon/styleguides/typography/_paragraphs.html.haml +17 -0
- data/app/views/tenon/styleguides/typography/_small.html.haml +18 -0
- data/app/views/tenon/styleguides/typography/_styles.html.haml +14 -0
- data/app/views/tenon/styleguides/typography/_variables.html.haml +43 -0
- data/app/views/tenon/tenon_content/_display.html.haml +2 -2
- data/app/views/tenon/tenon_content/_embed_modal.html.haml +3 -3
- data/app/views/tenon/tenon_content/_fields.html.haml +21 -35
- data/app/views/tenon/tenon_content/_row.html.haml +14 -13
- data/app/views/tenon/tenon_content/{_builder.html.haml → _tenon_content.html.haml} +2 -2
- data/app/views/tenon/tenon_content/piece_types/form/_background_image.html.haml +6 -6
- data/app/views/tenon/tenon_content/piece_types/form/_embedded_content.html.haml +2 -1
- data/app/views/tenon/tenon_content/piece_types/form/_image.html.haml +37 -29
- data/app/views/tenon/tenon_content/row_types/display/_four_column_image.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_four_column_image_and_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/display/_four_column_text.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_full_width_embedded_content.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/display/_full_width_image.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/display/_full_width_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/display/_left_image_right_text.html.haml +8 -8
- data/app/views/tenon/tenon_content/row_types/display/_left_text_right_image.html.haml +7 -7
- data/app/views/tenon/tenon_content/row_types/display/_left_wrapped_image_with_text.html.haml +6 -6
- data/app/views/tenon/tenon_content/row_types/display/_right_wrapped_image_with_text.html.haml +7 -7
- data/app/views/tenon/tenon_content/row_types/display/_six_column_image.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_six_column_image_and_text.html.haml +5 -5
- data/app/views/tenon/tenon_content/row_types/display/_three_column_image.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_three_column_image_and_text.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_three_column_text.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_two_column_image.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/display/_two_column_image_and_text.html.haml +4 -4
- data/app/views/tenon/tenon_content/row_types/display/_two_column_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/display/_two_column_with_background_image.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_four_column_image.html.haml +2 -2
- data/app/views/tenon/tenon_content/row_types/form/_four_column_image_and_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_four_column_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_full_width_embedded_content.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_full_width_image.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_full_width_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_left_image_right_text.html.haml +9 -8
- data/app/views/tenon/tenon_content/row_types/form/_left_text_right_image.html.haml +6 -6
- data/app/views/tenon/tenon_content/row_types/form/_left_wrapped_image_with_text.html.haml +7 -7
- data/app/views/tenon/tenon_content/row_types/form/_right_wrapped_image_with_text.html.haml +7 -7
- data/app/views/tenon/tenon_content/row_types/form/_six_column_image.html.haml +2 -2
- data/app/views/tenon/tenon_content/row_types/form/_six_column_image_and_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_three_column_image.html.haml +2 -2
- data/app/views/tenon/tenon_content/row_types/form/_three_column_image_and_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_three_column_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_two_column_image.html.haml +2 -2
- data/app/views/tenon/tenon_content/row_types/form/_two_column_image_and_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_two_column_text.html.haml +3 -3
- data/app/views/tenon/tenon_content/row_types/form/_two_column_with_background_image.html.haml +2 -2
- data/config/initializers/class_extensions/hash.rb +1 -1
- data/config/initializers/client_side_validations.rb +27 -0
- data/config/initializers/tenon.rb +0 -14
- data/config/routes.rb +10 -46
- data/db/migrate/20151117171000_drop_default_tenon_resources.rb +15 -0
- data/db/migrate/20160119185645_remove_tenon_users.rb +7 -0
- data/db/migrate/20160126123154_remove_tenon_callouts_subscribers.rb +8 -0
- data/db/migrate/20160126194219_convert_piece_size_to_int.rb +6 -0
- data/lib/ckeditor/plugins/pastefromword/filter/default.js +1 -1
- data/lib/generators/tenon/scaffold/scaffold_generator.rb +52 -27
- data/lib/generators/tenon/scaffold/templates/controller.rb +7 -4
- data/lib/generators/tenon/scaffold/templates/policy.rb +2 -0
- data/lib/generators/tenon/scaffold/templates/serializer.rb +2 -0
- data/lib/generators/tenon/scaffold/templates/view__form.html.haml +49 -54
- data/lib/generators/tenon/scaffold/templates/view_edit.html.haml +1 -8
- data/lib/generators/tenon/scaffold/templates/view_index.html.haml +8 -24
- data/lib/generators/tenon/scaffold/templates/view_new.html.haml +1 -8
- data/lib/tasks/tenon_tasks.rake +2 -2
- data/lib/templates/active_record/model/model.rb +12 -13
- data/lib/templates/migration/templates/create_table_migration.rb +1 -1
- data/lib/tenon/can_be_foreign.rb +1 -1
- data/lib/tenon/engine.rb +26 -32
- data/lib/tenon/filterers/base_filterer.rb +64 -0
- data/lib/tenon/has_history/attr_serializer.rb +6 -6
- data/lib/tenon/proxy_attachment.rb +2 -2
- data/lib/tenon/version.rb +1 -1
- data/lib/tenon.rb +1 -3
- data/vendor/assets/javascripts/bootstrap.modal.js +1 -1
- data/vendor/assets/javascripts/date_picker/picker.date.js +1429 -0
- data/vendor/assets/javascripts/date_picker/picker.js +1122 -0
- data/vendor/assets/javascripts/number-to-words.es6 +35 -0
- data/vendor/assets/stylesheets/bootstrap.scss +1 -1
- metadata +206 -972
- data/app/assets/images/tenon/icons/delete.png +0 -0
- data/app/assets/images/tenon/icons/edit.png +0 -0
- data/app/assets/images/tenon/icons/thumbdown.png +0 -0
- data/app/assets/images/tenon/icons/thumbup.png +0 -0
- data/app/assets/images/tenon/select2-spinner.gif +0 -0
- data/app/assets/images/tenon/select2.png +0 -0
- data/app/assets/images/tenon/select2x2.png +0 -0
- data/app/assets/javascripts/tenon/controllers/assets.js.coffee +0 -3
- data/app/assets/javascripts/tenon/controllers/index.js.coffee +0 -6
- data/app/assets/javascripts/tenon/controllers/tenon.js.coffee +0 -1
- data/app/assets/javascripts/tenon/features/asset_attachment.js.coffee +0 -37
- data/app/assets/javascripts/tenon/features/asset_cropping.js.coffee +0 -49
- data/app/assets/javascripts/tenon/features/asset_detachment.js.coffee +0 -11
- data/app/assets/javascripts/tenon/features/asset_list_post_crop_handler.js.coffee +0 -15
- data/app/assets/javascripts/tenon/features/asset_uploader.js.coffee +0 -88
- data/app/assets/javascripts/tenon/features/box_toggles.js.coffee +0 -17
- data/app/assets/javascripts/tenon/features/cocoon_hooks.js.coffee +0 -12
- data/app/assets/javascripts/tenon/features/date_time_picker.js.coffee +0 -25
- data/app/assets/javascripts/tenon/features/editor.js.coffee +0 -24
- data/app/assets/javascripts/tenon/features/file_select_widget.js.erb +0 -39
- data/app/assets/javascripts/tenon/features/flash.js.coffee +0 -13
- data/app/assets/javascripts/tenon/features/focus_first_field.js.coffee +0 -8
- data/app/assets/javascripts/tenon/features/hamburger_navigation.js.coffee +0 -26
- data/app/assets/javascripts/tenon/features/header_menu.js.coffee +0 -20
- data/app/assets/javascripts/tenon/features/i18n_fields.js.coffee +0 -23
- data/app/assets/javascripts/tenon/features/infinite_loading.js.coffee +0 -12
- data/app/assets/javascripts/tenon/features/item_version_autosave.js.coffee +0 -35
- data/app/assets/javascripts/tenon/features/item_version_index_handler.js.coffee +0 -3
- data/app/assets/javascripts/tenon/features/main_menu.js.coffee +0 -11
- data/app/assets/javascripts/tenon/features/modal_forms.js.coffee +0 -44
- data/app/assets/javascripts/tenon/features/modal_windows.js.coffee +0 -104
- data/app/assets/javascripts/tenon/features/multiple_asset_attachment.js.coffee +0 -8
- data/app/assets/javascripts/tenon/features/nested_fields.js +0 -95
- data/app/assets/javascripts/tenon/features/nested_lists.js +0 -10
- data/app/assets/javascripts/tenon/features/nested_set_writer.js.coffee +0 -65
- data/app/assets/javascripts/tenon/features/new_item_version_handler.js.coffee +0 -32
- data/app/assets/javascripts/tenon/features/pagination.js.coffee +0 -21
- data/app/assets/javascripts/tenon/features/protect_changes.js.coffee +0 -25
- data/app/assets/javascripts/tenon/features/quick_search.js.coffee +0 -41
- data/app/assets/javascripts/tenon/features/record_approval.js.coffee +0 -33
- data/app/assets/javascripts/tenon/features/record_boolean_toggle.js.coffee +0 -37
- data/app/assets/javascripts/tenon/features/record_deletion.js.coffee +0 -24
- data/app/assets/javascripts/tenon/features/record_list.js.coffee +0 -86
- data/app/assets/javascripts/tenon/features/record_list_updater.js.coffee +0 -56
- data/app/assets/javascripts/tenon/features/s3_direct_upload.js.coffee +0 -43
- data/app/assets/javascripts/tenon/features/sidebar_active_links.js.coffee +0 -20
- data/app/assets/javascripts/tenon/features/sortable_nested_fields.js.coffee +0 -17
- data/app/assets/javascripts/tenon/features/tenon_content/aesthetics.js.coffee +0 -31
- data/app/assets/javascripts/tenon/features/tenon_content/asset_attachment.js.coffee +0 -15
- data/app/assets/javascripts/tenon/features/tenon_content/asset_link.js.coffee +0 -11
- data/app/assets/javascripts/tenon/features/tenon_content/base.js.coffee +0 -16
- data/app/assets/javascripts/tenon/features/tenon_content/bottombar_toggler.js.coffee +0 -15
- data/app/assets/javascripts/tenon/features/tenon_content/caption_toggler.js.coffee +0 -11
- data/app/assets/javascripts/tenon/features/tenon_content/column_sizing.js.coffee +0 -53
- data/app/assets/javascripts/tenon/features/tenon_content/column_swap.js.coffee +0 -44
- data/app/assets/javascripts/tenon/features/tenon_content/editor.js.coffee +0 -34
- data/app/assets/javascripts/tenon/features/tenon_content/embedded_content_modal_handler.js.coffee +0 -12
- data/app/assets/javascripts/tenon/features/tenon_content/image_asset_link.js.coffee +0 -5
- data/app/assets/javascripts/tenon/features/tenon_content/image_controls.js.coffee +0 -63
- data/app/assets/javascripts/tenon/features/tenon_content/image_links.js.coffee +0 -54
- data/app/assets/javascripts/tenon/features/tenon_content/library.js.coffee +0 -39
- data/app/assets/javascripts/tenon/features/tenon_content/library_filter.js.coffee +0 -17
- data/app/assets/javascripts/tenon/features/tenon_content/pop_out.js.coffee +0 -46
- data/app/assets/javascripts/tenon/features/tenon_content/post_crop_handler.js.coffee +0 -22
- data/app/assets/javascripts/tenon/features/tenon_content/sidebar_navigation.js.coffee +0 -26
- data/app/assets/javascripts/tenon/features/tenon_content/sortable.js.coffee +0 -18
- data/app/assets/javascripts/tenon/features/tenon_content/stretch_to_fill.js.coffee +0 -50
- data/app/assets/javascripts/tenon/features/tenon_content/wrapped_sizing.js.coffee +0 -48
- data/app/assets/javascripts/tenon/features/tenon_content.js.coffee +0 -1
- data/app/assets/javascripts/tenon/features/video_feeds.js.coffee +0 -4
- data/app/assets/javascripts/tenon/manifest.json +0 -44
- data/app/assets/javascripts/tenon/medium-on-tenon.js +0 -1465
- data/app/assets/javascripts/tenon/templates/assets/asset_field.jst.eco +0 -17
- data/app/assets/javascripts/tenon/templates/assets/asset_progress.jst.eco +0 -8
- data/app/assets/javascripts/tenon/templates/assets/asset_row.jst.eco +0 -21
- data/app/assets/javascripts/tenon/templates/assets/asset_select.jst.eco +0 -1
- data/app/assets/javascripts/tenon/templates/comments/comment_row.jst.eco +0 -23
- data/app/assets/javascripts/tenon/templates/contacts/contact_row.jst.eco +0 -56
- data/app/assets/javascripts/tenon/templates/errors.jst.eco +0 -13
- data/app/assets/javascripts/tenon/templates/events/event_row.jst.eco +0 -22
- data/app/assets/javascripts/tenon/templates/galleries/gallery_row.jst.eco +0 -12
- data/app/assets/javascripts/tenon/templates/item_versions/item_version_row.jst.eco +0 -22
- data/app/assets/javascripts/tenon/templates/modal.jst.eco +0 -14
- data/app/assets/javascripts/tenon/templates/pages/page_row.jst.eco +0 -21
- data/app/assets/javascripts/tenon/templates/post_categories/post_category_row.jst.eco +0 -12
- data/app/assets/javascripts/tenon/templates/posts/post_row.jst.eco +0 -30
- data/app/assets/javascripts/tenon/templates/redirects/redirect_row.jst.eco +0 -18
- data/app/assets/javascripts/tenon/templates/tenon_callouts/tenon_callout_row.jst.eco +0 -19
- data/app/assets/javascripts/tenon/templates/tenon_content/popped_out.jst.eco +0 -6
- data/app/assets/javascripts/tenon/templates/users/user_row.jst.eco +0 -21
- data/app/assets/javascripts/tenon/tenon.js +0 -68
- data/app/assets/javascripts/tenon/tenon_dispatcher.js.coffee +0 -25
- data/app/assets/javascripts/tenon/tenon_manifest.js +0 -45
- data/app/assets/stylesheets/tenon/colors-custom.scss +0 -25
- data/app/assets/stylesheets/tenon/colors-named.scss +0 -22
- data/app/assets/stylesheets/tenon/helpers.scss +0 -28
- data/app/assets/stylesheets/tenon/layout/assets.scss +0 -49
- data/app/assets/stylesheets/tenon/layout/breakpoints.scss +0 -48
- data/app/assets/stylesheets/tenon/layout/global.scss +0 -36
- data/app/assets/stylesheets/tenon/layout/grid.scss +0 -145
- data/app/assets/stylesheets/tenon/layout/main-nav.scss +0 -149
- data/app/assets/stylesheets/tenon/layout/margins.scss +0 -3
- data/app/assets/stylesheets/tenon/layout/mobile.scss +0 -5
- data/app/assets/stylesheets/tenon/layout/sidebar.scss +0 -102
- data/app/assets/stylesheets/tenon/layout/util-nav.scss +0 -51
- data/app/assets/stylesheets/tenon/mixins.scss +0 -81
- data/app/assets/stylesheets/tenon/styleguide.scss +0 -6
- data/app/assets/stylesheets/tenon/tenon.scss +0 -71
- data/app/assets/stylesheets/tenon/typography.scss +0 -65
- data/app/assets/stylesheets/tenon/ui/alerts.scss +0 -65
- data/app/assets/stylesheets/tenon/ui/asset-attachment.scss +0 -136
- data/app/assets/stylesheets/tenon/ui/asset-cropping.scss +0 -51
- data/app/assets/stylesheets/tenon/ui/asset-uploads.scss +0 -26
- data/app/assets/stylesheets/tenon/ui/buttons.scss +0 -65
- data/app/assets/stylesheets/tenon/ui/callouts.scss +0 -26
- data/app/assets/stylesheets/tenon/ui/comments.scss +0 -57
- data/app/assets/stylesheets/tenon/ui/forms.scss +0 -204
- data/app/assets/stylesheets/tenon/ui/generic-loader.scss +0 -21
- data/app/assets/stylesheets/tenon/ui/header-tools.scss +0 -116
- data/app/assets/stylesheets/tenon/ui/i18n.scss +0 -18
- data/app/assets/stylesheets/tenon/ui/list-style-toggle.scss +0 -39
- data/app/assets/stylesheets/tenon/ui/login.scss +0 -97
- data/app/assets/stylesheets/tenon/ui/medium-editor.scss +0 -114
- data/app/assets/stylesheets/tenon/ui/modals.scss +0 -179
- data/app/assets/stylesheets/tenon/ui/pagination.scss +0 -113
- data/app/assets/stylesheets/tenon/ui/progress-bars.scss +0 -131
- data/app/assets/stylesheets/tenon/ui/quick-search.scss +0 -20
- data/app/assets/stylesheets/tenon/ui/record-grids.scss +0 -95
- data/app/assets/stylesheets/tenon/ui/record-lists.scss +0 -154
- data/app/assets/stylesheets/tenon/ui/section-headers.scss +0 -30
- data/app/assets/stylesheets/tenon/ui/select2-custom.scss +0 -70
- data/app/assets/stylesheets/tenon/ui/tables.scss +0 -19
- data/app/assets/stylesheets/tenon/ui/tabs.scss +0 -7
- data/app/assets/stylesheets/tenon/ui/tenon-content-library.scss +0 -80
- data/app/assets/stylesheets/tenon/ui/tenon-content-popped-out.scss +0 -92
- data/app/assets/stylesheets/tenon/ui/tenon-content.scss +0 -318
- data/app/assets/stylesheets/tenon/ui/thinking.scss +0 -3
- data/app/assets/stylesheets/tenon/ui/toolbox.scss +0 -31
- data/app/assets/stylesheets/tenon/z-indexes.scss +0 -35
- data/app/assets/stylesheets/tenon_addons.scss +0 -1
- data/app/controllers/tenon/comments_controller.rb +0 -51
- data/app/controllers/tenon/contacts_controller.rb +0 -65
- data/app/controllers/tenon/events_controller.rb +0 -9
- data/app/controllers/tenon/galleries_controller.rb +0 -9
- data/app/controllers/tenon/pages_controller.rb +0 -51
- data/app/controllers/tenon/post_categories_controller.rb +0 -9
- data/app/controllers/tenon/posts_controller.rb +0 -28
- data/app/controllers/tenon/redirects_controller.rb +0 -25
- data/app/controllers/tenon/tenon_callouts_controller.rb +0 -7
- data/app/controllers/tenon/users_controller.rb +0 -64
- data/app/decorators/tenon/comment_decorator.rb +0 -22
- data/app/decorators/tenon/contact_decorator.rb +0 -13
- data/app/decorators/tenon/event_decorator.rb +0 -11
- data/app/decorators/tenon/gallery_decorator.rb +0 -4
- data/app/decorators/tenon/page_decorator.rb +0 -11
- data/app/decorators/tenon/post_category_decorator.rb +0 -4
- data/app/decorators/tenon/post_decorator.rb +0 -4
- data/app/decorators/tenon/redirect_decorator.rb +0 -2
- data/app/decorators/tenon/tenon_callout_decorator.rb +0 -4
- data/app/decorators/tenon/user_decorator.rb +0 -4
- data/app/mailers/tenon/comment_mailer.rb +0 -16
- data/app/mailers/tenon/contact_mailer.rb +0 -15
- data/app/models/ability.rb +0 -32
- data/app/models/tenon/comment.rb +0 -47
- data/app/models/tenon/comment_subscriber.rb +0 -7
- data/app/models/tenon/contact.rb +0 -46
- data/app/models/tenon/event.rb +0 -45
- data/app/models/tenon/gallery.rb +0 -15
- data/app/models/tenon/page.rb +0 -105
- data/app/models/tenon/photo.rb +0 -10
- data/app/models/tenon/post.rb +0 -35
- data/app/models/tenon/post_category.rb +0 -7
- data/app/models/tenon/redirect.rb +0 -17
- data/app/models/tenon/role.rb +0 -8
- data/app/models/tenon/role_assignment.rb +0 -6
- data/app/models/tenon/s3_direct_upload.rb +0 -75
- data/app/models/tenon/tenon_callout.rb +0 -16
- data/app/models/tenon/user.rb +0 -60
- data/app/views/devise/confirmations/new.html.erb +0 -12
- data/app/views/devise/confirmations/new.html.haml +0 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +0 -7
- data/app/views/devise/mailer/reset_password_instructions.html.haml +0 -15
- data/app/views/devise/mailer/unlock_instructions.html.haml +0 -9
- data/app/views/devise/passwords/edit.html.haml +0 -22
- data/app/views/devise/passwords/new.html.haml +0 -17
- data/app/views/devise/registrations/edit.html.haml +0 -0
- data/app/views/devise/registrations/new.html.haml +0 -22
- data/app/views/devise/sessions/new.html.haml +0 -28
- data/app/views/devise/shared/_links.erb +0 -19
- data/app/views/devise/shared/_links.haml +0 -0
- data/app/views/devise/unlocks/new.html.erb +0 -12
- data/app/views/devise/unlocks/new.html.haml +0 -0
- data/app/views/layouts/tenon/login.html.haml +0 -19
- data/app/views/tenon/assets/_asset.json.jbuilder +0 -7
- data/app/views/tenon/assets/_sidebar_index.html.haml +0 -18
- data/app/views/tenon/assets/create.json.jbuilder +0 -1
- data/app/views/tenon/assets/index.json.jbuilder +0 -5
- data/app/views/tenon/assets/update.json.jbuilder +0 -1
- data/app/views/tenon/comment_mailer/comment_notification.html.haml +0 -7
- data/app/views/tenon/comments/_sidebar_index.html.haml +0 -22
- data/app/views/tenon/comments/index.html.haml +0 -19
- data/app/views/tenon/comments/index.json.jbuilder +0 -22
- data/app/views/tenon/contact_mailer/contact_notification.html.haml +0 -15
- data/app/views/tenon/contacts/_sidebar_index.html.haml +0 -32
- data/app/views/tenon/contacts/index.html.haml +0 -19
- data/app/views/tenon/contacts/index.json.jbuilder +0 -15
- data/app/views/tenon/events/_form.html.haml +0 -44
- data/app/views/tenon/events/edit.html.haml +0 -8
- data/app/views/tenon/events/index.html.haml +0 -23
- data/app/views/tenon/events/index.json.jbuilder +0 -16
- data/app/views/tenon/events/new.html.haml +0 -8
- data/app/views/tenon/galleries/_form.html.haml +0 -38
- data/app/views/tenon/galleries/_photo_fields.html.haml +0 -3
- data/app/views/tenon/galleries/edit.html.haml +0 -8
- data/app/views/tenon/galleries/index.html.haml +0 -22
- data/app/views/tenon/galleries/index.json.jbuilder +0 -15
- data/app/views/tenon/galleries/new.html.haml +0 -8
- data/app/views/tenon/pages/_form.html.haml +0 -58
- data/app/views/tenon/pages/edit.html.haml +0 -8
- data/app/views/tenon/pages/index.html.haml +0 -23
- data/app/views/tenon/pages/index.json.jbuilder +0 -22
- data/app/views/tenon/pages/new.html.haml +0 -8
- data/app/views/tenon/post_categories/_form.html.haml +0 -11
- data/app/views/tenon/post_categories/_post_category.json.jbuilder +0 -2
- data/app/views/tenon/post_categories/create.json.jbuilder +0 -1
- data/app/views/tenon/post_categories/edit.html.haml +0 -1
- data/app/views/tenon/post_categories/index.html.haml +0 -30
- data/app/views/tenon/post_categories/index.json.jbuilder +0 -5
- data/app/views/tenon/post_categories/update.json.jbuilder +0 -1
- data/app/views/tenon/posts/_form.html.haml +0 -65
- data/app/views/tenon/posts/edit.html.haml +0 -8
- data/app/views/tenon/posts/index.html.haml +0 -27
- data/app/views/tenon/posts/index.json.jbuilder +0 -20
- data/app/views/tenon/posts/new.html.haml +0 -8
- data/app/views/tenon/redirects/_form.html.haml +0 -42
- data/app/views/tenon/redirects/_redirect.json.jbuilder +0 -3
- data/app/views/tenon/redirects/edit.html.haml +0 -8
- data/app/views/tenon/redirects/index.html.haml +0 -29
- data/app/views/tenon/redirects/index.json.jbuilder +0 -5
- data/app/views/tenon/redirects/new.html.haml +0 -8
- data/app/views/tenon/shared/_posts_nav.html.haml +0 -8
- data/app/views/tenon/shared/menu_items/_assets.html.haml +0 -3
- data/app/views/tenon/shared/menu_items/_comments.html.haml +0 -2
- data/app/views/tenon/shared/menu_items/_events.html.haml +0 -6
- data/app/views/tenon/shared/menu_items/_galleries.html.haml +0 -6
- data/app/views/tenon/shared/menu_items/_pages.html.haml +0 -6
- data/app/views/tenon/shared/menu_items/_posts.html.haml +0 -7
- data/app/views/tenon/shared/menu_items/_settings.html.haml +0 -2
- data/app/views/tenon/shared/menu_items/_users.html.haml +0 -2
- data/app/views/tenon/shared/section_header/_quick_search.html.haml +0 -3
- data/app/views/tenon/shared/section_header/_sidebar_toggle.html.haml +0 -1
- data/app/views/tenon/tenon_callouts/_form.html.haml +0 -45
- data/app/views/tenon/tenon_callouts/_tenon_callout.json.jbuilder +0 -1
- data/app/views/tenon/tenon_callouts/edit.html.haml +0 -8
- data/app/views/tenon/tenon_callouts/index.html.haml +0 -24
- data/app/views/tenon/tenon_callouts/index.json.jbuilder +0 -5
- data/app/views/tenon/tenon_callouts/new.html.haml +0 -8
- data/app/views/tenon/users/_form.html.haml +0 -50
- data/app/views/tenon/users/edit.html.haml +0 -8
- data/app/views/tenon/users/index.html.haml +0 -23
- data/app/views/tenon/users/index.json.jbuilder +0 -28
- data/app/views/tenon/users/new.html.haml +0 -8
- data/config/initializers/devise.rb +0 -258
- data/config/locales/devise.en.yml +0 -60
- data/config/locales/tenon.en.yml +0 -313
- data/db/seeds.rb +0 -47
- data/lib/generators/tenon/scaffold/templates/view__item.json.jbuilder +0 -1
- data/lib/generators/tenon/scaffold/templates/view_index.json.jbuilder +0 -5
- data/lib/generators/tenon/scaffold/templates/view_item_row.jst.eco +0 -13
- data/lib/generators/tenon/scaffold_small/scaffold_small_generator.rb +0 -8
- data/lib/generators/tenon/scaffold_small/templates/controller.rb +0 -19
- data/lib/generators/tenon/scaffold_small/templates/decorator.rb +0 -2
- data/lib/generators/tenon/scaffold_small/templates/view__form.html.haml +0 -26
- data/lib/generators/tenon/scaffold_small/templates/view__item.json.jbuilder +0 -2
- data/lib/generators/tenon/scaffold_small/templates/view_create.json.jbuilder +0 -1
- data/lib/generators/tenon/scaffold_small/templates/view_index.html.haml +0 -27
- data/lib/generators/tenon/scaffold_small/templates/view_index.json.jbuilder +0 -5
- data/lib/generators/tenon/scaffold_small/templates/view_item_row.jst.eco +0 -12
- data/lib/generators/tenon/scaffold_small/templates/view_update.json.jbuilder +0 -1
- data/lib/tenon/can_have_comments.rb +0 -16
- data/lib/tenon/config/events.rb +0 -29
- data/lib/tenon/factories/comments.rb +0 -10
- data/lib/tenon/factories/contacts.rb +0 -9
- data/lib/tenon/factories/events.rb +0 -7
- data/lib/tenon/factories/galleries.rb +0 -5
- data/lib/tenon/factories/pages.rb +0 -5
- data/lib/tenon/factories/posts.rb +0 -10
- data/lib/tenon/factories/redirects.rb +0 -9
- data/lib/tenon/factories/tenon_callouts.rb +0 -9
- data/lib/tenon/factories/users.rb +0 -26
- data/lib/tenon/warning_generator.rb +0 -29
- data/spec/controllers/tenon/assets_controller_spec.rb +0 -262
- data/spec/controllers/tenon/comments_controller_spec.rb +0 -173
- data/spec/controllers/tenon/contacts_controller_spec.rb +0 -174
- data/spec/controllers/tenon/index_controller_spec.rb +0 -31
- data/spec/controllers/tenon/item_assets_controller_spec.rb +0 -29
- data/spec/controllers/tenon/pages_controller_spec.rb +0 -67
- data/spec/controllers/tenon/posts_controller_spec.rb +0 -31
- data/spec/controllers/tenon/resources_controller_spec.rb +0 -352
- data/spec/controllers/tenon/settings_controller_spec.rb +0 -65
- data/spec/controllers/tenon/simple_resources_controller_spec.rb +0 -42
- data/spec/controllers/tenon/users_controller_spec.rb +0 -112
- data/spec/decorators/tenon/application_decorator_spec.rb +0 -75
- data/spec/decorators/tenon/asset_decorator_spec.rb +0 -101
- data/spec/decorators/tenon/comment_decorator_spec.rb +0 -43
- data/spec/decorators/tenon/contact_decorator_spec.rb +0 -24
- data/spec/decorators/tenon/event_decorator_spec.rb +0 -26
- data/spec/decorators/tenon/page_decorator_spec.rb +0 -23
- data/spec/decorators/tenon/tenon_content/row_type_decorator_spec.rb +0 -20
- data/spec/features/settings_spec.rb +0 -75
- data/spec/features/tenon/assets_spec.rb +0 -88
- data/spec/features/tenon/comments_spec.rb +0 -51
- data/spec/features/tenon/contacts_spec.rb +0 -51
- data/spec/features/tenon/events_spec.rb +0 -104
- data/spec/features/tenon/galleries_spec.rb +0 -107
- data/spec/features/tenon/i18n_spec.rb +0 -106
- data/spec/features/tenon/pages_spec.rb +0 -97
- data/spec/features/tenon/post_categories_spec.rb +0 -91
- data/spec/features/tenon/posts_spec.rb +0 -93
- data/spec/features/tenon/tenon_callouts_spec.rb +0 -101
- data/spec/features/tenon/users_spec.rb +0 -98
- data/spec/fixtures/files/test.png +0 -0
- data/spec/lib/tenon/asset_style_generator_spec.rb +0 -84
- data/spec/lib/tenon/can_be_foreign_spec.rb +0 -20
- data/spec/lib/tenon/can_have_comments_spec.rb +0 -22
- data/spec/lib/tenon/has_asset_spec.rb +0 -46
- data/spec/lib/tenon/has_history/attr_serializer_spec.rb +0 -63
- data/spec/lib/tenon/i18n_lookup_spec.rb +0 -88
- data/spec/lib/tenon/proxy_attachment_spec.rb +0 -96
- data/spec/lib/tenon/reorderable_spec.rb +0 -25
- data/spec/lib/tenon/tenon_content_spec.rb +0 -22
- data/spec/lib/tenon/warning_generator_spec.rb +0 -153
- data/spec/models/tenon/asset_spec.rb +0 -98
- data/spec/models/tenon/comment_spec.rb +0 -81
- data/spec/models/tenon/contact_spec.rb +0 -62
- data/spec/models/tenon/event_spec.rb +0 -79
- data/spec/models/tenon/gallery_spec.rb +0 -12
- data/spec/models/tenon/item_asset_spec.rb +0 -19
- data/spec/models/tenon/my_settings_spec.rb +0 -27
- data/spec/models/tenon/page_spec.rb +0 -60
- data/spec/models/tenon/post_spec.rb +0 -48
- data/spec/models/tenon/redirect_spec.rb +0 -31
- data/spec/models/tenon/tenon_callout_spec.rb +0 -10
- data/spec/models/tenon/tenon_content/row_spec.rb +0 -34
- data/spec/models/tenon/user_spec.rb +0 -59
- data/spec/services/tenon/redirector_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -79
- data/spec/support/integration_example_group.rb +0 -35
- data/spec/support/request_helpers.rb +0 -10
- data/vendor/assets/javascripts/backstretch.js +0 -4
- data/vendor/assets/javascripts/bootstrap.collapse.js +0 -179
- data/vendor/assets/javascripts/bootstrap.datetimepicker.js +0 -954
- data/vendor/assets/javascripts/bootstrap.tabs.js +0 -135
- data/vendor/assets/javascripts/cufon/Aller_400.font.js +0 -7
- data/vendor/assets/javascripts/cufon/Aller_700.font.js +0 -7
- data/vendor/assets/javascripts/cufon/cufon.js +0 -7
- data/vendor/assets/javascripts/jquery.corner.js +0 -249
- data/vendor/assets/javascripts/jquery.hoverIntent.js +0 -115
- data/vendor/assets/javascripts/jquery.radioSlider.js +0 -55
- data/vendor/assets/javascripts/jscrollpane.js +0 -1435
- data/vendor/assets/javascripts/select2.js +0 -3
- data/vendor/assets/javascripts/underscore.inflection.js +0 -177
- data/vendor/assets/stylesheets/bootstrap.datetimepicker.css +0 -152
- data/vendor/assets/stylesheets/bootstrap.tables.scss +0 -201
- data/vendor/assets/stylesheets/jscrollpane.scss +0 -20
- data/vendor/assets/stylesheets/select2.css +0 -1
@@ -1,104 +0,0 @@
|
|
1
|
-
class Tenon.features.ModalWindows
|
2
|
-
constructor: ->
|
3
|
-
tags = '[data-modal-target], [data-modal-remote], [data-model-content], [data-keyboard]'
|
4
|
-
$(document).on('click', tags, @launchFromLink)
|
5
|
-
|
6
|
-
# Opts:
|
7
|
-
# $link: if launched by data tags, the link that was clicked
|
8
|
-
# title: string -- Title for the modal window
|
9
|
-
# remote: bool -- launch via a URL?
|
10
|
-
# href: string -- remote URL to launch
|
11
|
-
# target: string -- selector for the HTML element
|
12
|
-
# parent: string -- selector to use for parent of target
|
13
|
-
# handler: string -- string version of the class to instantiate on opening
|
14
|
-
# closest: string -- selector for link's parent when finding target
|
15
|
-
# clone: bool -- clone the target before putting it in the modal?
|
16
|
-
# content: string -- content to output directly in the modal
|
17
|
-
# keyboard: boolean -- legacy, not sure what it does
|
18
|
-
launchWithOpts: (@opts = {}) =>
|
19
|
-
@_chooseStrategy()
|
20
|
-
|
21
|
-
launchFromLink: (e) =>
|
22
|
-
e.preventDefault()
|
23
|
-
$link = $(e.currentTarget)
|
24
|
-
@opts =
|
25
|
-
$link: $link
|
26
|
-
href: $link.attr('href')
|
27
|
-
title: $link.data('modal-title')
|
28
|
-
remote: $link.data('modal-remote')
|
29
|
-
target: $link.data('modal-target')
|
30
|
-
handler: $link.data('modal-handler')
|
31
|
-
closest: $link.data('modal-closest')
|
32
|
-
parent: $link.data('modal-parent')
|
33
|
-
clone: $link.data('modal-clone')
|
34
|
-
content: $link.data('modal-content')
|
35
|
-
keyboard: $link.data('keyboard')
|
36
|
-
@_chooseStrategy()
|
37
|
-
|
38
|
-
_chooseStrategy: =>
|
39
|
-
@_launchWithUrl() if @opts.remote
|
40
|
-
@_launchWithTarget() if @opts.target?.length
|
41
|
-
@_launchWithContent() if @opts.content?.length
|
42
|
-
|
43
|
-
_launchWithUrl: (e) =>
|
44
|
-
@remote = true
|
45
|
-
Tenon.$genericLoader.show()
|
46
|
-
$.ajax
|
47
|
-
url: @opts.href
|
48
|
-
dataType: 'html'
|
49
|
-
success: @_openInModal
|
50
|
-
beforeSend: null
|
51
|
-
|
52
|
-
_launchWithTarget: (e) =>
|
53
|
-
if @opts.closest?.length && @opts.$link
|
54
|
-
$parentNode = @opts.$link.closest(@opts.closest)
|
55
|
-
$el = $parentNode.find(@opts.target)
|
56
|
-
else if @opts.parent?.length
|
57
|
-
$el = $(@opts.parent).find(@opts.target)
|
58
|
-
else
|
59
|
-
$el = $(@opts.target)
|
60
|
-
$el = $el.filter(':first').clone() if @opts.clone
|
61
|
-
@_openInModal($el)
|
62
|
-
|
63
|
-
_openInModal: (el) =>
|
64
|
-
Tenon.$genericLoader.hide()
|
65
|
-
@$el = $(el)
|
66
|
-
@$template = $(@_setupTemplate())
|
67
|
-
@_appendContent()
|
68
|
-
@$el.show()
|
69
|
-
@modal = @$template.modal(keyboard: @opts.keyboard)
|
70
|
-
@modal
|
71
|
-
.on('shown.bs.modal', @_runShownHandler)
|
72
|
-
.on('hidden.bs.modal', @_runHiddenHandler)
|
73
|
-
|
74
|
-
_setupTemplate: =>
|
75
|
-
JST['tenon/templates/modal']
|
76
|
-
title: @opts.title,
|
77
|
-
bodyProvided: @_bodyProvided()
|
78
|
-
|
79
|
-
_bodyProvided: =>
|
80
|
-
return @__bodyProvided if @__bodyProvided
|
81
|
-
@__bodyProvided = @$el.find('.modal-body').length > 0
|
82
|
-
|
83
|
-
_appendContent: =>
|
84
|
-
target = if @_bodyProvided() then '.modal-content' else '.modal-body'
|
85
|
-
@$template.find(target).append(@$el)
|
86
|
-
|
87
|
-
|
88
|
-
_runShownHandler: =>
|
89
|
-
if @opts.handler?.length
|
90
|
-
parts = @opts.handler.split('.')
|
91
|
-
method = window
|
92
|
-
$(parts).each (i, part) -> method = method[part]
|
93
|
-
new method(@opts.$link, @$el, @$template)
|
94
|
-
|
95
|
-
# Default shown action
|
96
|
-
$('select').select2()
|
97
|
-
@_focusFirstField()
|
98
|
-
|
99
|
-
_runHiddenHandler: =>
|
100
|
-
@$template.remove() if @remote
|
101
|
-
|
102
|
-
_focusFirstField: =>
|
103
|
-
el = $(".modal-content form input[type!='hidden'], .modal-content form select, .modal-content form textarea")[0]
|
104
|
-
$(el).focus()
|
@@ -1,95 +0,0 @@
|
|
1
|
-
Tenon.features.nestedFields = {
|
2
|
-
config: {
|
3
|
-
sortable: {
|
4
|
-
|
5
|
-
}
|
6
|
-
},
|
7
|
-
|
8
|
-
init: function (container, options) {
|
9
|
-
var self = Tenon.features.nestedFields,
|
10
|
-
$container = $(container);
|
11
|
-
$.extend(self.config, options);
|
12
|
-
|
13
|
-
$container
|
14
|
-
.on('click', 'a.add_child', self.addChild)
|
15
|
-
.on('click', 'a.remove_child', self.removeChild)
|
16
|
-
.find('.sortable').sortable({
|
17
|
-
update: function(event, ui) {
|
18
|
-
var $list = $(this);
|
19
|
-
var i = 0;
|
20
|
-
$.each($list.find('li'), function() {
|
21
|
-
$(this).find('input[name*=list_order]').val(i);
|
22
|
-
i++;
|
23
|
-
});
|
24
|
-
self.runCallback(self.config.after);
|
25
|
-
}
|
26
|
-
});
|
27
|
-
},
|
28
|
-
|
29
|
-
addChild: function (e) {
|
30
|
-
e.preventDefault();
|
31
|
-
var self = Tenon.features.nestedFields,
|
32
|
-
assoc = $(this).attr('data-association'),
|
33
|
-
content = $('#' + assoc + '_fields_template').html(),
|
34
|
-
regexp = new RegExp('new_' + assoc, 'g'),
|
35
|
-
new_id = new Date().getTime(),
|
36
|
-
$list = $('#'+assoc+'-list');
|
37
|
-
|
38
|
-
self.runCallback(self.config.before);
|
39
|
-
|
40
|
-
$list.append(content.replace(regexp, new_id));
|
41
|
-
|
42
|
-
// Maintain the same value as the last select box
|
43
|
-
if (content.match(/<select/)) {
|
44
|
-
var length = $list.find("select").length;
|
45
|
-
$($list.find("select")[length - 1]).val($($list.find("select")[length - 2]).val());
|
46
|
-
}
|
47
|
-
//$('input').hint();
|
48
|
-
self.runCallback(self.config.after);
|
49
|
-
},
|
50
|
-
|
51
|
-
removeChild: function () {
|
52
|
-
var self = Tenon.features.nestedFields,
|
53
|
-
hiddenField = $(this).prev('input[name*=_destroy]')[0];
|
54
|
-
|
55
|
-
if (confirm(I18n.tenon.common.are_you_sure)) {
|
56
|
-
// Existing records get set as deleted, new records just get cleared out of the DOM
|
57
|
-
if(hiddenField) {
|
58
|
-
hiddenField.value = 'true';
|
59
|
-
}
|
60
|
-
|
61
|
-
$(this).closest('li').fadeOut('fast', function() {
|
62
|
-
self.runCallback(self.config.after);
|
63
|
-
});
|
64
|
-
|
65
|
-
}
|
66
|
-
return false;
|
67
|
-
},
|
68
|
-
|
69
|
-
runCallback: function (callback) {
|
70
|
-
if (typeof(callback) !== 'undefined')
|
71
|
-
callback.call();
|
72
|
-
},
|
73
|
-
|
74
|
-
reorganize: function (mod, selector) {
|
75
|
-
var $images = $(selector);
|
76
|
-
$images.removeClass('last');
|
77
|
-
$.each($images, function() {
|
78
|
-
var index = $(this).index(selector + ":visible");
|
79
|
-
if((index + 1) % mod === 0) {
|
80
|
-
$(this).addClass('last');
|
81
|
-
}
|
82
|
-
});
|
83
|
-
},
|
84
|
-
|
85
|
-
setListOrder: function (selector) {
|
86
|
-
var $images = $(selector);
|
87
|
-
$.each($images, function() {
|
88
|
-
var listOrder = $(this).find('input[name*=list_order]');
|
89
|
-
var index = $(this).index(selector + ":visible");
|
90
|
-
if (listOrder.length > 0) {
|
91
|
-
listOrder.val(index);
|
92
|
-
}
|
93
|
-
});
|
94
|
-
}
|
95
|
-
};
|
@@ -1,10 +0,0 @@
|
|
1
|
-
Tenon.features.nestedLists = {
|
2
|
-
setSubpageTitleSize: function () {
|
3
|
-
$.each($('li.subpage'), function() {
|
4
|
-
var parentSize = $(this).parents('li.subpage').length,
|
5
|
-
setWidth = 300 - (parentSize * 10) + 'px',
|
6
|
-
padding = parentSize * 10;
|
7
|
-
$(this).find('div.item-title').css({width: setWidth, paddingLeft: padding + 'px'});
|
8
|
-
});
|
9
|
-
}
|
10
|
-
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
class Tenon.features.NestedSetWriter
|
2
|
-
constructor: (@set, @$list, @template, @name) ->
|
3
|
-
@output = "<li class='top' data-record-id='#{@set[0].id}'>\n"
|
4
|
-
@path = [null]
|
5
|
-
@_buildList()
|
6
|
-
@_populateList()
|
7
|
-
@_addPlaceholderLists()
|
8
|
-
|
9
|
-
# This was adapted from example code for the awesome_nested_set gem
|
10
|
-
# I have no idea how it the logic in here works.
|
11
|
-
_buildList: =>
|
12
|
-
for o, i in @set
|
13
|
-
@output += "\n<!-- Writing for page #{o.id} with parent_id #{o.parent_id} -->\n"
|
14
|
-
unless o == @set[0]
|
15
|
-
if o.parent_id != @path[@path.length - 1]
|
16
|
-
# We are on a new level, did we decend or ascend?
|
17
|
-
if $.inArray(o.parent_id, @path) != -1
|
18
|
-
|
19
|
-
# Remove wrong tailing paths elements
|
20
|
-
while @path[@path.length - 1] != o.parent_id
|
21
|
-
@path.pop()
|
22
|
-
@output += "\n</li>\n</ul>"
|
23
|
-
|
24
|
-
if o.parent_id
|
25
|
-
@output += "\n</li>\n<li data-record-id='#{o.id}' class='subpage'>\n"
|
26
|
-
else
|
27
|
-
@output += "\n</li>\n<li data-record-id='#{o.id}' class='top'>\n"
|
28
|
-
else
|
29
|
-
@path.push(o.parent_id)
|
30
|
-
@output += "<ul class='subpages'>\n<li class='subpage' data-record-id='#{o.id}'>\n"
|
31
|
-
else if i != 0
|
32
|
-
if o.parent_id
|
33
|
-
@output += "\n</li>\n<li data-record-id='#{o.id}' class='subpage'>\n"
|
34
|
-
else
|
35
|
-
@output += "\n</li>\n<li data-record-id='#{o.id}' class='top'>\n"
|
36
|
-
|
37
|
-
for p in @path
|
38
|
-
if p
|
39
|
-
@output += "\n</li>\n</ul>"
|
40
|
-
else
|
41
|
-
@output += "\n</li>"
|
42
|
-
|
43
|
-
@$list.append($.parseHTML(@output))
|
44
|
-
|
45
|
-
_populateList: =>
|
46
|
-
for record in @set
|
47
|
-
$li = @$list.find("li[data-record-id=#{record.id}]")
|
48
|
-
$ul = $li.find('ul:first')
|
49
|
-
template = @_getTemplate(record)
|
50
|
-
if $ul.length > 0
|
51
|
-
$(template).insertBefore($ul)
|
52
|
-
else
|
53
|
-
$li.html($(template))
|
54
|
-
|
55
|
-
_addPlaceholderLists: =>
|
56
|
-
$.each @$list.find('li'), ->
|
57
|
-
$li = $(this)
|
58
|
-
if $li.find('> ul').length == 0
|
59
|
-
$ul = $('<ul />').addClass('ui-sortable subpages')
|
60
|
-
$li.append($ul)
|
61
|
-
|
62
|
-
_getTemplate: (record) =>
|
63
|
-
opts = {}
|
64
|
-
opts[@name] = record
|
65
|
-
JST[@template](opts)
|
@@ -1,32 +0,0 @@
|
|
1
|
-
class Tenon.features.NewItemVersionHandler
|
2
|
-
constructor: (@$link, @$el, @$template) ->
|
3
|
-
@$itemForm = @$link.closest('form')
|
4
|
-
@$versionForm = @$template.find('form')
|
5
|
-
@$versionForm.on('submit', @submitItemVersion)
|
6
|
-
|
7
|
-
submitItemVersion: (e) =>
|
8
|
-
e.preventDefault()
|
9
|
-
jqxhr = $.ajax
|
10
|
-
url: @$versionForm.attr('action')
|
11
|
-
data: @_formData()
|
12
|
-
method: 'POST'
|
13
|
-
jqxhr.done(@$template.modal('hide'))
|
14
|
-
jqxhr.fail(@_failure())
|
15
|
-
|
16
|
-
_formData: =>
|
17
|
-
itemFormData = URI("?" + @$itemForm.serialize()).query(true)
|
18
|
-
|
19
|
-
# Serialize the checkbox in a way that rails can get down with
|
20
|
-
@$itemForm.find("input:checkbox").each ->
|
21
|
-
if !(@.checked)
|
22
|
-
itemFormData[@.name] = "0"
|
23
|
-
else
|
24
|
-
itemFormData[@.name] = "1"
|
25
|
-
|
26
|
-
versionFormData = URI("?" + @$versionForm.serialize()).query(true)
|
27
|
-
delete(itemFormData._method)
|
28
|
-
$.extend(itemFormData, versionFormData)
|
29
|
-
|
30
|
-
_failure: =>
|
31
|
-
msg = I18n.tenon.item_versions.failed_to_save_draft
|
32
|
-
@$versionForm.prepend(msg)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class Tenon.features.Pagination
|
2
|
-
constructor: ->
|
3
|
-
$('ul.pagination').on('click', 'a', @_pageClicked)
|
4
|
-
|
5
|
-
_pageClicked: (e) =>
|
6
|
-
e.preventDefault()
|
7
|
-
@$link = $(e.currentTarget)
|
8
|
-
@$pagination = @$link.closest('.pagination')
|
9
|
-
@_goToPage()
|
10
|
-
@_setActive()
|
11
|
-
|
12
|
-
_goToPage: =>
|
13
|
-
$recordList = $(@$pagination.data('record-list'))
|
14
|
-
$recordList
|
15
|
-
.data('records-page', @$link.data('page'))
|
16
|
-
.find('li').addClass('hidden').delay(250).remove()
|
17
|
-
new Tenon.features.RecordList($recordList)
|
18
|
-
|
19
|
-
_setActive: =>
|
20
|
-
@$pagination.find('li.active').removeClass('active')
|
21
|
-
@$link.closest('li').addClass('active')
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class Tenon.features.ProtectChanges
|
2
|
-
constructor: ->
|
3
|
-
@changesMade = false
|
4
|
-
@bindChangeEvents()
|
5
|
-
$(window).on('beforeunload', @confirmNavigation)
|
6
|
-
|
7
|
-
bindChangeEvents: =>
|
8
|
-
@$form = $('.main-content form')
|
9
|
-
@$form.on('cocoon:after-insert cocoon:after-remove', @_markChanged)
|
10
|
-
@$form.on('keyup change', 'input, select, textarea', @_markChanged)
|
11
|
-
@$form.on('input', '.editable-text', @_markChanged)
|
12
|
-
@$form.on('submit', @_clearChanges)
|
13
|
-
|
14
|
-
_markChanged: (e) =>
|
15
|
-
ignore = [37, 38, 39, 40, 20, 16, 17, 18]
|
16
|
-
code = e.keyCode || e.which
|
17
|
-
@changesMade = true if $.inArray(code, ignore) == -1
|
18
|
-
|
19
|
-
_clearChanges: =>
|
20
|
-
@changesMade = false
|
21
|
-
return true
|
22
|
-
|
23
|
-
confirmNavigation: =>
|
24
|
-
if @changesMade
|
25
|
-
I18n.tenon.common.you_have_unsaved_changes
|
@@ -1,41 +0,0 @@
|
|
1
|
-
class Tenon.features.QuickSearch
|
2
|
-
constructor: ->
|
3
|
-
@$content = $('.toolbox #quick-search-container')
|
4
|
-
@$toggle = $('#quick-search-toggle')
|
5
|
-
@openClass = 'open'
|
6
|
-
|
7
|
-
# listeners
|
8
|
-
$(document).on('keyup', '#quick-search', $.debounce(500, @_submitSearch))
|
9
|
-
|
10
|
-
@$toggle.on('click', @toggleNav)
|
11
|
-
# $(document).on('click', '.nav-holder.mobile-open a', @_closeNav)
|
12
|
-
|
13
|
-
_submitSearch: (e) =>
|
14
|
-
# Need to set this here so that if #quick-search is drawn after initial
|
15
|
-
# DOM-ready we still have access to it
|
16
|
-
@$field = $('#quick-search')
|
17
|
-
|
18
|
-
@$list = $(@$field.data('record-list'))
|
19
|
-
params = {q: @$field.val()}
|
20
|
-
new Tenon.features.RecordList(@$list, params: params, clear: true)
|
21
|
-
|
22
|
-
toggleNav: (e) =>
|
23
|
-
e.preventDefault()
|
24
|
-
@$toggle.find('i').toggleClass('fa-search fa-times')
|
25
|
-
if @$toggle.hasClass(@openClass)
|
26
|
-
@_closeNav()
|
27
|
-
else
|
28
|
-
@_openNav()
|
29
|
-
|
30
|
-
_closeNav: () =>
|
31
|
-
if @$field
|
32
|
-
@$field.val('').keyup() # clear quick search and submit it when closing the toolbox
|
33
|
-
@$toggle.removeClass(@openClass)
|
34
|
-
$('header').css('border-bottom-width', '1px')
|
35
|
-
@$content.removeClass(@openClass)
|
36
|
-
|
37
|
-
_openNav: () =>
|
38
|
-
@$toggle.addClass(@openClass)
|
39
|
-
$('header').css('border-bottom-width', '0px')
|
40
|
-
@$content.addClass(@openClass)
|
41
|
-
@$content.find('input')[0].focus()
|
@@ -1,33 +0,0 @@
|
|
1
|
-
class Tenon.features.RecordApproval
|
2
|
-
constructor: ->
|
3
|
-
$(document).on 'click', 'a.approve, a.unapprove', @_toggleRecordApproval
|
4
|
-
|
5
|
-
_toggleRecordApproval: (e) =>
|
6
|
-
e.preventDefault()
|
7
|
-
@$link = $(e.currentTarget)
|
8
|
-
@_startIconLoad()
|
9
|
-
@_setTooltip('Loading...')
|
10
|
-
$.getJSON(@$link.attr('href'))
|
11
|
-
.done(@_finishToggle)
|
12
|
-
.fail((data)-> console.log(data))
|
13
|
-
|
14
|
-
_finishToggle: =>
|
15
|
-
@$link.toggleClass('unapprove approve')
|
16
|
-
if @$link.hasClass('approve')
|
17
|
-
@_setTooltip(I18n.tenon.common.approve)
|
18
|
-
@$link.find('i').toggleClass('fa-spin fa-gear fa-thumbs-up')
|
19
|
-
else
|
20
|
-
@_setTooltip(I18n.tenon.common.unapprove)
|
21
|
-
@$link.find('i').toggleClass('fa-spin fa-gear fa-thumbs-down')
|
22
|
-
|
23
|
-
_startIconLoad: =>
|
24
|
-
@$link.find('i')
|
25
|
-
.removeClass('fa-thumbs-up fa-thumbs-down')
|
26
|
-
.addClass('fa-spin fa-gear')
|
27
|
-
|
28
|
-
_setTooltip: (tooltip) =>
|
29
|
-
@$link
|
30
|
-
.tooltip('hide')
|
31
|
-
.attr('data-original-title', tooltip)
|
32
|
-
.tooltip('fixTitle')
|
33
|
-
.tooltip('show')
|
@@ -1,37 +0,0 @@
|
|
1
|
-
class Tenon.features.RecordBooleanToggle
|
2
|
-
constructor: ->
|
3
|
-
$(document).on 'click', 'a.toggle', @_toggleRecordBoolean
|
4
|
-
|
5
|
-
_toggleRecordBoolean: (e) =>
|
6
|
-
e.preventDefault()
|
7
|
-
@$link = $(e.currentTarget)
|
8
|
-
@trueIcon = 'fa-' + @$link.data('trueicon')
|
9
|
-
@falseIcon = 'fa-' + @$link.data('falseicon')
|
10
|
-
@trueTooltip = @$link.data('truetooltip')
|
11
|
-
@falseTooltip = @$link.data('falsetooltip')
|
12
|
-
@_startIconLoad()
|
13
|
-
@_setTooltip(I18n.tenon.common.loading)
|
14
|
-
$.getJSON(@$link.attr('href'))
|
15
|
-
.done(@_finishToggle)
|
16
|
-
.fail((data)-> console.log(data))
|
17
|
-
|
18
|
-
_finishToggle: =>
|
19
|
-
@$link.toggleClass('true false')
|
20
|
-
if @$link.hasClass('true')
|
21
|
-
@_setTooltip(@trueTooltip)
|
22
|
-
@$link.find('i').toggleClass('fa-spin fa-gear ' + @trueIcon)
|
23
|
-
else
|
24
|
-
@_setTooltip(@falseTooltip)
|
25
|
-
@$link.find('i').toggleClass('fa-spin fa-gear ' + @falseIcon)
|
26
|
-
|
27
|
-
_startIconLoad: =>
|
28
|
-
@$link.find('i')
|
29
|
-
.removeClass(@trueIcon + ' ' + @falseIcon)
|
30
|
-
.addClass('fa-spin fa-gear')
|
31
|
-
|
32
|
-
_setTooltip: (tooltip) =>
|
33
|
-
@$link
|
34
|
-
.tooltip('hide')
|
35
|
-
.attr('data-original-title', tooltip)
|
36
|
-
.tooltip('fixTitle')
|
37
|
-
.tooltip('show')
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class Tenon.features.RecordDeletion
|
2
|
-
constructor: ->
|
3
|
-
selector = 'a[data-method="Delete"], a[data-method="delete"]'
|
4
|
-
$('.record-list, .record-grid').on('ajax:beforeSend', selector, @_showSpinner)
|
5
|
-
$('.record-list, .record-grid').on('ajax:success', selector, @_handleSuccess)
|
6
|
-
|
7
|
-
_showSpinner: (e) ->
|
8
|
-
$link = $(e.currentTarget)
|
9
|
-
$link.find('i')
|
10
|
-
.removeClass('fa fa-trash-o')
|
11
|
-
.addClass('fa fa-spinner fa fa-spin')
|
12
|
-
|
13
|
-
_handleSuccess: (e, data) =>
|
14
|
-
@$link = $(e.currentTarget)
|
15
|
-
if data && data.errors && data.errors.base
|
16
|
-
@_handleError(data.errors.base)
|
17
|
-
else
|
18
|
-
@$link.closest('li').fadeOut(-> $(@).remove())
|
19
|
-
|
20
|
-
_handleError: (error) =>
|
21
|
-
new Tenon.features.Flash('error', error)
|
22
|
-
@$link.find('i')
|
23
|
-
.removeClass('fa fa-spinner fa fa-spin')
|
24
|
-
.addClass('fa fa-trash-o')
|
@@ -1,86 +0,0 @@
|
|
1
|
-
class Tenon.features.RecordList
|
2
|
-
constructor: (@$list, @opts = {}) ->
|
3
|
-
@openClass = 'open'
|
4
|
-
Tenon.activeRecordList = this
|
5
|
-
@refresh()
|
6
|
-
|
7
|
-
refresh: (opts = {}) =>
|
8
|
-
@opts = $.extend(@opts, opts)
|
9
|
-
@_clearRecords() if @opts.clear
|
10
|
-
@_setupTemplate()
|
11
|
-
@_setupPagination()
|
12
|
-
@_updateParams()
|
13
|
-
@_showLoader()
|
14
|
-
@_loadRecords()
|
15
|
-
|
16
|
-
_setupTemplate: =>
|
17
|
-
@_templatePath = @$list.data('records-template')
|
18
|
-
@_recordName = @$list.data('records-name')
|
19
|
-
@_templateOpts = {}
|
20
|
-
|
21
|
-
_setupPagination: =>
|
22
|
-
@$list.data('records-page', 1) unless @$list.data('records-page')?
|
23
|
-
@_currentPage = @$list.data('records-page')
|
24
|
-
|
25
|
-
_clearRecords: =>
|
26
|
-
@$list.find('li:not(.header)').remove()
|
27
|
-
@$list.data('records-page', 1)
|
28
|
-
|
29
|
-
_updateParams: =>
|
30
|
-
@params = URI(window.location).query(true)
|
31
|
-
@params = $.extend(@params, @$list.data('records-params'))
|
32
|
-
@params = $.extend(@params, @opts.params)
|
33
|
-
|
34
|
-
_loadRecords: (i, list) =>
|
35
|
-
data = {page: @_currentPage}
|
36
|
-
data = $.extend(data, @params)
|
37
|
-
$.getJSON(@$list.data('records-url'), data)
|
38
|
-
.done(@_dataLoaded)
|
39
|
-
.fail(@_failedLoad)
|
40
|
-
.always(@_hideLoader)
|
41
|
-
|
42
|
-
_dataLoaded: (data) =>
|
43
|
-
if data.records.length == 0
|
44
|
-
@_showInfoLi(I18n.tenon.record_list.no_entries_found)
|
45
|
-
else if @$list.data('records-nested')
|
46
|
-
@_showInfoLi(I18n.tenon.record_list.no_entries_found) if data.records.length == 0
|
47
|
-
new Tenon.features.NestedSetWriter(data.records, @$list, @_templatePath, @_recordName)
|
48
|
-
else
|
49
|
-
@_drawRecords(data.records)
|
50
|
-
@_toggleInfiniteLoader(data.pagination)
|
51
|
-
$('.sortable').tenonTwoLevelSort()
|
52
|
-
@$list.trigger('tenon.records-refreshed')
|
53
|
-
|
54
|
-
_failedLoad: =>
|
55
|
-
@_showInfoLi(I18n.tenon.record_list.there_was_an_error_contacting_the_server)
|
56
|
-
|
57
|
-
_drawRecords: (records) =>
|
58
|
-
for record in records
|
59
|
-
@_templateOpts[@_recordName] = record
|
60
|
-
@$list.append(JST[@_templatePath](@_templateOpts))
|
61
|
-
@$list.imagesLoaded => @$list.find('li.hidden').removeClass('hidden')
|
62
|
-
|
63
|
-
_showInfoLi: (msg) =>
|
64
|
-
$divs = [
|
65
|
-
$('<div />').addClass('record-title').html(msg)
|
66
|
-
]
|
67
|
-
$details = $('<div />').addClass('record-details').html($divs)
|
68
|
-
$('<li />').addClass('info').html($details).appendTo(@$list)
|
69
|
-
|
70
|
-
_toggleInfiniteLoader: (pagination) =>
|
71
|
-
$loader = $(".infinite-loader[data-record-list='##{@$list.attr('id')}']")
|
72
|
-
if @_currentPage < parseInt(pagination.totalPages)
|
73
|
-
$loader.addClass(@openClass)
|
74
|
-
else
|
75
|
-
$loader.removeClass(@openClass)
|
76
|
-
|
77
|
-
_showLoader: =>
|
78
|
-
i = $('<i />').addClass('fa fa-gear fa fa-4x fa fa-spin')
|
79
|
-
div = $('<div />').append(i)
|
80
|
-
li = $('<li />')
|
81
|
-
.addClass('loader')
|
82
|
-
.append(div)
|
83
|
-
.appendTo(@$list)
|
84
|
-
|
85
|
-
_hideLoader: =>
|
86
|
-
@$list.find('li.loader').remove()
|
@@ -1,56 +0,0 @@
|
|
1
|
-
class Tenon.features.RecordListUpdater
|
2
|
-
constructor: ->
|
3
|
-
$(document).on('click', 'a.record-list-updater', @updateRecordList)
|
4
|
-
$(document).on('submit', 'form.record-list-updater', @updateRecordList)
|
5
|
-
$(window).on('popstate', @popUpdate)
|
6
|
-
|
7
|
-
updateRecordList: (e) =>
|
8
|
-
e.preventDefault()
|
9
|
-
$el = $(e.currentTarget)
|
10
|
-
@clearQuery = $el.attr('data-clear-record-list-params')
|
11
|
-
if $el.prop("tagName").toLowerCase() == 'form'
|
12
|
-
@_updateWithQuery(@_processFormData($el), I18n.tenon.common.search, $el)
|
13
|
-
else
|
14
|
-
@_updateWithQuery(URI($el.attr('href')).query(true), $el.textContent)
|
15
|
-
|
16
|
-
_processFormData: (form) =>
|
17
|
-
formData = URI("?" + form.serialize()).query(true)
|
18
|
-
form.find("input:checkbox").each ->
|
19
|
-
if !(@.checked)
|
20
|
-
formData[@.name] = "0"
|
21
|
-
formData
|
22
|
-
|
23
|
-
_updateWithQuery: (query, title, form = null) =>
|
24
|
-
query = if @clearQuery then query else @_mergedQuery(query, form)
|
25
|
-
state = if $.isEmptyObject(query) then "?" else "?#{query.toString()}"
|
26
|
-
history.pushState({recordListUpdate: true}, title, state)
|
27
|
-
Tenon.refreshed = false
|
28
|
-
Tenon.activeRecordList.refresh(clear: true)
|
29
|
-
|
30
|
-
# Get a combination of the current params and any new params that
|
31
|
-
# the link or form is adding. This allows us to, for example, submit
|
32
|
-
# an advanced search form and then change the sort order with a link.
|
33
|
-
# Add data-clear-record-list-params to prevent this merge.
|
34
|
-
_mergedQuery: (newQueryObj, form = null) =>
|
35
|
-
oldQueryObj = URI(location.href).query(true)
|
36
|
-
mergedQuery = $.extend(oldQueryObj, newQueryObj)
|
37
|
-
mergedQuery = @_removeEmptyMultiSelects(mergedQuery, form) if form
|
38
|
-
$.param(mergedQuery)
|
39
|
-
|
40
|
-
# multi-selects are handled as arrays, which causes problems with merging if
|
41
|
-
# you have unselected items
|
42
|
-
_removeEmptyMultiSelects: (query, form) =>
|
43
|
-
form.find("select[multiple='multiple']").each ->
|
44
|
-
if (@.selectedIndex == -1)
|
45
|
-
delete query[@.name]
|
46
|
-
query
|
47
|
-
|
48
|
-
popUpdate: (e) =>
|
49
|
-
# Chrome triggers window.onpopstate on page load, so elsewhere
|
50
|
-
# at page load we set Tenon.refreshed to true to indicate that
|
51
|
-
# as of yet nothing has been pushed to the history stack.
|
52
|
-
#
|
53
|
-
# Failing to do this results in a double AJAX load when the
|
54
|
-
# page is first loaded in Chrome, and possible other browsers.
|
55
|
-
if !Tenon.refreshed && Tenon.activeRecordList
|
56
|
-
Tenon.activeRecordList.refresh(clear: true)
|