comfortable_mexican_sofa 1.12.11 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +4 -0
- data/.gitattributes +2 -0
- data/.github/issue_template.md +22 -0
- data/.github/pull_request_template.md +6 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +974 -0
- data/.travis.yml +2 -10
- data/Gemfile +5 -7
- data/README.md +40 -39
- data/Rakefile +1 -31
- data/app/assets/javascripts/comfy/admin/cms/application.js.coffee +7 -4
- data/app/assets/javascripts/comfy/admin/cms/base.js.coffee +23 -33
- data/app/assets/javascripts/comfy/admin/cms/lib/diff/pretty_text_diff.js +76 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr.min.js +2 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/ar.js +52 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/bg.js +65 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/bn.js +65 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/cat.js +83 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/cs.js +70 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/cy.js +92 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/da.js +71 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/de.js +70 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/default.js +80 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/eo.js +73 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/es.js +69 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/et.js +73 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/fa.js +68 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/fi.js +69 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/fr.js +75 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/gr.js +74 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/he.js +57 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/hi.js +65 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/hr.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/hu.js +72 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/id.js +61 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/it.js +70 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/ja.js +57 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/ko.js +60 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/lt.js +72 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/lv.js +67 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/mk.js +69 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/mn.js +67 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/ms.js +68 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/my.js +69 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/nl.js +75 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/no.js +73 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/pa.js +65 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/pl.js +68 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/pt-BR.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/pt.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/ro.js +69 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/ru.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/si.js +65 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/sk.js +70 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/sl.js +70 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/sq.js +65 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/sr.js +69 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/sv.js +70 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/th.js +72 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/tr.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/uk.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/vn.js +66 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/zh-CN.js +61 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/flatpickr/i18n/zh-TW.js +61 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/redactor.js +9 -3
- data/app/assets/javascripts/comfy/admin/cms/uploader.js.coffee +9 -10
- data/app/assets/stylesheets/comfy/admin/cms/application.sass +4 -4
- data/app/assets/stylesheets/comfy/admin/cms/base.sass +215 -338
- data/app/assets/stylesheets/comfy/admin/cms/lib/flatpickr.min.css +13 -0
- data/app/assets/stylesheets/comfy/admin/cms/redactor_overrides.sass +2 -2
- data/app/controllers/comfy/admin/base_controller.rb +20 -0
- data/app/controllers/comfy/admin/cms/base_controller.rb +9 -22
- data/app/controllers/comfy/admin/cms/categories_controller.rb +2 -3
- data/app/controllers/comfy/admin/cms/files_controller.rb +50 -31
- data/app/controllers/comfy/admin/cms/layouts_controller.rb +12 -13
- data/app/controllers/comfy/admin/cms/pages_controller.rb +28 -28
- data/app/controllers/comfy/admin/cms/revisions_controller.rb +23 -14
- data/app/controllers/comfy/admin/cms/sites_controller.rb +9 -10
- data/app/controllers/comfy/admin/cms/snippets_controller.rb +11 -11
- data/app/controllers/comfy/admin/cms/translations_controller.rb +98 -0
- data/app/controllers/comfy/cms/assets_controller.rb +9 -10
- data/app/controllers/comfy/cms/base_controller.rb +0 -2
- data/app/controllers/comfy/cms/content_controller.rb +50 -31
- data/app/controllers/concerns/comfy/paginate.rb +2 -2
- data/app/helpers/comfy/admin/cms_helper.rb +29 -0
- data/app/helpers/comfy/cms_helper.rb +40 -60
- data/app/models/comfy/cms/categorization.rb +8 -11
- data/app/models/comfy/cms/category.rb +10 -14
- data/app/models/comfy/cms/file.rb +31 -47
- data/app/models/comfy/cms/fragment.rb +55 -0
- data/app/models/comfy/cms/layout.rb +45 -40
- data/app/models/comfy/cms/page.rb +47 -36
- data/app/models/comfy/cms/revision.rb +5 -8
- data/app/models/comfy/cms/site.rb +26 -51
- data/app/models/comfy/cms/snippet.rb +20 -24
- data/app/models/comfy/cms/translation.rb +37 -0
- data/app/models/concerns/comfy/cms/with_categories.rb +38 -0
- data/app/models/concerns/comfy/cms/with_fragments.rb +121 -0
- data/app/views/comfy/admin/cms/categories/_categories.html.haml +2 -1
- data/app/views/comfy/admin/cms/categories/_edit.html.haml +7 -6
- data/app/views/comfy/admin/cms/categories/_form.html.haml +8 -5
- data/app/views/comfy/admin/cms/categories/_index.html.haml +24 -20
- data/app/views/comfy/admin/cms/categories/_show.html.haml +10 -9
- data/app/views/comfy/admin/cms/categories/create.js.erb +2 -2
- data/app/views/comfy/admin/cms/categories/edit.js.erb +1 -1
- data/app/views/comfy/admin/cms/categories/update.js.erb +2 -2
- data/app/views/comfy/admin/cms/files/_file.html.haml +31 -25
- data/app/views/comfy/admin/cms/files/_form.html.haml +16 -12
- data/app/views/comfy/admin/cms/files/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/files/index.html.haml +17 -19
- data/app/views/comfy/admin/cms/files/new.html.haml +1 -1
- data/app/views/comfy/admin/cms/layouts/_form.html.haml +10 -10
- data/app/views/comfy/admin/cms/layouts/_index_branch.html.haml +21 -19
- data/app/views/comfy/admin/cms/layouts/edit.html.haml +5 -5
- data/app/views/comfy/admin/cms/layouts/index.html.haml +4 -7
- data/app/views/comfy/admin/cms/pages/_form.html.haml +15 -21
- data/app/views/comfy/admin/cms/pages/_form_fragments.html.haml +40 -0
- data/app/views/comfy/admin/cms/pages/_fragment_attachments.html.haml +10 -0
- data/app/views/comfy/admin/cms/pages/_index_branch.html.haml +34 -26
- data/app/views/comfy/admin/cms/pages/edit.html.haml +19 -5
- data/app/views/comfy/admin/cms/pages/form_fragments.js.erb +1 -0
- data/app/views/comfy/admin/cms/pages/index.html.haml +5 -8
- data/app/views/comfy/admin/cms/pages/new.html.haml +1 -1
- data/app/views/comfy/admin/cms/revisions/show.html.haml +29 -27
- data/app/views/comfy/admin/cms/sites/_form.html.haml +6 -8
- data/app/views/comfy/admin/cms/sites/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/sites/index.html.haml +23 -22
- data/app/views/comfy/admin/cms/sites/new.html.haml +1 -1
- data/app/views/comfy/admin/cms/snippets/_form.html.haml +9 -9
- data/app/views/comfy/admin/cms/snippets/edit.html.haml +6 -5
- data/app/views/comfy/admin/cms/snippets/index.html.haml +25 -25
- data/app/views/comfy/admin/cms/snippets/new.html.haml +1 -1
- data/app/views/comfy/admin/cms/translations/_form.html.haml +21 -0
- data/app/views/comfy/admin/cms/translations/edit.html.haml +9 -0
- data/app/views/comfy/admin/cms/translations/form_fragments.js.erb +1 -0
- data/app/views/comfy/admin/cms/translations/new.html.haml +5 -0
- data/app/views/kaminari/comfy/_first_page.html.haml +3 -2
- data/app/views/kaminari/comfy/_gap.html.haml +2 -2
- data/app/views/kaminari/comfy/_last_page.html.haml +3 -2
- data/app/views/kaminari/comfy/_next_page.html.haml +2 -2
- data/app/views/kaminari/comfy/_page.html.haml +2 -2
- data/app/views/kaminari/comfy/_prev_page.html.haml +1 -1
- data/app/views/layouts/comfy/admin/cms/_body.html.haml +13 -15
- data/app/views/layouts/comfy/admin/cms/_footer_js.html.haml +10 -3
- data/app/views/layouts/comfy/admin/cms/_head.html.haml +7 -10
- data/app/views/layouts/comfy/admin/cms/_left.html.haml +33 -15
- data/app/views/layouts/comfy/admin/cms/_right.html.haml +2 -2
- data/comfortable_mexican_sofa.gemspec +19 -19
- data/config/application.rb +14 -8
- data/config/boot.rb +2 -2
- data/config/cms_routes.rb +3 -3
- data/config/environments/development.rb +37 -4
- data/config/environments/test.rb +12 -14
- data/config/initializers/comfortable_mexican_sofa.rb +5 -12
- data/config/locales/cs.yml +33 -7
- data/config/locales/da.yml +33 -7
- data/config/locales/de.yml +32 -6
- data/config/locales/en.yml +33 -7
- data/config/locales/es.yml +33 -7
- data/config/locales/fr.yml +33 -7
- data/config/locales/it.yml +33 -7
- data/config/locales/ja.yml +33 -7
- data/config/locales/nb.yml +33 -7
- data/config/locales/nl.yml +33 -7
- data/config/locales/pl.yml +33 -7
- data/config/locales/pt-BR.yml +33 -7
- data/config/locales/ru.yml +33 -7
- data/config/locales/sk.yml +33 -7
- data/config/locales/sv.yml +33 -7
- data/config/locales/tr.yml +33 -7
- data/config/locales/uk.yml +33 -7
- data/config/locales/zh-CN.yml +33 -7
- data/config/locales/zh-TW.yml +33 -7
- data/config/storage.yml +35 -0
- data/db/cms_seeds/sample-site/files/_default.jpg.yml +5 -0
- data/db/{cms_fixtures/sample-site/files/sample.jpg → cms_seeds/sample-site/files/default.jpg} +0 -0
- data/db/cms_seeds/sample-site/layouts/default/content.html +16 -0
- data/db/cms_seeds/sample-site/layouts/default/nested/content.html +14 -0
- data/db/cms_seeds/sample-site/pages/index/child_a/content.html +7 -0
- data/db/cms_seeds/sample-site/pages/index/child_b/content.html +6 -0
- data/db/cms_seeds/sample-site/pages/index/content.es.html +6 -0
- data/db/cms_seeds/sample-site/pages/index/content.fr.html +6 -0
- data/db/cms_seeds/sample-site/pages/index/content.html +24 -0
- data/db/{cms_fixtures/sample-site/pages/index/child/thumbnail.png → cms_seeds/sample-site/pages/index/footer.png} +0 -0
- data/db/cms_seeds/sample-site/pages/index/header.png +0 -0
- data/db/cms_seeds/sample-site/snippets/default.html +8 -0
- data/db/migrate/00_create_active_storage_tables.active_storage.rb +26 -0
- data/db/migrate/01_create_cms.rb +113 -104
- data/doc/preview.jpg +0 -0
- data/lib/comfortable_mexican_sofa.rb +10 -14
- data/lib/comfortable_mexican_sofa/configuration.rb +9 -13
- data/lib/comfortable_mexican_sofa/content.rb +28 -0
- data/lib/comfortable_mexican_sofa/content/block.rb +11 -0
- data/lib/comfortable_mexican_sofa/content/params_parser.rb +80 -0
- data/lib/comfortable_mexican_sofa/content/renderer.rb +125 -0
- data/lib/comfortable_mexican_sofa/content/tag.rb +37 -0
- data/lib/comfortable_mexican_sofa/content/tags/asset.rb +56 -0
- data/lib/comfortable_mexican_sofa/content/tags/checkbox.rb +21 -0
- data/lib/comfortable_mexican_sofa/content/tags/date.rb +22 -0
- data/lib/comfortable_mexican_sofa/content/tags/datetime.rb +22 -0
- data/lib/comfortable_mexican_sofa/content/tags/file.rb +77 -0
- data/lib/comfortable_mexican_sofa/content/tags/file_link.rb +66 -0
- data/lib/comfortable_mexican_sofa/content/tags/files.rb +39 -0
- data/lib/comfortable_mexican_sofa/content/tags/fragment.rb +54 -0
- data/lib/comfortable_mexican_sofa/content/tags/helper.rb +52 -0
- data/lib/comfortable_mexican_sofa/content/tags/markdown.rb +21 -0
- data/lib/comfortable_mexican_sofa/content/tags/number.rb +17 -0
- data/lib/comfortable_mexican_sofa/content/tags/partial.rb +42 -0
- data/lib/comfortable_mexican_sofa/content/tags/snippet.rb +31 -0
- data/lib/comfortable_mexican_sofa/content/tags/template.rb +41 -0
- data/lib/comfortable_mexican_sofa/content/tags/text.rb +17 -0
- data/lib/comfortable_mexican_sofa/content/tags/textarea.rb +17 -0
- data/lib/comfortable_mexican_sofa/content/tags/wysiwyg.rb +18 -0
- data/lib/comfortable_mexican_sofa/engine.rb +3 -2
- data/lib/comfortable_mexican_sofa/extensions/acts_as_tree.rb +33 -30
- data/lib/comfortable_mexican_sofa/extensions/has_revisions.rb +27 -23
- data/lib/comfortable_mexican_sofa/form_builder.rb +32 -104
- data/lib/comfortable_mexican_sofa/render_methods.rb +24 -21
- data/lib/comfortable_mexican_sofa/routes/cms.rb +6 -14
- data/lib/comfortable_mexican_sofa/routes/cms_admin.rb +39 -29
- data/lib/comfortable_mexican_sofa/routing.rb +1 -1
- data/lib/comfortable_mexican_sofa/seeds.rb +102 -0
- data/lib/comfortable_mexican_sofa/seeds/file/exporter.rb +40 -0
- data/lib/comfortable_mexican_sofa/seeds/file/importer.rb +61 -0
- data/lib/comfortable_mexican_sofa/seeds/layout/exporter.rb +37 -0
- data/lib/comfortable_mexican_sofa/seeds/layout/importer.rb +59 -0
- data/lib/comfortable_mexican_sofa/seeds/page/exporter.rb +88 -0
- data/lib/comfortable_mexican_sofa/seeds/page/importer.rb +213 -0
- data/lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb +31 -0
- data/lib/comfortable_mexican_sofa/seeds/snippet/importer.rb +48 -0
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/lib/comfortable_mexican_sofa/view_hooks.rb +0 -1
- data/lib/generators/comfy/cms/assets_generator.rb +0 -1
- data/lib/generators/comfy/cms/cms_generator.rb +15 -5
- data/lib/generators/comfy/scaffold/scaffold_generator.rb +26 -20
- data/lib/generators/comfy/scaffold/templates/{controller.rb → controller.rb.tt} +10 -10
- data/lib/generators/comfy/scaffold/templates/{migration.rb → migration.rb.tt} +2 -3
- data/lib/generators/comfy/scaffold/templates/{model.rb → model.rb.tt} +7 -7
- data/lib/generators/comfy/scaffold/templates/tests/{controller.rb → controller.rb.tt} +37 -24
- data/lib/generators/comfy/scaffold/templates/tests/{fixture.yml → fixture.yml.tt} +0 -0
- data/lib/generators/comfy/scaffold/templates/tests/{model.rb → model.rb.tt} +3 -4
- data/lib/generators/comfy/scaffold/templates/views/_form.haml.tt +7 -0
- data/lib/generators/comfy/scaffold/templates/views/{edit.haml → edit.haml.tt} +1 -1
- data/lib/generators/comfy/scaffold/templates/views/index.haml.tt +21 -0
- data/lib/generators/comfy/scaffold/templates/views/{new.haml → new.haml.tt} +1 -1
- data/lib/generators/comfy/scaffold/templates/views/{show.haml → show.haml.tt} +2 -2
- data/lib/tasks/cms_seeds.rake +37 -0
- data/test/controllers/comfy/admin/cms/base_controller_test.rb +5 -6
- data/test/controllers/comfy/admin/cms/categories_controller_test.rb +27 -24
- data/test/controllers/comfy/admin/cms/files_controller_test.rb +97 -97
- data/test/controllers/comfy/admin/cms/layouts_controller_test.rb +32 -31
- data/test/controllers/comfy/admin/cms/pages_controller_test.rb +317 -263
- data/test/controllers/comfy/admin/cms/revisions_controller_test.rb +175 -65
- data/test/controllers/comfy/admin/cms/sites_controller_test.rb +27 -29
- data/test/controllers/comfy/admin/cms/snippets_controller_test.rb +54 -51
- data/test/controllers/comfy/admin/cms/translations_controller_test.rb +181 -0
- data/test/controllers/comfy/cms/assets_controller_test.rb +24 -22
- data/test/controllers/comfy/cms/content_controller_test.rb +126 -140
- data/test/fixtures/active_storage/attachments.yml +9 -0
- data/test/fixtures/active_storage/blobs.yml +13 -0
- data/test/fixtures/comfy/cms/files.yml +2 -6
- data/test/fixtures/comfy/cms/fragments.yml +25 -0
- data/test/fixtures/comfy/cms/layouts.yml +7 -13
- data/test/fixtures/comfy/cms/pages.yml +2 -17
- data/test/fixtures/comfy/cms/revisions.yml +16 -8
- data/test/fixtures/comfy/cms/sites.yml +0 -1
- data/test/fixtures/comfy/cms/snippets.yml +1 -1
- data/test/fixtures/comfy/cms/translations.yml +7 -0
- data/test/fixtures/generators/cms/application.rb +7 -0
- data/test/fixtures/generators/cms/routes.rb +4 -7
- data/test/fixtures/generators/scaffold/controller.rb +10 -10
- data/test/fixtures/generators/scaffold/migration.rb +2 -3
- data/test/fixtures/generators/scaffold/model.rb +7 -7
- data/test/fixtures/generators/scaffold/routes.rb +1 -2
- data/test/fixtures/generators/scaffold/tests/controller.rb +37 -24
- data/test/fixtures/generators/scaffold/tests/model.rb +3 -4
- data/test/fixtures/generators/scaffold/views/_form.haml +3 -2
- data/test/fixtures/generators/scaffold/views/edit.haml +1 -1
- data/test/fixtures/generators/scaffold/views/index.haml +15 -13
- data/test/fixtures/generators/scaffold/views/new.haml +1 -1
- data/test/fixtures/generators/scaffold/views/show.haml +2 -2
- data/test/gemfiles/Gemfile.rails.5.2 +32 -0
- data/test/generators/cms_assets_generator_test.rb +1 -2
- data/test/generators/cms_generator_test.rb +3 -1
- data/test/generators/cms_views_generator_test.rb +1 -1
- data/test/generators/scaffold_generator_test.rb +2 -2
- data/test/helpers/cms_helper_test.rb +52 -73
- data/test/integration/access_control_test.rb +35 -28
- data/test/integration/js_variables_test.rb +1 -2
- data/test/integration/render_cms_test.rb +37 -37
- data/test/integration/routing_test.rb +4 -5
- data/test/integration/seeds_test.rb +76 -0
- data/test/integration/sites_test.rb +35 -49
- data/test/integration/view_hooks_test.rb +12 -13
- data/test/lib/configuration_test.rb +3 -4
- data/test/lib/content/block_test.rb +26 -0
- data/test/lib/content/params_parser_test.rb +125 -0
- data/test/lib/content/renderer_test.rb +240 -0
- data/test/lib/content/tag_test.rb +48 -0
- data/test/lib/content/tags/asset_test.rb +79 -0
- data/test/lib/content/tags/checkbox_test.rb +20 -0
- data/test/lib/content/tags/date_test.rb +20 -0
- data/test/lib/content/tags/datetime_test.rb +20 -0
- data/test/lib/content/tags/file_link_test.rb +78 -0
- data/test/lib/content/tags/file_test.rb +60 -0
- data/test/lib/content/tags/files_test.rb +49 -0
- data/test/lib/content/tags/fragment_test.rb +63 -0
- data/test/lib/content/tags/helper_test.rb +52 -0
- data/test/lib/content/tags/markdown_test.rb +33 -0
- data/test/lib/content/tags/number_test.rb +13 -0
- data/test/lib/content/tags/partial_test.rb +43 -0
- data/test/lib/content/tags/snippet_test.rb +36 -0
- data/test/lib/content/tags/template_test.rb +35 -0
- data/test/lib/content/tags/text_test.rb +13 -0
- data/test/lib/content/tags/textarea_test.rb +13 -0
- data/test/lib/content/tags/wysiwyg_test.rb +13 -0
- data/test/lib/revisions_test.rb +146 -111
- data/test/lib/seeds/files_test.rb +96 -0
- data/test/lib/seeds/layouts_test.rb +155 -0
- data/test/lib/seeds/pages_test.rb +227 -0
- data/test/lib/seeds/snippets_test.rb +98 -0
- data/test/lib/seeds_test.rb +50 -0
- data/test/models/categorization_test.rb +37 -38
- data/test/models/category_test.rb +14 -14
- data/test/models/file_test.rb +23 -96
- data/test/models/fragment_test.rb +131 -0
- data/test/models/layout_test.rb +105 -74
- data/test/models/page_test.rb +352 -97
- data/test/models/site_test.rb +101 -90
- data/test/models/snippet_test.rb +29 -23
- data/test/models/translation_test.rb +60 -0
- data/test/tasks/cms_seeds_test.rb +33 -0
- data/test/test_helper.rb +49 -32
- metadata +235 -210
- data/_config.yml +0 -1
- data/app/assets/images/comfy/admin/cms/arrow_bottom.gif +0 -0
- data/app/assets/images/comfy/admin/cms/arrow_right.gif +0 -0
- data/app/assets/images/comfy/admin/cms/checkerboard.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_draft.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_file.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_layout.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_move.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_page.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_site.gif +0 -0
- data/app/assets/images/comfy/admin/cms/icon_snippet.gif +0 -0
- data/app/assets/javascripts/comfy/admin/cms/lib/bootstrap-datetimepicker.js +0 -29
- data/app/assets/javascripts/comfy/admin/cms/lib/diff.js.coffee +0 -9
- data/app/assets/javascripts/comfy/admin/cms/lib/diff/pretty_text_diff.min.js +0 -5
- data/app/assets/stylesheets/comfy/admin/cms/bootstrap_overrides.sass +0 -32
- data/app/assets/stylesheets/comfy/admin/cms/lib/bootstrap-datetimepicker.css +0 -9
- data/app/models/comfy/cms/block.rb +0 -63
- data/app/views/comfy/admin/cms/files/_page_form.html.haml +0 -10
- data/app/views/comfy/admin/cms/pages/_form_blocks.html.haml +0 -32
- data/app/views/comfy/admin/cms/pages/form_blocks.js.erb +0 -1
- data/app/views/comfy/admin/cms/partials/_body_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_file_form_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_file_form_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_files_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_files_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_html_footer.html.haml +0 -2
- data/app/views/comfy/admin/cms/partials/_html_head.html.haml +0 -2
- data/app/views/comfy/admin/cms/partials/_layout_form_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_layout_form_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_layouts_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_layouts_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_navigation_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_navigation_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_navigation_inner.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_page_form_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_page_form_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_page_form_inner.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_pages_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_pages_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_right_column_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_right_column_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_site_form_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_site_form_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_sites_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_sites_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_snippet_form_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_snippet_form_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_snippets_after.html.haml +0 -3
- data/app/views/comfy/admin/cms/partials/_snippets_before.html.haml +0 -3
- data/app/views/comfy/admin/cms/sites/_mirrors.html.haml +0 -18
- data/app/views/comfy/cms/content/render_sitemap.xml.builder +0 -14
- data/app/views/layouts/comfy/admin/cms/_footer.html.haml +0 -3
- data/config/initializers/paperclip.rb +0 -3
- data/config/initializers/secret_token.rb +0 -15
- data/db/cms_fixtures/sample-site/categories/files.yml +0 -1
- data/db/cms_fixtures/sample-site/categories/pages.yml +0 -1
- data/db/cms_fixtures/sample-site/categories/snippets.yml +0 -1
- data/db/cms_fixtures/sample-site/files/_sample.jpg.yml +0 -5
- data/db/cms_fixtures/sample-site/layouts/default/attributes.yml +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/content.html +0 -5
- data/db/cms_fixtures/sample-site/layouts/default/javascript.js +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/nested/attributes.yml +0 -2
- data/db/cms_fixtures/sample-site/layouts/default/nested/content.haml +0 -3
- data/db/cms_fixtures/sample-site/layouts/default/nested/javascript.js +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/nested/stylesheet.css +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/stylesheet.css +0 -1
- data/db/cms_fixtures/sample-site/pages/index/attributes.yml +0 -6
- data/db/cms_fixtures/sample-site/pages/index/child/attributes.yml +0 -3
- data/db/cms_fixtures/sample-site/pages/index/child/left.haml +0 -1
- data/db/cms_fixtures/sample-site/pages/index/child/right.html +0 -1
- data/db/cms_fixtures/sample-site/pages/index/content.html +0 -2
- data/db/cms_fixtures/sample-site/snippets/default/attributes.yml +0 -4
- data/db/cms_fixtures/sample-site/snippets/default/content.html +0 -1
- data/db/seeds.rb +0 -7
- data/db/upgrade_migrations/02_upgrade_to_1_1_0.rb +0 -19
- data/db/upgrade_migrations/03_upgrade_to_1_2_0.rb +0 -15
- data/db/upgrade_migrations/04_upgrade_to_1_3_0.rb +0 -23
- data/db/upgrade_migrations/05_upgrade_to_1_4_0.rb +0 -33
- data/db/upgrade_migrations/06_upgrade_to_1_5_0.rb +0 -21
- data/db/upgrade_migrations/07_upgrade_to_1_6_0.rb +0 -25
- data/db/upgrade_migrations/08_upgrade_to_1_12_0.rb +0 -83
- data/doc/preview.png +0 -0
- data/lib/comfortable_mexican_sofa/extensions/cms_manageable.rb +0 -106
- data/lib/comfortable_mexican_sofa/extensions/is_categorized.rb +0 -49
- data/lib/comfortable_mexican_sofa/extensions/is_mirrored.rb +0 -86
- data/lib/comfortable_mexican_sofa/extensions/rails.rb +0 -17
- data/lib/comfortable_mexican_sofa/fixture.rb +0 -82
- data/lib/comfortable_mexican_sofa/fixture/category.rb +0 -42
- data/lib/comfortable_mexican_sofa/fixture/file.rb +0 -85
- data/lib/comfortable_mexican_sofa/fixture/layout.rb +0 -95
- data/lib/comfortable_mexican_sofa/fixture/page.rb +0 -129
- data/lib/comfortable_mexican_sofa/fixture/snippet.rb +0 -75
- data/lib/comfortable_mexican_sofa/tag.rb +0 -154
- data/lib/comfortable_mexican_sofa/tags/asset.rb +0 -30
- data/lib/comfortable_mexican_sofa/tags/collection.rb +0 -64
- data/lib/comfortable_mexican_sofa/tags/field_boolean.rb +0 -17
- data/lib/comfortable_mexican_sofa/tags/field_datetime.rb +0 -17
- data/lib/comfortable_mexican_sofa/tags/field_integer.rb +0 -17
- data/lib/comfortable_mexican_sofa/tags/field_rich_text.rb +0 -17
- data/lib/comfortable_mexican_sofa/tags/field_string.rb +0 -17
- data/lib/comfortable_mexican_sofa/tags/field_text.rb +0 -17
- data/lib/comfortable_mexican_sofa/tags/file.rb +0 -29
- data/lib/comfortable_mexican_sofa/tags/helper.rb +0 -24
- data/lib/comfortable_mexican_sofa/tags/page_datetime.rb +0 -13
- data/lib/comfortable_mexican_sofa/tags/page_file.rb +0 -62
- data/lib/comfortable_mexican_sofa/tags/page_files.rb +0 -51
- data/lib/comfortable_mexican_sofa/tags/page_integer.rb +0 -13
- data/lib/comfortable_mexican_sofa/tags/page_markdown.rb +0 -16
- data/lib/comfortable_mexican_sofa/tags/page_rich_text.rb +0 -13
- data/lib/comfortable_mexican_sofa/tags/page_string.rb +0 -13
- data/lib/comfortable_mexican_sofa/tags/page_text.rb +0 -13
- data/lib/comfortable_mexican_sofa/tags/partial.rb +0 -23
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +0 -19
- data/lib/comfortable_mexican_sofa/tags/template.rb +0 -22
- data/lib/generators/comfy/scaffold/templates/views/_form.haml +0 -6
- data/lib/generators/comfy/scaffold/templates/views/index.haml +0 -23
- data/lib/tasks/comfortable_mexican_sofa.rake +0 -37
- data/test/fixtures/comfy/cms/blocks.yml +0 -12
- data/test/gemfiles/Gemfile.rails.4.1 +0 -22
- data/test/gemfiles/Gemfile.rails.4.2 +0 -22
- data/test/gemfiles/Gemfile.rails.5.0 +0 -23
- data/test/gemfiles/Gemfile.rails.master +0 -23
- data/test/integration/fixtures_test.rb +0 -65
- data/test/integration/mirrors_test.rb +0 -72
- data/test/lib/fixtures/categories_test.rb +0 -36
- data/test/lib/fixtures/files_test.rb +0 -109
- data/test/lib/fixtures/layouts_test.rb +0 -135
- data/test/lib/fixtures/pages_test.rb +0 -168
- data/test/lib/fixtures/snippets_test.rb +0 -106
- data/test/lib/fixtures_test.rb +0 -43
- data/test/lib/mirrors_test.rb +0 -254
- data/test/lib/tag_test.rb +0 -309
- data/test/lib/tags/asset_test.rb +0 -95
- data/test/lib/tags/collection_test.rb +0 -117
- data/test/lib/tags/field_boolean_test.rb +0 -49
- data/test/lib/tags/field_datetime_test.rb +0 -50
- data/test/lib/tags/field_integer_test.rb +0 -49
- data/test/lib/tags/field_rich_text_test.rb +0 -49
- data/test/lib/tags/field_string_test.rb +0 -52
- data/test/lib/tags/field_text_test.rb +0 -48
- data/test/lib/tags/file_test.rb +0 -67
- data/test/lib/tags/helper_test.rb +0 -86
- data/test/lib/tags/page_datetime_test.rb +0 -50
- data/test/lib/tags/page_file_test.rb +0 -119
- data/test/lib/tags/page_files_test.rb +0 -117
- data/test/lib/tags/page_integer_test.rb +0 -49
- data/test/lib/tags/page_markdown_test.rb +0 -48
- data/test/lib/tags/page_rich_text_test.rb +0 -49
- data/test/lib/tags/page_string_test.rb +0 -49
- data/test/lib/tags/page_text_test.rb +0 -52
- data/test/lib/tags/partial_test.rb +0 -76
- data/test/lib/tags/snippet_test.rb +0 -45
- data/test/lib/tags/template_test.rb +0 -56
- data/test/models/block_test.rb +0 -233
data/.travis.yml
CHANGED
@@ -4,21 +4,13 @@ before_install:
|
|
4
4
|
before_script:
|
5
5
|
- rake db:migrate
|
6
6
|
script:
|
7
|
-
- rake
|
7
|
+
- rake test
|
8
8
|
rvm:
|
9
9
|
- 2.2.7
|
10
10
|
- 2.3.5
|
11
11
|
- 2.4.2
|
12
12
|
gemfile:
|
13
|
-
- test/gemfiles/Gemfile.rails.
|
14
|
-
- test/gemfiles/Gemfile.rails.4.2
|
15
|
-
- test/gemfiles/Gemfile.rails.5.0
|
13
|
+
- test/gemfiles/Gemfile.rails.5.2
|
16
14
|
branches:
|
17
15
|
only:
|
18
16
|
- master
|
19
|
-
matrix:
|
20
|
-
fast_finish: true
|
21
|
-
exclude:
|
22
|
-
- rvm: 2.4.2
|
23
|
-
gemfile: test/gemfiles/Gemfile.rails.4.1
|
24
|
-
|
data/Gemfile
CHANGED
@@ -6,18 +6,16 @@ gemspec
|
|
6
6
|
gem 'kaminari'
|
7
7
|
|
8
8
|
group :development do
|
9
|
+
gem "listen"
|
9
10
|
gem 'awesome_print'
|
10
11
|
gem 'better_errors'
|
11
12
|
gem 'binding_of_caller'
|
13
|
+
gem "rubocop", "~> 0.51.0", require: false
|
12
14
|
end
|
13
15
|
|
14
16
|
group :test do
|
15
17
|
gem 'rails-controller-testing'
|
16
|
-
|
17
|
-
gem '
|
18
|
-
gem '
|
19
|
-
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
20
|
-
|
21
|
-
gem 'mocha', :require => false
|
22
|
-
gem 'coveralls', :require => false
|
18
|
+
gem 'sqlite3'
|
19
|
+
gem 'mocha', require: false
|
20
|
+
gem 'coveralls', require: false
|
23
21
|
end
|
data/README.md
CHANGED
@@ -1,30 +1,38 @@
|
|
1
1
|
# ComfortableMexicanSofa
|
2
|
-
[![Gem Version](https://img.shields.io/gem/v/comfortable_mexican_sofa.svg?style=flat)](http://rubygems.org/gems/comfortable_mexican_sofa)
|
3
|
-
[![Gem Downloads](https://img.shields.io/gem/dt/comfortable_mexican_sofa.svg?style=flat)](http://rubygems.org/gems/comfortable_mexican_sofa)
|
4
|
-
[![Build Status](https://img.shields.io/travis/comfy/comfortable-mexican-sofa.svg?branch=master&style=flat)](https://travis-ci.org/comfy/comfortable-mexican-sofa)
|
5
|
-
[![Dependency Status](https://img.shields.io/gemnasium/comfy/comfortable-mexican-sofa.svg?style=flat)](https://gemnasium.com/comfy/comfortable-mexican-sofa)
|
6
|
-
[![Code Climate](https://img.shields.io/codeclimate/github/comfy/comfortable-mexican-sofa.svg?style=flat)](https://codeclimate.com/github/comfy/comfortable-mexican-sofa)
|
7
|
-
[![Coverage Status](https://img.shields.io/coveralls/comfy/comfortable-mexican-sofa.svg?style=flat)](https://coveralls.io/r/comfy/comfortable-mexican-sofa?branch=master)
|
8
2
|
|
9
|
-
ComfortableMexicanSofa is a powerful Rails
|
3
|
+
ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine
|
4
|
+
|
5
|
+
[![Gem Version](https://img.shields.io/gem/v/comfortable_mexican_sofa.svg?style=flat)](http://rubygems.org/gems/comfortable_mexican_sofa)
|
6
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/comfortable_mexican_sofa.svg?style=flat)](http://rubygems.org/gems/comfortable_mexican_sofa)
|
7
|
+
[![Build Status](https://img.shields.io/travis/comfy/comfortable-mexican-sofa.svg?branch=master&style=flat)](https://travis-ci.org/comfy/comfortable-mexican-sofa)
|
8
|
+
[![Dependency Status](https://img.shields.io/gemnasium/comfy/comfortable-mexican-sofa.svg?style=flat)](https://gemnasium.com/comfy/comfortable-mexican-sofa)
|
9
|
+
[![Code Climate](https://img.shields.io/codeclimate/maintainability/comfy/comfortable-mexican-sofa.svg?style=flat)](https://codeclimate.com/github/comfy/comfortable-mexican-sofa)
|
10
|
+
[![Coverage Status](https://img.shields.io/coveralls/comfy/comfortable-mexican-sofa.svg?style=flat)](https://coveralls.io/r/comfy/comfortable-mexican-sofa?branch=master)
|
11
|
+
[![Gitter](https://badges.gitter.im/comfy/comfortable-mexican-sofa.svg)](https://gitter.im/comfy/comfortable-mexican-sofa)
|
10
12
|
|
11
13
|
## Features
|
12
14
|
|
13
|
-
* Simple integration with Rails
|
14
|
-
*
|
15
|
-
* Powerful page templating capability using [Tags](https://github.com/comfy/comfortable-mexican-sofa/wiki/Tags)
|
16
|
-
* [Multiple Sites](https://github.com/comfy/comfortable-mexican-sofa/wiki/Sites) from a single installation
|
17
|
-
* Multi-Language Support (i18n) (cs, da, de, en, es, fr, it, ja, nb, nl, pl, pt-BR, ru, sv, tr, uk, zh-CN, zh-TW)
|
18
|
-
* [
|
19
|
-
* [Revision History](https://github.com/comfy/comfortable-mexican-sofa/wiki/Revisions)
|
20
|
-
* [Great extendable admin interface](https://github.com/comfy/comfortable-mexican-sofa/wiki/Reusing-
|
15
|
+
* Simple drop-in integration with Rails 5.2+ apps with minimal configuration
|
16
|
+
* CMS stays away from the rest of your application
|
17
|
+
* Powerful page templating capability using [Content Tags](https://github.com/comfy/comfortable-mexican-sofa/wiki/Docs:-Content-Tags)
|
18
|
+
* [Multiple Sites](https://github.com/comfy/comfortable-mexican-sofa/wiki/Docs:-Sites) from a single installation
|
19
|
+
* Multi-Language Support (i18n) (cs, da, de, en, es, fr, it, ja, nb, nl, pl, pt-BR, ru, sv, tr, uk, zh-CN, zh-TW) and page localization.
|
20
|
+
* [CMS Seeds](https://github.com/comfy/comfortable-mexican-sofa/wiki/Docs:-CMS-Seeds) for initial content population
|
21
|
+
* [Revision History](https://github.com/comfy/comfortable-mexican-sofa/wiki/Docs:-Revisions) to revert changes
|
22
|
+
* [Great extendable admin interface](https://github.com/comfy/comfortable-mexican-sofa/wiki/HowTo:-Reusing-Admin-Area) built with [Bootstrap 4](http://getbootstrap.com) (responsive design). Using [CodeMirror](http://codemirror.net) for HTML and Markdown highlighing and [Redactor](http://imperavi.com/redactor) as the WYSIWYG editor.
|
23
|
+
|
24
|
+
## Dependencies
|
25
|
+
|
26
|
+
* File attachments are handled by [ActiveStorage](https://github.com/rails/rails/tree/master/activestorage). Make sure that you can run appropriate migrations by running: `rails active_storage:install`
|
27
|
+
* Image resizing is done with with [ImageMagick](http://www.imagemagick.org/script/download.php), so make sure it's installed.
|
28
|
+
* Pagination is handled by [kaminari](https://github.com/amatsuda/kaminari) or [will_paginate](https://github.com/mislav/will_paginate). Please add one of those to your Gemfile.
|
21
29
|
|
22
30
|
## Installation
|
23
31
|
|
24
32
|
Add gem definition to your Gemfile:
|
25
33
|
|
26
34
|
```ruby
|
27
|
-
gem 'comfortable_mexican_sofa', '~>
|
35
|
+
gem 'comfortable_mexican_sofa', '~> 2.0.0'
|
28
36
|
```
|
29
37
|
|
30
38
|
Then from the Rails project's root run:
|
@@ -33,21 +41,11 @@ Then from the Rails project's root run:
|
|
33
41
|
rails generate comfy:cms
|
34
42
|
rake db:migrate
|
35
43
|
|
36
|
-
Now take a look inside your `config/routes.rb` file. You'll see where routes attach for the admin area and content serving. Make sure that content serving route appears as a very last item.
|
44
|
+
Now take a look inside your `config/routes.rb` file. You'll see where routes attach for the admin area and content serving. Make sure that content serving route appears as a very last item or it will make all other routes to be inaccessible.
|
37
45
|
|
38
46
|
```ruby
|
39
|
-
comfy_route :cms_admin, :
|
40
|
-
comfy_route :cms, :
|
41
|
-
```
|
42
|
-
|
43
|
-
When upgrading from the older version please take a look at [Upgrading ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa/wiki/Upgrading-ComfortableMexicanSofa)
|
44
|
-
|
45
|
-
### Installation for Rails 3
|
46
|
-
|
47
|
-
For Rails 3 apps feel free to use [1.8 release](https://github.com/comfy/comfortable-mexican-sofa/tree/1.8)
|
48
|
-
|
49
|
-
```ruby
|
50
|
-
gem 'comfortable_mexican_sofa', '~> 1.8.0'
|
47
|
+
comfy_route :cms_admin, path: "/admin"
|
48
|
+
comfy_route :cms, path: "/"
|
51
49
|
```
|
52
50
|
|
53
51
|
## Quick Start Guide
|
@@ -63,30 +61,33 @@ After creating a Site, you need to make a Layout. Layout is the template of your
|
|
63
61
|
```html
|
64
62
|
<html>
|
65
63
|
<body>
|
66
|
-
<h1>{{ cms:
|
67
|
-
{{ cms:
|
64
|
+
<h1>{{ cms:text title }}</h1>
|
65
|
+
{{ cms:wysiwyg content }}
|
68
66
|
</body>
|
69
67
|
</html>
|
70
68
|
```
|
71
69
|
|
72
|
-
[See Wiki entry on available Tags you can use](https://github.com/comfy/comfortable-mexican-sofa/wiki/Tags)
|
70
|
+
[See Wiki entry on available Tags you can use](https://github.com/comfy/comfortable-mexican-sofa/wiki/Docs:-Content-Tags)
|
73
71
|
|
74
72
|
Once you have a layout, you may start creating pages and populating content. It's that easy.
|
75
73
|
|
76
74
|
For more information please refer to [Wiki](https://github.com/comfy/comfortable-mexican-sofa/wiki).
|
77
75
|
|
78
|
-
![Sofa's Page Edit View](https://github.com/comfy/comfortable-mexican-sofa/raw/master/doc/preview.
|
76
|
+
![Sofa's Page Edit View](https://github.com/comfy/comfortable-mexican-sofa/raw/master/doc/preview.jpg)
|
77
|
+
|
78
|
+
#### Old Versions
|
79
|
+
|
80
|
+
CMS for Rails 5.1 doesn't have published gem, but you may use [rails 5.1 branch](https://github.com/comfy/comfortable-mexican-sofa/tree/rails5.1) directly.
|
79
81
|
|
80
|
-
|
82
|
+
With Rails 4.2 and 5.0 use gem version [1.12.10](https://rubygems.org/gems/comfortable_mexican_sofa/versions/1.12.10)
|
81
83
|
|
82
|
-
|
83
|
-
* Make sure that Gemfile has either [kaminari](https://github.com/amatsuda/kaminari) or [will_paginate](https://github.com/mislav/will_paginate)
|
84
|
+
With Rails 3.0 use gem version [1.8.5](https://rubygems.org/gems/comfortable_mexican_sofa/versions/1.8.5)
|
84
85
|
|
85
86
|
#### Help and Contact
|
86
87
|
|
87
|
-
|
88
|
+
Gitter: https://gitter.im/comfy/comfortable-mexican-sofa
|
88
89
|
|
89
|
-
Twitter: [@GroceryBagHead](
|
90
|
+
Twitter: [@GroceryBagHead](https://twitter.com/grocerybaghead)
|
90
91
|
|
91
92
|
#### Acknowledgements
|
92
93
|
|
@@ -96,4 +97,4 @@ Twitter: [@GroceryBagHead](http://twitter.com/#!/GroceryBagHead)
|
|
96
97
|
|
97
98
|
ComfortableMexicanSofa is released under the [MIT license](https://github.com/comfy/comfortable-mexican-sofa/raw/master/LICENSE)
|
98
99
|
|
99
|
-
Copyright
|
100
|
+
Copyright 20010-2017 Oleg Khabarov
|
data/Rakefile
CHANGED
@@ -1,33 +1,3 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler.setup
|
3
|
-
|
4
|
-
require 'rake/testtask'
|
5
|
-
|
6
|
-
Rake::TestTask.new(:ci) do |t|
|
7
|
-
t.libs << 'test'
|
8
|
-
t.test_files = FileList['test/**/*_test.rb']
|
9
|
-
t.verbose = true
|
10
|
-
t.warning = false
|
11
|
-
end
|
12
|
-
|
13
1
|
require_relative 'config/application'
|
14
|
-
ComfortableMexicanSofa::Application.load_tasks
|
15
|
-
|
16
|
-
namespace :test do
|
17
|
-
Rake::TestTask.new(:lib) do |t|
|
18
|
-
t.libs << 'test'
|
19
|
-
t.pattern = 'test/lib/**/*_test.rb'
|
20
|
-
t.verbose = true
|
21
|
-
end
|
22
|
-
|
23
|
-
Rake::TestTask.new(:generators) do |t|
|
24
|
-
t.libs << 'test'
|
25
|
-
t.pattern = 'test/generators/**/*_test.rb'
|
26
|
-
t.verbose = true
|
27
|
-
end
|
28
|
-
end
|
29
2
|
|
30
|
-
|
31
|
-
Rake::Task['test:lib'].invoke
|
32
|
-
Rake::Task['test:generators'].invoke
|
33
|
-
end
|
3
|
+
Rails.application.load_tasks
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#= require
|
1
|
+
#= require jquery3
|
2
2
|
#= require jquery_ujs
|
3
3
|
#= require jquery-ui
|
4
4
|
#= require codemirror
|
@@ -8,9 +8,12 @@
|
|
8
8
|
#= require codemirror/modes/markdown
|
9
9
|
#= require codemirror/modes/xml
|
10
10
|
#= require codemirror/addons/edit/closetag
|
11
|
-
#= require
|
12
|
-
#= require
|
13
|
-
#= require comfy/admin/cms/lib/
|
11
|
+
#= require popper
|
12
|
+
#= require bootstrap
|
13
|
+
#= require comfy/admin/cms/lib/flatpickr.min
|
14
|
+
#= require_directory ./lib/flatpickr/i18n/
|
15
|
+
#= require comfy/admin/cms/lib/diff/diff_match_patch.min
|
16
|
+
#= require comfy/admin/cms/lib/diff/pretty_text_diff
|
14
17
|
#= require comfy/admin/cms/lib/redactor
|
15
18
|
#= require comfy/admin/cms/lib/redactor/filemanager
|
16
19
|
#= require comfy/admin/cms/lib/redactor/imagemanager
|
@@ -2,7 +2,9 @@ window.CMS ||= {}
|
|
2
2
|
|
3
3
|
window.CMS.code_mirror_instances = [ ]
|
4
4
|
|
5
|
-
|
5
|
+
unless Turbolinks?.controller? # Turbolinks 5 verification
|
6
|
+
$ -> window.CMS.init()
|
7
|
+
|
6
8
|
$(document).on 'page:load turbolinks:load', -> window.CMS.init()
|
7
9
|
|
8
10
|
window.CMS.init = ->
|
@@ -13,13 +15,12 @@ window.CMS.init = ->
|
|
13
15
|
CMS.codemirror()
|
14
16
|
CMS.sortable_list()
|
15
17
|
CMS.timepicker()
|
16
|
-
CMS.
|
18
|
+
CMS.page_fragments()
|
17
19
|
CMS.page_file_popovers()
|
18
|
-
CMS.mirrors()
|
19
20
|
CMS.page_update_preview()
|
20
|
-
CMS.page_update_publish()
|
21
21
|
CMS.categories()
|
22
22
|
CMS.files()
|
23
|
+
CMS.diff()
|
23
24
|
|
24
25
|
window.CMS.slugify = ->
|
25
26
|
slugify = (str) ->
|
@@ -113,25 +114,25 @@ window.CMS.codemirror = ->
|
|
113
114
|
|
114
115
|
window.CMS.sortable_list = ->
|
115
116
|
$('.sortable').sortable
|
116
|
-
handle: '
|
117
|
+
handle: '.dragger'
|
117
118
|
axis: 'y'
|
118
119
|
update: ->
|
119
120
|
$.post("#{CMS.current_path}/reorder", "_method=put&#{$(this).sortable('serialize')}")
|
120
121
|
|
121
122
|
|
122
123
|
window.CMS.timepicker = ->
|
123
|
-
$('input[type=text][data-cms-datetime]').
|
124
|
+
$('input[type=text][data-cms-datetime]').flatpickr
|
124
125
|
format: 'yyyy-mm-dd hh:ii'
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
enableTime: true
|
127
|
+
locale: CMS.locale
|
128
|
+
|
129
|
+
$('input[type=text][data-cms-date]').flatpickr
|
130
|
+
format: 'yyyy-mm-dd',
|
131
|
+
locale: CMS.locale
|
131
132
|
|
132
133
|
|
133
|
-
window.CMS.
|
134
|
-
$('select#
|
134
|
+
window.CMS.page_fragments = ->
|
135
|
+
$('select#fragments-toggle').bind 'change.cms', ->
|
135
136
|
$.ajax
|
136
137
|
url: $(this).data('url'),
|
137
138
|
data:
|
@@ -150,11 +151,6 @@ window.CMS.page_file_popovers = ->
|
|
150
151
|
html: true
|
151
152
|
|
152
153
|
|
153
|
-
window.CMS.mirrors = ->
|
154
|
-
$('#mirrors select').change ->
|
155
|
-
window.location = $(this).val()
|
156
|
-
|
157
|
-
|
158
154
|
window.CMS.page_update_preview = ->
|
159
155
|
$('input[name=commit]').click ->
|
160
156
|
$(this).parents('form').attr('target', '')
|
@@ -162,21 +158,8 @@ window.CMS.page_update_preview = ->
|
|
162
158
|
$(this).parents('form').attr('target', 'comfy-cms-preview')
|
163
159
|
|
164
160
|
|
165
|
-
window.CMS.page_update_publish = ->
|
166
|
-
widget = $('#form-save')
|
167
|
-
$('input', widget).prop('checked', $('input#page_is_published').is(':checked'))
|
168
|
-
$('button', widget).html($('input[name=commit]').val())
|
169
|
-
|
170
|
-
$('input', widget).click ->
|
171
|
-
$('input#page_is_published').prop('checked', $(this).is(':checked'))
|
172
|
-
$('input#page_is_published').click ->
|
173
|
-
$('input', widget).prop('checked', $(this).is(':checked'))
|
174
|
-
$('button', widget).click ->
|
175
|
-
$('input[name=commit]').click()
|
176
|
-
|
177
|
-
|
178
161
|
window.CMS.categories = ->
|
179
|
-
$('
|
162
|
+
$('button.toggle-cat-edit', '.categories-widget').click (event) ->
|
180
163
|
event.preventDefault()
|
181
164
|
$('.categories.read', '.categories-widget').toggle()
|
182
165
|
$('.categories.editable', '.categories-widget').toggle()
|
@@ -184,6 +167,13 @@ window.CMS.categories = ->
|
|
184
167
|
$('.done', '.categories-widget').toggle()
|
185
168
|
|
186
169
|
|
170
|
+
window.CMS.diff = ->
|
171
|
+
$(".revision").prettyTextDiff
|
172
|
+
cleanup: true
|
173
|
+
originalContainer: '.original'
|
174
|
+
changedContainer: '.current'
|
175
|
+
diffContainer: '.diff .content'
|
176
|
+
|
187
177
|
# If we are inside an iframe remove the columns and just keep the center column content.
|
188
178
|
# This is used for the files widget that opens in a modal window.
|
189
179
|
window.CMS.set_iframe_layout = ->
|
@@ -0,0 +1,76 @@
|
|
1
|
+
// Generated by CoffeeScript 1.9.2
|
2
|
+
|
3
|
+
/*
|
4
|
+
@preserve jQuery.PrettyTextDiff 1.0.4
|
5
|
+
See https://github.com/arnab/jQuery.PrettyTextDiff/
|
6
|
+
*/
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
var $;
|
10
|
+
|
11
|
+
$ = jQuery;
|
12
|
+
|
13
|
+
$.fn.extend({
|
14
|
+
prettyTextDiff: function(options) {
|
15
|
+
var dmp, settings;
|
16
|
+
settings = {
|
17
|
+
originalContainer: ".original",
|
18
|
+
changedContainer: ".changed",
|
19
|
+
diffContainer: ".diff",
|
20
|
+
cleanup: true,
|
21
|
+
debug: false
|
22
|
+
};
|
23
|
+
settings = $.extend(settings, options);
|
24
|
+
$.fn.prettyTextDiff.debug("Options: ", settings, settings);
|
25
|
+
dmp = new diff_match_patch();
|
26
|
+
return this.each(function() {
|
27
|
+
var changed, diff_as_html, diffs, original;
|
28
|
+
if (settings.originalContent && settings.changedContent) {
|
29
|
+
original = $('<div />').html(settings.originalContent).text();
|
30
|
+
changed = $('<div />').html(settings.changedContent).text();
|
31
|
+
} else {
|
32
|
+
original = $(settings.originalContainer, this).text();
|
33
|
+
changed = $(settings.changedContainer, this).text();
|
34
|
+
}
|
35
|
+
$.fn.prettyTextDiff.debug("Original text found: ", original, settings);
|
36
|
+
$.fn.prettyTextDiff.debug("Changed text found: ", changed, settings);
|
37
|
+
diffs = dmp.diff_main(original, changed);
|
38
|
+
if (settings.cleanup) {
|
39
|
+
dmp.diff_cleanupSemantic(diffs);
|
40
|
+
}
|
41
|
+
$.fn.prettyTextDiff.debug("Diffs: ", diffs, settings);
|
42
|
+
diff_as_html = $.map(diffs, function(diff) {
|
43
|
+
return $.fn.prettyTextDiff.createHTML(diff);
|
44
|
+
});
|
45
|
+
$(settings.diffContainer, this).html(diff_as_html.join(''));
|
46
|
+
return this;
|
47
|
+
});
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
$.fn.prettyTextDiff.debug = function(message, object, settings) {
|
52
|
+
if (settings.debug) {
|
53
|
+
return console.log(message, object);
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
$.fn.prettyTextDiff.createHTML = function(diff) {
|
58
|
+
var data, html, operation, pattern_amp, pattern_gt, pattern_lt, pattern_para, text;
|
59
|
+
html = [];
|
60
|
+
pattern_amp = /&/g;
|
61
|
+
pattern_lt = /</g;
|
62
|
+
pattern_gt = />/g;
|
63
|
+
pattern_para = /\n/g;
|
64
|
+
operation = diff[0], data = diff[1];
|
65
|
+
text = data.replace(pattern_amp, '&').replace(pattern_lt, '<').replace(pattern_gt, '>').replace(pattern_para, '<br>');
|
66
|
+
switch (operation) {
|
67
|
+
case DIFF_INSERT:
|
68
|
+
return '<ins>' + text + '</ins>';
|
69
|
+
case DIFF_DELETE:
|
70
|
+
return '<del>' + text + '</del>';
|
71
|
+
case DIFF_EQUAL:
|
72
|
+
return '<span>' + text + '</span>';
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
}).call(this);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/* flatpickr v4.0.6,, @license MIT */
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.flatpickr=t()}(this,function(){"use strict";function e(e,t,n){return!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}function t(e,t,n){void 0===n&&(n=!1);var a;return function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout(function(){a=null,n||e.apply(i,o)},t),n&&!a&&e.apply(i,o)}}function n(e){return(e.wheelDelta||-e.deltaY)>=0?1:-1}function a(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function i(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function o(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function r(e,t){return t(e)?e:e.parentNode?r(e.parentNode,t):void 0}function l(e){var t=i("div","numInputWrapper"),n=i("input","numInput "+e),a=i("span","arrowUp"),o=i("span","arrowDown");return n.type="text",n.pattern="\\d*",t.appendChild(n),t.appendChild(a),t.appendChild(o),t}function c(c,d){function m(){ye.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=ye.currentMonth),void 0===t&&(t=ye.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:ye.l10n.daysInMonth[e]}}}function g(e){return e.bind(ye)}function D(e){ye.config.noCalendar&&!ye.selectedDates.length&&(ye.setDate((new Date).setHours(ye.config.defaultHour,ye.config.defaultMinute,ye.config.defaultSeconds),!1),E(),Ce()),be(e),0!==ye.selectedDates.length&&(!ye.minDateHasTime||"input"!==e.type||e.target.value.length>=2?(E(),Ce()):setTimeout(function(){E(),Ce()},1e3))}function y(e,t){return e%12+12*h("PM"===t)}function x(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}function E(){if(void 0!==ye.hourElement&&void 0!==ye.minuteElement){var t=(parseInt(ye.hourElement.value.slice(-2),10)||0)%24,n=(parseInt(ye.minuteElement.value,10)||0)%60,a=void 0!==ye.secondElement?(parseInt(ye.secondElement.value,10)||0)%60:0;void 0!==ye.amPM&&(t=y(t,ye.amPM.textContent)),ye.config.minDate&&ye.minDateHasTime&&ye.latestSelectedDateObj&&0===e(ye.latestSelectedDateObj,ye.config.minDate)&&(t=Math.max(t,ye.config.minDate.getHours()))===ye.config.minDate.getHours()&&(n=Math.max(n,ye.config.minDate.getMinutes())),ye.config.maxDate&&ye.maxDateHasTime&&ye.latestSelectedDateObj&&0===e(ye.latestSelectedDateObj,ye.config.maxDate)&&(t=Math.min(t,ye.config.maxDate.getHours()))===ye.config.maxDate.getHours()&&(n=Math.min(n,ye.config.maxDate.getMinutes())),N(t,n,a)}}function k(e){var t=e||ye.latestSelectedDateObj;t&&N(t.getHours(),t.getMinutes(),t.getSeconds())}function N(e,t,n){void 0!==ye.latestSelectedDateObj&&ye.latestSelectedDateObj.setHours(e%24,t,n||0,0),ye.hourElement&&ye.minuteElement&&!ye.isMobile&&(ye.hourElement.value=p(ye.config.time_24hr?e:(12+e)%12+12*h(e%12==0)),ye.minuteElement.value=p(t),void 0!==ye.amPM&&(ye.amPM.textContent=e>=12?"PM":"AM"),void 0!==ye.secondElement&&(ye.secondElement.value=p(n)))}function S(e){var t=parseInt(e.target.value)+(e.delta||0);4!==t.toString().length&&"Enter"!==e.key||(ye.currentYearElement.blur(),/[^\d]/.test(t.toString())||Z(t))}function T(e,t,n){return t instanceof Array?t.forEach(function(t){return T(e,t,n)}):e instanceof Array?e.forEach(function(e){return T(e,t,n)}):(e.addEventListener(t,n),void ye._handlers.push({element:e,event:t,handler:n}))}function I(e){return function(t){return 1===t.which&&e(t)}}function Y(){ge("onChange")}function _(){if(ye.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(ye.element.querySelectorAll("[data-"+e+"]"),function(t){return T(t,"click",ye[e])})}),ye.isMobile)me();else{var e=t(te,50);if(ye._debouncedChange=t(Y,300),"range"===ye.config.mode&&ye.daysContainer&&T(ye.daysContainer,"mouseover",function(e){return ee(e.target)}),T(window.document.body,"keydown",X),ye.config.static||T(ye._input,"keydown",X),ye.config.inline||ye.config.static||T(window,"resize",e),void 0!==window.ontouchstart&&T(window.document.body,"touchstart",V),T(window.document.body,"mousedown",I(V)),T(ye._input,"blur",V),!0===ye.config.clickOpens&&(T(ye._input,"focus",ye.open),T(ye._input,"mousedown",I(ye.open))),void 0!==ye.daysContainer&&(ye.monthNav.addEventListener("wheel",function(e){return e.preventDefault()}),T(ye.monthNav,"wheel",t(we,10)),T(ye.monthNav,"mousedown",I(Me)),T(ye.monthNav,["keyup","increment"],S),T(ye.daysContainer,"mousedown",I(le)),ye.config.animate&&(T(ye.daysContainer,["webkitAnimationEnd","animationend"],F),T(ye.monthNav,["webkitAnimationEnd","animationend"],A))),void 0!==ye.timeContainer&&void 0!==ye.minuteElement&&void 0!==ye.hourElement){T(ye.timeContainer,["wheel","input","increment"],D),T(ye.timeContainer,"mousedown",I(P)),T(ye.timeContainer,["wheel","increment"],ye._debouncedChange),T(ye.timeContainer,"input",Y),T([ye.hourElement,ye.minuteElement],["focus","click"],function(e){return e.target.select()}),void 0!==ye.secondElement&&T(ye.secondElement,"focus",function(){return ye.secondElement&&ye.secondElement.select()}),void 0!==ye.amPM&&T(ye.amPM,"mousedown",I(function(e){D(e),Y()}))}}}function O(){ye._animationLoop.forEach(function(e){return e()}),ye._animationLoop=[]}function F(e){if(ye.daysContainer&&ye.daysContainer.childNodes.length>1)switch(e.animationName){case"fpSlideLeft":ye.daysContainer.lastChild&&ye.daysContainer.lastChild.classList.remove("slideLeftNew"),ye.daysContainer.removeChild(ye.daysContainer.firstChild),ye.days=ye.daysContainer.firstChild,O();break;case"fpSlideRight":ye.daysContainer.firstChild&&ye.daysContainer.firstChild.classList.remove("slideRightNew"),ye.daysContainer.removeChild(ye.daysContainer.lastChild),ye.days=ye.daysContainer.firstChild,O()}}function A(e){switch(e.animationName){case"fpSlideLeftNew":case"fpSlideRightNew":ye.navigationCurrentMonth.classList.remove("slideLeftNew"),ye.navigationCurrentMonth.classList.remove("slideRightNew");for(var t=ye.navigationCurrentMonth;t.nextSibling&&/curr/.test(t.nextSibling.className);)ye.monthNav.removeChild(t.nextSibling);for(;t.previousSibling&&/curr/.test(t.previousSibling.className);)ye.monthNav.removeChild(t.previousSibling);ye.oldCurMonth=void 0}}function L(e){var t=void 0!==e?ue(e):ye.latestSelectedDateObj||(ye.config.minDate&&ye.config.minDate>ye.now?ye.config.minDate:ye.config.maxDate&&ye.config.maxDate<ye.now?ye.config.maxDate:ye.now);try{void 0!==t&&(ye.currentYear=t.getFullYear(),ye.currentMonth=t.getMonth())}catch(e){console.error(e.stack),console.warn("Invalid date supplied: "+t)}ye.redraw()}function P(e){~e.target.className.indexOf("arrow")&&j(e,e.target.classList.contains("arrowUp")?1:-1)}function j(e,t,n){var a=e&&e.target,i=n||a&&a.parentNode&&a.parentNode.firstChild,o=pe("increment");o.delta=t,i&&i.dispatchEvent(o)}function H(){var e=window.document.createDocumentFragment();if(ye.calendarContainer=i("div","flatpickr-calendar"),ye.calendarContainer.tabIndex=-1,!ye.config.noCalendar){if(e.appendChild(K()),ye.innerContainer=i("div","flatpickr-innerContainer"),ye.config.weekNumbers){var t=q(),n=t.weekWrapper,o=t.weekNumbers;ye.innerContainer.appendChild(n),ye.weekNumbers=o,ye.weekWrapper=n}ye.rContainer=i("div","flatpickr-rContainer"),ye.rContainer.appendChild($()),ye.daysContainer||(ye.daysContainer=i("div","flatpickr-days"),ye.daysContainer.tabIndex=-1),J(),ye.rContainer.appendChild(ye.daysContainer),ye.innerContainer.appendChild(ye.rContainer),e.appendChild(ye.innerContainer)}ye.config.enableTime&&e.appendChild(U()),a(ye.calendarContainer,"rangeMode","range"===ye.config.mode),a(ye.calendarContainer,"animate",ye.config.animate),ye.calendarContainer.appendChild(e);var r=void 0!==ye.config.appendTo&&ye.config.appendTo.nodeType;if((ye.config.inline||ye.config.static)&&(ye.calendarContainer.classList.add(ye.config.inline?"inline":"static"),ye.config.inline&&(!r&&ye.element.parentNode?ye.element.parentNode.insertBefore(ye.calendarContainer,ye._input.nextSibling):void 0!==ye.config.appendTo&&ye.config.appendTo.appendChild(ye.calendarContainer)),ye.config.static)){var l=i("div","flatpickr-wrapper");ye.element.parentNode&&ye.element.parentNode.insertBefore(l,ye.element),l.appendChild(ye.element),ye.altInput&&l.appendChild(ye.altInput),l.appendChild(ye.calendarContainer)}ye.config.static||ye.config.inline||(void 0!==ye.config.appendTo?ye.config.appendTo:window.document.body).appendChild(ye.calendarContainer)}function R(t,n,o,r){var l=Q(n,!0),c=i("span","flatpickr-day "+t,n.getDate().toString());return c.dateObj=n,c.$i=r,c.setAttribute("aria-label",ye.formatDate(n,ye.config.ariaDateFormat)),0===e(n,ye.now)&&(ye.todayDateElem=c,c.classList.add("today")),l?(c.tabIndex=-1,he(n)&&(c.classList.add("selected"),ye.selectedDateElem=c,"range"===ye.config.mode&&(a(c,"startRange",ye.selectedDates[0]&&0===e(n,ye.selectedDates[0])),a(c,"endRange",ye.selectedDates[1]&&0===e(n,ye.selectedDates[1]))))):(c.classList.add("disabled"),ye.selectedDates[0]&&ye.minRangeDate&&n>ye.minRangeDate&&n<ye.selectedDates[0]?ye.minRangeDate=n:ye.selectedDates[0]&&ye.maxRangeDate&&n<ye.maxRangeDate&&n>ye.selectedDates[0]&&(ye.maxRangeDate=n)),"range"===ye.config.mode&&(ve(n)&&!he(n)&&c.classList.add("inRange"),1===ye.selectedDates.length&&void 0!==ye.minRangeDate&&void 0!==ye.maxRangeDate&&(n<ye.minRangeDate||n>ye.maxRangeDate)&&c.classList.add("notAllowed")),ye.weekNumbers&&"prevMonthDay"!==t&&o%7==1&&ye.weekNumbers.insertAdjacentHTML("beforeend","<span class='disabled flatpickr-day'>"+ye.config.getWeek(n)+"</span>"),ge("onDayCreate",c),c}function W(e,t){var n=e+t||0,a=void 0!==e?ye.days.childNodes[n]:ye.selectedDateElem||ye.todayDateElem||ye.days.childNodes[0],i=function(){(a=a||ye.days.childNodes[n]).focus(),"range"===ye.config.mode&&ee(a)};if(void 0===a&&0!==t)return t>0?(ye.changeMonth(1,!0,void 0,!0),n%=42):t<0&&(ye.changeMonth(-1,!0,void 0,!0),n+=42),B(i);i()}function B(e){!0===ye.config.animate?ye._animationLoop.push(e):e()}function J(e){if(void 0!==ye.daysContainer){var t=(new Date(ye.currentYear,ye.currentMonth,1).getDay()-ye.l10n.firstDayOfWeek+7)%7,n="range"===ye.config.mode,a=ye.utils.getDaysInMonth((ye.currentMonth-1+12)%12),r=ye.utils.getDaysInMonth(),l=window.document.createDocumentFragment(),c=a+1-t,d=0;for(ye.weekNumbers&&ye.weekNumbers.firstChild&&(ye.weekNumbers.textContent=""),n&&(ye.minRangeDate=new Date(ye.currentYear,ye.currentMonth-1,c),ye.maxRangeDate=new Date(ye.currentYear,ye.currentMonth+1,(42-t)%r));c<=a;c++,d++)l.appendChild(R("prevMonthDay",new Date(ye.currentYear,ye.currentMonth-1,c),c,d));for(c=1;c<=r;c++,d++)l.appendChild(R("",new Date(ye.currentYear,ye.currentMonth,c),c,d));for(var s=r+1;s<=42-t;s++,d++)l.appendChild(R("nextMonthDay",new Date(ye.currentYear,ye.currentMonth+1,s%r),s,d));n&&1===ye.selectedDates.length&&l.childNodes[0]?(ye._hidePrevMonthArrow=ye._hidePrevMonthArrow||!!ye.minRangeDate&&ye.minRangeDate>l.childNodes[0].dateObj,ye._hideNextMonthArrow=ye._hideNextMonthArrow||!!ye.maxRangeDate&&ye.maxRangeDate<new Date(ye.currentYear,ye.currentMonth+1,1)):De();var u=i("div","dayContainer");if(u.appendChild(l),ye.config.animate&&void 0!==e)for(;ye.daysContainer.childNodes.length>1;)ye.daysContainer.removeChild(ye.daysContainer.firstChild);else o(ye.daysContainer);e&&e>=0?ye.daysContainer.appendChild(u):ye.daysContainer.insertBefore(u,ye.daysContainer.firstChild),ye.days=ye.daysContainer.childNodes[0]}}function K(){var e=window.document.createDocumentFragment();ye.monthNav=i("div","flatpickr-month"),ye.prevMonthNav=i("span","flatpickr-prev-month"),ye.prevMonthNav.innerHTML=ye.config.prevArrow,ye.currentMonthElement=i("span","cur-month"),ye.currentMonthElement.title=ye.l10n.scrollTitle;var t=l("cur-year");return ye.currentYearElement=t.childNodes[0],ye.currentYearElement.title=ye.l10n.scrollTitle,ye.config.minDate&&(ye.currentYearElement.min=ye.config.minDate.getFullYear().toString()),ye.config.maxDate&&(ye.currentYearElement.max=ye.config.maxDate.getFullYear().toString(),ye.currentYearElement.disabled=!!ye.config.minDate&&ye.config.minDate.getFullYear()===ye.config.maxDate.getFullYear()),ye.nextMonthNav=i("span","flatpickr-next-month"),ye.nextMonthNav.innerHTML=ye.config.nextArrow,ye.navigationCurrentMonth=i("span","flatpickr-current-month"),ye.navigationCurrentMonth.appendChild(ye.currentMonthElement),ye.navigationCurrentMonth.appendChild(t),e.appendChild(ye.prevMonthNav),e.appendChild(ye.navigationCurrentMonth),e.appendChild(ye.nextMonthNav),ye.monthNav.appendChild(e),Object.defineProperty(ye,"_hidePrevMonthArrow",{get:function(){return ye.__hidePrevMonthArrow},set:function(e){ye.__hidePrevMonthArrow!==e&&(ye.prevMonthNav.style.display=e?"none":"block"),ye.__hidePrevMonthArrow=e}}),Object.defineProperty(ye,"_hideNextMonthArrow",{get:function(){return ye.__hideNextMonthArrow},set:function(e){ye.__hideNextMonthArrow!==e&&(ye.nextMonthNav.style.display=e?"none":"block"),ye.__hideNextMonthArrow=e}}),De(),ye.monthNav}function U(){ye.calendarContainer.classList.add("hasTime"),ye.config.noCalendar&&ye.calendarContainer.classList.add("noCalendar"),ye.timeContainer=i("div","flatpickr-time"),ye.timeContainer.tabIndex=-1;var e=i("span","flatpickr-time-separator",":"),t=l("flatpickr-hour");ye.hourElement=t.childNodes[0];var n=l("flatpickr-minute");if(ye.minuteElement=n.childNodes[0],ye.hourElement.tabIndex=ye.minuteElement.tabIndex=-1,ye.hourElement.value=p(ye.latestSelectedDateObj?ye.latestSelectedDateObj.getHours():ye.config.time_24hr?ye.config.defaultHour:x(ye.config.defaultHour)),ye.minuteElement.value=p(ye.latestSelectedDateObj?ye.latestSelectedDateObj.getMinutes():ye.config.defaultMinute),ye.hourElement.step=ye.config.hourIncrement.toString(),ye.minuteElement.step=ye.config.minuteIncrement.toString(),ye.hourElement.min=ye.config.time_24hr?"0":"1",ye.hourElement.max=ye.config.time_24hr?"23":"12",ye.minuteElement.min="0",ye.minuteElement.max="59",ye.hourElement.title=ye.minuteElement.title=ye.l10n.scrollTitle,ye.timeContainer.appendChild(t),ye.timeContainer.appendChild(e),ye.timeContainer.appendChild(n),ye.config.time_24hr&&ye.timeContainer.classList.add("time24hr"),ye.config.enableSeconds){ye.timeContainer.classList.add("hasSeconds");var a=l("flatpickr-second");ye.secondElement=a.childNodes[0],ye.secondElement.value=p(ye.latestSelectedDateObj?ye.latestSelectedDateObj.getSeconds():ye.config.defaultSeconds),ye.secondElement.step=ye.minuteElement.step,ye.secondElement.min=ye.minuteElement.min,ye.secondElement.max=ye.minuteElement.max,ye.timeContainer.appendChild(i("span","flatpickr-time-separator",":")),ye.timeContainer.appendChild(a)}return ye.config.time_24hr||(ye.amPM=i("span","flatpickr-am-pm",ye.l10n.amPM[h((ye.latestSelectedDateObj?ye.hourElement.value:ye.config.defaultHour)>11)]),ye.amPM.title=ye.l10n.toggleTitle,ye.amPM.tabIndex=-1,ye.timeContainer.appendChild(ye.amPM)),ye.timeContainer}function $(){ye.weekdayContainer||(ye.weekdayContainer=i("div","flatpickr-weekdays"));var e=ye.l10n.firstDayOfWeek,t=ye.l10n.weekdays.shorthand.slice();return e>0&&e<t.length&&(t=t.splice(e,t.length).concat(t.splice(0,e))),ye.weekdayContainer.innerHTML="\n <span class=flatpickr-weekday>\n "+t.join("</span><span class=flatpickr-weekday>")+"\n </span>\n ",ye.weekdayContainer}function q(){ye.calendarContainer.classList.add("hasWeeks");var e=i("div","flatpickr-weekwrapper");e.appendChild(i("span","flatpickr-weekday",ye.l10n.weekAbbreviation));var t=i("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}function z(e,t,n,a){void 0===t&&(t=!0),void 0===n&&(n=ye.config.animate),void 0===a&&(a=!1);var i=t?e:e-ye.currentMonth;if(!(i<0&&ye._hidePrevMonthArrow||i>0&&ye._hideNextMonthArrow)){if(ye.currentMonth+=i,(ye.currentMonth<0||ye.currentMonth>11)&&(ye.currentYear+=ye.currentMonth>11?1:-1,ye.currentMonth=(ye.currentMonth+12)%12,ge("onYearChange")),J(n?i:void 0),!n)return ge("onMonthChange"),De();var o=ye.navigationCurrentMonth;if(i<0)for(;o.nextSibling&&/curr/.test(o.nextSibling.className);)ye.monthNav.removeChild(o.nextSibling);else if(i>0)for(;o.previousSibling&&/curr/.test(o.previousSibling.className);)ye.monthNav.removeChild(o.previousSibling);ye.oldCurMonth=ye.navigationCurrentMonth,ye.navigationCurrentMonth=ye.monthNav.insertBefore(ye.oldCurMonth.cloneNode(!0),i>0?ye.oldCurMonth.nextSibling:ye.oldCurMonth);var r=ye.daysContainer;if(r.firstChild&&r.lastChild&&(i>0?(r.firstChild.classList.add("slideLeft"),r.lastChild.classList.add("slideLeftNew"),ye.oldCurMonth.classList.add("slideLeft"),ye.navigationCurrentMonth.classList.add("slideLeftNew")):i<0&&(r.firstChild.classList.add("slideRightNew"),r.lastChild.classList.add("slideRight"),ye.oldCurMonth.classList.add("slideRight"),ye.navigationCurrentMonth.classList.add("slideRightNew"))),ye.currentMonthElement=ye.navigationCurrentMonth.firstChild,ye.currentYearElement=ye.navigationCurrentMonth.lastChild.childNodes[0],De(),ye.oldCurMonth.firstChild&&(ye.oldCurMonth.firstChild.textContent=u(ye.currentMonth-i,ye.config.shorthandCurrentMonth,ye.l10n)),ge("onMonthChange"),a&&document.activeElement&&document.activeElement.$i){var l=document.activeElement.$i;B(function(){W(l,0)})}}}function G(e){return!(!ye.config.appendTo||!ye.config.appendTo.contains(e))||ye.calendarContainer.contains(e)}function V(e){if(ye.isOpen&&!ye.config.inline){var t=G(e.target),n=e.target===ye.input||e.target===ye.altInput||ye.element.contains(e.target)||e.path&&e.path.indexOf&&(~e.path.indexOf(ye.input)||~e.path.indexOf(ye.altInput));("blur"===e.type?n&&e.relatedTarget&&!G(e.relatedTarget):!n&&!t)&&-1===ye.config.ignoredFocusElements.indexOf(e.target)&&(ye.close(),"range"===ye.config.mode&&1===ye.selectedDates.length&&(ye.clear(!1),ye.redraw()))}}function Z(e){if(!(!e||ye.currentYearElement.min&&e<parseInt(ye.currentYearElement.min)||ye.currentYearElement.max&&e>parseInt(ye.currentYearElement.max))){var t=e,n=ye.currentYear!==t;ye.currentYear=t||ye.currentYear,ye.config.maxDate&&ye.currentYear===ye.config.maxDate.getFullYear()?ye.currentMonth=Math.min(ye.config.maxDate.getMonth(),ye.currentMonth):ye.config.minDate&&ye.currentYear===ye.config.minDate.getFullYear()&&(ye.currentMonth=Math.max(ye.config.minDate.getMonth(),ye.currentMonth)),n&&(ye.redraw(),ge("onYearChange"))}}function Q(t,n){void 0===n&&(n=!0);var a=ye.parseDate(t,void 0,n);if(ye.config.minDate&&a&&e(a,ye.config.minDate,void 0!==n?n:!ye.minDateHasTime)<0||ye.config.maxDate&&a&&e(a,ye.config.maxDate,void 0!==n?n:!ye.maxDateHasTime)>0)return!1;if(!ye.config.enable.length&&!ye.config.disable.length)return!0;if(void 0===a)return!1;for(var i=ye.config.enable.length>0,o=i?ye.config.enable:ye.config.disable,r=0,l=void 0;r<o.length;r++){if("function"==typeof(l=o[r])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l&&void 0!==a){var c=ye.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.getTime()<=l.to.getTime())return i}return!i}function X(e){var t=e.target===ye._input,n=G(e.target),a=ye.config.allowInput,i=ye.isOpen&&(!a||!t),o=ye.config.inline&&t&&!a;if("Enter"===e.key&&t){if(a)return ye.setDate(ye._input.value,!0,e.target===ye.altInput?ye.config.altFormat:ye.config.dateFormat),e.target.blur();ye.open()}else if(n||i||o){var r=!!ye.timeContainer&&ye.timeContainer.contains(e.target);switch(e.key){case"Enter":r?Ce():le(e);break;case"Escape":e.preventDefault(),ye.close();break;case"Backspace":case"Delete":t&&!ye.config.allowInput&&ye.clear();break;case"ArrowLeft":case"ArrowRight":if(r)ye.hourElement&&ye.hourElement.focus();else if(e.preventDefault(),ye.daysContainer){var l="ArrowRight"===e.key?1:-1;e.ctrlKey?z(l,!0,void 0,!0):W(e.target.$i,l)}break;case"ArrowUp":case"ArrowDown":e.preventDefault();var c="ArrowDown"===e.key?1:-1;ye.daysContainer&&void 0!==e.target.$i?e.ctrlKey?(Z(ye.currentYear-c),W(e.target.$i,0)):r||W(e.target.$i,7*c):ye.config.enableTime&&(!r&&ye.hourElement&&ye.hourElement.focus(),D(e),ye._debouncedChange());break;case"Tab":e.target===ye.hourElement?(e.preventDefault(),ye.minuteElement.select()):e.target===ye.minuteElement&&(ye.secondElement||ye.amPM)?(e.preventDefault(),void 0!==ye.secondElement?ye.secondElement.focus():void 0!==ye.amPM&&ye.amPM.focus()):e.target===ye.secondElement&&ye.amPM&&(e.preventDefault(),ye.amPM.focus());break;case"a":void 0!==ye.amPM&&e.target===ye.amPM&&(ye.amPM.textContent="AM",E(),Ce());break;case"p":void 0!==ye.amPM&&e.target===ye.amPM&&(ye.amPM.textContent="PM",E(),Ce())}ge("onKeyDown",e)}}function ee(e){if(1===ye.selectedDates.length&&e.classList.contains("flatpickr-day")&&void 0!==ye.minRangeDate&&void 0!==ye.maxRangeDate){for(var t=e.dateObj,n=ye.parseDate(ye.selectedDates[0],void 0,!0),a=Math.min(t.getTime(),ye.selectedDates[0].getTime()),i=Math.max(t.getTime(),ye.selectedDates[0].getTime()),o=!1,r=a;r<i;r+=f.DAY)if(!Q(new Date(r))){o=!0;break}for(var l=ye.days.childNodes[0].dateObj.getTime(),c=0;c<42;c++,l+=f.DAY)!function(r,l){var c=r<ye.minRangeDate.getTime()||r>ye.maxRangeDate.getTime(),d=ye.days.childNodes[l];if(c)return d.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){d.classList.remove(e)}),"continue";if(o&&!c)return"continue";["startRange","inRange","endRange","notAllowed"].forEach(function(e){d.classList.remove(e)});var s=Math.max(ye.minRangeDate.getTime(),a),u=Math.min(ye.maxRangeDate.getTime(),i);e.classList.add(t<ye.selectedDates[0]?"startRange":"endRange"),n<t&&r===n.getTime()?d.classList.add("startRange"):n>t&&r===n.getTime()&&d.classList.add("endRange"),r>=s&&r<=u&&d.classList.add("inRange")}(l,c)}}function te(){!ye.isOpen||ye.config.static||ye.config.inline||oe()}function ne(e){return function(t){var n=ye.config["_"+e+"Date"]=ye.parseDate(t),a=ye.config["_"+("min"===e?"max":"min")+"Date"];void 0!==n&&(ye["min"===e?"minDateHasTime":"maxDateHasTime"]=n.getHours()>0||n.getMinutes()>0||n.getSeconds()>0),ye.selectedDates&&(ye.selectedDates=ye.selectedDates.filter(function(e){return Q(e)}),ye.selectedDates.length||"min"!==e||k(n),Ce()),ye.daysContainer&&(re(),void 0!==n?ye.currentYearElement[e]=n.getFullYear().toString():ye.currentYearElement.removeAttribute(e),ye.currentYearElement.disabled=!!a&&void 0!==n&&a.getFullYear()===n.getFullYear())}}function ae(){var e=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange"];ye.config=s({},b.defaultConfig);var n=s({},d,JSON.parse(JSON.stringify(c.dataset||{}))),a={};Object.defineProperty(ye.config,"enable",{get:function(){return ye.config._enable||[]},set:function(e){ye.config._enable=de(e)}}),Object.defineProperty(ye.config,"disable",{get:function(){return ye.config._disable||[]},set:function(e){ye.config._disable=de(e)}}),!n.dateFormat&&n.enableTime&&(a.dateFormat=n.noCalendar?"H:i"+(n.enableSeconds?":S":""):b.defaultConfig.dateFormat+" H:i"+(n.enableSeconds?":S":"")),n.altInput&&n.enableTime&&!n.altFormat&&(a.altFormat=n.noCalendar?"h:i"+(n.enableSeconds?":S K":" K"):b.defaultConfig.altFormat+" h:i"+(n.enableSeconds?":S":"")+" K"),Object.defineProperty(ye.config,"minDate",{get:function(){return ye.config._minDate},set:ne("min")}),Object.defineProperty(ye.config,"maxDate",{get:function(){return ye.config._maxDate},set:ne("max")}),Object.assign(ye.config,a,n);for(i=0;i<e.length;i++)ye.config[e[i]]=!0===ye.config[e[i]]||"true"===ye.config[e[i]];for(i=t.length;i--;)void 0!==ye.config[t[i]]&&(ye.config[t[i]]=v(ye.config[t[i]]||[]).map(g));for(var i=0;i<ye.config.plugins.length;i++){var o=ye.config.plugins[i](ye)||{};for(var r in o)~t.indexOf(r)?ye.config[r]=v(o[r]).map(g).concat(ye.config[r]):void 0===n[r]&&(ye.config[r]=o[r])}ye.isMobile=!ye.config.disableMobile&&!ye.config.inline&&"single"===ye.config.mode&&!ye.config.disable.length&&!ye.config.enable.length&&!ye.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),ge("onParseConfig")}function ie(){"object"!=typeof ye.config.locale&&void 0===b.l10ns[ye.config.locale]&&console.warn("flatpickr: invalid locale "+ye.config.locale),ye.l10n=s({},b.l10ns.default,"object"==typeof ye.config.locale?ye.config.locale:"default"!==ye.config.locale?b.l10ns[ye.config.locale]:void 0)}function oe(e){if(void 0===e&&(e=ye._positionElement),void 0!==ye.calendarContainer){var t=ye.calendarContainer.offsetHeight,n=ye.calendarContainer.offsetWidth,i=ye.config.position,o=e.getBoundingClientRect(),r=window.innerHeight-o.bottom,l="above"===i||"below"!==i&&r<t&&o.top>t,c=window.pageYOffset+o.top+(l?-t-2:e.offsetHeight+2);if(a(ye.calendarContainer,"arrowTop",!l),a(ye.calendarContainer,"arrowBottom",l),!ye.config.inline){var d=window.pageXOffset+o.left,s=window.document.body.offsetWidth-o.right,u=d+n>window.document.body.offsetWidth;a(ye.calendarContainer,"rightMost",u),ye.config.static||(ye.calendarContainer.style.top=c+"px",u?(ye.calendarContainer.style.left="auto",ye.calendarContainer.style.right=s+"px"):(ye.calendarContainer.style.left=d+"px",ye.calendarContainer.style.right="auto"))}}}function re(){ye.config.noCalendar||ye.isMobile||($(),De(),J())}function le(t){t.preventDefault(),t.stopPropagation();var n=r(t.target,function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("disabled")&&!e.classList.contains("notAllowed")});if(void 0!==n){var a=n,i=ye.latestSelectedDateObj=new Date(a.dateObj.getTime()),o=i.getMonth()!==ye.currentMonth&&"range"!==ye.config.mode;if(ye.selectedDateElem=a,"single"===ye.config.mode)ye.selectedDates=[i];else if("multiple"===ye.config.mode){var l=he(i);l?ye.selectedDates.splice(parseInt(l),1):ye.selectedDates.push(i)}else"range"===ye.config.mode&&(2===ye.selectedDates.length&&ye.clear(),ye.selectedDates.push(i),0!==e(i,ye.selectedDates[0],!0)&&ye.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));if(E(),o){var c=ye.currentYear!==i.getFullYear();ye.currentYear=i.getFullYear(),ye.currentMonth=i.getMonth(),c&&ge("onYearChange"),ge("onMonthChange")}if(J(),ye.config.minDate&&ye.minDateHasTime&&ye.config.enableTime&&0===e(i,ye.config.minDate)&&k(ye.config.minDate),Ce(),ye.config.enableTime&&setTimeout(function(){return ye.showTimeInput=!0},50),"range"===ye.config.mode&&(1===ye.selectedDates.length?(ee(a),ye._hidePrevMonthArrow=ye._hidePrevMonthArrow||void 0!==ye.minRangeDate&&ye.minRangeDate>ye.days.childNodes[0].dateObj,ye._hideNextMonthArrow=ye._hideNextMonthArrow||void 0!==ye.maxRangeDate&&ye.maxRangeDate<new Date(ye.currentYear,ye.currentMonth+1,1)):De()),ge("onChange"),o?B(function(){return ye.selectedDateElem&&ye.selectedDateElem.focus()}):W(a.$i,0),void 0!==ye.hourElement&&setTimeout(function(){return void 0!==ye.hourElement&&ye.hourElement.select()},451),ye.config.closeOnSelect){var d="single"===ye.config.mode&&!ye.config.enableTime,s="range"===ye.config.mode&&2===ye.selectedDates.length&&!ye.config.enableTime;(d||s)&&ye.close()}}}function ce(e,t){var n=[];if(e instanceof Array)n=e.map(function(e){return ye.parseDate(e,t)});else if(e instanceof Date||"number"==typeof e)n=[ye.parseDate(e,t)];else if("string"==typeof e)switch(ye.config.mode){case"single":n=[ye.parseDate(e,t)];break;case"multiple":n=e.split("; ").map(function(e){return ye.parseDate(e,t)});break;case"range":n=e.split(ye.l10n.rangeSeparator).map(function(e){return ye.parseDate(e,t)})}ye.selectedDates=n.filter(function(e){return e instanceof Date&&Q(e,!1)}),ye.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})}function de(e){return e.map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?ye.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:ye.parseDate(e.from,void 0),to:ye.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function se(){ye.selectedDates=[],ye.now=new Date;var e=ye.config.defaultDate||ye.input.value;e&&ce(e,ye.config.dateFormat);var t=ye.selectedDates.length?ye.selectedDates[0]:ye.config.minDate&&ye.config.minDate.getTime()>ye.now.getTime()?ye.config.minDate:ye.config.maxDate&&ye.config.maxDate.getTime()<ye.now.getTime()?ye.config.maxDate:ye.now;ye.currentYear=t.getFullYear(),ye.currentMonth=t.getMonth(),ye.selectedDates.length&&(ye.latestSelectedDateObj=ye.selectedDates[0]),ye.minDateHasTime=!!ye.config.minDate&&(ye.config.minDate.getHours()>0||ye.config.minDate.getMinutes()>0||ye.config.minDate.getSeconds()>0),ye.maxDateHasTime=!!ye.config.maxDate&&(ye.config.maxDate.getHours()>0||ye.config.maxDate.getMinutes()>0||ye.config.maxDate.getSeconds()>0),Object.defineProperty(ye,"showTimeInput",{get:function(){return ye._showTimeInput},set:function(e){ye._showTimeInput=e,ye.calendarContainer&&a(ye.calendarContainer,"showTimeInput",e),oe()}})}function ue(e,t,n){if(0===e||e){var a,i=e;if(e instanceof Date)a=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)a=new Date(e);else if("string"==typeof e){var o=t||(ye.config||b.defaultConfig).dateFormat,r=String(e).trim();if("today"===r)a=new Date,n=!0;else if(/Z$/.test(r)||/GMT$/.test(r))a=new Date(e);else if(ye.config&&ye.config.parseDate)a=ye.config.parseDate(e,o);else{a=ye.config&&ye.config.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var l=void 0,c=[],d=0,s=0,u="";d<o.length;d++){var f=o[d],m="\\"===f,g="\\"===o[d-1]||m;if(w[f]&&!g){u+=w[f];var p=new RegExp(u).exec(e);p&&(l=!0)&&c["Y"!==f?"push":"unshift"]({fn:C[f],val:p[++s]})}else m||(u+=".");c.forEach(function(e){var t=e.fn,n=e.val;return a=t(a,n,ye.l10n)||a})}a=l?a:void 0}}return a instanceof Date?(!0===n&&a.setHours(0,0,0,0),a):(console.warn("flatpickr: invalid date "+i),void console.info(ye.element))}}function fe(){ye.input=ye.config.wrap?c.querySelector("[data-input]"):c,ye.input?(ye.input._type=ye.input.type,ye.input.type="text",ye.input.classList.add("flatpickr-input"),ye._input=ye.input,ye.config.altInput&&(ye.altInput=i(ye.input.nodeName,ye.input.className+" "+ye.config.altInputClass),ye._input=ye.altInput,ye.altInput.placeholder=ye.input.placeholder,ye.altInput.disabled=ye.input.disabled,ye.altInput.required=ye.input.required,ye.altInput.type="text",ye.input.type="hidden",!ye.config.static&&ye.input.parentNode&&ye.input.parentNode.insertBefore(ye.altInput,ye.input.nextSibling)),ye.config.allowInput||ye._input.setAttribute("readonly","readonly"),ye._positionElement=ye.config.positionElement||ye._input):console.warn("Error: invalid input element specified",ye.input)}function me(){var e=ye.config.enableTime?ye.config.noCalendar?"time":"datetime-local":"date";ye.mobileInput=i("input",ye.input.className+" flatpickr-mobile"),ye.mobileInput.step=ye.input.getAttribute("step")||"any",ye.mobileInput.tabIndex=1,ye.mobileInput.type=e,ye.mobileInput.disabled=ye.input.disabled,ye.mobileInput.placeholder=ye.input.placeholder,ye.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",ye.selectedDates.length&&(ye.mobileInput.defaultValue=ye.mobileInput.value=ye.formatDate(ye.selectedDates[0],ye.mobileFormatStr)),ye.config.minDate&&(ye.mobileInput.min=ye.formatDate(ye.config.minDate,"Y-m-d")),ye.config.maxDate&&(ye.mobileInput.max=ye.formatDate(ye.config.maxDate,"Y-m-d")),ye.input.type="hidden",void 0!==ye.altInput&&(ye.altInput.type="hidden");try{ye.input.parentNode&&ye.input.parentNode.insertBefore(ye.mobileInput,ye.input.nextSibling)}catch(e){}ye.mobileInput.addEventListener("change",function(e){ye.setDate(e.target.value,!1,ye.mobileFormatStr),ge("onChange"),ge("onClose")})}function ge(e,t){var n=ye.config[e];if(void 0!==n&&n.length>0)for(var a=0;n[a]&&a<n.length;a++)n[a](ye.selectedDates,ye.input.value,ye,t);"onChange"===e&&(ye.input.dispatchEvent(pe("change")),ye.input.dispatchEvent(pe("input")))}function pe(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}function he(t){for(var n=0;n<ye.selectedDates.length;n++)if(0===e(ye.selectedDates[n],t))return""+n;return!1}function ve(t){return!("range"!==ye.config.mode||ye.selectedDates.length<2)&&(e(t,ye.selectedDates[0])>=0&&e(t,ye.selectedDates[1])<=0)}function De(){ye.config.noCalendar||ye.isMobile||!ye.monthNav||(ye.currentMonthElement.textContent=u(ye.currentMonth,ye.config.shorthandCurrentMonth,ye.l10n)+" ",ye.currentYearElement.value=ye.currentYear.toString(),ye._hidePrevMonthArrow=void 0!==ye.config.minDate&&(ye.currentYear===ye.config.minDate.getFullYear()?ye.currentMonth<=ye.config.minDate.getMonth():ye.currentYear<ye.config.minDate.getFullYear()),ye._hideNextMonthArrow=void 0!==ye.config.maxDate&&(ye.currentYear===ye.config.maxDate.getFullYear()?ye.currentMonth+1>ye.config.maxDate.getMonth():ye.currentYear>ye.config.maxDate.getFullYear()))}function Ce(e){if(void 0===e&&(e=!0),!ye.selectedDates.length)return ye.clear(e);void 0!==ye.mobileInput&&ye.mobileFormatStr&&(ye.mobileInput.value=void 0!==ye.latestSelectedDateObj?ye.formatDate(ye.latestSelectedDateObj,ye.mobileFormatStr):"");var t="range"!==ye.config.mode?ye.config.conjunction:ye.l10n.rangeSeparator;ye.input.value=ye.selectedDates.map(function(e){return ye.formatDate(e,ye.config.dateFormat)}).join(t),void 0!==ye.altInput&&(ye.altInput.value=ye.selectedDates.map(function(e){return ye.formatDate(e,ye.config.altFormat)}).join(t)),!1!==e&&ge("onValueUpdate")}function we(e){e.preventDefault();var t=ye.currentYearElement.parentNode&&ye.currentYearElement.parentNode.contains(e.target);if(e.target===ye.currentMonthElement||t){var a=n(e);t?(Z(ye.currentYear+a),e.target.value=ye.currentYear.toString()):ye.changeMonth(a,!0,!1)}}function Me(e){var t=ye.prevMonthNav.contains(e.target),n=ye.nextMonthNav.contains(e.target);t||n?z(t?-1:1):e.target===ye.currentYearElement?(e.preventDefault(),ye.currentYearElement.select()):"arrowUp"===e.target.className?ye.changeYear(ye.currentYear+1):"arrowDown"===e.target.className&&ye.changeYear(ye.currentYear-1)}function be(e){e.preventDefault();var t="keydown"===e.type,n=e.target;void 0!==ye.amPM&&e.target===ye.amPM&&(ye.amPM.textContent=ye.l10n.amPM["AM"===ye.amPM.textContent?1:0]);var a=Number(n.min),i=Number(n.max),o=Number(n.step),r=parseInt(n.value,10),l=r+o*(e.delta||(t?38===e.which?1:-1:Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY))||0));if(void 0!==n.value&&2===n.value.length){var c=n===ye.hourElement,d=n===ye.minuteElement;l<a?(l=i+l+h(!c)+(h(c)&&h(!ye.amPM)),d&&j(void 0,-1,ye.hourElement)):l>i&&(l=n===ye.hourElement?l-i-h(!ye.amPM):a,d&&j(void 0,1,ye.hourElement)),ye.amPM&&c&&(1===o?l+r===23:Math.abs(l-r)>o)&&(ye.amPM.textContent="PM"===ye.amPM.textContent?"AM":"PM"),n.value=p(l)}}var ye={};return ye.parseDate=ue,ye.formatDate=function(e,t){return void 0!==ye.config&&void 0!==ye.config.formatDate?ye.config.formatDate(e,t):t.split("").map(function(t,n,a){return M[t]&&"\\"!==a[n-1]?M[t](e,ye.l10n,ye.config):"\\"!==t?t:""}).join("")},ye._animationLoop=[],ye._handlers=[],ye._bind=T,ye._setHoursFromDate=k,ye.changeMonth=z,ye.changeYear=Z,ye.clear=function(e){void 0===e&&(e=!0),ye.input.value="",ye.altInput&&(ye.altInput.value=""),ye.mobileInput&&(ye.mobileInput.value=""),ye.selectedDates=[],ye.latestSelectedDateObj=void 0,ye.showTimeInput=!1,ye.redraw(),e&&ge("onChange")},ye.close=function(){ye.isOpen=!1,ye.isMobile||(ye.calendarContainer.classList.remove("open"),ye._input.classList.remove("active")),ge("onClose")},ye._createElement=i,ye.destroy=function(){void 0!==ye.config&&ge("onDestroy");for(var e=ye._handlers.length;e--;){var t=ye._handlers[e];t.element.removeEventListener(t.event,t.handler)}ye._handlers=[],ye.mobileInput?(ye.mobileInput.parentNode&&ye.mobileInput.parentNode.removeChild(ye.mobileInput),ye.mobileInput=void 0):ye.calendarContainer&&ye.calendarContainer.parentNode&&ye.calendarContainer.parentNode.removeChild(ye.calendarContainer),ye.altInput&&(ye.input.type="text",ye.altInput.parentNode&&ye.altInput.parentNode.removeChild(ye.altInput),delete ye.altInput),ye.input&&(ye.input.type=ye.input._type,ye.input.classList.remove("flatpickr-input"),ye.input.removeAttribute("readonly"),ye.input.value=""),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete ye[e]}catch(e){}})},ye.isEnabled=Q,ye.jumpToDate=L,ye.open=function(e,t){if(void 0===t&&(t=ye._input),ye.isMobile)return e&&(e.preventDefault(),e.target&&e.target.blur()),setTimeout(function(){void 0!==ye.mobileInput&&ye.mobileInput.click()},0),void ge("onOpen");ye._input.disabled||ye.config.inline||(ye.isOpen=!0,ye.calendarContainer.classList.add("open"),oe(t),ye._input.classList.add("active"),ge("onOpen"))},ye.redraw=re,ye.set=function(e,t){null!==e&&"object"==typeof e?Object.assign(ye.config,e):ye.config[e]=t,ye.redraw(),L()},ye.setDate=function(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=void 0),0!==e&&!e)return ye.clear(t);ce(e,n),ye.showTimeInput=ye.selectedDates.length>0,ye.latestSelectedDateObj=ye.selectedDates[0],ye.redraw(),L(),k(),Ce(t),t&&ge("onChange")},ye.toggle=function(){if(ye.isOpen)return ye.close();ye.open()},ye.element=ye.input=c,ye.isOpen=!1,ae(),ie(),fe(),se(),m(),ye.isMobile||H(),_(),(ye.selectedDates.length||ye.config.noCalendar)&&(ye.config.enableTime&&k(ye.config.noCalendar?ye.latestSelectedDateObj||ye.config.minDate:void 0),Ce(!1)),ye.showTimeInput=ye.selectedDates.length>0||ye.config.noCalendar,void 0!==ye.weekWrapper&&void 0!==ye.daysContainer&&(ye.calendarContainer.style.width=ye.daysContainer.offsetWidth+ye.weekWrapper.offsetWidth+"px"),ye.isMobile||oe(),ge("onReady"),ye}function d(e,t){for(var n=Array.prototype.slice.call(e),a=[],i=0;i<n.length;i++){var o=n[i];try{if(null!==o.getAttribute("data-fp-omit"))continue;void 0!==o._flatpickr&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=c(o,t||{}),a.push(o._flatpickr)}catch(e){console.warn(e,e.stack)}}return 1===a.length?a[0]:a}var s=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},u=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},f={DAY:864e5},m={_disable:[],_enable:[],allowInput:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enable:[],enableSeconds:!1,enableTime:!1,getWeek:function(e){var t=new Date(e.getFullYear(),0,1);return Math.ceil(((e.getTime()-t.getTime())/864e5+t.getDay()+1)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},g={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"]},p=function(e){return("0"+e).slice(-2)},h=function(e){return!0===e?1:0},v=function(e){return e instanceof Array?e:[e]},D=function(){},C={D:D,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t){e.setHours(e.getHours()%12+12*h(/pm/i.test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t){var n=parseInt(t);return new Date(e.getFullYear(),0,2+7*(n-1),0,0,0,0)},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:D,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},w:D,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},w={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"(am|AM|Am|aM|pm|PM|Pm|pM)",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},M={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[M.w(e,t,n)]},F:function(e,t,n){return u(M.n(e,t,n)-1,!1,t)},G:function(e,t,n){return p(M.h(e,t,n))},H:function(e){return p(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e){return e.getHours()>11?"PM":"AM"},M:function(e,t){return u(e.getMonth(),!0,t)},S:function(e){return p(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return e.getFullYear()},d:function(e){return p(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return p(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return p(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}};"function"!=typeof Object.assign&&(Object.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var a=0,i=t;a<i.length;a++)!function(t){t&&Object.keys(t).forEach(function(n){return e[n]=t[n]})}(i[a]);return e}),"undefined"!=typeof HTMLElement&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return d(this,e)},HTMLElement.prototype.flatpickr=function(e){return d([this],e)});var b;return b=function(e,t){return e instanceof NodeList?d(e,t):"string"==typeof e?d(window.document.querySelectorAll(e),t):d([e],t)},"object"==typeof window&&(window.flatpickr=b),b.defaultConfig=m,b.l10ns={en:s({},g),default:s({},g)},b.localize=function(e){b.l10ns.default=s({},b.l10ns.default,e)},b.setDefaults=function(e){b.defaultConfig=s({},b.defaultConfig,e)},"undefined"!=typeof jQuery&&(jQuery.fn.flatpickr=function(e){return d(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},b});
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/* flatpickr v4.0.6, @license MIT */
|
2
|
+
(function (global, factory) {
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
5
|
+
(factory((global.ar = {})));
|
6
|
+
}(this, (function (exports) { 'use strict';
|
7
|
+
|
8
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== undefined
|
9
|
+
? window.flatpickr
|
10
|
+
: {
|
11
|
+
l10ns: {},
|
12
|
+
};
|
13
|
+
var Arabic = {
|
14
|
+
weekdays: {
|
15
|
+
shorthand: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
|
16
|
+
longhand: [
|
17
|
+
"الأحد",
|
18
|
+
"الاثنين",
|
19
|
+
"الثلاثاء",
|
20
|
+
"الأربعاء",
|
21
|
+
"الخميس",
|
22
|
+
"الجمعة",
|
23
|
+
"السبت",
|
24
|
+
],
|
25
|
+
},
|
26
|
+
months: {
|
27
|
+
shorthand: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
28
|
+
longhand: [
|
29
|
+
"يناير",
|
30
|
+
"فبراير",
|
31
|
+
"مارس",
|
32
|
+
"أبريل",
|
33
|
+
"مايو",
|
34
|
+
"يونيو",
|
35
|
+
"يوليو",
|
36
|
+
"أغسطس",
|
37
|
+
"سبتمبر",
|
38
|
+
"أكتوبر",
|
39
|
+
"نوفمبر",
|
40
|
+
"ديسمبر",
|
41
|
+
],
|
42
|
+
},
|
43
|
+
};
|
44
|
+
fp.l10ns.ar = Arabic;
|
45
|
+
var ar = fp.l10ns;
|
46
|
+
|
47
|
+
exports.Arabic = Arabic;
|
48
|
+
exports['default'] = ar;
|
49
|
+
|
50
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
51
|
+
|
52
|
+
})));
|