fae-railsz 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +5 -0
- data/Rakefile +37 -0
- data/app/assets/fonts/fae/icons.eot +0 -0
- data/app/assets/fonts/fae/icons.svg +56 -0
- data/app/assets/fonts/fae/icons.ttf +0 -0
- data/app/assets/fonts/fae/icons.woff +0 -0
- data/app/assets/fonts/fae/lato-bold-webfont.eot +0 -0
- data/app/assets/fonts/fae/lato-bold-webfont.svg +4551 -0
- data/app/assets/fonts/fae/lato-bold-webfont.ttf +0 -0
- data/app/assets/fonts/fae/lato-bold-webfont.woff +0 -0
- data/app/assets/fonts/fae/lato-light-webfont.eot +0 -0
- data/app/assets/fonts/fae/lato-light-webfont.svg +4241 -0
- data/app/assets/fonts/fae/lato-light-webfont.ttf +0 -0
- data/app/assets/fonts/fae/lato-light-webfont.woff +0 -0
- data/app/assets/fonts/fae/lato-regular-webfont.eot +0 -0
- data/app/assets/fonts/fae/lato-regular-webfont.svg +4241 -0
- data/app/assets/fonts/fae/lato-regular-webfont.ttf +0 -0
- data/app/assets/fonts/fae/lato-regular-webfont.woff +0 -0
- data/app/assets/fonts/fae/selection.json +1334 -0
- data/app/assets/images/fae/error_bg.jpg +0 -0
- data/app/assets/images/fae/error_sad_face.png +0 -0
- data/app/assets/images/fae/icons/alert.svg +9 -0
- data/app/assets/images/fae/icons/arrow_down.svg +8 -0
- data/app/assets/images/fae/icons/arrow_left.svg +9 -0
- data/app/assets/images/fae/icons/arrow_right.svg +9 -0
- data/app/assets/images/fae/icons/arrow_stacked.svg +8 -0
- data/app/assets/images/fae/icons/arrow_up.svg +8 -0
- data/app/assets/images/fae/icons/calendar.svg +17 -0
- data/app/assets/images/fae/icons/check.svg +7 -0
- data/app/assets/images/fae/icons/checkmark.svg +8 -0
- data/app/assets/images/fae/icons/chevron_down.svg +7 -0
- data/app/assets/images/fae/icons/chevron_left.svg +10 -0
- data/app/assets/images/fae/icons/chevron_right.svg +10 -0
- data/app/assets/images/fae/icons/chevron_up.svg +7 -0
- data/app/assets/images/fae/icons/delete.svg +8 -0
- data/app/assets/images/fae/icons/delete_x.svg +8 -0
- data/app/assets/images/fae/icons/edit.svg +11 -0
- data/app/assets/images/fae/icons/handle.svg +13 -0
- data/app/assets/images/fae/icons/home.svg +10 -0
- data/app/assets/images/fae/icons/logout.svg +12 -0
- data/app/assets/images/fae/icons/magnifying_glass.svg +10 -0
- data/app/assets/images/fae/icons/menu.svg +11 -0
- data/app/assets/images/fae/icons/offlink.svg +25 -0
- data/app/assets/images/fae/icons/plus.svg +8 -0
- data/app/assets/images/fae/icons/pulldown.svg +11 -0
- data/app/assets/images/fae/icons/search.svg +11 -0
- data/app/assets/images/fae/icons/settings.svg +12 -0
- data/app/assets/images/fae/icons/sort.svg +11 -0
- data/app/assets/images/fae/icons/support.svg +15 -0
- data/app/assets/images/fae/icons/trash.svg +10 -0
- data/app/assets/images/fae/icons/trumbowyg.svg +1 -0
- data/app/assets/images/fae/icons/user.svg +13 -0
- data/app/assets/images/fae/icons/users.svg +19 -0
- data/app/assets/images/fae/icons/zoom.svg +12 -0
- data/app/assets/images/fae/tutorial_model_location.png +0 -0
- data/app/assets/images/fae/youtube_helper.jpg +0 -0
- data/app/assets/javascripts/fae/_modals.js +60 -0
- data/app/assets/javascripts/fae/_tables.js +403 -0
- data/app/assets/javascripts/fae/admin.js.erb +11 -0
- data/app/assets/javascripts/fae/application.js +63 -0
- data/app/assets/javascripts/fae/fae_init.js +8 -0
- data/app/assets/javascripts/fae/form/_ajax.js +380 -0
- data/app/assets/javascripts/fae/form/_cancel.js +38 -0
- data/app/assets/javascripts/fae/form/_filtering.js +276 -0
- data/app/assets/javascripts/fae/form/_form.js +60 -0
- data/app/assets/javascripts/fae/form/_slugger.js.erb +100 -0
- data/app/assets/javascripts/fae/form/_validator.js +459 -0
- data/app/assets/javascripts/fae/form/fae_chosen.js +44 -0
- data/app/assets/javascripts/fae/form/fileinputer.js +178 -0
- data/app/assets/javascripts/fae/form/hinter.js +111 -0
- data/app/assets/javascripts/fae/form/inputs/_checkbox.js +27 -0
- data/app/assets/javascripts/fae/form/inputs/_color.js +42 -0
- data/app/assets/javascripts/fae/form/inputs/_dates.js +78 -0
- data/app/assets/javascripts/fae/form/inputs/_select.js +162 -0
- data/app/assets/javascripts/fae/form/inputs/_text.js +118 -0
- data/app/assets/javascripts/fae/navigation/_global_search.js +184 -0
- data/app/assets/javascripts/fae/navigation/_language.js +89 -0
- data/app/assets/javascripts/fae/navigation/_navigation.js +206 -0
- data/app/assets/javascripts/fae/navigation/_subnav_highlighter.js +81 -0
- data/app/assets/javascripts/fae/navigation/sticky.js +186 -0
- data/app/assets/javascripts/fae/vendor/chosen.jquery.min.js +2 -0
- data/app/assets/javascripts/fae/vendor/frob_core_helpers.js +587 -0
- data/app/assets/javascripts/fae/vendor/fryr.js +437 -0
- data/app/assets/javascripts/fae/vendor/jqColorPicker.min.js +4 -0
- data/app/assets/javascripts/fae/vendor/jquery.daterangepicker.js +1292 -0
- data/app/assets/javascripts/fae/vendor/jquery.multi-select.js +534 -0
- data/app/assets/javascripts/fae/vendor/jquery.simplemodal.1.4.4.js +719 -0
- data/app/assets/javascripts/fae/vendor/jquery.tablesorter.js +1901 -0
- data/app/assets/javascripts/fae/vendor/js.cookie.js +139 -0
- data/app/assets/javascripts/fae/vendor/moment.min.js +7 -0
- data/app/assets/javascripts/fae/vendor/simplemde.min.js +13 -0
- data/app/assets/javascripts/fae/vendor/touch_punch.js +11 -0
- data/app/assets/javascripts/fae/vendor/trumbowyg.js.erb +4 -0
- data/app/assets/javascripts/fae/vendor/trumbowyg/plugins/upload/trumbowyg.upload.js +223 -0
- data/app/assets/javascripts/fae/vendor/trumbowyg/trumbowyg.js +1603 -0
- data/app/assets/stylesheets/fae/application.css +8 -0
- data/app/assets/stylesheets/fae/base.scss +82 -0
- data/app/assets/stylesheets/fae/globals/_fonts.scss +43 -0
- data/app/assets/stylesheets/fae/globals/_icons.scss +15 -0
- data/app/assets/stylesheets/fae/globals/_plugins.scss +51 -0
- data/app/assets/stylesheets/fae/globals/_tags.scss +68 -0
- data/app/assets/stylesheets/fae/globals/imports/_extends.scss +53 -0
- data/app/assets/stylesheets/fae/globals/imports/_mixins.scss +58 -0
- data/app/assets/stylesheets/fae/globals/imports/_variables.scss +165 -0
- data/app/assets/stylesheets/fae/globals/imports/finescss/_fine.scss +7 -0
- data/app/assets/stylesheets/fae/globals/imports/finescss/_fine_functions.scss +88 -0
- data/app/assets/stylesheets/fae/globals/imports/finescss/_fine_mixins.scss +280 -0
- data/app/assets/stylesheets/fae/globals/imports/finescss/_fine_variables.scss +30 -0
- data/app/assets/stylesheets/fae/globals/layout/_base.scss +48 -0
- data/app/assets/stylesheets/fae/globals/layout/_breadcrumbs.scss +45 -0
- data/app/assets/stylesheets/fae/globals/layout/_content-header.scss +99 -0
- data/app/assets/stylesheets/fae/globals/legacy/_pre-1.3.scss +659 -0
- data/app/assets/stylesheets/fae/globals/navigation/_base.scss +22 -0
- data/app/assets/stylesheets/fae/globals/navigation/_footer.scss +50 -0
- data/app/assets/stylesheets/fae/globals/navigation/_header.scss +149 -0
- data/app/assets/stylesheets/fae/globals/navigation/_mobilenav.scss +149 -0
- data/app/assets/stylesheets/fae/globals/navigation/_search.scss +76 -0
- data/app/assets/stylesheets/fae/globals/navigation/_sidenav.scss +142 -0
- data/app/assets/stylesheets/fae/globals/navigation/_utility.scss +95 -0
- data/app/assets/stylesheets/fae/modules/_alerts.scss +50 -0
- data/app/assets/stylesheets/fae/modules/_buttons.scss +62 -0
- data/app/assets/stylesheets/fae/modules/_modal.scss +78 -0
- data/app/assets/stylesheets/fae/modules/_toggles.scss +48 -0
- data/app/assets/stylesheets/fae/modules/forms/_asset-actions.scss +83 -0
- data/app/assets/stylesheets/fae/modules/forms/_base.scss +100 -0
- data/app/assets/stylesheets/fae/modules/forms/_checkbox.scss +87 -0
- data/app/assets/stylesheets/fae/modules/forms/_colorpicker.scss +57 -0
- data/app/assets/stylesheets/fae/modules/forms/_date.scss +335 -0
- data/app/assets/stylesheets/fae/modules/forms/_hints.scss +40 -0
- data/app/assets/stylesheets/fae/modules/forms/_label.scss +57 -0
- data/app/assets/stylesheets/fae/modules/forms/_radio.scss +69 -0
- data/app/assets/stylesheets/fae/modules/forms/_select.scss +317 -0
- data/app/assets/stylesheets/fae/modules/forms/_simple-mde.scss +29 -0
- data/app/assets/stylesheets/fae/modules/forms/_text.scss +62 -0
- data/app/assets/stylesheets/fae/modules/forms/_textarea.scss +16 -0
- data/app/assets/stylesheets/fae/modules/forms/_validation.scss +63 -0
- data/app/assets/stylesheets/fae/modules/tables/_actions.scss +41 -0
- data/app/assets/stylesheets/fae/modules/tables/_base.scss +63 -0
- data/app/assets/stylesheets/fae/modules/tables/_collapsible.scss +76 -0
- data/app/assets/stylesheets/fae/modules/tables/_filters.scss +61 -0
- data/app/assets/stylesheets/fae/modules/tables/_image.scss +21 -0
- data/app/assets/stylesheets/fae/modules/tables/_pagination.scss +34 -0
- data/app/assets/stylesheets/fae/modules/tables/_sorting.scss +58 -0
- data/app/assets/stylesheets/fae/modules/tables/_sticky.scss +9 -0
- data/app/assets/stylesheets/fae/modules/tables/_tooltips.scss +24 -0
- data/app/assets/stylesheets/fae/pages/_error.scss +35 -0
- data/app/assets/stylesheets/fae/pages/_help.scss +28 -0
- data/app/assets/stylesheets/fae/pages/_home.scss +18 -0
- data/app/assets/stylesheets/fae/pages/_login.scss +137 -0
- data/app/assets/stylesheets/fae/vendor/chosen.css +377 -0
- data/app/assets/stylesheets/fae/vendor/daterangepicker.css +227 -0
- data/app/assets/stylesheets/fae/vendor/reset.css +48 -0
- data/app/assets/stylesheets/fae/vendor/simplemde.min.css +7 -0
- data/app/assets/stylesheets/fae/vendor/trumbowyg.css +584 -0
- data/app/controllers/concerns/fae/application_controller_concern.rb +1 -0
- data/app/controllers/concerns/fae/asset_cloner.rb +46 -0
- data/app/controllers/concerns/fae/cloneable.rb +136 -0
- data/app/controllers/fae/application_controller.rb +123 -0
- data/app/controllers/fae/base_controller.rb +117 -0
- data/app/controllers/fae/files_controller.rb +26 -0
- data/app/controllers/fae/images_controller.rb +37 -0
- data/app/controllers/fae/nested_base_controller.rb +100 -0
- data/app/controllers/fae/options_controller.rb +29 -0
- data/app/controllers/fae/pages_controller.rb +44 -0
- data/app/controllers/fae/setup_controller.rb +54 -0
- data/app/controllers/fae/static_pages_controller.rb +54 -0
- data/app/controllers/fae/users_controller.rb +71 -0
- data/app/controllers/fae/utilities_controller.rb +61 -0
- data/app/helpers/fae/application_helper.rb +114 -0
- data/app/helpers/fae/fae_helper.rb +6 -0
- data/app/helpers/fae/form_helper.rb +240 -0
- data/app/helpers/fae/nested_form_helper.rb +39 -0
- data/app/helpers/fae/view_helper.rb +175 -0
- data/app/inputs/date_range_input.rb +17 -0
- data/app/inputs/radio_collection_input.rb +17 -0
- data/app/inputs/symbol_input.rb +5 -0
- data/app/models/concerns/fae/assets_validatable.rb +12 -0
- data/app/models/concerns/fae/authorization_concern.rb +12 -0
- data/app/models/concerns/fae/base_model_concern.rb +105 -0
- data/app/models/concerns/fae/change_concern.rb +1 -0
- data/app/models/concerns/fae/file_concern.rb +1 -0
- data/app/models/concerns/fae/image_concern.rb +1 -0
- data/app/models/concerns/fae/navigation_concern.rb +10 -0
- data/app/models/concerns/fae/option_concern.rb +1 -0
- data/app/models/concerns/fae/page_validatable.rb +26 -0
- data/app/models/concerns/fae/paper_trailer.rb +8 -0
- data/app/models/concerns/fae/role_concern.rb +1 -0
- data/app/models/concerns/fae/sortable.rb +51 -0
- data/app/models/concerns/fae/static_page_concern.rb +1 -0
- data/app/models/concerns/fae/text_area_concern.rb +1 -0
- data/app/models/concerns/fae/text_field_concern.rb +1 -0
- data/app/models/concerns/fae/trackable.rb +124 -0
- data/app/models/concerns/fae/user_concern.rb +7 -0
- data/app/models/fae/authorization.rb +8 -0
- data/app/models/fae/change.rb +53 -0
- data/app/models/fae/file.rb +24 -0
- data/app/models/fae/image.rb +33 -0
- data/app/models/fae/navigation.rb +132 -0
- data/app/models/fae/option.rb +38 -0
- data/app/models/fae/role.rb +18 -0
- data/app/models/fae/static_page.rb +109 -0
- data/app/models/fae/text_area.rb +14 -0
- data/app/models/fae/text_field.rb +14 -0
- data/app/models/fae/user.rb +67 -0
- data/app/uploaders/fae/file_uploader.rb +26 -0
- data/app/uploaders/fae/image_uploader.rb +28 -0
- data/app/validators/fae/cross_model_uniqueness_validator.rb +14 -0
- data/app/views/devise/confirmations/new.html.slim +13 -0
- data/app/views/devise/mailer/confirmation_instructions.html.slim +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.slim +5 -0
- data/app/views/devise/mailer/unlock_instructions.html.slim +4 -0
- data/app/views/devise/passwords/edit.html.slim +10 -0
- data/app/views/devise/passwords/new.html.slim +10 -0
- data/app/views/devise/registrations/edit.html.slim +22 -0
- data/app/views/devise/registrations/new.html.slim +15 -0
- data/app/views/devise/sessions/new.html.slim +7 -0
- data/app/views/devise/shared/_links.slim +25 -0
- data/app/views/devise/unlocks/new.html.slim +13 -0
- data/app/views/fae/application/_breadcrumb.html.slim +19 -0
- data/app/views/fae/application/_content_form.html.slim +55 -0
- data/app/views/fae/application/_credit.slim +6 -0
- data/app/views/fae/application/_file_uploader.html.slim +36 -0
- data/app/views/fae/application/_flash_messages.slim +2 -0
- data/app/views/fae/application/_global_search_results.html.slim +37 -0
- data/app/views/fae/application/_header.slim +50 -0
- data/app/views/fae/application/_markdown_helper.slim +41 -0
- data/app/views/fae/application/_mobilenav.slim +66 -0
- data/app/views/fae/application/_sidenav.slim +23 -0
- data/app/views/fae/application/_user_log.html.slim +36 -0
- data/app/views/fae/images/_image_uploader.html.slim +66 -0
- data/app/views/fae/options/_form.html.slim +16 -0
- data/app/views/fae/options/edit.html.slim +1 -0
- data/app/views/fae/pages/activity_log.html.slim +32 -0
- data/app/views/fae/pages/disabled_environment.html.slim +4 -0
- data/app/views/fae/pages/error404.html.slim +7 -0
- data/app/views/fae/pages/help.html.slim +35 -0
- data/app/views/fae/pages/home.html.slim +36 -0
- data/app/views/fae/setup/first_user.html.slim +11 -0
- data/app/views/fae/shared/_errors.slim +4 -0
- data/app/views/fae/shared/_form_header.html.slim +40 -0
- data/app/views/fae/shared/_index_header.html.slim +26 -0
- data/app/views/fae/shared/_nested_table.html.slim +49 -0
- data/app/views/fae/shared/_recent_changes.html.slim +22 -0
- data/app/views/fae/shared/_shared_nested_table.html.slim +46 -0
- data/app/views/fae/static_pages/index.html.slim +13 -0
- data/app/views/fae/users/_form.html.slim +19 -0
- data/app/views/fae/users/edit.html.slim +1 -0
- data/app/views/fae/users/index.html.slim +23 -0
- data/app/views/fae/users/new.html.slim +1 -0
- data/app/views/fae/users/settings.html.slim +1 -0
- data/app/views/kaminari/fae/_gap.html.slim +8 -0
- data/app/views/kaminari/fae/_next_page.html.slim +9 -0
- data/app/views/kaminari/fae/_page.html.slim +15 -0
- data/app/views/kaminari/fae/_paginator.html.slim +15 -0
- data/app/views/kaminari/fae/_prev_page.html.slim +9 -0
- data/app/views/layouts/devise.html.slim +29 -0
- data/app/views/layouts/fae/application.html.slim +23 -0
- data/app/views/layouts/fae/error.html.slim +11 -0
- data/config/deploy.rb +73 -0
- data/config/deploy/dev.rb +19 -0
- data/config/deploy/prod.rb +19 -0
- data/config/deploy/stage.rb +19 -0
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/carrierwave.rb +3 -0
- data/config/initializers/devise.rb +258 -0
- data/config/initializers/devise_monkeypatch.rb +11 -0
- data/config/initializers/fae_judge.rb +3 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/kaminari_config.rb +10 -0
- data/config/initializers/simple_form.rb +147 -0
- data/config/initializers/time_formats.rb +3 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/devise.zh-CN.yml +59 -0
- data/config/locales/fae.en.yml +10 -0
- data/config/locales/fae.zh-CN.yml +10 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/simple_form.zh-CN.yml +26 -0
- data/config/routes.rb +46 -0
- data/db/migrate/20140809222030_add_user_table.rb +49 -0
- data/db/migrate/20140822224029_create_fae_roles.rb +10 -0
- data/db/migrate/20141008180718_create_fae_images_table.rb +19 -0
- data/db/migrate/20141017194616_create_fae_options.rb +16 -0
- data/db/migrate/20141021181327_create_fae_files.rb +17 -0
- data/db/migrate/20141021183047_create_fae_text_areas.rb +16 -0
- data/db/migrate/20141021184311_create_fae_pages.rb +13 -0
- data/db/migrate/20141105214814_create_fae_text_fields.rb +15 -0
- data/db/migrate/20150930224821_create_fae_changes.rb +17 -0
- data/lib/fae-rails.rb +6 -0
- data/lib/fae/concerns/models/base.rb +8 -0
- data/lib/fae/engine.rb +37 -0
- data/lib/fae/options.rb +35 -0
- data/lib/fae/validation_helper_collection.rb +76 -0
- data/lib/fae/version.rb +3 -0
- data/lib/file_size_validator.rb +71 -0
- data/lib/generators/fae/base_generator.rb +156 -0
- data/lib/generators/fae/controller_generator.rb +13 -0
- data/lib/generators/fae/install_generator.rb +61 -0
- data/lib/generators/fae/model_generator.rb +11 -0
- data/lib/generators/fae/nested_index_scaffold_generator.rb +36 -0
- data/lib/generators/fae/nested_scaffold_generator.rb +51 -0
- data/lib/generators/fae/page_generator.rb +65 -0
- data/lib/generators/fae/scaffold_generator.rb +15 -0
- data/lib/generators/fae/templates/assets/fae.js +6 -0
- data/lib/generators/fae/templates/assets/fae.scss +2 -0
- data/lib/generators/fae/templates/controllers/nested_index_scaffold_controller.rb +81 -0
- data/lib/generators/fae/templates/controllers/nested_scaffold_controller.rb +13 -0
- data/lib/generators/fae/templates/controllers/scaffold_controller.rb +13 -0
- data/lib/generators/fae/templates/controllers/static_pages_controller.rb +10 -0
- data/lib/generators/fae/templates/initializers/fae.rb +63 -0
- data/lib/generators/fae/templates/initializers/fae_fine.rb +51 -0
- data/lib/generators/fae/templates/initializers/judge.rb +6 -0
- data/lib/generators/fae/templates/models/concerns/authorization_concern.rb +27 -0
- data/lib/generators/fae/templates/models/concerns/navigation_concern.rb +33 -0
- data/lib/generators/fae/templates/models/pages_model.rb +14 -0
- data/lib/generators/fae/templates/tasks/fae_tasks.rake +19 -0
- data/lib/generators/fae/templates/views/_form.html.slim +18 -0
- data/lib/generators/fae/templates/views/_form_index_nested.html.slim +13 -0
- data/lib/generators/fae/templates/views/_form_nested.html.slim +17 -0
- data/lib/generators/fae/templates/views/edit.html.slim +1 -0
- data/lib/generators/fae/templates/views/edit_nested.html.slim +3 -0
- data/lib/generators/fae/templates/views/index.html.slim +35 -0
- data/lib/generators/fae/templates/views/index_nested.html.slim +8 -0
- data/lib/generators/fae/templates/views/new.html.slim +1 -0
- data/lib/generators/fae/templates/views/new_nested.html.slim +3 -0
- data/lib/generators/fae/templates/views/static_page_form.html.slim +15 -0
- data/lib/generators/fae/templates/views/table_nested.html.slim +4 -0
- metadata +692 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/* global Fae, multiSelect, fae_chosen */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fae form select
|
|
5
|
+
* @namespace form.select
|
|
6
|
+
* @memberof form
|
|
7
|
+
*/
|
|
8
|
+
Fae.form.select = {
|
|
9
|
+
|
|
10
|
+
init: function() {
|
|
11
|
+
this.multiselectOrChosen();
|
|
12
|
+
this.multiselectChosenActions();
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Initialize multi select fields or regular select fields and add appropriate available/added item helper text
|
|
17
|
+
*/
|
|
18
|
+
multiselectOrChosen: function() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
var availableItemsStr = ' Available Items';
|
|
21
|
+
var addedItemsStr = ' Added Items';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* On selection change, update items left and currently added
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
function updateMultiselectHeader() {
|
|
28
|
+
var $instance = $(this)[0];
|
|
29
|
+
$('.ms-selectable .custom-header').text( $instance.$selectableContainer.find($instance.elemsSelector).length + availableItemsStr);
|
|
30
|
+
$('.ms-selection .custom-header').text( $instance.$selectionContainer.find($instance.elemsSelector).length + addedItemsStr);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$('select').each(function(index, elm){
|
|
34
|
+
var $this = $(this);
|
|
35
|
+
|
|
36
|
+
if ($this.hasClass('multiselect')) {
|
|
37
|
+
$this.multiSelect({
|
|
38
|
+
selectableHeader: '<div class="custom-header"></div>',
|
|
39
|
+
selectionHeader: '<div class="custom-header"></div>',
|
|
40
|
+
afterSelect: function(values) {
|
|
41
|
+
updateMultiselectHeader.call(this);
|
|
42
|
+
},
|
|
43
|
+
afterDeselect: function(values) {
|
|
44
|
+
updateMultiselectHeader.call(this);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
var selectableCount = $this.next('.ms-container').find('.ms-selectable li').not('.ms-selected').length
|
|
49
|
+
var selectedCount = $this.next('.ms-container').find('.ms-selection .ms-selected').length;
|
|
50
|
+
|
|
51
|
+
$('.ms-selectable .custom-header').text(selectableCount + availableItemsStr);
|
|
52
|
+
$('.ms-selection .custom-header').text(selectedCount + addedItemsStr);
|
|
53
|
+
|
|
54
|
+
} else {
|
|
55
|
+
$this.fae_chosen();
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Adds functionality for Select All and Deselect All multiselect options
|
|
63
|
+
*/
|
|
64
|
+
multiselectChosenActions: function() {
|
|
65
|
+
var query_input_select = '.input.select';
|
|
66
|
+
// Ignore select elements with .multiselect classes, because these are used for a different widget
|
|
67
|
+
var query_eligible_multiselects = query_input_select + ' select[multiple]:not(.multiselect)';
|
|
68
|
+
var select_all_value = 'multiselect_action-select_all';
|
|
69
|
+
|
|
70
|
+
var $eligible_multiselects = $(query_eligible_multiselects);
|
|
71
|
+
$eligible_multiselects.each(function(index, element) {
|
|
72
|
+
var $element = $(element);
|
|
73
|
+
var $options = $element.find('option');
|
|
74
|
+
var $chosen = $('#' + $element.attr('id') + '_chosen');
|
|
75
|
+
|
|
76
|
+
// Ignore if select doesn't have enough options to warrant additional actions
|
|
77
|
+
if ($options.length < 2) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Insert Select All btn above select
|
|
82
|
+
var $label = $element.closest(query_input_select).find('label:first');
|
|
83
|
+
var $deselect_all_action = $('<div/>', {
|
|
84
|
+
class: 'multiselect-action_wrap',
|
|
85
|
+
html: $('<div/>', {
|
|
86
|
+
class: 'js-multiselect-action-deselect_all multiselect-action-deselect_all multiselect-action',
|
|
87
|
+
html: $('<a/>', {
|
|
88
|
+
href: '#',
|
|
89
|
+
tabindex: '-1',
|
|
90
|
+
html: 'Deselect All'
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Add actions to wraper
|
|
96
|
+
$deselect_all_action.insertAfter($chosen);
|
|
97
|
+
|
|
98
|
+
// Add special "Select All" option and notify Chosen of new option
|
|
99
|
+
addSelectAllOption($element)
|
|
100
|
+
|
|
101
|
+
// Mark label wrapper as having multiselect actions for styling
|
|
102
|
+
$label.addClass('has-multiselect-actions');
|
|
103
|
+
|
|
104
|
+
// Enable or disable multiselect actions based on select state
|
|
105
|
+
setAbilities($element);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Watch select for changes and add, remove, or carry out Select All option as needed
|
|
109
|
+
$('#js-main-content').on('change', query_eligible_multiselects, function(e) {
|
|
110
|
+
var $element = $(e.currentTarget);
|
|
111
|
+
|
|
112
|
+
// Set state of possible actions
|
|
113
|
+
setAbilities($element);
|
|
114
|
+
|
|
115
|
+
// Intercept selections of the Select All option and select all other options.
|
|
116
|
+
var requesting_select_all = $element.val() && $element.val().indexOf(select_all_value) !== -1;
|
|
117
|
+
if (requesting_select_all) {
|
|
118
|
+
setAllOptionsSelected($element, true);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Handle click on Deselect All btn
|
|
123
|
+
$('#js-main-content').on('click', '.js-multiselect-action-deselect_all', function(e) {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
setAllOptionsSelected(this, false);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Enable or disable actions based on state
|
|
129
|
+
function setAbilities($element) {
|
|
130
|
+
var $deselect_all = $('.js-multiselect-action-deselect_all');
|
|
131
|
+
|
|
132
|
+
// Only allow deselects when options are selected
|
|
133
|
+
if ($element.find('option:selected').length) {
|
|
134
|
+
$deselect_all.show();
|
|
135
|
+
} else {
|
|
136
|
+
$deselect_all.hide();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Add special "Select All" option
|
|
141
|
+
function addSelectAllOption($element) {
|
|
142
|
+
var $select_all_option = $('<option />', {
|
|
143
|
+
value: select_all_value,
|
|
144
|
+
text: 'SELECT ALL'
|
|
145
|
+
});
|
|
146
|
+
$select_all_option.prependTo($element);
|
|
147
|
+
$element.trigger('chosen:updated');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Mark all options as selected or not
|
|
151
|
+
function setAllOptionsSelected(select, state) {
|
|
152
|
+
var $select = $(select).closest(query_input_select).find('select');
|
|
153
|
+
// Set selection state per provided state boolean
|
|
154
|
+
$select.find('option').prop('selected', state);
|
|
155
|
+
// Always ignore magic Select All btn
|
|
156
|
+
$select.find('option[value="' + select_all_value + '"]').prop('selected', false);
|
|
157
|
+
$select.trigger('chosen:updated');
|
|
158
|
+
$select.trigger('change');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* global Fae, SimpleMDE, toolbarBuiltInButtons */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fae form text
|
|
5
|
+
* @namespace form.text
|
|
6
|
+
* @memberof form
|
|
7
|
+
*/
|
|
8
|
+
Fae.form.text = {
|
|
9
|
+
init: function() {
|
|
10
|
+
this.overrideMarkdownDefaults();
|
|
11
|
+
this.initMarkdown();
|
|
12
|
+
this.initHTML();
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Override SimpleMDE's preference for font-awesome icons and use a modal for the guide
|
|
17
|
+
* @see {@link modals.markdownModal}
|
|
18
|
+
*/
|
|
19
|
+
overrideMarkdownDefaults: function() {
|
|
20
|
+
toolbarBuiltInButtons['bold'].className = 'icon-bold';
|
|
21
|
+
toolbarBuiltInButtons['italic'].className = 'icon-italic';
|
|
22
|
+
toolbarBuiltInButtons['heading'].className = 'icon-font';
|
|
23
|
+
toolbarBuiltInButtons['code'].className = 'icon-code';
|
|
24
|
+
toolbarBuiltInButtons['unordered-list'].className = 'icon-list-ul';
|
|
25
|
+
toolbarBuiltInButtons['ordered-list'].className = 'icon-list-ol';
|
|
26
|
+
toolbarBuiltInButtons['link'].className = 'icon-link';
|
|
27
|
+
toolbarBuiltInButtons['image'].className = 'icon-image';
|
|
28
|
+
toolbarBuiltInButtons['quote'].className = 'icon-quote';
|
|
29
|
+
toolbarBuiltInButtons['fullscreen'].className = 'icon-fullscreen no-disable no-mobile';
|
|
30
|
+
toolbarBuiltInButtons['horizontal-rule'].className = 'icon-minus';
|
|
31
|
+
toolbarBuiltInButtons['preview'].className = 'icon-eye no-disable';
|
|
32
|
+
toolbarBuiltInButtons['side-by-side'].className = 'icon-columns no-disable no-mobile';
|
|
33
|
+
toolbarBuiltInButtons['guide'].className = 'icon-question';
|
|
34
|
+
|
|
35
|
+
// Override SimpleMDE's default guide and use a homegrown modal
|
|
36
|
+
toolbarBuiltInButtons['guide'].action = Fae.modals.markdownModal;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Find all markdown fields and initialize them with a markdown GUI
|
|
41
|
+
* @has_test {features/form_helpers/fae_input_spec.rb}
|
|
42
|
+
*/
|
|
43
|
+
initMarkdown: function() {
|
|
44
|
+
$('.js-markdown-editor:not(.mde-enabled)').each(function() {
|
|
45
|
+
var $this = $(this);
|
|
46
|
+
|
|
47
|
+
var editor = new SimpleMDE({
|
|
48
|
+
element: this,
|
|
49
|
+
autoDownloadFontAwesome: false,
|
|
50
|
+
status: false,
|
|
51
|
+
spellChecker: false,
|
|
52
|
+
hideIcons: ['image', 'side-by-side', 'fullscreen', 'preview']
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Disable tabbing within editor
|
|
56
|
+
editor.codemirror.options.extraKeys['Tab'] = false;
|
|
57
|
+
editor.codemirror.options.extraKeys['Shift-Tab'] = false;
|
|
58
|
+
|
|
59
|
+
$this.addClass('mde-enabled');
|
|
60
|
+
|
|
61
|
+
// code mirror events to hook into current form element functions
|
|
62
|
+
editor.codemirror.on('change', function(){
|
|
63
|
+
// updates the original textarea's value for JS validations
|
|
64
|
+
$this.val(editor.value());
|
|
65
|
+
// update length counter
|
|
66
|
+
Fae.form.validator.length_counter.updateCounter($this);
|
|
67
|
+
});
|
|
68
|
+
editor.codemirror.on('focus', function(){
|
|
69
|
+
$this.parent().addClass('mde-focus');
|
|
70
|
+
});
|
|
71
|
+
editor.codemirror.on('blur', function(){
|
|
72
|
+
// trigger blur on the original textarea to trigger JS validations
|
|
73
|
+
$this.blur();
|
|
74
|
+
$this.parent().removeClass('mde-focus');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Find all HTML fields and initialize them with a wysiwyg GUI
|
|
81
|
+
* @has_test {features/form_helpers/fae_input_spec.rb}
|
|
82
|
+
*/
|
|
83
|
+
initHTML: function() {
|
|
84
|
+
var $html_editors = $('.js-html-editor');
|
|
85
|
+
if(!$html_editors.length) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
$html_editors.trumbowyg({
|
|
89
|
+
btnsDef: {
|
|
90
|
+
image: {
|
|
91
|
+
dropdown: ['insertImage', 'upload', 'base64', 'noEmbed'],
|
|
92
|
+
ico: 'insertImage'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
btns: [
|
|
96
|
+
['viewHTML'],
|
|
97
|
+
['undo', 'redo'],
|
|
98
|
+
['formatting'],
|
|
99
|
+
'btnGrp-design',
|
|
100
|
+
['link'],
|
|
101
|
+
['image'],
|
|
102
|
+
'btnGrp-justify',
|
|
103
|
+
'btnGrp-lists',
|
|
104
|
+
['foreColor', 'backColor'],
|
|
105
|
+
['preformatted'],
|
|
106
|
+
['horizontalRule'],
|
|
107
|
+
['fullscreen']
|
|
108
|
+
],
|
|
109
|
+
plugins: {
|
|
110
|
+
upload: {
|
|
111
|
+
serverPath: '/admin/html_embedded_image',
|
|
112
|
+
fileFieldName: 'image'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
resetCss: true
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/* global Fae, FCH */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fae global search
|
|
5
|
+
* @namespace global_search
|
|
6
|
+
* @memberof Fae
|
|
7
|
+
*/
|
|
8
|
+
Fae.navigation.global_search = {
|
|
9
|
+
|
|
10
|
+
init: function() {
|
|
11
|
+
this.$wrapper = $('#js-utility-search-wrapper');
|
|
12
|
+
this.$input = $('#js-global-search');
|
|
13
|
+
|
|
14
|
+
this.utilitySearch();
|
|
15
|
+
this.searchListener();
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Click event of the admin search in the main nav
|
|
20
|
+
*/
|
|
21
|
+
utilitySearch: function() {
|
|
22
|
+
var _this = this;
|
|
23
|
+
var $header = $('#js-main-header');
|
|
24
|
+
var timer;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Hide search menu, unbind listener, and blur the input
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
function hideSearch() {
|
|
31
|
+
_this.$wrapper.data('hover', 0);
|
|
32
|
+
_this.$wrapper.hide();
|
|
33
|
+
_this.$input.blur();
|
|
34
|
+
// Avoid duplicate/rapid bindings
|
|
35
|
+
$header.off('mouseleave', hideSearch);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// If user leaves search, remove menu
|
|
39
|
+
_this.$wrapper.on('mouseleave', hideSearch);
|
|
40
|
+
|
|
41
|
+
// Search mouseover effects
|
|
42
|
+
$('#js-utility-search')
|
|
43
|
+
// Ensure that the cursor is over the search menu after timeout
|
|
44
|
+
.hover(function() {
|
|
45
|
+
_this.$wrapper.data('hover', 1);
|
|
46
|
+
}, function() {
|
|
47
|
+
_this.$wrapper.data('hover', 0);
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
.mouseover(function() {
|
|
51
|
+
// Reset timeout
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
$header.on('mouseleave', hideSearch);
|
|
54
|
+
|
|
55
|
+
// Hover intent
|
|
56
|
+
// If user gets from header to search within .8s, they can pass over other icons
|
|
57
|
+
// but after .8s, the search menu will disappear if they leave the area
|
|
58
|
+
timer = setTimeout(function() {
|
|
59
|
+
$header.off('mouseleave', hideSearch);
|
|
60
|
+
|
|
61
|
+
// If cursor is no long on search, collapse it
|
|
62
|
+
if ( !_this.$wrapper.data('hover') ) {
|
|
63
|
+
hideSearch();
|
|
64
|
+
}
|
|
65
|
+
}, 800);
|
|
66
|
+
|
|
67
|
+
_this.$wrapper.show();
|
|
68
|
+
_this.$input.focus();
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Applies keyup listener on search input to handle live results and navigation
|
|
74
|
+
*/
|
|
75
|
+
searchListener: function() {
|
|
76
|
+
var _this = this;
|
|
77
|
+
// shift, ctrl, alt, caps
|
|
78
|
+
var ignored_keycodes = [16, 17, 18, 20];
|
|
79
|
+
// left, up, right, down
|
|
80
|
+
var arrow_keycodes = [37, 38, 39, 40];
|
|
81
|
+
|
|
82
|
+
_this.$input.on('keyup', function(ev) {
|
|
83
|
+
// handle arrow keys
|
|
84
|
+
if (arrow_keycodes.indexOf(ev.keyCode) > -1) {
|
|
85
|
+
_this.moveSelection(ev.keyCode);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// handle enter key
|
|
90
|
+
if (ev.keyCode === 13) {
|
|
91
|
+
// if there's a highlighted result, redirect to its href
|
|
92
|
+
var $current_link = $('.js-search-results a.-current');
|
|
93
|
+
if ($current_link.length) {
|
|
94
|
+
window.location = $current_link.attr('href');
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ignore keys that won't change the result set
|
|
100
|
+
if (ignored_keycodes.indexOf(ev.keyCode) > -1) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// otherwise update the live search
|
|
105
|
+
var val = _this.$input.val();
|
|
106
|
+
var post_url = Fae.path + '/search/' + val;
|
|
107
|
+
|
|
108
|
+
// Match only values that exist within links - we don't want to highlight the labels
|
|
109
|
+
// Positive lookahead
|
|
110
|
+
// Ignore if > is present (to avoid matches in href=".*">)
|
|
111
|
+
// End at </a> tag (to ensure that we don't highlight any other markup, like the labels)
|
|
112
|
+
// Case insensitive; find all
|
|
113
|
+
var val_regex = new RegExp(val + '(?=[^>]*<\/a>)', 'ig');
|
|
114
|
+
|
|
115
|
+
$.post(post_url, function(data) {
|
|
116
|
+
// Wrap query in b tags
|
|
117
|
+
data = data.replace(val_regex, '<b>$&</b>');
|
|
118
|
+
_this.$wrapper.find('ul').replaceWith(data);
|
|
119
|
+
|
|
120
|
+
var $links = _this.$wrapper.find('a');
|
|
121
|
+
// Initial offset spoofs items' position relative to their parent (.js-search-results)
|
|
122
|
+
var initial_offset = $links.first().offset().top;
|
|
123
|
+
|
|
124
|
+
// Cache the offset for use later in moveSelection
|
|
125
|
+
$links.each(function() {
|
|
126
|
+
// Have to use offset because the element is hidden
|
|
127
|
+
// So .position() is ineffective
|
|
128
|
+
$(this).data('offset', $(this).offset().top - initial_offset);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// If only one result, remove border from header nav item (set by the .search-nav-item class)
|
|
132
|
+
if ($('.js-search-results li').length === 1) {
|
|
133
|
+
$('.js-search-results .search-nav-item').removeClass('search-nav-item');
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Updates the selected result
|
|
141
|
+
* @param {Number} keyCode - the key pressed
|
|
142
|
+
*/
|
|
143
|
+
moveSelection: function(keyCode) {
|
|
144
|
+
var $results = $('.js-search-results');
|
|
145
|
+
var $result_links = $('.js-search-results a');
|
|
146
|
+
var $current_link = $('.js-search-results a.-current');
|
|
147
|
+
var current_index = $.inArray($current_link[0], $result_links);
|
|
148
|
+
|
|
149
|
+
// handle up and left arrow keys
|
|
150
|
+
if (keyCode === 37 || keyCode === 38) {
|
|
151
|
+
if (current_index <= 0) {
|
|
152
|
+
current_index = $result_links.length - 1;
|
|
153
|
+
} else {
|
|
154
|
+
current_index -= 1
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// handle down and right arrow keys
|
|
159
|
+
if (keyCode === 39 || keyCode === 40) {
|
|
160
|
+
if (current_index + 1 >= $result_links.length) {
|
|
161
|
+
current_index = 0;
|
|
162
|
+
} else {
|
|
163
|
+
current_index += 1
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// move current class to new selection
|
|
168
|
+
$current_link.removeClass('-current');
|
|
169
|
+
var $new_current = $result_links.eq(current_index);
|
|
170
|
+
$new_current.addClass('-current');
|
|
171
|
+
|
|
172
|
+
// Scroll to item
|
|
173
|
+
var offset = $new_current.data('offset');
|
|
174
|
+
|
|
175
|
+
// Reset to start if it's in the first "page" of results
|
|
176
|
+
// Add height in case it's inbetween "pages"
|
|
177
|
+
if( (offset + $new_current.outerHeight()) < $results.outerHeight() ) {
|
|
178
|
+
offset = 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
$results.scrollTop( offset );
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
};
|