decidim-core 0.28.4 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/cells/decidim/activities_cell.rb +0 -1
- data/app/cells/decidim/activity_cell.rb +5 -7
- data/app/cells/decidim/address/online.erb +2 -2
- data/app/cells/decidim/address_cell.rb +3 -9
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +0 -2
- data/app/cells/decidim/amendable/amendments_cell.rb +0 -2
- data/app/cells/decidim/amendable/announcement_cell.rb +10 -14
- data/app/cells/decidim/amendable/emendation_actions_cell.rb +0 -2
- data/app/cells/decidim/amendable/promote_button_card_cell.rb +0 -2
- data/app/cells/decidim/amendable/wizard_step_form_cell.rb +6 -19
- data/app/cells/decidim/announcement/show.erb +1 -1
- data/app/cells/decidim/announcement_cell.rb +6 -2
- data/app/cells/decidim/attachments_file_tab/show.erb +3 -0
- data/app/cells/decidim/attachments_file_tab_cell.rb +11 -0
- data/app/cells/decidim/attachments_link_tab/show.erb +12 -0
- data/app/cells/decidim/attachments_link_tab_cell.rb +21 -0
- data/app/cells/decidim/author/flag.erb +2 -2
- data/app/cells/decidim/author_cell.rb +0 -2
- data/app/cells/decidim/authorization_modal_cell.rb +0 -3
- data/app/cells/decidim/badge_cell.rb +0 -4
- data/app/cells/decidim/badges_cell.rb +0 -2
- data/app/cells/decidim/button_cell.rb +0 -3
- data/app/cells/decidim/card_cell.rb +1 -5
- data/app/cells/decidim/card_g/show.erb +1 -1
- data/app/cells/decidim/card_g_cell.rb +4 -7
- data/app/cells/decidim/card_l/image.erb +2 -2
- data/app/cells/decidim/card_l/space.erb +1 -1
- data/app/cells/decidim/card_l_cell.rb +3 -8
- data/app/cells/decidim/card_metadata_cell.rb +1 -5
- data/app/cells/decidim/card_s_cell.rb +1 -4
- data/app/cells/decidim/coauthorships_cell.rb +0 -2
- data/app/cells/decidim/comments_button_cell.rb +0 -2
- data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +1 -1
- data/app/cells/decidim/content_blocks/footer_sub_hero_cell.rb +0 -3
- data/app/cells/decidim/content_blocks/hero/show.erb +1 -1
- data/app/cells/decidim/content_blocks/hero_cell.rb +1 -2
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +0 -2
- data/app/cells/decidim/content_blocks/how_to_participate/show.erb +1 -1
- data/app/cells/decidim/content_blocks/how_to_participate_cell.rb +0 -1
- data/app/cells/decidim/content_blocks/participatory_space_documents/content.erb +1 -1
- data/app/cells/decidim/content_blocks/participatory_space_documents_cell.rb +17 -1
- data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +2 -4
- data/app/cells/decidim/content_blocks/participatory_space_last_activity_cell.rb +1 -3
- data/app/cells/decidim/content_blocks/stats/show.erb +1 -1
- data/app/cells/decidim/content_blocks/stats_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +0 -3
- data/app/cells/decidim/date_range/show.erb +10 -10
- data/app/cells/decidim/date_range_cell.rb +0 -2
- data/app/cells/decidim/diff_cell.rb +0 -1
- data/app/cells/decidim/documents_panel/show.erb +4 -0
- data/app/cells/decidim/documents_panel_cell.rb +9 -1
- data/app/cells/decidim/endorsement_buttons_cell.rb +6 -14
- data/app/cells/decidim/flag_modal/flag_user.erb +3 -3
- data/app/cells/decidim/followers_cell.rb +0 -1
- data/app/cells/decidim/following_cell.rb +0 -1
- data/app/cells/decidim/footer_topics/show.erb +8 -0
- data/app/cells/decidim/footer_topics_cell.rb +39 -0
- data/app/cells/decidim/groups_cell.rb +0 -3
- data/app/cells/decidim/linked_resources_for_cell.rb +0 -3
- data/app/cells/decidim/members_cell.rb +0 -1
- data/app/cells/decidim/nav_links/show.erb +3 -3
- data/app/cells/decidim/navbar_admin_link_cell.rb +0 -2
- data/app/cells/decidim/newsletter_templates/base_cell.rb +0 -1
- data/app/cells/decidim/newsletter_templates/basic_only_text/show.erb +2 -2
- data/app/cells/decidim/newsletter_templates/image_text_cta/show.erb +2 -2
- data/app/cells/decidim/notification/show.erb +5 -0
- data/app/cells/decidim/notification_actions/base_cell.rb +13 -0
- data/app/cells/decidim/notification_actions/buttons/show.erb +5 -0
- data/app/cells/decidim/notification_actions/buttons_cell.rb +41 -0
- data/app/cells/decidim/notification_cell.rb +9 -3
- data/app/cells/decidim/notifications_cell.rb +0 -1
- data/app/cells/decidim/pad_iframe/show.erb +2 -2
- data/app/cells/decidim/pad_iframe_cell.rb +0 -1
- data/app/cells/decidim/participatory_space_dropdown_metadata_cell.rb +1 -2
- data/app/cells/decidim/photo_cell.rb +1 -5
- data/app/cells/decidim/photos_list_cell.rb +0 -2
- data/app/cells/decidim/profile_cell.rb +0 -2
- data/app/cells/decidim/profile_sidebar/show.erb +20 -20
- data/app/cells/decidim/profile_sidebar_cell.rb +1 -10
- data/app/cells/decidim/progress_bar/show.erb +8 -6
- data/app/cells/decidim/public_participation/show.erb +1 -1
- data/app/cells/decidim/report_button/flag_modal.erb +1 -1
- data/app/cells/decidim/resource_types_filter/show.erb +12 -11
- data/app/cells/decidim/resource_types_filter_cell.rb +0 -2
- data/app/cells/decidim/scopes_picker/show.erb +1 -1
- data/app/cells/decidim/scopes_picker_cell.rb +0 -1
- data/app/cells/decidim/search_results_cell.rb +1 -1
- data/app/cells/decidim/statistic_cell.rb +0 -2
- data/app/cells/decidim/tab_panels/show.erb +1 -1
- data/app/cells/decidim/tab_panels_cell.rb +12 -2
- data/app/cells/decidim/tags_cell.rb +0 -2
- data/app/cells/decidim/tos_page_cell.rb +0 -3
- data/app/cells/decidim/translation_bar/show.erb +1 -1
- data/app/cells/decidim/translation_bar_cell.rb +0 -2
- data/app/cells/decidim/upload_modal/files.erb +1 -1
- data/app/cells/decidim/upload_modal_cell.rb +1 -3
- data/app/cells/decidim/user_conversation/new.erb +1 -1
- data/app/cells/decidim/user_conversation/show.erb +1 -1
- data/app/cells/decidim/user_conversation_cell.rb +0 -1
- data/app/cells/decidim/user_conversations/show.erb +1 -1
- data/app/cells/decidim/user_conversations_cell.rb +0 -1
- data/app/cells/decidim/user_group_pending_invitations_list_cell.rb +0 -1
- data/app/cells/decidim/user_group_pending_requests_list_cell.rb +0 -1
- data/app/cells/decidim/user_timeline/show.erb +1 -1
- data/app/cells/decidim/version_cell.rb +3 -5
- data/app/cells/decidim/versions_list_cell.rb +1 -3
- data/app/cells/decidim/versions_list_item_cell.rb +2 -4
- data/app/cells/decidim/wizard_step_form/wizard_aside.erb +2 -2
- data/app/cells/decidim/wizard_step_form/wizard_header.erb +2 -3
- data/app/cells/decidim/wizard_step_form_cell.rb +0 -8
- data/app/commands/decidim/amendable/create_draft.rb +4 -4
- data/app/commands/decidim/amendable/promote.rb +3 -2
- data/app/commands/decidim/amendable/publish_draft.rb +3 -2
- data/app/commands/decidim/amendable/update_draft.rb +4 -3
- data/app/commands/decidim/amendable/withdraw.rb +1 -1
- data/app/commands/decidim/create_follow.rb +4 -4
- data/app/commands/decidim/create_omniauth_registration.rb +4 -10
- data/app/commands/decidim/create_report.rb +3 -3
- data/app/commands/decidim/create_user_report.rb +5 -5
- data/app/commands/decidim/delete_follow.rb +4 -4
- data/app/commands/decidim/demote_membership.rb +2 -2
- data/app/commands/decidim/destroy_account.rb +21 -19
- data/app/commands/decidim/endorse_resource.rb +1 -1
- data/app/commands/decidim/invite_user_to_group.rb +5 -4
- data/app/commands/decidim/update_account.rb +24 -22
- data/app/commands/decidim/update_notifications_settings.rb +13 -11
- data/app/commands/decidim/update_password.rb +7 -7
- data/app/commands/decidim/update_user_interests.rb +9 -7
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +1 -1
- data/app/controllers/concerns/decidim/devise_controllers.rb +2 -1
- data/app/controllers/concerns/decidim/filter_resource.rb +1 -1
- data/app/controllers/concerns/decidim/needs_rtl_direction.rb +23 -0
- data/app/controllers/concerns/decidim/paginable.rb +1 -1
- data/app/controllers/concerns/decidim/participatory_space_context.rb +1 -23
- data/app/controllers/concerns/decidim/payload_info.rb +2 -1
- data/app/controllers/concerns/decidim/registers_permissions.rb +4 -4
- data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
- data/app/controllers/concerns/decidim/withdrawable.rb +1 -1
- data/app/controllers/decidim/account_controller.rb +2 -2
- data/app/controllers/{concerns/decidim → decidim}/amendments_controller.rb +3 -16
- data/app/controllers/decidim/application_controller.rb +1 -1
- data/app/controllers/decidim/components/base_controller.rb +1 -1
- data/app/controllers/decidim/devise/invitations_controller.rb +1 -1
- data/app/controllers/decidim/devise/passwords_controller.rb +2 -2
- data/app/controllers/decidim/endorsements_controller.rb +1 -1
- data/app/controllers/decidim/favicon_controller.rb +1 -1
- data/app/controllers/decidim/follows_controller.rb +2 -2
- data/app/controllers/decidim/group_invites_controller.rb +36 -9
- data/app/controllers/decidim/newsletters_opt_in_controller.rb +1 -1
- data/app/controllers/decidim/notifications_settings_controller.rb +1 -1
- data/app/controllers/decidim/report_users_controller.rb +1 -1
- data/app/controllers/decidim/reports_controller.rb +1 -1
- data/app/controllers/decidim/user_interests_controller.rb +1 -1
- data/app/events/decidim/change_nickname_event.rb +0 -1
- data/app/events/decidim/invited_to_group_event.rb +29 -0
- data/app/events/decidim/welcome_notification_event.rb +2 -4
- data/app/forms/decidim/form.rb +4 -0
- data/app/forms/decidim/omniauth_registration_form.rb +1 -1
- data/app/forms/decidim/upload_validation_form.rb +2 -2
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +1 -1
- data/app/helpers/decidim/amendments_helper.rb +4 -14
- data/app/helpers/decidim/application_helper.rb +8 -0
- data/app/helpers/decidim/authorization_form_helper.rb +2 -2
- data/app/helpers/decidim/breadcrumb_helper.rb +1 -1
- data/app/helpers/decidim/cells_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +1 -1
- data/app/helpers/decidim/datalist_select_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +3 -3
- data/app/helpers/decidim/filters_helper.rb +1 -1
- data/app/helpers/decidim/layout_helper.rb +1 -64
- data/app/helpers/decidim/localized_locales_helper.rb +1 -1
- data/app/helpers/decidim/menu_helper.rb +9 -1
- data/app/helpers/decidim/meta_tags_helper.rb +26 -23
- data/app/helpers/decidim/modal_helper.rb +1 -1
- data/app/helpers/decidim/orders_helper.rb +1 -1
- data/app/helpers/decidim/organization_helper.rb +55 -0
- data/app/helpers/decidim/paginate_helper.rb +5 -3
- data/app/helpers/decidim/resource_helper.rb +0 -7
- data/app/helpers/decidim/scopes_helper.rb +3 -4
- data/app/helpers/decidim/searches_helper.rb +1 -1
- data/app/helpers/decidim/short_link_helper.rb +2 -2
- data/app/helpers/decidim/translations_helper.rb +2 -2
- data/app/helpers/decidim/twitter_search_helper.rb +1 -1
- data/app/helpers/decidim/user_profile_helper.rb +0 -1
- data/app/jobs/decidim/email_notifications_digest_generator_job.rb +2 -2
- data/app/mailers/decidim/application_mailer.rb +6 -2
- data/app/mailers/decidim/block_user_mailer.rb +1 -1
- data/app/mailers/decidim/decidim_devise_mailer.rb +7 -1
- data/app/mailers/decidim/newsletter_mailer.rb +1 -4
- data/app/mailers/decidim/newsletters_opt_in_mailer.rb +2 -2
- data/app/mailers/decidim/notification_mailer.rb +0 -1
- data/app/mailers/decidim/notifications_digest_mailer.rb +0 -1
- data/app/mailers/decidim/reported_mailer.rb +6 -3
- data/app/mailers/decidim/user_report_mailer.rb +1 -1
- data/app/models/decidim/action_log.rb +2 -12
- data/app/models/decidim/area_type.rb +1 -1
- data/app/models/decidim/attachment.rb +28 -4
- data/app/models/decidim/authorization.rb +1 -1
- data/app/models/decidim/authorization_transfer.rb +1 -0
- data/app/models/decidim/component.rb +3 -6
- data/app/models/decidim/content_block.rb +3 -3
- data/app/models/decidim/messaging/message.rb +2 -2
- data/app/models/decidim/newsletter.rb +9 -9
- data/app/models/decidim/notification.rb +2 -2
- data/app/models/decidim/organization.rb +23 -2
- data/app/models/decidim/push_notification_message.rb +1 -1
- data/app/models/decidim/resource_link.rb +1 -1
- data/app/models/decidim/user.rb +14 -14
- data/app/models/decidim/user_group.rb +2 -2
- data/app/packs/src/decidim/a11y.js +61 -11
- data/app/packs/src/decidim/append_redirect_url_to_modals.js +12 -14
- data/app/packs/src/decidim/attachments/file_or_link_tabs.js +55 -0
- data/app/packs/src/decidim/attachments/index.js +1 -0
- data/app/packs/src/decidim/back_to_list.js +1 -1
- data/app/packs/src/decidim/check_boxes_tree.js +1 -1
- data/app/packs/src/decidim/data_consent/consent_manager.js +1 -1
- data/app/packs/src/decidim/data_consent/consent_manager.test.js +6 -6
- data/app/packs/src/decidim/data_consent/index.js +1 -1
- data/app/packs/src/decidim/datepicker/datepicker_functions.js +243 -0
- data/app/packs/src/decidim/datepicker/datepicker_listeners.js +78 -0
- data/app/packs/src/decidim/datepicker/form_datepicker.js +91 -0
- data/app/packs/src/decidim/datepicker/generate_datepicker.js +148 -0
- data/app/packs/src/decidim/datepicker/generate_timepicker.js +298 -0
- data/app/packs/src/decidim/datepicker/test/date.test.js +118 -0
- data/app/packs/src/decidim/datepicker/test/time.test.js +227 -0
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +0 -3
- data/app/packs/src/decidim/editor/extensions/indent/index.js +1 -1
- data/app/packs/src/decidim/editor/extensions/video_embed/index.js +4 -4
- data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +0 -15
- data/app/packs/src/decidim/editor/test/extensions/indent.test.js +1 -1
- data/app/packs/src/decidim/editor/test/fixtures/upload_templates.js +1 -1
- data/app/packs/src/decidim/editor/test/helpers.js +1 -14
- data/app/packs/src/decidim/editor/utilities/paste_transform.js +2 -2
- data/app/packs/src/decidim/external_domain_warning.js +2 -2
- data/app/packs/src/decidim/external_domain_warning.test.js +4 -4
- data/app/packs/src/decidim/form_filter.js +4 -4
- data/app/packs/src/decidim/impersonation.js +1 -1
- data/app/packs/src/decidim/index.js +11 -5
- data/app/packs/src/decidim/input_character_counter.js +2 -2
- data/app/packs/src/decidim/input_emoji.js +171 -72
- data/app/packs/src/decidim/input_hashtags.js +1 -1
- data/app/packs/src/decidim/input_mentions.js +1 -1
- data/app/packs/src/decidim/notifications_actions.js +40 -0
- data/app/packs/src/decidim/sticky_header.js +87 -0
- data/app/packs/src/decidim/sw/sw.js +8 -6
- data/app/packs/src/decidim/tooltips.js +1 -1
- data/app/packs/stylesheets/decidim/_buttons.scss +1 -1
- data/app/packs/stylesheets/decidim/_datepicker.scss +193 -0
- data/app/packs/stylesheets/decidim/_dropdown.scss +45 -9
- data/app/packs/stylesheets/decidim/_emoji.scss +36 -0
- data/app/packs/stylesheets/decidim/_filters.scss +4 -2
- data/app/packs/stylesheets/decidim/_flash.scss +2 -2
- data/app/packs/stylesheets/decidim/_footer.scss +1 -3
- data/app/packs/stylesheets/decidim/_forms.scss +13 -5
- data/app/packs/stylesheets/decidim/_header.scss +70 -50
- data/app/packs/stylesheets/decidim/_home.scss +1 -1
- data/app/packs/stylesheets/decidim/_layout.scss +13 -0
- data/app/packs/stylesheets/decidim/_modal.scss +1 -1
- data/app/packs/stylesheets/decidim/_modal_update.scss +1 -5
- data/app/packs/stylesheets/decidim/_notifications.scss +4 -0
- data/app/packs/stylesheets/decidim/_tabs_x.scss +5 -1
- data/app/packs/stylesheets/decidim/_tooltip.scss +10 -10
- data/app/packs/stylesheets/decidim/application.scss +4 -0
- data/app/packs/stylesheets/decidim/editor.scss +1 -1
- data/app/packs/stylesheets/decidim/legacy/leaflet.scss +1 -1
- data/app/packs/stylesheets/decidim/vendor/_datepicker_light.scss +228 -0
- data/app/permissions/decidim/default_permissions.rb +2 -2
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/static_page_presenter.rb +1 -1
- data/app/presenters/decidim/authorization_transfer_presenter.rb +1 -1
- data/app/presenters/decidim/component_attachment_collection_presenter.rb +81 -0
- data/app/presenters/decidim/footer_menu_presenter.rb +1 -1
- data/app/presenters/decidim/home_stats_presenter.rb +1 -1
- data/app/presenters/decidim/menu_item_presenter.rb +1 -1
- data/app/presenters/decidim/organization_presenter.rb +1 -1
- data/app/queries/decidim/last_activity.rb +5 -16
- data/app/queries/decidim/metric_measure.rb +1 -1
- data/app/queries/decidim/public_activities.rb +1 -1
- data/app/queries/decidim/user_groups/admin_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/member_memberships.rb +1 -1
- data/app/services/decidim/action_logger.rb +3 -3
- data/app/services/decidim/download_your_data_exporter.rb +25 -36
- data/app/services/decidim/log/diff_changeset_calculator.rb +2 -2
- data/app/services/decidim/notifications_digest_sending_decider.rb +1 -1
- data/app/services/decidim/open_data_exporter.rb +7 -8
- data/app/services/decidim/zip_stream/writer.rb +39 -0
- data/app/uploaders/decidim/organization_favicon_uploader.rb +1 -1
- data/app/uploaders/decidim/record_image_uploader.rb +2 -2
- data/app/validators/organization_present_validator.rb +1 -1
- data/app/validators/passthru_validator.rb +1 -1
- data/app/validators/uploader_image_dimensions_validator.rb +2 -2
- data/app/views/decidim/account/show.html.erb +1 -1
- data/app/views/decidim/amendments/_wizard_header.html.erb +1 -2
- data/app/views/decidim/application/_collection.html.erb +3 -1
- data/app/views/decidim/application/_component_documents.html.erb +4 -0
- data/app/views/decidim/application/_document.html.erb +23 -9
- data/app/views/decidim/block_user_mailer/notify.html.erb +2 -2
- data/app/views/decidim/devise/invitations/edit.html.erb +2 -2
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +2 -2
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/devise/shared/_login_boxes.html.erb +1 -1
- data/app/views/decidim/doorkeeper/authorizations/new.html.erb +1 -1
- data/app/views/decidim/endorsements/_identity.html.erb +1 -1
- data/app/views/decidim/gamification/badges/index.html.erb +1 -1
- data/app/views/decidim/manifests/show.json.erb +4 -4
- data/app/views/decidim/messaging/conversations/_add_conversation_users.html.erb +2 -2
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +5 -5
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +1 -1
- data/app/views/decidim/newsletters/show.html.erb +1 -1
- data/app/views/decidim/newsletters_opt_in_mailer/notify.html.erb +2 -2
- data/app/views/decidim/offline/show.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +3 -3
- data/app/views/decidim/pages/index.html.erb +1 -2
- data/app/views/decidim/reported_mailer/report.html.erb +4 -2
- data/app/views/decidim/scopes/picker.html.erb +5 -5
- data/app/views/decidim/searches/_resources_filter_block.html.erb +6 -6
- data/app/views/decidim/shared/_extended_navigation_bar.html.erb +8 -8
- data/app/views/decidim/shared/_filters.html.erb +5 -5
- data/app/views/decidim/shared/_login_modal.html.erb +1 -1
- data/app/views/decidim/shared/_orders.html.erb +2 -3
- data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -1
- data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
- data/app/views/decidim/user_interests/_areas.html.erb +2 -2
- data/app/views/decidim/user_report_mailer/notify.html.erb +2 -2
- data/app/views/decidim/user_update_mailer/notify.html.erb +1 -1
- data/app/views/decidim/widgets/_data_picker.html.erb +1 -1
- data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/invitation_instructions.text.erb +1 -1
- data/app/views/devise/mailer/invite_admin.html.erb +2 -2
- data/app/views/devise/mailer/invite_admin.text.erb +2 -2
- data/app/views/devise/mailer/invite_collaborator.html.erb +2 -2
- data/app/views/devise/mailer/invite_collaborator.text.erb +2 -2
- data/app/views/devise/mailer/invite_private_user.html.erb +2 -2
- data/app/views/devise/mailer/invite_private_user.text.erb +2 -2
- data/app/views/devise/mailer/organization_admin_invitation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/organization_admin_invitation_instructions.text.erb +1 -1
- data/app/views/layouts/decidim/_application.html.erb +3 -6
- data/app/views/layouts/decidim/_data_consent_warning.html.erb +2 -2
- data/app/views/layouts/decidim/_decidim_javascript.html.erb +1 -1
- data/app/views/layouts/decidim/_head.html.erb +1 -1
- data/app/views/layouts/decidim/_head_extra.html.erb +2 -2
- data/app/views/layouts/decidim/_impersonation_warning.html.erb +1 -1
- data/app/views/layouts/decidim/_js_configuration.html.erb +7 -2
- data/app/views/layouts/decidim/_logo.html.erb +2 -2
- data/app/views/layouts/decidim/_logo_mobile.html.erb +11 -0
- data/app/views/layouts/decidim/_mailer_logo.html.erb +2 -2
- data/app/views/layouts/decidim/_meta_tags_config.html.erb +1 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +16 -9
- data/app/views/layouts/decidim/footer/_main.html.erb +2 -3
- data/app/views/layouts/decidim/footer/_main_intro.html.erb +2 -2
- data/app/views/layouts/decidim/footer/_main_legal.html.erb +2 -3
- data/app/views/layouts/decidim/footer/_main_links.html.erb +13 -11
- data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +8 -8
- data/app/views/layouts/decidim/header/_main.html.erb +9 -22
- data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +4 -5
- data/app/views/layouts/decidim/header/_main_links_mobile_account.html.erb +11 -4
- data/app/views/layouts/decidim/header/_main_links_mobile_item_account.html.erb +24 -0
- data/app/views/layouts/decidim/header/_main_links_mobile_search.html.erb +0 -21
- data/app/views/layouts/decidim/header/_main_menu_mobile.html.erb +12 -0
- data/app/views/layouts/decidim/header/_menu_breadcrumb_desktop.html.erb +1 -1
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_mobile.html.erb +17 -0
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_top_left.html.erb +1 -1
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/app/views/layouts/decidim/header/_menu_form_search_mobile.html.erb +16 -0
- data/app/views/layouts/decidim/header/_mobile_language_choose.html.erb +25 -0
- data/app/views/layouts/decidim/mailer.html.erb +2 -2
- data/app/views/layouts/decidim/shared/_layout_center.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_item.html.erb +0 -14
- data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
- data/config/initializers/active_storage.rb +3 -0
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/new_framework_defaults_7_0.rb +145 -0
- data/config/locales/ar.yml +3 -42
- data/config/locales/bg.yml +56 -57
- data/config/locales/ca.yml +69 -58
- data/config/locales/cs.yml +54 -58
- data/config/locales/de.yml +65 -54
- data/config/locales/el.yml +1 -29
- data/config/locales/en.yml +69 -58
- data/config/locales/es-MX.yml +68 -57
- data/config/locales/es-PY.yml +68 -57
- data/config/locales/es.yml +67 -56
- data/config/locales/eu.yml +71 -60
- data/config/locales/fi-plain.yml +70 -59
- data/config/locales/fi.yml +94 -83
- data/config/locales/fr-CA.yml +61 -56
- data/config/locales/fr.yml +56 -51
- data/config/locales/ga-IE.yml +0 -11
- data/config/locales/gl.yml +1 -18
- data/config/locales/hu.yml +37 -56
- data/config/locales/id-ID.yml +0 -14
- data/config/locales/is-IS.yml +0 -13
- data/config/locales/it.yml +0 -25
- data/config/locales/ja.yml +70 -59
- data/config/locales/lb.yml +0 -25
- data/config/locales/lt.yml +1 -48
- data/config/locales/lv.yml +0 -21
- data/config/locales/nl.yml +0 -24
- data/config/locales/no.yml +0 -25
- data/config/locales/pl.yml +68 -56
- data/config/locales/pt-BR.yml +5 -250
- data/config/locales/pt.yml +0 -25
- data/config/locales/ro-RO.yml +49 -89
- data/config/locales/ru.yml +0 -15
- data/config/locales/sk.yml +0 -21
- data/config/locales/sl.yml +0 -8
- data/config/locales/sv.yml +159 -600
- data/config/locales/tr-TR.yml +4 -27
- data/config/locales/uk.yml +0 -10
- data/config/locales/zh-CN.yml +0 -22
- data/config/locales/zh-TW.yml +1 -47
- data/config/routes.rb +0 -1
- data/db/migrate/20170128112958_change_user_groups_verified_to_timestamp.rb +1 -1
- data/db/migrate/20181025082245_add_timestamps_to_components.rb +1 -5
- data/db/migrate/20240110150230_rename_external_domain_whitelist_to_external_domain_allowlist.rb +7 -0
- data/db/migrate/20240326104215_remove_show_in_footer_in_static_pages.rb +7 -0
- data/db/migrate/20240401192628_change_name_on_decidim_organizations.rb +31 -0
- data/db/seeds/avatars/001.jpg +0 -0
- data/db/seeds/avatars/002.jpg +0 -0
- data/db/seeds/avatars/003.jpg +0 -0
- data/db/seeds/avatars/004.jpg +0 -0
- data/db/seeds/avatars/005.jpg +0 -0
- data/db/seeds/avatars/006.jpg +0 -0
- data/db/seeds/avatars/007.jpg +0 -0
- data/db/seeds/avatars/008.jpg +0 -0
- data/db/seeds/avatars/009.jpg +0 -0
- data/db/seeds/avatars/010.jpg +0 -0
- data/db/seeds/avatars/011.jpg +0 -0
- data/db/seeds/avatars/012.jpg +0 -0
- data/db/seeds/avatars/013.jpg +0 -0
- data/db/seeds/avatars/014.jpg +0 -0
- data/db/seeds/avatars/015.jpg +0 -0
- data/db/seeds/avatars/016.jpg +0 -0
- data/db/seeds/avatars/017.jpg +0 -0
- data/db/seeds/avatars/018.jpg +0 -0
- data/db/seeds/avatars/019.jpg +0 -0
- data/db/seeds/avatars/020.jpg +0 -0
- data/db/seeds/avatars/021.jpg +0 -0
- data/db/seeds/avatars/022.jpg +0 -0
- data/db/seeds/avatars/023.jpg +0 -0
- data/db/seeds/avatars/024.jpg +0 -0
- data/db/seeds/avatars/025.jpg +0 -0
- data/db/seeds/avatars/026.jpg +0 -0
- data/db/seeds/avatars/027.jpg +0 -0
- data/db/seeds/avatars/028.jpg +0 -0
- data/db/seeds/avatars/029.jpg +0 -0
- data/db/seeds/avatars/030.jpg +0 -0
- data/db/seeds/avatars/031.jpg +0 -0
- data/db/seeds/avatars/032.jpg +0 -0
- data/db/seeds/avatars/033.jpg +0 -0
- data/db/seeds/avatars/034.jpg +0 -0
- data/db/seeds/avatars/035.jpg +0 -0
- data/db/seeds/avatars/036.jpg +0 -0
- data/db/seeds/avatars/037.jpg +0 -0
- data/db/seeds/avatars/038.jpg +0 -0
- data/db/seeds/avatars/039.jpg +0 -0
- data/db/seeds/avatars/040.jpg +0 -0
- data/db/seeds/avatars/041.jpg +0 -0
- data/db/seeds/avatars/042.jpg +0 -0
- data/db/seeds/avatars/043.jpg +0 -0
- data/db/seeds/avatars/044.jpg +0 -0
- data/db/seeds/avatars/045.jpg +0 -0
- data/db/seeds/avatars/046.jpg +0 -0
- data/db/seeds/avatars/047.jpg +0 -0
- data/db/seeds/avatars/048.jpg +0 -0
- data/db/seeds/avatars/049.jpg +0 -0
- data/db/seeds/avatars/050.jpg +0 -0
- data/db/seeds/avatars/051.jpg +0 -0
- data/db/seeds/avatars/052.jpg +0 -0
- data/db/seeds/avatars/053.jpg +0 -0
- data/db/seeds/avatars/054.jpg +0 -0
- data/db/seeds/avatars/055.jpg +0 -0
- data/db/seeds/avatars/056.jpg +0 -0
- data/db/seeds/avatars/057.jpg +0 -0
- data/db/seeds/avatars/058.jpg +0 -0
- data/db/seeds/avatars/059.jpg +0 -0
- data/db/seeds/avatars/060.jpg +0 -0
- data/db/seeds/avatars/061.jpg +0 -0
- data/db/seeds/avatars/062.jpg +0 -0
- data/db/seeds/avatars/063.jpg +0 -0
- data/db/seeds/avatars/064.jpg +0 -0
- data/db/seeds/avatars/065.jpg +0 -0
- data/db/seeds/avatars/066.jpg +0 -0
- data/db/seeds/avatars/067.jpg +0 -0
- data/db/seeds/avatars/068.jpg +0 -0
- data/db/seeds/avatars/069.jpg +0 -0
- data/db/seeds/avatars/070.jpg +0 -0
- data/db/seeds/avatars/071.jpg +0 -0
- data/db/seeds/avatars/072.jpg +0 -0
- data/db/seeds/avatars/073.jpg +0 -0
- data/db/seeds/avatars/074.jpg +0 -0
- data/db/seeds/avatars/075.jpg +0 -0
- data/db/seeds/avatars/076.jpg +0 -0
- data/db/seeds/avatars/077.jpg +0 -0
- data/db/seeds/avatars/078.jpg +0 -0
- data/db/seeds/avatars/079.jpg +0 -0
- data/db/seeds/avatars/080.jpg +0 -0
- data/db/seeds/avatars/081.jpg +0 -0
- data/db/seeds/avatars/082.jpg +0 -0
- data/db/seeds/avatars/083.jpg +0 -0
- data/db/seeds/avatars/084.jpg +0 -0
- data/db/seeds/avatars/085.jpg +0 -0
- data/db/seeds/avatars/086.jpg +0 -0
- data/db/seeds/avatars/087.jpg +0 -0
- data/db/seeds/avatars/088.jpg +0 -0
- data/db/seeds/avatars/089.jpg +0 -0
- data/db/seeds/avatars/090.jpg +0 -0
- data/db/seeds/avatars/091.jpg +0 -0
- data/db/seeds/avatars/092.jpg +0 -0
- data/db/seeds/avatars/093.jpg +0 -0
- data/db/seeds/avatars/094.jpg +0 -0
- data/db/seeds/avatars/095.jpg +0 -0
- data/db/seeds/avatars/096.jpg +0 -0
- data/db/seeds/avatars/097.jpg +0 -0
- data/db/seeds/avatars/098.jpg +0 -0
- data/db/seeds/avatars/099.jpg +0 -0
- data/db/seeds/avatars/100.jpg +0 -0
- data/db/seeds/avatars/CREDITS.md +114 -0
- data/db/seeds/avatars/README.md +25 -0
- data/decidim-core.gemspec +7 -5
- data/lib/decidim/acts_as_author.rb +1 -1
- data/lib/decidim/admin_filter.rb +44 -0
- data/lib/decidim/admin_filters_registry.rb +55 -0
- data/lib/decidim/amendable.rb +1 -2
- data/lib/decidim/api/functions/component_finder_base.rb +1 -1
- data/lib/decidim/api/functions/needs_api_filter_and_order.rb +3 -3
- data/lib/decidim/api/functions/participatory_space_finder_base.rb +1 -1
- data/lib/decidim/api/functions/participatory_space_list_base.rb +1 -1
- data/lib/decidim/api/input_filters/user_entity_input_filter.rb +3 -3
- data/lib/decidim/api/interfaces/author_interface.rb +1 -1
- data/lib/decidim/api/types/organization_type.rb +1 -1
- data/lib/decidim/api/types/user_group_type.rb +1 -1
- data/lib/decidim/api/types/user_type.rb +1 -1
- data/lib/decidim/asset_router/pipeline.rb +2 -2
- data/lib/decidim/asset_router/storage.rb +11 -214
- data/lib/decidim/assets/tailwind/instance.rb +1 -1
- data/lib/decidim/assets/tailwind/tailwind.config.js.erb +8 -3
- data/lib/decidim/attribute_object/model.rb +2 -2
- data/lib/decidim/attribute_object/type_resolver.rb +1 -3
- data/lib/decidim/attribute_object.rb +2 -2
- data/lib/decidim/attributes.rb +0 -4
- data/lib/decidim/authorable.rb +5 -0
- data/lib/decidim/command.rb +2 -2
- data/lib/decidim/commands/create_resource.rb +63 -0
- data/lib/decidim/commands/destroy_resource.rb +74 -0
- data/lib/decidim/commands/hook_error.rb +8 -0
- data/lib/decidim/commands/resource_handler.rb +85 -0
- data/lib/decidim/commands/update_resource.rb +64 -0
- data/lib/decidim/component_manifest.rb +3 -1
- data/lib/decidim/component_validator.rb +1 -1
- data/lib/decidim/content_blocks/has_related_components.rb +1 -1
- data/lib/decidim/content_parsers/resource_parser.rb +2 -2
- data/lib/decidim/content_processor.rb +1 -1
- data/lib/decidim/content_security_policy.rb +1 -1
- data/lib/decidim/core/engine.rb +12 -29
- data/lib/decidim/core/menu.rb +13 -3
- data/lib/decidim/core/seeds.rb +120 -147
- data/lib/decidim/core/test/factories.rb +24 -3
- data/lib/decidim/core/test/shared_examples/acts_as_author_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/amendable/withdraw_amendment_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/announcements_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/assembly_announcements_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/attachable_interface_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +88 -92
- data/lib/decidim/core/test/shared_examples/comments_reports_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/digest_mail_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/editor_shared_examples.rb +7 -7
- data/lib/decidim/core/test/shared_examples/fingerprint_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +6 -11
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +4 -2
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +3 -2
- data/lib/decidim/core/test/shared_examples/has_contextual_help.rb +4 -4
- data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
- data/lib/decidim/core/test/shared_examples/logo_email.rb +1 -1
- data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +9 -9
- data/lib/decidim/core/test/shared_examples/map_examples.rb +5 -5
- data/lib/decidim/core/test/shared_examples/paginated_resource_examples.rb +7 -7
- data/lib/decidim/core/test/shared_examples/participatory_space_dropdown_metadata_cell_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/reports_examples.rb +5 -5
- data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +10 -10
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +8 -8
- data/lib/decidim/core/test/shared_examples/share_link_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/simple_event.rb +1 -1
- data/lib/decidim/core/test/shared_examples/space_cell_changes_button_text_cta.rb +3 -3
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +15 -113
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +24 -17
- data/lib/decidim/dependency_resolver.rb +3 -3
- data/lib/decidim/diffy_extension.rb +1 -1
- data/lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb +2 -1
- data/lib/decidim/engine_router.rb +2 -2
- data/lib/decidim/events/base_event.rb +19 -0
- data/lib/decidim/events/simple_event.rb +1 -0
- data/lib/decidim/exporters/export_manifest.rb +1 -1
- data/lib/decidim/faker/localized.rb +3 -3
- data/lib/decidim/form_builder.rb +4 -4
- data/lib/decidim/hashtag.rb +1 -1
- data/lib/decidim/jsonb_attributes.rb +4 -4
- data/lib/decidim/manifest_messages.rb +2 -2
- data/lib/decidim/organization_settings.rb +5 -8
- data/lib/decidim/paddable.rb +1 -1
- data/lib/decidim/participable.rb +1 -1
- data/lib/decidim/participatory_space_manifest.rb +1 -1
- data/lib/decidim/resourceable.rb +1 -1
- data/lib/decidim/search_resource_fields_mapper.rb +2 -2
- data/lib/decidim/searchable.rb +3 -3
- data/lib/decidim/seeds.rb +62 -0
- data/lib/decidim/stats_registry.rb +2 -2
- data/lib/decidim/translatable_attributes.rb +3 -3
- data/lib/decidim/translatable_resource.rb +1 -1
- data/lib/decidim/view_hooks.rb +1 -1
- data/lib/decidim/view_model.rb +5 -1
- data/lib/decidim/webpacker/esbuild.config.js +14 -0
- data/lib/decidim/webpacker/shakapacker.yml +2 -2
- data/lib/decidim/webpacker/tsconfig.json +11 -0
- data/lib/decidim/webpacker/webpack/custom.js +13 -35
- data/lib/devise/models/decidim_newsletterable.rb +1 -1
- data/lib/tasks/decidim_download_your_data_tasks.rake +2 -2
- data/lib/tasks/decidim_locales_tasks.rake +1 -1
- data/lib/tasks/decidim_mailers_tasks.rake +2 -2
- data/lib/tasks/decidim_metrics_tasks.rake +6 -6
- data/lib/tasks/decidim_procfile.rake +9 -3
- data/lib/tasks/decidim_tasks.rake +5 -4
- data/lib/tasks/decidim_webpacker_tasks.rake +126 -117
- data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +80 -0
- data/lib/tasks/upgrade/decidim_content_blocks_tasks.rake +50 -0
- data/lib/tasks/upgrade/decidim_deduplicate_endorsements.rake +1 -1
- data/lib/tasks/upgrade/decidim_fix_categorization.rake +0 -100
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +1 -1
- data/lib/tasks/upgrade/decidim_fix_short_url_resolver.rake +1 -1
- data/lib/tasks/upgrade/decidim_moderation_tasks.rake +1 -1
- data/lib/tasks/upgrade/decidim_user_moderation.rake +1 -1
- metadata +218 -79
- data/app/cells/decidim/content_blocks/cta/show.erb +0 -12
- data/app/cells/decidim/content_blocks/cta_cell.rb +0 -31
- data/app/cells/decidim/footer_pages/pages.erb +0 -3
- data/app/cells/decidim/footer_pages/topics.erb +0 -12
- data/app/cells/decidim/footer_pages_cell.rb +0 -68
- data/app/controllers/concerns/decidim/direct_upload.rb +0 -82
- data/app/packs/src/decidim/vendor/modernizr.js +0 -5
- data/app/queries/decidim/similar_emendations.rb +0 -56
- data/app/uploaders/decidim/cw/application_uploader.rb +0 -77
- data/app/uploaders/decidim/cw/attachment_uploader.rb +0 -56
- data/app/uploaders/decidim/cw/avatar_uploader.rb +0 -24
- data/app/uploaders/decidim/cw/banner_image_uploader.rb +0 -7
- data/app/uploaders/decidim/cw/download_your_data_uploader.rb +0 -15
- data/app/uploaders/decidim/cw/downloader.rb +0 -9
- data/app/uploaders/decidim/cw/hero_image_uploader.rb +0 -10
- data/app/uploaders/decidim/cw/homepage_image_uploader.rb +0 -14
- data/app/uploaders/decidim/cw/image_uploader.rb +0 -78
- data/app/uploaders/decidim/cw/newsletter_template_image_uploader.rb +0 -38
- data/app/uploaders/decidim/cw/oauth_application_logo_uploader.rb +0 -10
- data/app/uploaders/decidim/cw/official_image_footer_uploader.rb +0 -10
- data/app/uploaders/decidim/cw/official_image_header_uploader.rb +0 -10
- data/app/uploaders/decidim/cw/open_data_uploader.rb +0 -23
- data/app/uploaders/decidim/cw/organization_favicon_uploader.rb +0 -18
- data/app/uploaders/decidim/cw/organization_logo_uploader.rb +0 -10
- data/app/uploaders/decidim/cw/record_image_uploader.rb +0 -15
- data/app/uploaders/decidim/downloader.rb +0 -9
- data/app/views/decidim/amendments/compare_draft.html.erb +0 -18
- data/app/views/layouts/decidim/_edit_link.html.erb +0 -0
- data/app/views/layouts/decidim/header/_main_links_mobile.html.erb +0 -36
- data/config/initializers/carrierwave.rb +0 -15
- data/lib/decidim/carrier_wave_migrator_service.rb +0 -287
- data/lib/decidim/seven_zip_wrapper.rb +0 -29
- data/lib/tasks/decidim_active_storage_migration_tasks.rake +0 -114
- data/lib/tasks/decidim_content_blocks_tasks.rake +0 -48
- data/lib/tasks/upgrade/decidim_attachments.rake +0 -14
- /data/app/views/layouts/decidim/header/{_menu_breadcrumb_main_dropdown.html.erb → _menu_breadcrumb_main_dropdown_desktop.html.erb} +0 -0
@@ -0,0 +1,298 @@
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
2
|
+
import icon from "src/decidim/icon"
|
3
|
+
import { changeHourDisplay, changeMinuteDisplay, formatDate, hourDisplay, minuteDisplay, formatTime, setHour, setMinute, updateTimeValue, updateInputValue } from "src/decidim/datepicker/datepicker_functions"
|
4
|
+
import { timeKeyDownListener, timeBeforeInputListener } from "src/decidim/datepicker/datepicker_listeners";
|
5
|
+
import { getDictionary } from "src/decidim/i18n";
|
6
|
+
|
7
|
+
export default function generateTimePicker(input, row, formats) {
|
8
|
+
const i18n = getDictionary("time.buttons");
|
9
|
+
|
10
|
+
const timeColumn = document.createElement("div");
|
11
|
+
timeColumn.setAttribute("class", "datepicker__time-column");
|
12
|
+
|
13
|
+
const time = document.createElement("input");
|
14
|
+
time.setAttribute("id", `${input.id}_time`);
|
15
|
+
time.setAttribute("type", "text");
|
16
|
+
|
17
|
+
const clock = document.createElement("button");
|
18
|
+
clock.innerHTML = icon("time-line")
|
19
|
+
clock.setAttribute("class", "datepicker__clock-button");
|
20
|
+
clock.setAttribute("type", "button");
|
21
|
+
|
22
|
+
timeColumn.appendChild(time);
|
23
|
+
timeColumn.appendChild(clock);
|
24
|
+
|
25
|
+
row.append(timeColumn);
|
26
|
+
|
27
|
+
const hourColumn = document.createElement("div");
|
28
|
+
hourColumn.setAttribute("class", "datepicker__hour-column");
|
29
|
+
|
30
|
+
const hours = document.createElement("input");
|
31
|
+
hours.setAttribute("class", "datepicker__hour-picker");
|
32
|
+
hours.setAttribute("readonly", "true");
|
33
|
+
hours.setAttribute("disabled", "true");
|
34
|
+
|
35
|
+
const hourUp = document.createElement("button");
|
36
|
+
hourUp.setAttribute("class", "datepicker__hour-up");
|
37
|
+
hourUp.innerHTML = icon("arrow-drop-up-line", {class: "w-10 h-6 pr-1"});
|
38
|
+
hourUp.setAttribute("type", "button");
|
39
|
+
|
40
|
+
const hourDown = document.createElement("button");
|
41
|
+
hourDown.setAttribute("class", "datepicker__hour-down");
|
42
|
+
hourDown.innerHTML = icon("arrow-drop-down-line", {class: "w-10 h-6 pr-1"});
|
43
|
+
hourDown.setAttribute("type", "button");
|
44
|
+
|
45
|
+
hourColumn.appendChild(hours);
|
46
|
+
hourColumn.appendChild(hourUp);
|
47
|
+
hourColumn.appendChild(hourDown);
|
48
|
+
|
49
|
+
const minuteColumn = document.createElement("div");
|
50
|
+
minuteColumn.setAttribute("class", "datepicker__minute-column");
|
51
|
+
|
52
|
+
const minutes = document.createElement("input");
|
53
|
+
minutes.setAttribute("class", "datepicker__minute-picker");
|
54
|
+
minutes.setAttribute("readonly", "true");
|
55
|
+
minutes.setAttribute("disabled", "true");
|
56
|
+
|
57
|
+
const minuteUp = document.createElement("button");
|
58
|
+
minuteUp.setAttribute("class", "datepicker__minute-up");
|
59
|
+
minuteUp.innerHTML = icon("arrow-drop-up-line", {class: "w-10 h-6 pr-1"});
|
60
|
+
minuteUp.setAttribute("type", "button");
|
61
|
+
|
62
|
+
const minuteDown = document.createElement("button");
|
63
|
+
minuteDown.setAttribute("class", "datepicker__minute-down");
|
64
|
+
minuteDown.innerHTML = icon("arrow-drop-down-line", {class: "w-10 h-6 pr-1"});
|
65
|
+
minuteDown.setAttribute("type", "button");
|
66
|
+
|
67
|
+
minuteColumn.appendChild(minutes);
|
68
|
+
minuteColumn.appendChild(minuteUp);
|
69
|
+
minuteColumn.appendChild(minuteDown);
|
70
|
+
|
71
|
+
const timeRow = document.createElement("div");
|
72
|
+
timeRow.setAttribute("class", "datepicker__time-row");
|
73
|
+
|
74
|
+
timeRow.appendChild(hourColumn);
|
75
|
+
timeRow.appendChild(minuteColumn);
|
76
|
+
|
77
|
+
|
78
|
+
// US FORMAT
|
79
|
+
|
80
|
+
if (formats.time === 12) {
|
81
|
+
const periodColumn = document.createElement("div");
|
82
|
+
periodColumn.setAttribute("class", "datepicker__period-column");
|
83
|
+
|
84
|
+
const periodAm = document.createElement("input");
|
85
|
+
periodAm.setAttribute("type", "radio");
|
86
|
+
periodAm.setAttribute("name", `period_${input.id}`);
|
87
|
+
periodAm.setAttribute("id", `period_am_${input.id}`);
|
88
|
+
periodAm.setAttribute("class", "datepicker__period-am");
|
89
|
+
const periodAmLabel = document.createElement("span");
|
90
|
+
periodAmLabel.innerText = "AM"
|
91
|
+
|
92
|
+
const periodPm = document.createElement("input");
|
93
|
+
periodPm.setAttribute("type", "radio");
|
94
|
+
periodPm.setAttribute("name", `period_${input.id}`);
|
95
|
+
periodPm.setAttribute("id", `period_pm_${input.id}`);
|
96
|
+
periodPm.setAttribute("class", "datepicker__period-pm");
|
97
|
+
const periodPmLabel = document.createElement("span");
|
98
|
+
periodPmLabel.innerText = "PM"
|
99
|
+
|
100
|
+
periodColumn.appendChild(periodAm);
|
101
|
+
periodColumn.appendChild(periodAmLabel);
|
102
|
+
periodColumn.appendChild(periodPm);
|
103
|
+
periodColumn.appendChild(periodPmLabel);
|
104
|
+
timeColumn.appendChild(periodColumn);
|
105
|
+
|
106
|
+
periodAm.addEventListener("click", () => {
|
107
|
+
input.value = `${formatDate(document.querySelector(`#${input.id}_date`).value, formats)}T${formatTime(time.value, formats.time, input.id)}`;
|
108
|
+
});
|
109
|
+
|
110
|
+
periodPm.addEventListener("click", () => {
|
111
|
+
input.value = `${formatDate(document.querySelector(`#${input.id}_date`).value, formats)}T${formatTime(time.value, formats.time, input.id)}`;
|
112
|
+
});
|
113
|
+
};
|
114
|
+
|
115
|
+
const hourLabel = document.createElement("span");
|
116
|
+
hourLabel.innerText = "Hour";
|
117
|
+
|
118
|
+
const hourLabelContainer = document.createElement("div");
|
119
|
+
hourLabelContainer.setAttribute("class", "datepicker__hour-label-container");
|
120
|
+
|
121
|
+
hourLabelContainer.appendChild(hourLabel);
|
122
|
+
|
123
|
+
const minuteLabel = document.createElement("span");
|
124
|
+
minuteLabel.innerText = "Minute";
|
125
|
+
|
126
|
+
const minuteLabelContainer = document.createElement("div");
|
127
|
+
minuteLabelContainer.setAttribute("class", "datepicker__minute-label-container");
|
128
|
+
|
129
|
+
minuteLabelContainer.appendChild(minuteLabel);
|
130
|
+
|
131
|
+
const labels = document.createElement("div");
|
132
|
+
labels.setAttribute("class", "datepicker__label-row");
|
133
|
+
|
134
|
+
labels.appendChild(hourLabelContainer);
|
135
|
+
labels.appendChild(minuteLabelContainer);
|
136
|
+
|
137
|
+
const timePicker = document.createElement("div");
|
138
|
+
timePicker.setAttribute("id", `${time.id}_timepicker`);
|
139
|
+
timePicker.setAttribute("class", "datepicker__time-frame");
|
140
|
+
timePicker.style.display = "none";
|
141
|
+
|
142
|
+
timePicker.appendChild(timeRow);
|
143
|
+
timePicker.appendChild(labels);
|
144
|
+
|
145
|
+
const closeClock = document.createElement("button");
|
146
|
+
closeClock.innerText = i18n.close;
|
147
|
+
closeClock.setAttribute("class", "datepicker__close-clock button button__transparent-secondary button__xs");
|
148
|
+
closeClock.setAttribute("type", "button");
|
149
|
+
|
150
|
+
const resetClock = document.createElement("button");
|
151
|
+
resetClock.innerText = i18n.reset;
|
152
|
+
resetClock.setAttribute("class", "datepicker__reset-clock button button__xs button__text-secondary");
|
153
|
+
resetClock.setAttribute("type", "button");
|
154
|
+
|
155
|
+
const selectClock = document.createElement("button");
|
156
|
+
selectClock.innerText = i18n.select;
|
157
|
+
selectClock.setAttribute("class", "datepicker__select-clock button button__secondary button__xs");
|
158
|
+
selectClock.setAttribute("type", "button");
|
159
|
+
|
160
|
+
timePicker.appendChild(resetClock);
|
161
|
+
timePicker.appendChild(selectClock);
|
162
|
+
timePicker.appendChild(closeClock);
|
163
|
+
|
164
|
+
clock.after(timePicker);
|
165
|
+
|
166
|
+
const timePickerDisplay = (event) => {
|
167
|
+
if (!timeColumn.contains(event.target)) {
|
168
|
+
timePicker.style.display = "none";
|
169
|
+
document.removeEventListener("click", timePickerDisplay)
|
170
|
+
}
|
171
|
+
};
|
172
|
+
|
173
|
+
let hour = 0;
|
174
|
+
|
175
|
+
if (formats.time === 12) {
|
176
|
+
hour = 1;
|
177
|
+
};
|
178
|
+
|
179
|
+
let minute = 0;
|
180
|
+
|
181
|
+
if (input.value !== "") {
|
182
|
+
hour = setHour(input.value.split("T")[1], formats.time);
|
183
|
+
minute = setMinute(input.value.split("T")[1]);
|
184
|
+
};
|
185
|
+
|
186
|
+
time.addEventListener("focus", () => {
|
187
|
+
timePicker.style.display = "none";
|
188
|
+
})
|
189
|
+
|
190
|
+
time.addEventListener("paste", (event) => {
|
191
|
+
event.preventDefault();
|
192
|
+
const value = event.clipboardData.getData("text/plain");
|
193
|
+
|
194
|
+
let formatGuard = (/^([0-9]|0[0-9]|1[0-9]|2[0-3])(.|:)[0-5][0-9]/).test(value);
|
195
|
+
|
196
|
+
if (formats.time === 12) {
|
197
|
+
formatGuard = (/^([0-9]|0[0-9]|1[0-2])(.|:)[0-5][0-9]/).test(value);
|
198
|
+
};
|
199
|
+
|
200
|
+
if (formatGuard) {
|
201
|
+
if ((/(^[0-9])(.|:)[0-5][0-9]/).test(value)) {
|
202
|
+
hour = Number(value[0]);
|
203
|
+
minute = Number(`${value[2]}${value[3]}`);
|
204
|
+
} else if ((/(^0[0-9])(.|:)[0-5][0-9]/).test(value)) {
|
205
|
+
hour = Number(value[1]);
|
206
|
+
minute = Number(`${value[3]}${value[4]}`);
|
207
|
+
} else {
|
208
|
+
hour = Number(`${value[0]}${value[1]}`);
|
209
|
+
minute = Number(`${value[3]}${value[4]}`);
|
210
|
+
}
|
211
|
+
hours.value = hourDisplay(hour);
|
212
|
+
minutes.value = minuteDisplay(minute);
|
213
|
+
time.value = `${hourDisplay(hour)}:${minuteDisplay(minute)}`;
|
214
|
+
input.value = `${formatDate(document.querySelector(`#${input.id}_date`).value, formats)}T${formatTime(time.value, formats.time, input.id)}`;
|
215
|
+
}
|
216
|
+
});
|
217
|
+
|
218
|
+
timeKeyDownListener(time);
|
219
|
+
timeBeforeInputListener(time);
|
220
|
+
|
221
|
+
time.addEventListener("keyup", () => {
|
222
|
+
if (time.value.length === 5) {
|
223
|
+
const inputHour = time.value.split(":")[0];
|
224
|
+
const inputMinute = time.value.split(":")[1];
|
225
|
+
|
226
|
+
if (formats.time === 12 && Number(inputHour) <= 12 && Number(inputMinute) <= 59 ||
|
227
|
+
formats.time === 24 && Number(inputHour) <= 23 && Number(inputMinute) <= 59) {
|
228
|
+
hour = Number(inputHour);
|
229
|
+
minute = Number(inputMinute);
|
230
|
+
|
231
|
+
hours.value = hourDisplay(hour);
|
232
|
+
minutes.value = minuteDisplay(minute);
|
233
|
+
input.value = `${formatDate(document.querySelector(`#${input.id}_date`).value, formats)}T${formatTime(time.value, formats.time, input.id)}`;
|
234
|
+
};
|
235
|
+
} else if (time.value.length === 0) {
|
236
|
+
hours.value = "";
|
237
|
+
minutes.value = "";
|
238
|
+
};
|
239
|
+
});
|
240
|
+
|
241
|
+
resetClock.addEventListener("click", (event) => {
|
242
|
+
event.preventDefault();
|
243
|
+
if (formats.time === 24) {
|
244
|
+
hour = 0;
|
245
|
+
} else {
|
246
|
+
hour = 1;
|
247
|
+
}
|
248
|
+
minute = 0;
|
249
|
+
|
250
|
+
hours.value = hourDisplay(hour);
|
251
|
+
minutes.value = minuteDisplay(minute);
|
252
|
+
time.value = "";
|
253
|
+
});
|
254
|
+
|
255
|
+
closeClock.addEventListener("click", (event) => {
|
256
|
+
event.preventDefault();
|
257
|
+
timePicker.style.display = "none";
|
258
|
+
});
|
259
|
+
|
260
|
+
selectClock.addEventListener("click", (event) => {
|
261
|
+
event.preventDefault();
|
262
|
+
updateTimeValue(time, hour, minute);
|
263
|
+
updateInputValue(input, formats, time);
|
264
|
+
timePicker.style.display = "none";
|
265
|
+
});
|
266
|
+
|
267
|
+
clock.addEventListener("click", (event) => {
|
268
|
+
event.preventDefault();
|
269
|
+
timePicker.style.display = "block";
|
270
|
+
document.addEventListener("click", timePickerDisplay);
|
271
|
+
hours.value = hourDisplay(hour);
|
272
|
+
minutes.value = minuteDisplay(minute);
|
273
|
+
});
|
274
|
+
|
275
|
+
hourUp.addEventListener("click", (event) => {
|
276
|
+
event.preventDefault();
|
277
|
+
hour = changeHourDisplay("increase", hour, formats.time);
|
278
|
+
hours.value = hourDisplay(hour);
|
279
|
+
});
|
280
|
+
|
281
|
+
hourDown.addEventListener("click", (event) => {
|
282
|
+
event.preventDefault();
|
283
|
+
hour = changeHourDisplay("decrease", hour, formats.time);
|
284
|
+
hours.value = hourDisplay(hour);
|
285
|
+
});
|
286
|
+
|
287
|
+
minuteUp.addEventListener("click", (event) => {
|
288
|
+
event.preventDefault();
|
289
|
+
minute = changeMinuteDisplay("increase", minute);
|
290
|
+
minutes.value = minuteDisplay(minute);
|
291
|
+
});
|
292
|
+
|
293
|
+
minuteDown.addEventListener("click", (event) => {
|
294
|
+
event.preventDefault();
|
295
|
+
minute = changeMinuteDisplay("decrease", minute);
|
296
|
+
minutes.value = minuteDisplay(minute);
|
297
|
+
});
|
298
|
+
};
|
@@ -0,0 +1,118 @@
|
|
1
|
+
/* global jest */
|
2
|
+
|
3
|
+
import {
|
4
|
+
dateToPicker,
|
5
|
+
displayDate,
|
6
|
+
formatDate,
|
7
|
+
formatInputDate,
|
8
|
+
calculateDatepickerPos
|
9
|
+
} from "src/decidim/datepicker/datepicker_functions"
|
10
|
+
|
11
|
+
describe("dateToPicker", () => {
|
12
|
+
it('should format date from "d-m-y" to "m-d-y" -format for datepicker', () => {
|
13
|
+
const inputDate = "01/02/2023";
|
14
|
+
const formats = { separator: "/", order: "d-m-y" };
|
15
|
+
|
16
|
+
const result = dateToPicker(inputDate, formats);
|
17
|
+
|
18
|
+
expect(result).toEqual("02/01/2023");
|
19
|
+
});
|
20
|
+
|
21
|
+
it('should format date from "y-m-d" to "m-d-y" -format for datepicker', () => {
|
22
|
+
const inputDate = "2023.02.01";
|
23
|
+
const formats = { separator: ".", order: "y-m-d" };
|
24
|
+
|
25
|
+
const result = dateToPicker(inputDate, formats);
|
26
|
+
|
27
|
+
expect(result).toEqual("02/01/2023");
|
28
|
+
});
|
29
|
+
});
|
30
|
+
|
31
|
+
describe("displayDate", () => {
|
32
|
+
it('should format date in "d-m-y" order correctly', () => {
|
33
|
+
const inputDate = new Date("2023-02-01");
|
34
|
+
const formats = { separator: "/", order: "d-m-y" };
|
35
|
+
|
36
|
+
const result = displayDate(inputDate, formats);
|
37
|
+
|
38
|
+
expect(result).toEqual("01/02/2023");
|
39
|
+
});
|
40
|
+
|
41
|
+
it('should format date in "y-m-d" order correctly', () => {
|
42
|
+
const inputDate = new Date("2023-02-01");
|
43
|
+
const formats = { separator: ".", order: "y-m-d" };
|
44
|
+
|
45
|
+
const result = displayDate(inputDate, formats);
|
46
|
+
|
47
|
+
expect(result).toEqual("2023.02.01");
|
48
|
+
});
|
49
|
+
});
|
50
|
+
|
51
|
+
describe("formatDate", () => {
|
52
|
+
it('should format date in "d-m-y" -format correctly to "datetime-local" or "date" formfield', () => {
|
53
|
+
const inputDate = "01/02/2023";
|
54
|
+
const formats = { separator: "/", order: "d-m-y" };
|
55
|
+
|
56
|
+
const result = formatDate(inputDate, formats);
|
57
|
+
|
58
|
+
expect(result).toEqual("2023-02-01");
|
59
|
+
});
|
60
|
+
|
61
|
+
it('should format date in "y-m-d" -format correctly to "datetime-local" or "date" formfield', () => {
|
62
|
+
const inputDate = "2023.02.01";
|
63
|
+
const formats = { separator: ".", order: "y-m-d" };
|
64
|
+
|
65
|
+
const result = formatDate(inputDate, formats);
|
66
|
+
|
67
|
+
expect(result).toEqual("2023-02-01");
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
describe("formatInputDate", () => {
|
72
|
+
it('should format date in "d-m-y" order correctly', () => {
|
73
|
+
const inputDate = "2023-02-01";
|
74
|
+
const formats = { separator: "/", order: "d-m-y" };
|
75
|
+
|
76
|
+
const result = formatInputDate(inputDate, formats);
|
77
|
+
|
78
|
+
expect(result).toEqual("01/02/2023");
|
79
|
+
});
|
80
|
+
|
81
|
+
it('should format date in "y-m-d" order correctly', () => {
|
82
|
+
const inputDate = "2023-02-01";
|
83
|
+
const formats = { separator: ".", order: "y-m-d" };
|
84
|
+
|
85
|
+
const result = formatInputDate(inputDate, formats);
|
86
|
+
|
87
|
+
expect(result).toEqual("2023.02.01");
|
88
|
+
});
|
89
|
+
});
|
90
|
+
|
91
|
+
describe("calculateDatepickerPos", () => {
|
92
|
+
it("should calculate datepicker position correctly in Admin panel", () => {
|
93
|
+
Reflect.defineProperty(document.body, "clientHeight", {
|
94
|
+
value: 800,
|
95
|
+
writable: true
|
96
|
+
});
|
97
|
+
|
98
|
+
Reflect.defineProperty(window, "scrollY", {
|
99
|
+
value: 200,
|
100
|
+
writable: true
|
101
|
+
});
|
102
|
+
|
103
|
+
const datePicker = {
|
104
|
+
getBoundingClientRect: jest.fn(() => ({
|
105
|
+
top: 300
|
106
|
+
})),
|
107
|
+
clientHeight: 100
|
108
|
+
};
|
109
|
+
|
110
|
+
jest.spyOn(document, "querySelector").mockReturnValue({
|
111
|
+
clientHeight: 50
|
112
|
+
});
|
113
|
+
|
114
|
+
const result = calculateDatepickerPos(datePicker);
|
115
|
+
|
116
|
+
expect(result).toEqual(150);
|
117
|
+
});
|
118
|
+
});
|
@@ -0,0 +1,227 @@
|
|
1
|
+
import {
|
2
|
+
setHour,
|
3
|
+
setMinute,
|
4
|
+
formatInputTime,
|
5
|
+
changeHourDisplay,
|
6
|
+
changeMinuteDisplay,
|
7
|
+
hourDisplay,
|
8
|
+
minuteDisplay,
|
9
|
+
formatTime
|
10
|
+
} from "src/decidim/datepicker/datepicker_functions"
|
11
|
+
|
12
|
+
describe("setHour", () => {
|
13
|
+
it("returns the hour in correct 24-hour format", () => {
|
14
|
+
const result = setHour("15:30", 24);
|
15
|
+
expect(result).toBe(15);
|
16
|
+
});
|
17
|
+
|
18
|
+
it("returns the hour in correct 12-hour format when hour is more than 12", () => {
|
19
|
+
const result = setHour("18:45", 12);
|
20
|
+
expect(result).toBe(6);
|
21
|
+
});
|
22
|
+
|
23
|
+
it("returns 12 for 12-hour format when hour is 0", () => {
|
24
|
+
const result = setHour("00:30", 12);
|
25
|
+
expect(result).toBe(12);
|
26
|
+
});
|
27
|
+
|
28
|
+
it("returns the hour in correct 12-hour format when hour is less than or equal to 12", () => {
|
29
|
+
const result = setHour("09:15", 12);
|
30
|
+
expect(result).toBe(9);
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
describe("setMinute", () => {
|
35
|
+
it("returns the correct value", () => {
|
36
|
+
const result = setMinute("12:45");
|
37
|
+
expect(result).toBe(45);
|
38
|
+
});
|
39
|
+
|
40
|
+
it("returns the correct minute value when 0", () => {
|
41
|
+
const result = setMinute("08:00");
|
42
|
+
expect(result).toBe(0);
|
43
|
+
});
|
44
|
+
|
45
|
+
it("returns the correct single-digit value", () => {
|
46
|
+
const result = setMinute("09:05");
|
47
|
+
expect(result).toBe(5);
|
48
|
+
});
|
49
|
+
});
|
50
|
+
|
51
|
+
describe("formatInputTime", () => {
|
52
|
+
const setupDOM = () => {
|
53
|
+
document.body.innerHTML = `
|
54
|
+
<input type="radio" id="period_am_exampleInput" name="period">
|
55
|
+
<input type="radio" id="period_pm_exampleInput" name="period">
|
56
|
+
`;
|
57
|
+
};
|
58
|
+
|
59
|
+
describe("24-hour format", () => {
|
60
|
+
it("returns the value in correct format", () => {
|
61
|
+
setupDOM();
|
62
|
+
const time = "15:30";
|
63
|
+
const format = 24;
|
64
|
+
const input = { id: "exampleInput" };
|
65
|
+
|
66
|
+
const result = formatInputTime(time, format, input);
|
67
|
+
|
68
|
+
expect(result).toBe("15:30");
|
69
|
+
});
|
70
|
+
})
|
71
|
+
|
72
|
+
describe("12-hour format", () => {
|
73
|
+
it("returns the value in correct format and checks the PM radio-button", () => {
|
74
|
+
setupDOM();
|
75
|
+
const time = "12:45";
|
76
|
+
const format = 12;
|
77
|
+
const input = { id: "exampleInput" };
|
78
|
+
|
79
|
+
const result = formatInputTime(time, format, input);
|
80
|
+
|
81
|
+
expect(result).toBe("12:45");
|
82
|
+
expect(document.getElementById("period_pm_exampleInput").checked).toBeTruthy();
|
83
|
+
expect(document.getElementById("period_am_exampleInput").checked).toBeFalsy();
|
84
|
+
});
|
85
|
+
|
86
|
+
it("returns the value in correct format", () => {
|
87
|
+
setupDOM();
|
88
|
+
const time = "00:25";
|
89
|
+
const format = 12;
|
90
|
+
const input = { id: "exampleInput" };
|
91
|
+
|
92
|
+
const result = formatInputTime(time, format, input);
|
93
|
+
|
94
|
+
expect(result).toBe("12:25");
|
95
|
+
// We are not expecting a radio button to be selected here since in a real environment the selected button is not
|
96
|
+
// handled by this method for values < 12
|
97
|
+
});
|
98
|
+
})
|
99
|
+
});
|
100
|
+
|
101
|
+
|
102
|
+
describe("changeHourDisplay", () => {
|
103
|
+
describe("24-hour format", () => {
|
104
|
+
it("should increase the hour", () => {
|
105
|
+
expect(changeHourDisplay("increase", 10, 24)).toEqual(11);
|
106
|
+
});
|
107
|
+
|
108
|
+
it("should change hour from 23 -> 0", () => {
|
109
|
+
expect(changeHourDisplay("increase", 23, 24)).toEqual(0);
|
110
|
+
});
|
111
|
+
|
112
|
+
it("should decrease the hour", () => {
|
113
|
+
expect(changeHourDisplay("decrease", 10, 24)).toEqual(9);
|
114
|
+
});
|
115
|
+
|
116
|
+
it("should change the hour from 0 -> 23", () => {
|
117
|
+
expect(changeHourDisplay("decrease", 0, 24)).toEqual(23);
|
118
|
+
});
|
119
|
+
});
|
120
|
+
|
121
|
+
describe("12-hour format", () => {
|
122
|
+
it("should increase the hour", () => {
|
123
|
+
expect(changeHourDisplay("increase", 10, 12)).toEqual(11);
|
124
|
+
});
|
125
|
+
|
126
|
+
it("should change hour from 12 -> 1", () => {
|
127
|
+
expect(changeHourDisplay("increase", 12, 12)).toEqual(1);
|
128
|
+
});
|
129
|
+
|
130
|
+
it("should decrease the hour", () => {
|
131
|
+
expect(changeHourDisplay("decrease", 10, 12)).toEqual(9);
|
132
|
+
});
|
133
|
+
|
134
|
+
it("should change the hour from 1 -> 12", () => {
|
135
|
+
expect(changeHourDisplay("decrease", 1, 12)).toEqual(12);
|
136
|
+
});
|
137
|
+
});
|
138
|
+
|
139
|
+
it("should return null when invalid parameter", () => {
|
140
|
+
expect(changeHourDisplay("invalid", 10, 12)).toBeNull();
|
141
|
+
});
|
142
|
+
});
|
143
|
+
|
144
|
+
describe("changeMinuteDisplay", () => {
|
145
|
+
describe("increase", () => {
|
146
|
+
it("should increase the minute", () => {
|
147
|
+
expect(changeMinuteDisplay("increase", 10)).toEqual(11);
|
148
|
+
});
|
149
|
+
|
150
|
+
it("should change the minute from 59 -> 0", () => {
|
151
|
+
expect(changeMinuteDisplay("increase", 59)).toEqual(0);
|
152
|
+
});
|
153
|
+
});
|
154
|
+
|
155
|
+
describe("decrease", () => {
|
156
|
+
it("should decrease the minute", () => {
|
157
|
+
expect(changeMinuteDisplay("decrease", 10)).toEqual(9);
|
158
|
+
});
|
159
|
+
|
160
|
+
it("should change the minute from 0 -> 59", () => {
|
161
|
+
expect(changeMinuteDisplay("decrease", 0)).toEqual(59);
|
162
|
+
});
|
163
|
+
});
|
164
|
+
|
165
|
+
it("should handle invalid input by returning null", () => {
|
166
|
+
expect(changeMinuteDisplay("invalid", 10)).toBeNull();
|
167
|
+
});
|
168
|
+
});
|
169
|
+
|
170
|
+
describe("hourDisplay", () => {
|
171
|
+
it("should add a prefix zero for single-digit hours", () => {
|
172
|
+
expect(hourDisplay(5)).toEqual("05");
|
173
|
+
expect(hourDisplay(9)).toEqual("09");
|
174
|
+
});
|
175
|
+
|
176
|
+
it("should not add a prefix zero for double-digit hours", () => {
|
177
|
+
expect(hourDisplay(10)).toEqual(10);
|
178
|
+
expect(hourDisplay(15)).toEqual(15);
|
179
|
+
});
|
180
|
+
});
|
181
|
+
|
182
|
+
describe("minuteDisplay", () => {
|
183
|
+
it("should add a prefix zero for single-digit minutes", () => {
|
184
|
+
expect(minuteDisplay(5)).toEqual("05");
|
185
|
+
expect(minuteDisplay(9)).toEqual("09");
|
186
|
+
});
|
187
|
+
|
188
|
+
it("should not add a prefix zero for double-digit minutes", () => {
|
189
|
+
expect(minuteDisplay(10)).toEqual(10);
|
190
|
+
expect(minuteDisplay(15)).toEqual(15);
|
191
|
+
});
|
192
|
+
});
|
193
|
+
|
194
|
+
|
195
|
+
describe("formatTime", () => {
|
196
|
+
const id = "exampleInput";
|
197
|
+
|
198
|
+
it("should convert 12-hour time to 24-hour time for AM", () => {
|
199
|
+
document.body.innerHTML = `
|
200
|
+
<input type="radio" id="period_am_exampleInput" checked> AM
|
201
|
+
<input type="radio" id="period_pm_exampleInput"> PM
|
202
|
+
`;
|
203
|
+
|
204
|
+
expect(formatTime("09:30", 12, id)).toEqual("09:30");
|
205
|
+
expect(formatTime("12:45", 12, id)).toEqual("00:45");
|
206
|
+
});
|
207
|
+
|
208
|
+
it("should convert 12-hour time to 24-hour time for PM", () => {
|
209
|
+
document.body.innerHTML = `
|
210
|
+
<input type="radio" id="period_am_exampleInput"> AM
|
211
|
+
<input type="radio" id="period_pm_exampleInput" checked> PM
|
212
|
+
`;
|
213
|
+
|
214
|
+
expect(formatTime("03:15", 12, id)).toEqual("15:15");
|
215
|
+
expect(formatTime("11:30", 12, id)).toEqual("23:30");
|
216
|
+
});
|
217
|
+
|
218
|
+
it("should return the original time for 24-hour format", () => {
|
219
|
+
document.body.innerHTML = `
|
220
|
+
<input type="radio" id="period_am_exampleInput"> AM
|
221
|
+
<input type="radio" id="period_pm_exampleInput"> PM
|
222
|
+
`;
|
223
|
+
|
224
|
+
expect(formatTime("15:45", 24, id)).toEqual("15:45");
|
225
|
+
expect(formatTime("08:20", 24, id)).toEqual("08:20");
|
226
|
+
});
|
227
|
+
});
|
@@ -77,9 +77,6 @@ export default class UploadModal {
|
|
77
77
|
uploader.upload.create((error, blob) => {
|
78
78
|
if (error) {
|
79
79
|
uploader.errors = [error]
|
80
|
-
this.uploadItems.replaceChild(this.createUploadItem(file, [error], { value: 100 }), item);
|
81
|
-
this.updateDropZone();
|
82
|
-
|
83
80
|
} else {
|
84
81
|
// attach the file hash to submit the form, when the file has been uploaded
|
85
82
|
file.hiddenField = blob.signed_id
|
@@ -13,7 +13,7 @@ const allowedNodeTypes = ["heading", "paragraph"];
|
|
13
13
|
const allowedNodeActive = (editor) => allowedNodeTypes.some((type) => editor.isActive(type));
|
14
14
|
|
15
15
|
/**
|
16
|
-
* Finds the closest allowed type node from the given position.
|
16
|
+
* Finds the closest allowed type node from the given position. Traverses the
|
17
17
|
* document depth upwards to search through all the node parents.
|
18
18
|
*
|
19
19
|
* @param {Object} position The position where to look for
|
@@ -9,7 +9,7 @@ const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu
|
|
9
9
|
const VIMEO_REGEX = /^(https?:\/\/)?(www\.|player\.)?(vimeo\.com)(.+)?$/;
|
10
10
|
const VIMEO_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|player\.)?(vimeo\.com)(.+)?$/g;
|
11
11
|
|
12
|
-
const
|
12
|
+
const isValidYouTubeUrl = (url) => {
|
13
13
|
return url.match(YOUTUBE_REGEX);
|
14
14
|
}
|
15
15
|
|
@@ -17,7 +17,7 @@ const isValidVimeoUrl = (url) => {
|
|
17
17
|
return url.match(VIMEO_REGEX);
|
18
18
|
};
|
19
19
|
|
20
|
-
const
|
20
|
+
const getEmbedUrlFromYouTubeUrl = (options) => {
|
21
21
|
const embedUrl = "https://www.youtube-nocookie.com/embed/";
|
22
22
|
|
23
23
|
const { url } = options;
|
@@ -74,8 +74,8 @@ const getEmbedUrlFromVimeoUrl = (options) => {
|
|
74
74
|
const getEmbedUrlFromVideoUrl = (options) => {
|
75
75
|
const { url } = options;
|
76
76
|
|
77
|
-
if (
|
78
|
-
return
|
77
|
+
if (isValidYouTubeUrl(url)) {
|
78
|
+
return getEmbedUrlFromYouTubeUrl(options);
|
79
79
|
} else if (isValidVimeoUrl(url)) {
|
80
80
|
return getEmbedUrlFromVimeoUrl(options);
|
81
81
|
}
|