fae-railsz 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,44 @@
|
|
1
|
+
(function ( $ ) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* This plugin sets chosen defaults and massages options based on class names.
|
6
|
+
* @function external:"jQuery.fn".fae_chosen
|
7
|
+
*/
|
8
|
+
$.fn.fae_chosen = function( options ) {
|
9
|
+
var defaults = {
|
10
|
+
disable_search_threshold: 10
|
11
|
+
};
|
12
|
+
|
13
|
+
var settings = $.extend( {}, defaults, options );
|
14
|
+
|
15
|
+
return this.each(function() {
|
16
|
+
var $this = $(this);
|
17
|
+
|
18
|
+
// remove threshold if show_search class is added from `search: true`
|
19
|
+
if ($this.hasClass('select-search')) {
|
20
|
+
settings.disable_search_threshold = 0;
|
21
|
+
}
|
22
|
+
|
23
|
+
$this.chosen(settings);
|
24
|
+
|
25
|
+
// add handling for bottom of viewport / drop-up support
|
26
|
+
$this.on('chosen:showing_dropdown', function(event, params) {
|
27
|
+
var $chosen_container = $(event.target ).next('.chosen-container');
|
28
|
+
var $dropdown = $chosen_container.find('.chosen-drop');
|
29
|
+
var results_container_max_height = parseInt($dropdown.find('.chosen-results').css('max-height'));
|
30
|
+
var results_container_top_offset = 40; // to account for possibility of chosen search input
|
31
|
+
var dropdown_top = $dropdown.offset().top - FCH.$window.scrollTop();
|
32
|
+
|
33
|
+
if (dropdown_top + results_container_max_height + results_container_top_offset > FCH.dimensions.wh) {
|
34
|
+
$chosen_container.addClass('chosen-drop-up');
|
35
|
+
}
|
36
|
+
});
|
37
|
+
$this.on('chosen:hiding_dropdown', function(event, params) {
|
38
|
+
$(event.target).next('.chosen-container').removeClass('chosen-drop-up');
|
39
|
+
});
|
40
|
+
});
|
41
|
+
|
42
|
+
};
|
43
|
+
|
44
|
+
}( jQuery ));
|
@@ -0,0 +1,178 @@
|
|
1
|
+
(function ( $ ) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Private initialization of FileInputer object.
|
6
|
+
* @private
|
7
|
+
* @class
|
8
|
+
*/
|
9
|
+
function FileInputer($el, options) {
|
10
|
+
/** Inherited settings from jQuery initialization */
|
11
|
+
this.options = options;
|
12
|
+
|
13
|
+
/** @type {jQuery} */
|
14
|
+
this.$el = $el;
|
15
|
+
this._drawElements();
|
16
|
+
this.changeListener();
|
17
|
+
|
18
|
+
return this;
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Create jQuery objects of all necessary components and add them to the DOM
|
23
|
+
* @protected
|
24
|
+
* @fires FileInputer._buttonListener
|
25
|
+
* @fires FileInputer._deleterListener
|
26
|
+
*/
|
27
|
+
FileInputer.prototype._drawElements = function() {
|
28
|
+
this.$input = this.$el.find('input[type="file"]');
|
29
|
+
|
30
|
+
// position the input off screen
|
31
|
+
this.$input.css({
|
32
|
+
position: 'absolute',
|
33
|
+
top: 0,
|
34
|
+
left: '-9999px',
|
35
|
+
visibility: 'hidden'
|
36
|
+
});
|
37
|
+
|
38
|
+
//save the reference for each element to object
|
39
|
+
this.$inputer = $('<div />', {
|
40
|
+
class: this.options.wrapper_class
|
41
|
+
});
|
42
|
+
|
43
|
+
this.$text = $('<span />', {
|
44
|
+
text: this.options.file_text
|
45
|
+
});
|
46
|
+
|
47
|
+
var $button = $('<button />', {
|
48
|
+
class: this.options.button_class,
|
49
|
+
attr: {
|
50
|
+
type: 'button'
|
51
|
+
},
|
52
|
+
text: this.options.choose_text
|
53
|
+
});
|
54
|
+
|
55
|
+
var $deleter = $('<div />', {
|
56
|
+
class: this.options.delete_class
|
57
|
+
});
|
58
|
+
|
59
|
+
this.$inputer
|
60
|
+
.append($button)
|
61
|
+
.append(this.$text)
|
62
|
+
.append($deleter);
|
63
|
+
|
64
|
+
this.$el.append(this.$inputer);
|
65
|
+
|
66
|
+
this._deleterListener($deleter);
|
67
|
+
this._buttonListener($button);
|
68
|
+
};
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Redirect the click on the created visuals to the file input area
|
72
|
+
* @protected
|
73
|
+
* @param {jQuery} $button
|
74
|
+
*/
|
75
|
+
FileInputer.prototype._buttonListener = function($button) {
|
76
|
+
var _this = this;
|
77
|
+
|
78
|
+
$button.on('click', function(){
|
79
|
+
_this.$input.click();
|
80
|
+
});
|
81
|
+
};
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Clear input, set upload text, and remove active text to destroy appearance of a file uploaded
|
85
|
+
* @protected
|
86
|
+
* @param {jQuery} $deleter
|
87
|
+
*/
|
88
|
+
FileInputer.prototype._deleterListener = function($deleter) {
|
89
|
+
var _this = this;
|
90
|
+
|
91
|
+
$deleter.on('click', function() {
|
92
|
+
_this.$input.val('');
|
93
|
+
_this.$text.text(_this.options.file_text);
|
94
|
+
_this.$inputer.removeClass(_this.options.active_class);
|
95
|
+
});
|
96
|
+
};
|
97
|
+
|
98
|
+
/**
|
99
|
+
* On $input change (a file is uploaded), display file name and set field to active
|
100
|
+
*/
|
101
|
+
FileInputer.prototype.changeListener = function() {
|
102
|
+
var _this = this;
|
103
|
+
|
104
|
+
// this is to get the filename and present it next to the button
|
105
|
+
_this.$input.on('change', function(e){
|
106
|
+
var $this = $(this);
|
107
|
+
|
108
|
+
if (_this._checkSize()) {
|
109
|
+
_this.$text.text( $this.val().replace('C:\\fakepath\\', '') );
|
110
|
+
|
111
|
+
if ($this.val() !== '') {
|
112
|
+
_this.$inputer.addClass( _this.options.active_class );
|
113
|
+
}
|
114
|
+
} else {
|
115
|
+
e.preventDefault();
|
116
|
+
}
|
117
|
+
});
|
118
|
+
};
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Determine if file uploaded exceeds provided limit
|
122
|
+
* @private
|
123
|
+
* @return {Boolean}
|
124
|
+
*/
|
125
|
+
FileInputer.prototype._checkSize = function() {
|
126
|
+
var limit = parseInt( this.$input.attr('data-limit') );
|
127
|
+
var input_files = this.$input.get(0).files;
|
128
|
+
|
129
|
+
// IE9 doesn't support size lookups; exit early and return true to clear validation
|
130
|
+
if (typeof input_files === undefined) {
|
131
|
+
return true;
|
132
|
+
}
|
133
|
+
|
134
|
+
var size = input_files[0].size / 1024 / 1024;
|
135
|
+
|
136
|
+
var error_obj = $('<span />', {
|
137
|
+
class: 'error',
|
138
|
+
text: this.$input.attr('data-exceeded').replace('###', limit)
|
139
|
+
});
|
140
|
+
|
141
|
+
if (size > limit) {
|
142
|
+
this.$input.after( error_obj );
|
143
|
+
this.$el.addClass('field_with_errors');
|
144
|
+
|
145
|
+
return false;
|
146
|
+
} else {
|
147
|
+
this.$input.next('.error').remove();
|
148
|
+
this.$el.removeClass('field_with_errors');
|
149
|
+
|
150
|
+
return true;
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
/**
|
155
|
+
* A small helper library for displaying a file input field
|
156
|
+
* @function external:"jQuery.fn".fileinputer
|
157
|
+
*/
|
158
|
+
$.fn.fileinputer = function( options ) {
|
159
|
+
|
160
|
+
var defaults = {
|
161
|
+
wrapper_class: 'asset-actions',
|
162
|
+
button_class: 'button',
|
163
|
+
choose_text: 'Choose File',
|
164
|
+
file_text: 'No File Chosen',
|
165
|
+
active_class: 'active',
|
166
|
+
delete_class: 'asset-delete'
|
167
|
+
};
|
168
|
+
|
169
|
+
// unite the default options with the passed-in ones
|
170
|
+
var settings = $.extend( {}, defaults, options );
|
171
|
+
|
172
|
+
return this.each(function() {
|
173
|
+
var file = new FileInputer($(this), settings);
|
174
|
+
});
|
175
|
+
|
176
|
+
};
|
177
|
+
|
178
|
+
}( jQuery ));
|
@@ -0,0 +1,111 @@
|
|
1
|
+
/* global FCH */
|
2
|
+
|
3
|
+
(function ( $ ) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Display inline modal of helper text. This is the bread and butter of the plugin.
|
8
|
+
* @private
|
9
|
+
* @param {jQuery} $el - The object to display the text relative to
|
10
|
+
*/
|
11
|
+
function showModal($el) {
|
12
|
+
var top = $el.offset().top - FCH.$window.scrollTop();
|
13
|
+
var left = $el.offset().left + 20;
|
14
|
+
var $hint = $el.closest('label').siblings('.hint');
|
15
|
+
var new_height = $hint.height() + 80;
|
16
|
+
var width = 250;
|
17
|
+
|
18
|
+
if ($hint.find('.youtube-hint').length) {
|
19
|
+
width = 570;
|
20
|
+
new_height -= 40;
|
21
|
+
}
|
22
|
+
|
23
|
+
$hint.modal({
|
24
|
+
minHeight: new_height,
|
25
|
+
minWidth: width,
|
26
|
+
maxWidth: width,
|
27
|
+
position: [top, left],
|
28
|
+
overlayClose: true,
|
29
|
+
opacity: 0,
|
30
|
+
containerCss: { position: 'absolute' }
|
31
|
+
});
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Private initialization of Hinter object.
|
37
|
+
* @class
|
38
|
+
*/
|
39
|
+
function Hinter($el, options) {
|
40
|
+
/** Inherited settings from jQuery initialization */
|
41
|
+
this.options = options;
|
42
|
+
this._drawElements($el);
|
43
|
+
this._clickListener();
|
44
|
+
// this._hoverListener();
|
45
|
+
|
46
|
+
return this
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Create jQuery object of the $icon and add it to the DOM
|
51
|
+
* @protected
|
52
|
+
*/
|
53
|
+
Hinter.prototype._drawElements = function($el) {
|
54
|
+
var $label = $el.parent().find('.label_inner');
|
55
|
+
|
56
|
+
//create the icon
|
57
|
+
this.$icon = $('<span />', {
|
58
|
+
class: this.options.icon_class + ' ' + this.options.style_class
|
59
|
+
});
|
60
|
+
|
61
|
+
this.$icon.appendTo($label);
|
62
|
+
};
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Show the modal on click
|
66
|
+
* @protected
|
67
|
+
*/
|
68
|
+
Hinter.prototype._clickListener = function() {
|
69
|
+
this.$icon.click(function(){
|
70
|
+
showModal( $(this) );
|
71
|
+
});
|
72
|
+
};
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Allow hover to do the same as a clicking
|
76
|
+
*/
|
77
|
+
Hinter.prototype._hoverListener = function(){
|
78
|
+
var $clicker = $('.hinter-clicker');
|
79
|
+
|
80
|
+
this.$icon.mouseenter(function() {
|
81
|
+
$clicker.addClass('hovered');
|
82
|
+
showModal( $(this) );
|
83
|
+
});
|
84
|
+
|
85
|
+
this.$icon.mouseleave(function() {
|
86
|
+
$clicker.removeClass('hovered');
|
87
|
+
$.modal.close();
|
88
|
+
});
|
89
|
+
};
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Display helper text in a very small inline modal
|
93
|
+
* @function external:'jQuery.fn'.hinter
|
94
|
+
*/
|
95
|
+
$.fn.hinter = function( options ) {
|
96
|
+
|
97
|
+
var defaults = {
|
98
|
+
icon_class: 'icon-support',
|
99
|
+
style_class: 'hinter-clicker'
|
100
|
+
};
|
101
|
+
|
102
|
+
// unite the default options with the passed-in ones
|
103
|
+
var settings = $.extend( {}, defaults, options );
|
104
|
+
|
105
|
+
return this.each(function() {
|
106
|
+
var hint = new Hinter($(this), settings);
|
107
|
+
});
|
108
|
+
|
109
|
+
};
|
110
|
+
|
111
|
+
}( jQuery ));
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/* global Fae */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Fae form checkbox
|
5
|
+
* @namespace form.checkbox
|
6
|
+
* @memberof form
|
7
|
+
*/
|
8
|
+
Fae.form.checkbox = {
|
9
|
+
|
10
|
+
init: function() {
|
11
|
+
this.setCheckboxAsActive();
|
12
|
+
},
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Run through the checkboxes and see if they are checked. apply js class for styling.
|
16
|
+
*/
|
17
|
+
setCheckboxAsActive: function() {
|
18
|
+
$('.boolean label, .js-checkbox-wrapper label').each(function(){
|
19
|
+
var $this = $(this);
|
20
|
+
|
21
|
+
if ($this.find(':checkbox:checked').length) {
|
22
|
+
$this.addClass('active');
|
23
|
+
}
|
24
|
+
});
|
25
|
+
}
|
26
|
+
|
27
|
+
};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/* global Fae, colorpicker, FCH */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Fae form color
|
5
|
+
* @namespace form.color
|
6
|
+
* @memberof form
|
7
|
+
*/
|
8
|
+
|
9
|
+
Fae.form.color = {
|
10
|
+
init: function() {
|
11
|
+
this.initColorpicker();
|
12
|
+
},
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Initialize colorpicker
|
16
|
+
*/
|
17
|
+
initColorpicker: function(e) {
|
18
|
+
var includeAlphaSlider = $('.alpha-slider').length > 0
|
19
|
+
|
20
|
+
var settings = {
|
21
|
+
opacity: includeAlphaSlider,
|
22
|
+
positionCallback: function($elm) {
|
23
|
+
var inputOffset = $elm.offset().top;
|
24
|
+
var distanceToBottom = $(document).height() - inputOffset;
|
25
|
+
var top = distanceToBottom <= this.$UI._height ? 414 : inputOffset + $elm.innerHeight();
|
26
|
+
var left = $elm.offset().left;
|
27
|
+
|
28
|
+
return { left: left, top: top }
|
29
|
+
},
|
30
|
+
renderCallback: function($elm, toggled) {
|
31
|
+
var colors = this.color.colors;
|
32
|
+
|
33
|
+
// default to HEX if Alpha is 1
|
34
|
+
if ($elm.val() && colors.alpha > 0.9) {
|
35
|
+
$elm.val('#' + colors.HEX);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
$('.js-color-picker').colorPicker(settings);
|
41
|
+
}
|
42
|
+
};
|
@@ -0,0 +1,78 @@
|
|
1
|
+
/* global Fae, datepicker, FCH */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Fae form dates
|
5
|
+
* @namespace form.dates
|
6
|
+
* @memberof form
|
7
|
+
*/
|
8
|
+
Fae.form.dates = {
|
9
|
+
|
10
|
+
init: function() {
|
11
|
+
this.initDatepicker();
|
12
|
+
this.initDateRangePicker();
|
13
|
+
},
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Initialize date picker
|
17
|
+
*/
|
18
|
+
initDatepicker: function() {
|
19
|
+
$('.datepicker input:not(.hasDatepicker)').datepicker({
|
20
|
+
dateFormat: 'M dd, yy',
|
21
|
+
inline: true,
|
22
|
+
showOtherMonths: true,
|
23
|
+
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
24
|
+
});
|
25
|
+
},
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Initialize date range picker
|
29
|
+
*/
|
30
|
+
initDateRangePicker: function() {
|
31
|
+
$.dateRangePickerLanguages['custom'] = {
|
32
|
+
'selected': 'Choosed:',
|
33
|
+
'days': 'Days',
|
34
|
+
'apply': 'Close',
|
35
|
+
'week-1' : 'Mon',
|
36
|
+
'week-2' : 'Tue',
|
37
|
+
'week-3' : 'Wed',
|
38
|
+
'week-4' : 'Thu',
|
39
|
+
'week-5' : 'Fri',
|
40
|
+
'week-6' : 'Sat',
|
41
|
+
'week-7' : 'Sun',
|
42
|
+
'month-name': ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
43
|
+
'previous' : 'Previous',
|
44
|
+
'prev-week' : 'Week',
|
45
|
+
'prev-month' : 'Month',
|
46
|
+
'prev-quarter' : 'Quarter',
|
47
|
+
'prev-year' : 'Year',
|
48
|
+
'less-than' : 'Date range should longer than %d days',
|
49
|
+
'more-than' : 'Date range should less than %d days',
|
50
|
+
'default-more' : 'Please select a date range longer than %d days',
|
51
|
+
'default-less' : 'Please select a date range less than %d days',
|
52
|
+
'default-range' : 'Please select a date range between %d and %d days',
|
53
|
+
'default-default': 'Please select a date'
|
54
|
+
};
|
55
|
+
|
56
|
+
// daterangepicker instantiation
|
57
|
+
if (FCH.exists('.daterangepicker')) {
|
58
|
+
$('.daterangepicker').dateRangePicker({
|
59
|
+
format: 'MMM DD, YYYY',
|
60
|
+
separator : ' to ',
|
61
|
+
showShortcuts: false,
|
62
|
+
language: 'custom',
|
63
|
+
getValue: function() {
|
64
|
+
if ($('.js-start_date').val() && $('.js-end_date').val()) {
|
65
|
+
return $('.js-start_date').val() + ' to ' + $('.js-end_date').val();
|
66
|
+
} else {
|
67
|
+
return '';
|
68
|
+
}
|
69
|
+
},
|
70
|
+
setValue: function(s,s1,s2) {
|
71
|
+
$('.js-start_date').val(s1);
|
72
|
+
$('.js-end_date').val(s2);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
};
|
76
|
+
},
|
77
|
+
|
78
|
+
};
|