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,954 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* version 2.1.11
|
3
|
-
* @license
|
4
|
-
* =========================================================
|
5
|
-
* bootstrap-datetimepicker.js
|
6
|
-
* http://www.eyecon.ro/bootstrap-datepicker
|
7
|
-
* =========================================================
|
8
|
-
* Copyright 2012 Stefan Petre
|
9
|
-
*
|
10
|
-
* Contributions:
|
11
|
-
* - updated for Bootstrap v3 by Jonathan Peterson (@Eonasdan) and (almost)
|
12
|
-
* completely rewritten to use Momentjs
|
13
|
-
* - based on tarruda's bootstrap-datepicker
|
14
|
-
*
|
15
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
-
* you may not use this file except in compliance with the License.
|
17
|
-
* You may obtain a copy of the License at
|
18
|
-
*
|
19
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
20
|
-
*
|
21
|
-
* Unless required by applicable law or agreed to in writing, software
|
22
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
23
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
-
* See the License for the specific language governing permissions and
|
25
|
-
* limitations under the License.
|
26
|
-
* =========================================================
|
27
|
-
*/
|
28
|
-
; (function ($) {
|
29
|
-
|
30
|
-
if (typeof moment === 'undefined') {
|
31
|
-
alert("momentjs is requried");
|
32
|
-
throw new Error('momentjs is requried');
|
33
|
-
};
|
34
|
-
|
35
|
-
var dpgId = 0,
|
36
|
-
|
37
|
-
pMoment = moment,
|
38
|
-
|
39
|
-
// ReSharper disable once InconsistentNaming
|
40
|
-
DateTimePicker = function (element, options) {
|
41
|
-
var defaults = {
|
42
|
-
pickDate: true,
|
43
|
-
pickTime: true,
|
44
|
-
startDate: new pMoment({ y: 1970 }),
|
45
|
-
endDate: new pMoment().add(50, "y"),
|
46
|
-
collapse: true,
|
47
|
-
language: "en",
|
48
|
-
defaultDate: "",
|
49
|
-
disabledDates: [],
|
50
|
-
icons: {},
|
51
|
-
useStrict: false
|
52
|
-
},
|
53
|
-
|
54
|
-
icons = {
|
55
|
-
time: 'fa fa-clock-o',
|
56
|
-
date: 'fa fa-calendar',
|
57
|
-
up: 'fa fa-chevron-up',
|
58
|
-
down: 'fa fa-chevron-down'
|
59
|
-
},
|
60
|
-
|
61
|
-
picker = this,
|
62
|
-
|
63
|
-
init = function () {
|
64
|
-
|
65
|
-
var icon = false, i, dDate, longDateFormat;
|
66
|
-
picker.options = $.extend({}, defaults, options);
|
67
|
-
picker.options.icons = $.extend({}, icons, picker.options.icons);
|
68
|
-
|
69
|
-
if (!(picker.options.pickTime || picker.options.pickDate))
|
70
|
-
throw new Error('Must choose at least one picker');
|
71
|
-
|
72
|
-
picker.id = dpgId++;
|
73
|
-
pMoment.lang(picker.options.language);
|
74
|
-
picker.date = pMoment();
|
75
|
-
picker.element = $(element);
|
76
|
-
picker.unset = false;
|
77
|
-
picker.isInput = picker.element.is('input');
|
78
|
-
picker.component = false;
|
79
|
-
|
80
|
-
if (picker.element.hasClass('input-group')) {
|
81
|
-
if (picker.element.find('.datepickerbutton').size() == 0) {//in case there is more then one 'input-group-addon` #48
|
82
|
-
picker.component = picker.element.find('.input-group-addon');
|
83
|
-
}
|
84
|
-
else {
|
85
|
-
picker.component = picker.element.find('.datepickerbutton');
|
86
|
-
}
|
87
|
-
}
|
88
|
-
picker.format = picker.options.format;
|
89
|
-
|
90
|
-
longDateFormat = pMoment()._lang._longDateFormat;
|
91
|
-
|
92
|
-
if (!picker.format) {
|
93
|
-
if (picker.isInput) picker.format = picker.element.data('format');
|
94
|
-
else picker.format = picker.element.find('input').data('format');
|
95
|
-
if (!picker.format) {
|
96
|
-
picker.format = (picker.options.pickDate ? longDateFormat.L : '');
|
97
|
-
if (picker.options.pickDate && picker.options.pickTime) picker.format += ' ';
|
98
|
-
picker.format += (picker.options.pickTime ? longDateFormat.LT : '');
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
picker.use24hours = picker.format.toLowerCase().indexOf("a") < 1;
|
103
|
-
|
104
|
-
if (picker.component) icon = picker.component.find('span');
|
105
|
-
|
106
|
-
if (picker.options.pickTime) {
|
107
|
-
if (icon) icon.addClass(picker.options.icons.time);
|
108
|
-
}
|
109
|
-
if (picker.options.pickDate) {
|
110
|
-
if (icon) {
|
111
|
-
icon.removeClass(picker.options.icons.time);
|
112
|
-
icon.addClass(picker.options.icons.date);
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
picker.widget = $(getTemplate(picker.options.pickDate, picker.options.pickTime, picker.options.collapse)).appendTo('body');
|
117
|
-
picker.minViewMode = picker.options.minViewMode || picker.element.data('date-minviewmode') || 0;
|
118
|
-
if (typeof picker.minViewMode === 'string') {
|
119
|
-
switch (picker.minViewMode) {
|
120
|
-
case 'months':
|
121
|
-
picker.minViewMode = 1;
|
122
|
-
break;
|
123
|
-
case 'years':
|
124
|
-
picker.minViewMode = 2;
|
125
|
-
break;
|
126
|
-
default:
|
127
|
-
picker.minViewMode = 0;
|
128
|
-
break;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
picker.viewMode = picker.options.viewMode || picker.element.data('date-viewmode') || 0;
|
132
|
-
if (typeof picker.viewMode === 'string') {
|
133
|
-
switch (picker.viewMode) {
|
134
|
-
case 'months':
|
135
|
-
picker.viewMode = 1;
|
136
|
-
break;
|
137
|
-
case 'years':
|
138
|
-
picker.viewMode = 2;
|
139
|
-
break;
|
140
|
-
default:
|
141
|
-
picker.viewMode = 0;
|
142
|
-
break;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
for (i = 0; i < picker.options.disabledDates.length; i++) {
|
147
|
-
dDate = picker.options.disabledDates[i];
|
148
|
-
dDate = pMoment(dDate);
|
149
|
-
//if this is not a valid date then set it to the startdate -1 day so it's disabled.
|
150
|
-
if (!dDate.isValid()) dDate = pMoment(picker.options.startDate).subtract(1, "day");
|
151
|
-
picker.options.disabledDates[i] = dDate.format("L");
|
152
|
-
}
|
153
|
-
|
154
|
-
picker.startViewMode = picker.viewMode;
|
155
|
-
picker.setStartDate(picker.options.startDate || picker.element.data('date-startdate'));
|
156
|
-
picker.setEndDate(picker.options.endDate || picker.element.data('date-enddate'));
|
157
|
-
fillDow();
|
158
|
-
fillMonths();
|
159
|
-
fillHours();
|
160
|
-
fillMinutes();
|
161
|
-
update();
|
162
|
-
showMode();
|
163
|
-
attachDatePickerEvents();
|
164
|
-
if (picker.options.defaultDate !== "") picker.setValue(picker.options.defaultDate);
|
165
|
-
},
|
166
|
-
|
167
|
-
place = function () {
|
168
|
-
var position = 'absolute',
|
169
|
-
offset = picker.component ? picker.component.offset() : picker.element.offset(), $window = $(window);
|
170
|
-
picker.width = picker.component ? picker.component.outerWidth() : picker.element.outerWidth();
|
171
|
-
offset.top = offset.top + picker.element.outerHeight();
|
172
|
-
|
173
|
-
//if (offset.top + picker.widget.height() > $window.height()) offset.top = offset.top - (picker.widget.height() + picker.height + 10);
|
174
|
-
|
175
|
-
if (picker.options.width !== undefined) {
|
176
|
-
picker.widget.width(picker.options.width);
|
177
|
-
}
|
178
|
-
|
179
|
-
if (picker.options.orientation === 'left') {
|
180
|
-
picker.widget.addClass('left-oriented');
|
181
|
-
offset.left = offset.left - picker.widget.width() + 20;
|
182
|
-
}
|
183
|
-
|
184
|
-
if (isInFixed()) {
|
185
|
-
position = 'fixed';
|
186
|
-
offset.top -= $window.scrollTop();
|
187
|
-
offset.left -= $window.scrollLeft();
|
188
|
-
}
|
189
|
-
|
190
|
-
if ($window.width() < offset.left + picker.widget.outerWidth()) {
|
191
|
-
offset.right = $window.width() - offset.left - picker.width;
|
192
|
-
offset.left = 'auto';
|
193
|
-
picker.widget.addClass('pull-right');
|
194
|
-
} else {
|
195
|
-
offset.right = 'auto';
|
196
|
-
picker.widget.removeClass('pull-right');
|
197
|
-
}
|
198
|
-
|
199
|
-
picker.widget.css({
|
200
|
-
position: position,
|
201
|
-
top: offset.top,
|
202
|
-
left: offset.left,
|
203
|
-
right: offset.right
|
204
|
-
});
|
205
|
-
},
|
206
|
-
|
207
|
-
notifyChange = function (oldDate) {
|
208
|
-
picker.element.trigger({
|
209
|
-
type: 'change.dp',
|
210
|
-
date: picker.getDate(),
|
211
|
-
oldDate: oldDate
|
212
|
-
});
|
213
|
-
},
|
214
|
-
|
215
|
-
notifyError = function (date) {
|
216
|
-
picker.element.trigger({
|
217
|
-
type: 'error.dp',
|
218
|
-
date: date
|
219
|
-
});
|
220
|
-
},
|
221
|
-
|
222
|
-
update = function (newDate) {
|
223
|
-
pMoment.lang(picker.options.language);
|
224
|
-
var dateStr = newDate;
|
225
|
-
if (!dateStr) {
|
226
|
-
if (picker.isInput) {
|
227
|
-
dateStr = picker.element.val();
|
228
|
-
} else {
|
229
|
-
dateStr = picker.element.find('input').val();
|
230
|
-
}
|
231
|
-
if (dateStr) picker.date = pMoment(dateStr, picker.format, picker.options.useStrict);
|
232
|
-
if (!picker.date) picker.date = pMoment();
|
233
|
-
}
|
234
|
-
picker.viewDate = pMoment(picker.date).startOf("month");
|
235
|
-
fillDate();
|
236
|
-
fillTime();
|
237
|
-
},
|
238
|
-
|
239
|
-
fillDow = function () {
|
240
|
-
pMoment.lang(picker.options.language);
|
241
|
-
var html = $('<tr>'), weekdaysMin = pMoment.weekdaysMin(), i;
|
242
|
-
if (pMoment()._lang._week.dow == 0) { // starts on Sunday
|
243
|
-
for(i = 0; i < 7; i++) {
|
244
|
-
html.append('<th class="dow">' + weekdaysMin[i] + '</th>');
|
245
|
-
}
|
246
|
-
} else {
|
247
|
-
for (i = 1; i < 8; i++) {
|
248
|
-
if (i == 7) {
|
249
|
-
html.append('<th class="dow">' + weekdaysMin[0] + '</th>');
|
250
|
-
} else {
|
251
|
-
html.append('<th class="dow">' + weekdaysMin[i] + '</th>');
|
252
|
-
}
|
253
|
-
}
|
254
|
-
}
|
255
|
-
picker.widget.find('.datepicker-days thead').append(html);
|
256
|
-
},
|
257
|
-
|
258
|
-
fillMonths = function () {
|
259
|
-
pMoment.lang(picker.options.language);
|
260
|
-
var html = '', i = 0, monthsShort = pMoment.monthsShort();
|
261
|
-
while (i < 12) {
|
262
|
-
html += '<span class="month">' + monthsShort[i++] + '</span>';
|
263
|
-
}
|
264
|
-
picker.widget.find('.datepicker-months td').append(html);
|
265
|
-
},
|
266
|
-
|
267
|
-
fillDate = function () {
|
268
|
-
pMoment.lang(picker.options.language);
|
269
|
-
var year = picker.viewDate.year(),
|
270
|
-
month = picker.viewDate.month(),
|
271
|
-
startYear = picker.options.startDate.year(),
|
272
|
-
startMonth = picker.options.startDate.month(),
|
273
|
-
endYear = picker.options.endDate.year(),
|
274
|
-
endMonth = picker.options.endDate.month(),
|
275
|
-
prevMonth, nextMonth, html = [], row, clsName, i, days, yearCont, currentYear, months = pMoment.months();
|
276
|
-
|
277
|
-
picker.widget.find('.datepicker-days').find('.disabled').removeClass('disabled');
|
278
|
-
picker.widget.find('.datepicker-months').find('.disabled').removeClass('disabled');
|
279
|
-
picker.widget.find('.datepicker-years').find('.disabled').removeClass('disabled');
|
280
|
-
|
281
|
-
picker.widget.find('.datepicker-days th:eq(1)').text(
|
282
|
-
months[month] + ' ' + year);
|
283
|
-
|
284
|
-
prevMonth = pMoment(picker.viewDate).subtract("months", 1);
|
285
|
-
days = prevMonth.daysInMonth();
|
286
|
-
prevMonth.date(days).startOf('week');
|
287
|
-
if ((year == startYear && month <= startMonth) || year < startYear) {
|
288
|
-
picker.widget.find('.datepicker-days th:eq(0)').addClass('disabled');
|
289
|
-
}
|
290
|
-
if ((year == endYear && month >= endMonth) || year > endYear) {
|
291
|
-
picker.widget.find('.datepicker-days th:eq(2)').addClass('disabled');
|
292
|
-
}
|
293
|
-
|
294
|
-
nextMonth = pMoment(prevMonth).add(42, "d");
|
295
|
-
while (prevMonth.isBefore(nextMonth)) {
|
296
|
-
if (prevMonth.weekday() === pMoment().startOf('week').weekday()) {
|
297
|
-
row = $('<tr>');
|
298
|
-
html.push(row);
|
299
|
-
}
|
300
|
-
clsName = '';
|
301
|
-
if (prevMonth.year() < year || (prevMonth.year() == year && prevMonth.month() < month)) {
|
302
|
-
clsName += ' old';
|
303
|
-
} else if (prevMonth.year() > year || (prevMonth.year() == year && prevMonth.month() > month)) {
|
304
|
-
clsName += ' new';
|
305
|
-
}
|
306
|
-
if (prevMonth.isSame(pMoment({ y: picker.date.year(), M: picker.date.month(), d: picker.date.date() }))) {
|
307
|
-
clsName += ' active';
|
308
|
-
}
|
309
|
-
if ((pMoment(prevMonth).add(1, "d") <= picker.options.startDate) || (prevMonth > picker.options.endDate) || isInDisableDates(prevMonth)) {
|
310
|
-
clsName += ' disabled';
|
311
|
-
}
|
312
|
-
row.append('<td class="day' + clsName + '">' + prevMonth.date() + '</td>');
|
313
|
-
prevMonth.add(1, "d");
|
314
|
-
}
|
315
|
-
picker.widget.find('.datepicker-days tbody').empty().append(html);
|
316
|
-
currentYear = pMoment().year(), months = picker.widget.find('.datepicker-months')
|
317
|
-
.find('th:eq(1)').text(year).end().find('span').removeClass('active');
|
318
|
-
if (currentYear === year) {
|
319
|
-
months.eq(pMoment().month()).addClass('active');
|
320
|
-
}
|
321
|
-
if (currentYear - 1 < startYear) {
|
322
|
-
picker.widget.find('.datepicker-months th:eq(0)').addClass('disabled');
|
323
|
-
}
|
324
|
-
if (currentYear + 1 > endYear) {
|
325
|
-
picker.widget.find('.datepicker-months th:eq(2)').addClass('disabled');
|
326
|
-
}
|
327
|
-
for (i = 0; i < 12; i++) {
|
328
|
-
if ((year == startYear && startMonth > i) || (year < startYear)) {
|
329
|
-
$(months[i]).addClass('disabled');
|
330
|
-
} else if ((year == endYear && endMonth < i) || (year > endYear)) {
|
331
|
-
$(months[i]).addClass('disabled');
|
332
|
-
}
|
333
|
-
}
|
334
|
-
|
335
|
-
html = '';
|
336
|
-
year = parseInt(year / 10, 10) * 10;
|
337
|
-
yearCont = picker.widget.find('.datepicker-years').find(
|
338
|
-
'th:eq(1)').text(year + '-' + (year + 9)).end().find('td');
|
339
|
-
picker.widget.find('.datepicker-years').find('th').removeClass('disabled');
|
340
|
-
if (startYear > year) {
|
341
|
-
picker.widget.find('.datepicker-years').find('th:eq(0)').addClass('disabled');
|
342
|
-
}
|
343
|
-
if (endYear < year + 9) {
|
344
|
-
picker.widget.find('.datepicker-years').find('th:eq(2)').addClass('disabled');
|
345
|
-
}
|
346
|
-
year -= 1;
|
347
|
-
for (i = -1; i < 11; i++) {
|
348
|
-
html += '<span class="year' + (i === -1 || i === 10 ? ' old' : '') + (currentYear === year ? ' active' : '') + ((year < startYear || year > endYear) ? ' disabled' : '') + '">' + year + '</span>';
|
349
|
-
year += 1;
|
350
|
-
}
|
351
|
-
yearCont.html(html);
|
352
|
-
},
|
353
|
-
|
354
|
-
fillHours = function () {
|
355
|
-
pMoment.lang(picker.options.language);
|
356
|
-
var table = picker.widget.find('.timepicker .timepicker-hours table'), html = '', current, i, j;
|
357
|
-
table.parent().hide();
|
358
|
-
if (picker.use24hours) {
|
359
|
-
current = 0;
|
360
|
-
for (i = 0; i < 6; i += 1) {
|
361
|
-
html += '<tr>';
|
362
|
-
for (j = 0; j < 4; j += 1) {
|
363
|
-
html += '<td class="hour">' + padLeft(current.toString()) + '</td>';
|
364
|
-
current++;
|
365
|
-
}
|
366
|
-
html += '</tr>';
|
367
|
-
}
|
368
|
-
}
|
369
|
-
else {
|
370
|
-
current = 1;
|
371
|
-
for (i = 0; i < 3; i += 1) {
|
372
|
-
html += '<tr>';
|
373
|
-
for (j = 0; j < 4; j += 1) {
|
374
|
-
html += '<td class="hour">' + padLeft(current.toString()) + '</td>';
|
375
|
-
current++;
|
376
|
-
}
|
377
|
-
html += '</tr>';
|
378
|
-
}
|
379
|
-
}
|
380
|
-
table.html(html);
|
381
|
-
},
|
382
|
-
|
383
|
-
fillMinutes = function () {
|
384
|
-
var table = picker.widget.find('.timepicker .timepicker-minutes table'), html = '', current = 0, i, j;
|
385
|
-
table.parent().hide();
|
386
|
-
for (i = 0; i < 5; i++) {
|
387
|
-
html += '<tr>';
|
388
|
-
for (j = 0; j < 4; j += 1) {
|
389
|
-
html += '<td class="minute">' + padLeft(current.toString()) + '</td>';
|
390
|
-
current += 3;
|
391
|
-
}
|
392
|
-
html += '</tr>';
|
393
|
-
}
|
394
|
-
table.html(html);
|
395
|
-
},
|
396
|
-
|
397
|
-
fillTime = function () {
|
398
|
-
if (!picker.date) return;
|
399
|
-
var timeComponents = picker.widget.find('.timepicker span[data-time-component]'),
|
400
|
-
hour = picker.date.hours(),
|
401
|
-
period = 'AM';
|
402
|
-
if (!picker.use24hours) {
|
403
|
-
if (hour >= 12) period = 'PM';
|
404
|
-
if (hour === 0) hour = 12;
|
405
|
-
else if (hour != 12) hour = hour % 12;
|
406
|
-
picker.widget.find('.timepicker [data-action=togglePeriod]').text(period);
|
407
|
-
}
|
408
|
-
timeComponents.filter('[data-time-component=hours]').text(padLeft(hour));
|
409
|
-
timeComponents.filter('[data-time-component=minutes]').text(padLeft(picker.date.minutes()));
|
410
|
-
},
|
411
|
-
|
412
|
-
click = function (e) {
|
413
|
-
e.stopPropagation();
|
414
|
-
e.preventDefault();
|
415
|
-
picker.unset = false;
|
416
|
-
var target = $(e.target).closest('span, td, th'), month, year, step, day, oldDate = picker.date;
|
417
|
-
if (target.length === 1) {
|
418
|
-
if (!target.is('.disabled')) {
|
419
|
-
switch (target[0].nodeName.toLowerCase()) {
|
420
|
-
case 'th':
|
421
|
-
switch (target[0].className) {
|
422
|
-
case 'switch':
|
423
|
-
showMode(1);
|
424
|
-
break;
|
425
|
-
case 'prev':
|
426
|
-
case 'next':
|
427
|
-
step = dpGlobal.modes[picker.viewMode].navStep;
|
428
|
-
if (target[0].className === 'prev') step = step * -1;
|
429
|
-
picker.viewDate.add(step, dpGlobal.modes[picker.viewMode].navFnc);
|
430
|
-
fillDate();
|
431
|
-
break;
|
432
|
-
}
|
433
|
-
break;
|
434
|
-
case 'span':
|
435
|
-
if (target.is('.month')) {
|
436
|
-
month = target.parent().find('span').index(target);
|
437
|
-
picker.viewDate.month(month);
|
438
|
-
} else {
|
439
|
-
year = parseInt(target.text(), 10) || 0;
|
440
|
-
picker.viewDate.year(year);
|
441
|
-
}
|
442
|
-
if (picker.viewMode !== 0) {
|
443
|
-
picker.date = pMoment({
|
444
|
-
y: picker.viewDate.year(),
|
445
|
-
M: picker.viewDate.month(),
|
446
|
-
d: picker.viewDate.date(),
|
447
|
-
h: picker.date.hours(),
|
448
|
-
m: picker.date.minutes()
|
449
|
-
});
|
450
|
-
notifyChange(oldDate);
|
451
|
-
}
|
452
|
-
showMode(-1);
|
453
|
-
fillDate();
|
454
|
-
break;
|
455
|
-
case 'td':
|
456
|
-
if (target.is('.day')) {
|
457
|
-
day = parseInt(target.text(), 10) || 1;
|
458
|
-
month = picker.viewDate.month();
|
459
|
-
year = picker.viewDate.year();
|
460
|
-
if (target.is('.old')) {
|
461
|
-
if (month === 0) {
|
462
|
-
month = 11;
|
463
|
-
year -= 1;
|
464
|
-
} else {
|
465
|
-
month -= 1;
|
466
|
-
}
|
467
|
-
} else if (target.is('.new')) {
|
468
|
-
if (month == 11) {
|
469
|
-
month = 0;
|
470
|
-
year += 1;
|
471
|
-
} else {
|
472
|
-
month += 1;
|
473
|
-
}
|
474
|
-
}
|
475
|
-
picker.date = pMoment({
|
476
|
-
y: year,
|
477
|
-
M: month,
|
478
|
-
d: day,
|
479
|
-
h: picker.date.hours(),
|
480
|
-
m: picker.date.minutes()
|
481
|
-
}
|
482
|
-
);
|
483
|
-
picker.viewDate = pMoment({
|
484
|
-
y: year, M: month, d: Math.min(28, day)
|
485
|
-
});
|
486
|
-
fillDate();
|
487
|
-
set();
|
488
|
-
notifyChange(oldDate);
|
489
|
-
}
|
490
|
-
break;
|
491
|
-
}
|
492
|
-
}
|
493
|
-
}
|
494
|
-
},
|
495
|
-
|
496
|
-
actions = {
|
497
|
-
incrementHours: function () {
|
498
|
-
checkDate("add", "hours");
|
499
|
-
},
|
500
|
-
|
501
|
-
incrementMinutes: function () {
|
502
|
-
checkDate("add", "minutes");
|
503
|
-
},
|
504
|
-
|
505
|
-
decrementHours: function () {
|
506
|
-
checkDate("subtract", "hours");
|
507
|
-
},
|
508
|
-
|
509
|
-
decrementMinutes: function () {
|
510
|
-
checkDate("subtract", "minutes");
|
511
|
-
},
|
512
|
-
|
513
|
-
togglePeriod: function () {
|
514
|
-
var hour = picker.date.hours();
|
515
|
-
if (hour >= 12) hour -= 12;
|
516
|
-
else hour += 12;
|
517
|
-
picker.date.hours(hour);
|
518
|
-
},
|
519
|
-
|
520
|
-
showPicker: function () {
|
521
|
-
picker.widget.find('.timepicker > div:not(.timepicker-picker)').hide();
|
522
|
-
picker.widget.find('.timepicker .timepicker-picker').show();
|
523
|
-
},
|
524
|
-
|
525
|
-
showHours: function () {
|
526
|
-
picker.widget.find('.timepicker .timepicker-picker').hide();
|
527
|
-
picker.widget.find('.timepicker .timepicker-hours').show();
|
528
|
-
},
|
529
|
-
|
530
|
-
showMinutes: function () {
|
531
|
-
picker.widget.find('.timepicker .timepicker-picker').hide();
|
532
|
-
picker.widget.find('.timepicker .timepicker-minutes').show();
|
533
|
-
},
|
534
|
-
|
535
|
-
selectHour: function (e) {
|
536
|
-
picker.date.hours(parseInt($(e.target).text(), 10));
|
537
|
-
actions.showPicker.call(picker);
|
538
|
-
},
|
539
|
-
|
540
|
-
selectMinute: function (e) {
|
541
|
-
picker.date.minutes(parseInt($(e.target).text(), 10));
|
542
|
-
actions.showPicker.call(picker);
|
543
|
-
}
|
544
|
-
},
|
545
|
-
|
546
|
-
doAction = function (e) {
|
547
|
-
var action = $(e.currentTarget).data('action'), rv = actions[action].apply(picker, arguments), oldDate = picker.date;
|
548
|
-
stopEvent(e);
|
549
|
-
if (!picker.date) picker.date = pMoment({ y: 1970 });
|
550
|
-
set();
|
551
|
-
fillTime();
|
552
|
-
notifyChange(oldDate);
|
553
|
-
return rv;
|
554
|
-
},
|
555
|
-
|
556
|
-
stopEvent = function (e) {
|
557
|
-
e.stopPropagation();
|
558
|
-
e.preventDefault();
|
559
|
-
},
|
560
|
-
|
561
|
-
change = function (e) {
|
562
|
-
pMoment.lang(picker.options.language);
|
563
|
-
var input = $(e.target), oldDate = picker.date, d = pMoment(input.val(), picker.format, picker.options.useStrict);
|
564
|
-
if (d.isValid()) {
|
565
|
-
update();
|
566
|
-
picker.setValue(d);
|
567
|
-
notifyChange(oldDate);
|
568
|
-
set();
|
569
|
-
}
|
570
|
-
else {
|
571
|
-
picker.viewDate = oldDate;
|
572
|
-
//picker.setValue(""); // unset the date when the input is erased
|
573
|
-
notifyChange(oldDate);
|
574
|
-
notifyError(d);
|
575
|
-
picker.unset = true;
|
576
|
-
input.val('');
|
577
|
-
}
|
578
|
-
},
|
579
|
-
|
580
|
-
showMode = function (dir) {
|
581
|
-
if (dir) {
|
582
|
-
picker.viewMode = Math.max(picker.minViewMode, Math.min(2, picker.viewMode + dir));
|
583
|
-
}
|
584
|
-
|
585
|
-
picker.widget.find('.datepicker > div').hide().filter('.datepicker-' + dpGlobal.modes[picker.viewMode].clsName).show();
|
586
|
-
},
|
587
|
-
|
588
|
-
attachDatePickerEvents = function () {
|
589
|
-
var $this, $parent, expanded, closed, collapseData;
|
590
|
-
picker.widget.on('click', '.datepicker *', $.proxy(click, this)); // this handles date picker clicks
|
591
|
-
picker.widget.on('click', '[data-action]', $.proxy(doAction, this)); // this handles time picker clicks
|
592
|
-
picker.widget.on('mousedown', $.proxy(stopEvent, this));
|
593
|
-
if (picker.options.pickDate && picker.options.pickTime) {
|
594
|
-
picker.widget.on('click.togglePicker', '.accordion-toggle', function (e) {
|
595
|
-
e.stopPropagation();
|
596
|
-
$this = $(this);
|
597
|
-
$parent = $this.closest('ul');
|
598
|
-
expanded = $parent.find('.in');
|
599
|
-
closed = $parent.find('.collapse:not(.in)');
|
600
|
-
|
601
|
-
if (expanded && expanded.length) {
|
602
|
-
collapseData = expanded.data('collapse');
|
603
|
-
if (collapseData && collapseData.transitioning) return;
|
604
|
-
expanded.collapse('hide');
|
605
|
-
closed.collapse('show');
|
606
|
-
$this.find('span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date);
|
607
|
-
picker.element.find('.input-group-addon span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date);
|
608
|
-
}
|
609
|
-
});
|
610
|
-
}
|
611
|
-
if (picker.isInput) {
|
612
|
-
picker.element.on({
|
613
|
-
'focus': $.proxy(picker.show, this),
|
614
|
-
'change': $.proxy(change, this),
|
615
|
-
'blur': $.proxy(picker.hide, this)
|
616
|
-
});
|
617
|
-
} else {
|
618
|
-
picker.element.on({
|
619
|
-
'change': $.proxy(change, this)
|
620
|
-
}, 'input');
|
621
|
-
if (picker.component) {
|
622
|
-
picker.component.on('click', $.proxy(picker.show, this));
|
623
|
-
} else {
|
624
|
-
picker.element.on('click', $.proxy(picker.show, this));
|
625
|
-
}
|
626
|
-
}
|
627
|
-
},
|
628
|
-
|
629
|
-
attachDatePickerGlobalEvents = function () {
|
630
|
-
$(window).on(
|
631
|
-
'resize.datetimepicker' + picker.id, $.proxy(place, this));
|
632
|
-
if (!picker.isInput) {
|
633
|
-
$(document).on(
|
634
|
-
'mousedown.datetimepicker' + picker.id, $.proxy(picker.hide, this));
|
635
|
-
}
|
636
|
-
},
|
637
|
-
|
638
|
-
detachDatePickerEvents = function () {
|
639
|
-
picker.widget.off('click', '.datepicker *', picker.click);
|
640
|
-
picker.widget.off('click', '[data-action]');
|
641
|
-
picker.widget.off('mousedown', picker.stopEvent);
|
642
|
-
if (picker.options.pickDate && picker.options.pickTime) {
|
643
|
-
picker.widget.off('click.togglePicker');
|
644
|
-
}
|
645
|
-
if (picker.isInput) {
|
646
|
-
picker.element.off({
|
647
|
-
'focus': picker.show,
|
648
|
-
'change': picker.change
|
649
|
-
});
|
650
|
-
} else {
|
651
|
-
picker.element.off({
|
652
|
-
'change': picker.change
|
653
|
-
}, 'input');
|
654
|
-
if (picker.component) {
|
655
|
-
picker.component.off('click', picker.show);
|
656
|
-
} else {
|
657
|
-
picker.element.off('click', picker.show);
|
658
|
-
}
|
659
|
-
}
|
660
|
-
},
|
661
|
-
|
662
|
-
detachDatePickerGlobalEvents = function () {
|
663
|
-
$(window).off('resize.datetimepicker' + picker.id);
|
664
|
-
if (!picker.isInput) {
|
665
|
-
$(document).off('mousedown.datetimepicker' + picker.id);
|
666
|
-
}
|
667
|
-
},
|
668
|
-
|
669
|
-
isInFixed = function () {
|
670
|
-
if (picker.element) {
|
671
|
-
var parents = picker.element.parents(), inFixed = false, i;
|
672
|
-
for (i = 0; i < parents.length; i++) {
|
673
|
-
if ($(parents[i]).css('position') == 'fixed') {
|
674
|
-
inFixed = true;
|
675
|
-
break;
|
676
|
-
}
|
677
|
-
}
|
678
|
-
;
|
679
|
-
return inFixed;
|
680
|
-
} else {
|
681
|
-
return false;
|
682
|
-
}
|
683
|
-
},
|
684
|
-
|
685
|
-
set = function () {
|
686
|
-
pMoment.lang(picker.options.language);
|
687
|
-
var formatted = '', input;
|
688
|
-
if (!picker.unset) formatted = pMoment(picker.date).format(picker.format);
|
689
|
-
if (!picker.isInput) {
|
690
|
-
if (picker.component) {
|
691
|
-
input = picker.element.find('input');
|
692
|
-
input.val(formatted);
|
693
|
-
}
|
694
|
-
picker.element.data('date', formatted);
|
695
|
-
} else {
|
696
|
-
picker.element.val(formatted);
|
697
|
-
}
|
698
|
-
if (!picker.options.pickTime) picker.hide();
|
699
|
-
},
|
700
|
-
|
701
|
-
checkDate = function (direction, unit) {
|
702
|
-
pMoment.lang(picker.options.language);
|
703
|
-
var newDate;
|
704
|
-
if (direction == "add") {
|
705
|
-
newDate = pMoment(picker.date);
|
706
|
-
if (newDate.hours() == 23) newDate.add(1, unit);
|
707
|
-
newDate.add(1, unit);
|
708
|
-
}
|
709
|
-
else {
|
710
|
-
newDate = pMoment(picker.date).subtract(1, unit);
|
711
|
-
}
|
712
|
-
if (newDate.isAfter(picker.options.endDate) || newDate.subtract(1, unit).isBefore(picker.options.startDate) || isInDisableDates(newDate)) {
|
713
|
-
notifyError(newDate.format(picker.format));
|
714
|
-
return;
|
715
|
-
}
|
716
|
-
|
717
|
-
if (direction == "add") {
|
718
|
-
picker.date.add(1, unit);
|
719
|
-
}
|
720
|
-
else {
|
721
|
-
picker.date.subtract(1, unit);
|
722
|
-
}
|
723
|
-
},
|
724
|
-
|
725
|
-
isInDisableDates = function (date) {
|
726
|
-
pMoment.lang(picker.options.language);
|
727
|
-
var disabled = picker.options.disabledDates, i;
|
728
|
-
for (i in disabled) {
|
729
|
-
if (disabled[i] == pMoment(date).format("L")) {
|
730
|
-
return true;
|
731
|
-
}
|
732
|
-
}
|
733
|
-
return false;
|
734
|
-
},
|
735
|
-
|
736
|
-
padLeft = function (string) {
|
737
|
-
string = string.toString();
|
738
|
-
if (string.length >= 2) return string;
|
739
|
-
else return '0' + string;
|
740
|
-
},
|
741
|
-
|
742
|
-
getTemplate = function (pickDate, pickTime, collapse) {
|
743
|
-
if (pickDate && pickTime) {
|
744
|
-
return (
|
745
|
-
'<div class="bootstrap-datetimepicker-widget dropdown-menu" style="z-index:9999 !important;">' +
|
746
|
-
'<ul class="list-unstyled">' +
|
747
|
-
'<li' + (collapse ? ' class="collapse in"' : '') + '>' +
|
748
|
-
'<div class="datepicker">' + dpGlobal.template + '</div>' +
|
749
|
-
'</li>' +
|
750
|
-
'<li class="picker-switch accordion-toggle"><a class="btn" style="width:100%"><i class="' + picker.options.icons.time + '"></i></a></li>' +
|
751
|
-
'<li' + (collapse ? ' class="collapse"' : '') + '>' +
|
752
|
-
'<div class="timepicker">' + tpGlobal.getTemplate() + '</div>' +
|
753
|
-
'</li>' +
|
754
|
-
'</ul>' +
|
755
|
-
'</div>'
|
756
|
-
);
|
757
|
-
} else if (pickTime) {
|
758
|
-
return (
|
759
|
-
'<div class="bootstrap-datetimepicker-widget dropdown-menu">' +
|
760
|
-
'<div class="timepicker">' + tpGlobal.getTemplate() + '</div>' +
|
761
|
-
'</div>'
|
762
|
-
);
|
763
|
-
} else {
|
764
|
-
return (
|
765
|
-
'<div class="bootstrap-datetimepicker-widget dropdown-menu">' +
|
766
|
-
'<div class="datepicker">' + dpGlobal.template + '</div>' +
|
767
|
-
'</div>'
|
768
|
-
);
|
769
|
-
}
|
770
|
-
},
|
771
|
-
|
772
|
-
dpGlobal = {
|
773
|
-
modes: [
|
774
|
-
{
|
775
|
-
clsName: 'days',
|
776
|
-
navFnc: 'month',
|
777
|
-
navStep: 1
|
778
|
-
},
|
779
|
-
{
|
780
|
-
clsName: 'months',
|
781
|
-
navFnc: 'year',
|
782
|
-
navStep: 1
|
783
|
-
},
|
784
|
-
{
|
785
|
-
clsName: 'years',
|
786
|
-
navFnc: 'year',
|
787
|
-
navStep: 10
|
788
|
-
}],
|
789
|
-
headTemplate:
|
790
|
-
'<thead>' +
|
791
|
-
'<tr>' +
|
792
|
-
'<th class="prev">‹</th><th colspan="5" class="switch"></th><th class="next">›</th>' +
|
793
|
-
'</tr>' +
|
794
|
-
'</thead>',
|
795
|
-
contTemplate:
|
796
|
-
'<tbody><tr><td colspan="7"></td></tr></tbody>'
|
797
|
-
},
|
798
|
-
|
799
|
-
tpGlobal = {
|
800
|
-
hourTemplate: '<span data-action="showHours" data-time-component="hours" class="timepicker-hour"></span>',
|
801
|
-
minuteTemplate: '<span data-action="showMinutes" data-time-component="minutes" class="timepicker-minute"></span>'
|
802
|
-
};
|
803
|
-
|
804
|
-
dpGlobal.template =
|
805
|
-
'<div class="datepicker-days">' +
|
806
|
-
'<table class="table-condensed">' + dpGlobal.headTemplate + '<tbody></tbody></table>' +
|
807
|
-
'</div>' +
|
808
|
-
'<div class="datepicker-months">' +
|
809
|
-
'<table class="table-condensed">' + dpGlobal.headTemplate + dpGlobal.contTemplate + '</table>' +
|
810
|
-
'</div>' +
|
811
|
-
'<div class="datepicker-years">' +
|
812
|
-
'<table class="table-condensed">' + dpGlobal.headTemplate + dpGlobal.contTemplate + '</table>' +
|
813
|
-
'</div>';
|
814
|
-
|
815
|
-
tpGlobal.getTemplate = function () {
|
816
|
-
return (
|
817
|
-
'<div class="timepicker-picker">' +
|
818
|
-
'<table class="table-condensed">' +
|
819
|
-
'<tr>' +
|
820
|
-
'<td><a href="#" class="btn" data-action="incrementHours"><span class="' + picker.options.icons.up + '"></span></a></td>' +
|
821
|
-
'<td class="separator"></td>' +
|
822
|
-
'<td><a href="#" class="btn" data-action="incrementMinutes"><span class="' + picker.options.icons.up + '"></span></a></td>' +
|
823
|
-
(!picker.use24hours ? '<td class="separator"></td>' : '') +
|
824
|
-
'</tr>' +
|
825
|
-
'<tr>' +
|
826
|
-
'<td>' + tpGlobal.hourTemplate + '</td> ' +
|
827
|
-
'<td class="separator">:</td>' +
|
828
|
-
'<td>' + tpGlobal.minuteTemplate + '</td> ' +
|
829
|
-
(!picker.use24hours ? '<td class="separator"></td>' +
|
830
|
-
'<td><button type="button" class="btn btn-comp" data-action="togglePeriod"></button></td>' : '') +
|
831
|
-
'</tr>' +
|
832
|
-
'<tr>' +
|
833
|
-
'<td><a href="#" class="btn" data-action="decrementHours"><span class="' + picker.options.icons.down + '"></span></a></td>' +
|
834
|
-
'<td class="separator"></td>' +
|
835
|
-
'<td><a href="#" class="btn" data-action="decrementMinutes"><span class="' + picker.options.icons.down + '"></span></a></td>' +
|
836
|
-
(!picker.use24hours ? '<td class="separator"></td>' : '') +
|
837
|
-
'</tr>' +
|
838
|
-
'</table>' +
|
839
|
-
'</div>' +
|
840
|
-
'<div class="timepicker-hours" data-action="selectHour">' +
|
841
|
-
'<table class="table-condensed"></table>' +
|
842
|
-
'</div>' +
|
843
|
-
'<div class="timepicker-minutes" data-action="selectMinute">' +
|
844
|
-
'<table class="table-condensed"></table>' +
|
845
|
-
'</div>'
|
846
|
-
);
|
847
|
-
};
|
848
|
-
|
849
|
-
picker.destroy = function () {
|
850
|
-
detachDatePickerEvents();
|
851
|
-
detachDatePickerGlobalEvents();
|
852
|
-
picker.widget.remove();
|
853
|
-
picker.element.removeData('DateTimePicker');
|
854
|
-
picker.component.removeData('DateTimePicker');
|
855
|
-
};
|
856
|
-
|
857
|
-
picker.show = function (e) {
|
858
|
-
picker.widget.show();
|
859
|
-
picker.height = picker.component ? picker.component.outerHeight() : picker.element.outerHeight();
|
860
|
-
place();
|
861
|
-
picker.element.trigger({
|
862
|
-
type: 'show.dp',
|
863
|
-
date: picker.date
|
864
|
-
});
|
865
|
-
attachDatePickerGlobalEvents();
|
866
|
-
if (e) {
|
867
|
-
stopEvent(e);
|
868
|
-
}
|
869
|
-
},
|
870
|
-
|
871
|
-
picker.disable = function () {
|
872
|
-
picker.element.find('input').prop('disabled', true);
|
873
|
-
detachDatePickerEvents();
|
874
|
-
},
|
875
|
-
|
876
|
-
picker.enable = function () {
|
877
|
-
picker.element.find('input').prop('disabled', false);
|
878
|
-
attachDatePickerEvents();
|
879
|
-
},
|
880
|
-
|
881
|
-
picker.hide = function () {
|
882
|
-
// Ignore event if in the middle of a picker transition
|
883
|
-
var collapse = picker.widget.find('.collapse'), i, collapseData;
|
884
|
-
for (i = 0; i < collapse.length; i++) {
|
885
|
-
collapseData = collapse.eq(i).data('collapse');
|
886
|
-
if (collapseData && collapseData.transitioning)
|
887
|
-
return;
|
888
|
-
}
|
889
|
-
picker.widget.hide();
|
890
|
-
picker.viewMode = picker.startViewMode;
|
891
|
-
showMode();
|
892
|
-
picker.element.trigger({
|
893
|
-
type: 'hide.dp',
|
894
|
-
date: picker.date
|
895
|
-
});
|
896
|
-
detachDatePickerGlobalEvents();
|
897
|
-
},
|
898
|
-
|
899
|
-
picker.setValue = function (newDate) {
|
900
|
-
pMoment.lang(picker.options.language);
|
901
|
-
if (!newDate) {
|
902
|
-
picker.unset = true;
|
903
|
-
} else {
|
904
|
-
picker.unset = false;
|
905
|
-
}
|
906
|
-
if (!pMoment.isMoment(newDate)) newDate = pMoment(newDate);
|
907
|
-
if (newDate.isValid()) {
|
908
|
-
picker.date = newDate;
|
909
|
-
set();
|
910
|
-
picker.viewDate = pMoment({ y: picker.date.year(), M: picker.date.month() });
|
911
|
-
fillDate();
|
912
|
-
fillTime();
|
913
|
-
}
|
914
|
-
else {
|
915
|
-
notifyError(newDate);
|
916
|
-
}
|
917
|
-
},
|
918
|
-
|
919
|
-
picker.getDate = function () {
|
920
|
-
if (picker.unset) return null;
|
921
|
-
return picker.date;
|
922
|
-
},
|
923
|
-
|
924
|
-
picker.setDate = function (date) {
|
925
|
-
if (!date) picker.setValue(null);
|
926
|
-
else picker.setValue(date);
|
927
|
-
},
|
928
|
-
|
929
|
-
picker.setEndDate = function (date) {
|
930
|
-
picker.options.endDate = pMoment(date);
|
931
|
-
if (!picker.options.endDate.isValid()) {
|
932
|
-
picker.options.endDate = pMoment().add(50, "y");
|
933
|
-
}
|
934
|
-
if (picker.viewDate) update();
|
935
|
-
},
|
936
|
-
|
937
|
-
picker.setStartDate = function (date) {
|
938
|
-
picker.options.startDate = pMoment(date);
|
939
|
-
if (!picker.options.startDate.isValid()) {
|
940
|
-
picker.options.startDate = pMoment({ y: 1970 });
|
941
|
-
}
|
942
|
-
if (picker.viewDate) update();
|
943
|
-
};
|
944
|
-
|
945
|
-
init();
|
946
|
-
};
|
947
|
-
|
948
|
-
$.fn.datetimepicker = function (options) {
|
949
|
-
return this.each(function () {
|
950
|
-
var $this = $(this), data = $this.data('DateTimePicker');
|
951
|
-
if (!data) $this.data('DateTimePicker', new DateTimePicker(this, options));
|
952
|
-
});
|
953
|
-
};
|
954
|
-
})(jQuery);
|