camaleon_cms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/Rakefile +37 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/images/admin/no_image.jpg +0 -0
- data/app/assets/images/bg-tree.jpeg +0 -0
- data/app/assets/images/camaleon-dark.png +0 -0
- data/app/assets/images/camaleon.png +0 -0
- data/app/assets/images/category-icon.png +0 -0
- data/app/assets/images/image-not-found.png +0 -0
- data/app/assets/images/language/de.png +0 -0
- data/app/assets/images/language/en.png +0 -0
- data/app/assets/images/language/es.png +0 -0
- data/app/assets/images/language/fr.png +0 -0
- data/app/assets/images/language/it.png +0 -0
- data/app/assets/images/language/pt.png +0 -0
- data/app/assets/images/language/zh.png +0 -0
- data/app/assets/images/loader.gif +0 -0
- data/app/assets/images/users/no-image.jpg +0 -0
- data/app/assets/javascripts/admin/actions.js +248 -0
- data/app/assets/javascripts/admin/admin-manifest.js +32 -0
- data/app/assets/javascripts/admin/bootstrap-colorpicker.js +540 -0
- data/app/assets/javascripts/admin/bootstrap-datepicker.js +1690 -0
- data/app/assets/javascripts/admin/bootstrap-datetimepicker.min.js +26 -0
- data/app/assets/javascripts/admin/bootstrap-select.js +1022 -0
- data/app/assets/javascripts/admin/core.js +267 -0
- data/app/assets/javascripts/admin/custom_fields.js +165 -0
- data/app/assets/javascripts/admin/data.js +78 -0
- data/app/assets/javascripts/admin/elfinder-manifest.js +7 -0
- data/app/assets/javascripts/admin/elfinder/elfinder.full.js +12646 -0
- data/app/assets/javascripts/admin/elfinder/i18n/elfinder.es.js +294 -0
- data/app/assets/javascripts/admin/elfinder/i18n/elfinder.fr.js +298 -0
- data/app/assets/javascripts/admin/elfinder/proxy/elFinderSupportVer1.js +338 -0
- data/app/assets/javascripts/admin/elfinder/upload_elfinder.js +236 -0
- data/app/assets/javascripts/admin/es.js +27 -0
- data/app/assets/javascripts/admin/form-builder/formbuilder.js +1250 -0
- data/app/assets/javascripts/admin/form-builder/vendor.js +3072 -0
- data/app/assets/javascripts/admin/form/cropper.min.js +9 -0
- data/app/assets/javascripts/admin/form/jquery.form.js +911 -0
- data/app/assets/javascripts/admin/jquery-sieve.js +6 -0
- data/app/assets/javascripts/admin/jquery-ui.min.js +10 -0
- data/app/assets/javascripts/admin/jquery.nestable.js +485 -0
- data/app/assets/javascripts/admin/jquery.slugify.js +65 -0
- data/app/assets/javascripts/admin/jquery.tagsinput.min.js +1 -0
- data/app/assets/javascripts/admin/jquery.validate.js +1415 -0
- data/app/assets/javascripts/admin/login.js.coffee +7 -0
- data/app/assets/javascripts/admin/login_manifest.js +18 -0
- data/app/assets/javascripts/admin/modal.js +94 -0
- data/app/assets/javascripts/admin/nav-menu.js +110 -0
- data/app/assets/javascripts/admin/plugins.js +637 -0
- data/app/assets/javascripts/admin/post.js +274 -0
- data/app/assets/javascripts/admin/tageditor/jquery.caret.min.js +2 -0
- data/app/assets/javascripts/admin/tageditor/jquery.tag-editor.js +352 -0
- data/app/assets/javascripts/admin/tinymce/langs/es.js +177 -0
- data/app/assets/javascripts/admin/tinymce/langs/readme.md +3 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/plugins/filemanager/plugin.min.js +31 -0
- data/app/assets/javascripts/admin/tinymce/plugins/visualblocks/css/visualblocks.css +135 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/content.min.css.scss +4 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce-small.svg +62 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce.svg +83 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/img/object.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/app/assets/javascripts/admin/tinymce/themes/modern/theme.min.js +1 -0
- data/app/assets/javascripts/admin/tinymce/tinymce.min.js +11 -0
- data/app/assets/javascripts/admin/translator.js +109 -0
- data/app/assets/javascripts/admin/underscore.js +1536 -0
- data/app/assets/javascripts/admin/widgets.js +53 -0
- data/app/assets/javascripts/audio/alert.mp3 +0 -0
- data/app/assets/javascripts/audio/fail.mp3 +0 -0
- data/app/assets/javascripts/bootstrap.min.js +7 -0
- data/app/assets/javascripts/elfinder_front.js +85 -0
- data/app/assets/javascripts/gibberish-aes.js +1017 -0
- data/app/assets/javascripts/jquery-1.11.3.min.js +5 -0
- data/app/assets/stylesheets/admin/admin-manifest.css +28 -0
- data/app/assets/stylesheets/admin/animate/animate.min.css +6 -0
- data/app/assets/stylesheets/admin/bootstrap/bootstrap-datetimepicker.css +339 -0
- data/app/assets/stylesheets/admin/bootstrap/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/admin/bootstrap/images/glyphicons-halflings.png +0 -0
- data/app/assets/stylesheets/admin/core.scss +345 -0
- data/app/assets/stylesheets/admin/cropper/cropper.min.css +52 -0
- data/app/assets/stylesheets/admin/elfinder-manifest.css +6 -0
- data/app/assets/stylesheets/admin/elfinder/elfinder-theme.scss +191 -0
- data/app/assets/stylesheets/admin/elfinder/elfinder.css +1922 -0
- data/app/assets/stylesheets/admin/elfinder/images/arrows-active.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/arrows-normal.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/crop.gif +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/dialogs.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/icons-big.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/icons-small.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/logo.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/progress.gif +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/quicklook-bg.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/quicklook-icons.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/resize.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/spinner-mini.gif +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/toolbar.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/stylesheets/admin/elfinder/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.eot +0 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.svg +1831 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.ttf +0 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.woff +0 -0
- data/app/assets/stylesheets/admin/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/admin/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/stylesheets/admin/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/admin/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/admin/form-builder/formbuilder.css +71 -0
- data/app/assets/stylesheets/admin/img/bg.png +0 -0
- data/app/assets/stylesheets/admin/img/colorpicker/alpha.png +0 -0
- data/app/assets/stylesheets/admin/img/colorpicker/hue.png +0 -0
- data/app/assets/stylesheets/admin/img/colorpicker/saturation.png +0 -0
- data/app/assets/stylesheets/admin/img/girls-1.jpg +0 -0
- data/app/assets/stylesheets/admin/img/jquery/resize-icon.png +0 -0
- data/app/assets/stylesheets/admin/img/loading.gif +1 -0
- data/app/assets/stylesheets/admin/img/logo-small.png +0 -0
- data/app/assets/stylesheets/admin/img/logo.png +0 -0
- data/app/assets/stylesheets/admin/img/no_image.jpg +0 -0
- data/app/assets/stylesheets/admin/img/rormeleon-white.png +0 -0
- data/app/assets/stylesheets/admin/img/thumb_no_found.jpg +0 -0
- data/app/assets/stylesheets/admin/jquery.tagsinput.css +72 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/admin/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/admin/jquery/jquery-ui.scss +1226 -0
- data/app/assets/stylesheets/admin/nav-menu.css +54 -0
- data/app/assets/stylesheets/admin/nestable/jquery.nestable.css +103 -0
- data/app/assets/stylesheets/admin/tageditor/delete.png +0 -0
- data/app/assets/stylesheets/admin/tageditor/delete.svg +4 -0
- data/app/assets/stylesheets/admin/tageditor/jquery.tag-editor.css +49 -0
- data/app/assets/stylesheets/admin/theme-default.scss +8462 -0
- data/app/assets/stylesheets/admin/widgets.css.scss +26 -0
- data/app/assets/stylesheets/bootstrap.min.css.scss +5 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/css/style.css +84 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/editor_plugin.js +1 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/editor_plugin_src.js +90 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/img/youtube.png +0 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/index.html +86 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/js/scripts.js +1 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/js/scripts_src.js +81 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/en.js +3 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/en_dlg.js +12 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/es.js +3 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/es_dlg.js +12 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/bootstrap.css +2228 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/content.css +189 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/dialog.css +295 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/butt2.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/button-bg.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/buttons.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/down_arrow.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/fade-butt.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/icons.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/items.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/menu-arrow.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/menu-check.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/progress.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/tabs.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/toolbarbg.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/ui.css +1163 -0
- data/app/controllers/admin/appearances/nav_menus_controller.rb +120 -0
- data/app/controllers/admin/appearances/themes_controller.rb +30 -0
- data/app/controllers/admin/appearances/widgets/assign_controller.rb +40 -0
- data/app/controllers/admin/appearances/widgets/main_controller.rb +57 -0
- data/app/controllers/admin/appearances/widgets/sidebar_controller.rb +59 -0
- data/app/controllers/admin/appearances_controller.rb +17 -0
- data/app/controllers/admin/categories_controller.rb +77 -0
- data/app/controllers/admin/comments_controller.rb +119 -0
- data/app/controllers/admin/installers_controller.rb +40 -0
- data/app/controllers/admin/media_controller.rb +55 -0
- data/app/controllers/admin/plugins_controller.rb +45 -0
- data/app/controllers/admin/post_tags_controller.rb +83 -0
- data/app/controllers/admin/posts/drafts_controller.rb +76 -0
- data/app/controllers/admin/posts_controller.rb +195 -0
- data/app/controllers/admin/sessions_controller.rb +144 -0
- data/app/controllers/admin/settings/custom_fields_controller.rb +85 -0
- data/app/controllers/admin/settings/post_types_controller.rb +73 -0
- data/app/controllers/admin/settings/sites_controller.rb +89 -0
- data/app/controllers/admin/settings_controller.rb +60 -0
- data/app/controllers/admin/user_roles_controller.rb +76 -0
- data/app/controllers/admin/users_controller.rb +120 -0
- data/app/controllers/admin_controller.rb +56 -0
- data/app/controllers/apps/plugins_admin_controller.rb +21 -0
- data/app/controllers/apps/plugins_front_controller.rb +21 -0
- data/app/controllers/apps/themes_admin_controller.rb +21 -0
- data/app/controllers/apps/themes_front_controller.rb +21 -0
- data/app/controllers/camaleon_controller.rb +87 -0
- data/app/controllers/concerns/frontend_concern.rb +57 -0
- data/app/controllers/frontend_controller.rb +240 -0
- data/app/decorators/application_decorator.rb +81 -0
- data/app/decorators/category_decorator.rb +61 -0
- data/app/decorators/custom_field_decorator.rb +31 -0
- data/app/decorators/custom_fields_concern.rb +33 -0
- data/app/decorators/metas_decorator_methods.rb +19 -0
- data/app/decorators/post_comment_decorator.rb +26 -0
- data/app/decorators/post_decorator.rb +162 -0
- data/app/decorators/post_tag_decorator.rb +36 -0
- data/app/decorators/post_type_decorator.rb +56 -0
- data/app/decorators/site_decorator.rb +136 -0
- data/app/decorators/term_taxonomy_decorator.rb +97 -0
- data/app/decorators/theme_decorator.rb +16 -0
- data/app/decorators/user_decorator.rb +67 -0
- data/app/decorators/widget_decorator.rb +13 -0
- data/app/helpers/admin/application_helper.rb +27 -0
- data/app/helpers/admin/breadcrumb_helper.rb +37 -0
- data/app/helpers/admin/category_helper.rb +22 -0
- data/app/helpers/admin/custom_fields_helper.rb +329 -0
- data/app/helpers/admin/menus_helper.rb +199 -0
- data/app/helpers/admin/post_type_helper.rb +50 -0
- data/app/helpers/camaleon_helper.rb +65 -0
- data/app/helpers/captcha_helper.rb +90 -0
- data/app/helpers/content_helper.rb +35 -0
- data/app/helpers/frontend/application_helper.rb +41 -0
- data/app/helpers/frontend/nav_menu_helper.rb +177 -0
- data/app/helpers/frontend/seo_helper.rb +60 -0
- data/app/helpers/frontend/site_helper.rb +60 -0
- data/app/helpers/hooks_helper.rb +54 -0
- data/app/helpers/html_helper.rb +114 -0
- data/app/helpers/plugins_helper.rb +129 -0
- data/app/helpers/session_helper.rb +108 -0
- data/app/helpers/short_code_helper.rb +82 -0
- data/app/helpers/site_helper.rb +124 -0
- data/app/helpers/theme_helper.rb +51 -0
- data/app/helpers/uploader_helper.rb +144 -0
- data/app/helpers/user_roles_helper.rb +14 -0
- data/app/mailers/html_mailer.rb +47 -0
- data/app/models/ability.rb +113 -0
- data/app/models/category.rb +55 -0
- data/app/models/concerns/categories_tags_for_posts.rb +140 -0
- data/app/models/concerns/custom_fields_read.rb +221 -0
- data/app/models/concerns/metas.rb +133 -0
- data/app/models/concerns/metas_saved.rb +10 -0
- data/app/models/concerns/site_public.rb +23 -0
- data/app/models/custom_field.rb +34 -0
- data/app/models/custom_field_group.rb +121 -0
- data/app/models/custom_fields_relationship.rb +26 -0
- data/app/models/meta.rb +16 -0
- data/app/models/nav_menu.rb +41 -0
- data/app/models/nav_menu_item.rb +36 -0
- data/app/models/plugin.rb +57 -0
- data/app/models/plugins.rb +13 -0
- data/app/models/post.rb +89 -0
- data/app/models/post_comment.rb +44 -0
- data/app/models/post_default.rb +78 -0
- data/app/models/post_relationship.rb +26 -0
- data/app/models/post_tag.rb +15 -0
- data/app/models/post_type.rb +125 -0
- data/app/models/site.rb +337 -0
- data/app/models/term_relationship.rb +26 -0
- data/app/models/term_taxonomy.rb +156 -0
- data/app/models/theme.rb +33 -0
- data/app/models/themes.rb +13 -0
- data/app/models/user.rb +172 -0
- data/app/models/user_relationship.rb +17 -0
- data/app/models/user_role.rb +139 -0
- data/app/models/widget.rb +13 -0
- data/app/models/widget/assigned.rb +34 -0
- data/app/models/widget/main.rb +52 -0
- data/app/models/widget/sidebar.rb +28 -0
- data/app/views/_flash_messages.html.erb +39 -0
- data/app/views/admin/appearances/_external_menu.html.erb +16 -0
- data/app/views/admin/appearances/menu.html.erb +199 -0
- data/app/views/admin/appearances/themes/index.html.erb +68 -0
- data/app/views/admin/appearances/themes/preview.html.erb +1 -0
- data/app/views/admin/appearances/themes/theme_load_data.html.erb +40 -0
- data/app/views/admin/appearances/widgets/assign/_form.html.erb +35 -0
- data/app/views/admin/appearances/widgets/main/form.html.erb +27 -0
- data/app/views/admin/appearances/widgets/main/index.html.erb +91 -0
- data/app/views/admin/appearances/widgets/sidebar/form.html.erb +23 -0
- data/app/views/admin/categories/_form.html.erb +42 -0
- data/app/views/admin/categories/edit.html.erb +18 -0
- data/app/views/admin/categories/index.html.erb +81 -0
- data/app/views/admin/comments/form.html.erb +55 -0
- data/app/views/admin/comments/index.html.erb +58 -0
- data/app/views/admin/comments/reply.html.erb +197 -0
- data/app/views/admin/dashboard/index.html.erb +25 -0
- data/app/views/admin/installers/form.html.erb +19 -0
- data/app/views/admin/installers/welcome.html.erb +8 -0
- data/app/views/admin/media/iframe.html.erb +33 -0
- data/app/views/admin/media/index.html.erb +31 -0
- data/app/views/admin/plugins/_plugins_list.html.erb +59 -0
- data/app/views/admin/plugins/index.html.erb +37 -0
- data/app/views/admin/post_tags/_form.html.erb +34 -0
- data/app/views/admin/post_tags/edit.html.erb +18 -0
- data/app/views/admin/post_tags/index.html.erb +79 -0
- data/app/views/admin/posts/_filter_posts.html.erb +6 -0
- data/app/views/admin/posts/form.html.erb +294 -0
- data/app/views/admin/posts/index.html.erb +121 -0
- data/app/views/admin/posts/show.html.erb +20 -0
- data/app/views/admin/sessions/forgot.html.erb +51 -0
- data/app/views/admin/sessions/login.html.erb +39 -0
- data/app/views/admin/sessions/register.html.erb +63 -0
- data/app/views/admin/settings/custom_fields/_meta_data.html.erb +102 -0
- data/app/views/admin/settings/custom_fields/_render.html.erb +73 -0
- data/app/views/admin/settings/custom_fields/fields/audio.html.erb +4 -0
- data/app/views/admin/settings/custom_fields/fields/checkbox.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/checkboxes.html.erb +5 -0
- data/app/views/admin/settings/custom_fields/fields/colorpicker.html.erb +7 -0
- data/app/views/admin/settings/custom_fields/fields/date.html.erb +7 -0
- data/app/views/admin/settings/custom_fields/fields/editor.html.erb +4 -0
- data/app/views/admin/settings/custom_fields/fields/email.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/field_attrs.html.erb +10 -0
- data/app/views/admin/settings/custom_fields/fields/file.html.erb +4 -0
- data/app/views/admin/settings/custom_fields/fields/image.html.erb +4 -0
- data/app/views/admin/settings/custom_fields/fields/numeric.html.erb +4 -0
- data/app/views/admin/settings/custom_fields/fields/phone.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/posts.html.erb +17 -0
- data/app/views/admin/settings/custom_fields/fields/radio.html.erb +5 -0
- data/app/views/admin/settings/custom_fields/fields/select.html.erb +7 -0
- data/app/views/admin/settings/custom_fields/fields/select_eval.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/text_area.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/text_box.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/url.html.erb +3 -0
- data/app/views/admin/settings/custom_fields/fields/users.html.erb +8 -0
- data/app/views/admin/settings/custom_fields/fields/video.html.erb +4 -0
- data/app/views/admin/settings/custom_fields/form.html.erb +249 -0
- data/app/views/admin/settings/custom_fields/get_items.html.erb +199 -0
- data/app/views/admin/settings/custom_fields/index.html.erb +69 -0
- data/app/views/admin/settings/languages.html.erb +68 -0
- data/app/views/admin/settings/post_types/_form.html.erb +93 -0
- data/app/views/admin/settings/post_types/edit.html.erb +18 -0
- data/app/views/admin/settings/post_types/index.html.erb +80 -0
- data/app/views/admin/settings/site.html.erb +124 -0
- data/app/views/admin/settings/sites/form.html.erb +50 -0
- data/app/views/admin/settings/sites/index.html.erb +56 -0
- data/app/views/admin/taxonomy/_form.html.erb +62 -0
- data/app/views/admin/taxonomy/edit.html.erb +18 -0
- data/app/views/admin/taxonomy/index.html.erb +79 -0
- data/app/views/admin/user_roles/form.html.erb +168 -0
- data/app/views/admin/user_roles/index.html.erb +54 -0
- data/app/views/admin/users/form.html.erb +305 -0
- data/app/views/admin/users/index.html.erb +58 -0
- data/app/views/admin/users/profile.html.erb +118 -0
- data/app/views/admin/users/profile/_activity.html.erb +180 -0
- data/app/views/admin/users/profile/_settings.html.erb +15 -0
- data/app/views/admin/users/profile_edit.html.erb +305 -0
- data/app/views/default_theme/admin/settings.html.erb +1 -0
- data/app/views/default_theme/category.html.erb +25 -0
- data/app/views/default_theme/category.rss.builder +23 -0
- data/app/views/default_theme/index.html.erb +70 -0
- data/app/views/default_theme/index.rss.builder +21 -0
- data/app/views/default_theme/layouts/_footer.html.erb +18 -0
- data/app/views/default_theme/layouts/_header.html.erb +38 -0
- data/app/views/default_theme/layouts/index.html.erb +34 -0
- data/app/views/default_theme/partials/_breadcrumb.html.erb +10 -0
- data/app/views/default_theme/partials/_categories_list.html.erb +23 -0
- data/app/views/default_theme/partials/_comments.html.erb +33 -0
- data/app/views/default_theme/partials/_comments_list.html.erb +21 -0
- data/app/views/default_theme/partials/_flash_messages.html.erb +26 -0
- data/app/views/default_theme/partials/_forms.html.erb +19 -0
- data/app/views/default_theme/partials/_post_list_item.html.erb +13 -0
- data/app/views/default_theme/partials/_render_custom_field.html.erb +57 -0
- data/app/views/default_theme/partials/_search_form.html.erb +10 -0
- data/app/views/default_theme/partials/_sidebar.html.erb +56 -0
- data/app/views/default_theme/post.html.erb +40 -0
- data/app/views/default_theme/post.rss.builder +12 -0
- data/app/views/default_theme/post_tag.html.erb +17 -0
- data/app/views/default_theme/post_tag.rss.builder +22 -0
- data/app/views/default_theme/post_type.html.erb +25 -0
- data/app/views/default_theme/post_type.rss.builder +22 -0
- data/app/views/default_theme/profile.html.erb +18 -0
- data/app/views/default_theme/robots.text.erb +1 -0
- data/app/views/default_theme/search.html.erb +13 -0
- data/app/views/default_theme/sitemap.html.erb +0 -0
- data/app/views/html_mailer/other.html.erb +3 -0
- data/app/views/html_mailer/sender.html.erb +25 -0
- data/app/views/layouts/admin.html.erb +164 -0
- data/app/views/layouts/admin/_ajax.html.erb +2 -0
- data/app/views/layouts/admin/_flash_messages.html.erb +49 -0
- data/app/views/layouts/admin/_form_error.html.erb +10 -0
- data/app/views/layouts/admin/_sidebar.html.erb +31 -0
- data/app/views/layouts/admin/installer.html.erb +36 -0
- data/app/views/layouts/application.html.erb +15 -0
- data/app/views/layouts/login.html.erb +40 -0
- data/app/views/shortcode_templates/form.html.erb +1 -0
- data/app/views/shortcode_templates/widget.html.erb +11 -0
- data/config/initializers/active_record_extension.rb +24 -0
- data/config/initializers/assets.rb +17 -0
- data/config/initializers/cache_helper.rb +9 -0
- data/config/initializers/elfinder.rb +79 -0
- data/config/initializers/fix_ssl.rb +14 -0
- data/config/initializers/mobu.rb +24 -0
- data/config/initializers/page_caching.rb +35 -0
- data/config/initializers/rufus_cron.rb +44 -0
- data/config/locales/admin/en.yml +561 -0
- data/config/locales/admin/es.yml +560 -0
- data/config/locales/ar.yml +275 -0
- data/config/locales/common.yml +125 -0
- data/config/locales/de.yml +210 -0
- data/config/locales/en.yml +207 -0
- data/config/locales/es.yml +198 -0
- data/config/locales/fr.yml +207 -0
- data/config/locales/languages.yml +19 -0
- data/config/locales/pl.yml +237 -0
- data/config/locales/pt.yml +201 -0
- data/config/locales/routes.yml +23 -0
- data/config/routes.rb +10 -0
- data/config/routes/admin.rb +119 -0
- data/config/routes/frontend.rb +35 -0
- data/config/sitemap.rb +52 -0
- data/config/system.json +16 -0
- data/db/migrate/20150611161134_post_table_into_utf8.rb +115 -0
- data/lib/ca-bundle.crt +3554 -0
- data/lib/camaleon_cms.rb +4 -0
- data/lib/camaleon_cms/engine.rb +60 -0
- data/lib/camaleon_cms/version.rb +3 -0
- data/lib/captcha/bumpyroad.ttf +0 -0
- data/lib/captcha/captcha_0.jpg +0 -0
- data/lib/captcha/captcha_1.jpg +0 -0
- data/lib/captcha/captcha_10.jpg +0 -0
- data/lib/captcha/captcha_11.jpg +0 -0
- data/lib/captcha/captcha_2.jpg +0 -0
- data/lib/captcha/captcha_3.jpg +0 -0
- data/lib/captcha/captcha_4.jpg +0 -0
- data/lib/captcha/captcha_5.jpg +0 -0
- data/lib/captcha/captcha_6.jpg +0 -0
- data/lib/captcha/captcha_7.jpg +0 -0
- data/lib/captcha/captcha_8.jpg +0 -0
- data/lib/captcha/captcha_9.jpg +0 -0
- data/lib/ext/aes_crypt.rb +246 -0
- data/lib/ext/array.rb +54 -0
- data/lib/ext/hash.rb +41 -0
- data/lib/ext/string.rb +159 -0
- data/lib/ext/translator.rb +83 -0
- data/lib/generators/camaleon_cms/install_generator.rb +20 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/admin_controller.rb +25 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/assets/docs/images/screenshot_1.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/assets/docs/images/screenshot_2.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/assets/docs/images/screenshot_3.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/assets/docs/index.html +60 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/attack_helper.rb +99 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/config/config.json +31 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/config/custom_models.rb +4 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/config/locales/readme.txt +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/config/locales/translation.yml +36 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/config/routes_admin.txt +2 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/models/attack.rb +12 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/attack/views/admin/settings.html.erb +49 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/admin_forms_controller.rb +93 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/css/admin/form-builder/formbuilder.css +70 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/css/contact-form.css +8 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/css/front/railsform.scss +94 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/css/readme.txt +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/docs/images/screenshot_1.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/docs/images/screenshot_2.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/docs/images/screenshot_3.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/docs/images/screenshot_4.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/docs/images/screenshot_5.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/docs/index.html +89 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/js/contact_form.js +2 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/js/form-builder/formbuilder.js +1271 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/js/form-builder/vendor.js +3072 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/assets/js/readme.txt +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/config/config.json +35 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/config/locales/readme.txt +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/config/locales/translation.yml +210 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/config/routes_admin.txt +4 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/config/routes_front.txt +2 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/contact_form_helper.rb +91 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/contact_form_html_helper.rb +157 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/front_controller.rb +106 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/models/contact_form.rb +26 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/admin_forms/_form.html.erb +33 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/admin_forms/edit.html.erb +375 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/admin_forms/index.html.erb +65 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/admin_forms/manual.html.erb +59 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/admin_forms/responses.html.erb +67 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/forms_shorcode.html.erb +27 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/contact_form/views/front/index.html.erb +3 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/admin_controller.rb +35 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/assets/docs/images/screenshot_1.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/assets/docs/images/screenshot_2.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/assets/docs/index.html +58 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/config/config.json +21 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/config/locales/readme.txt +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/config/locales/translation.yml +37 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/config/routes_admin.txt +3 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/front_cache_helper.rb +154 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/front_cache/views/admin/settings.html.erb +71 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/assets/docs/images/screenshot_1.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/assets/docs/images/screenshot_2.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/assets/docs/images/screenshot_3.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/assets/docs/images/screenshot_4.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/assets/docs/index.html +62 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/assets/js/form.js +29 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/config/config.json +24 -0
- data/lib/generators/camaleon_cms/install_template/apps/plugins/visibility_post/visibility_post_helper.rb +132 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/css/magnific-ver.css +394 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/css/main.css +15 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/css/style-ver.css.scss +224 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/css/wpbase.css +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/images/empe.jpg +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/images/image.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/images/loader.gif +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/images/zoom.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/js/hover.zoom.js +67 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/js/magnific.min.js +3 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/js/main-ver.js +46 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/js/main.js +18 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/assets/js/modernizr.custom.js +4 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/config/config.json +14 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/main_helper.rb +43 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/views/admin/settings.html.erb +4 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/views/index.html.erb +28 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/views/layouts/index.html.erb +85 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/views/partials/readme.txt +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/camaleon_first/views/template_sample_page.html.erb +6 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/css/main.css +13 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/css/style.css.scss +3395 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/css/styles.css.scss +175 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/COPYING.txt +9 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/Genericons-Regular.otf +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/LICENSE.txt +339 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/README.txt +123 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/font/genericons-regular-webfont.eot +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/font/genericons-regular-webfont.svg +135 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/font/genericons-regular-webfont.ttf +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/font/genericons-regular-webfont.woff +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/genericons/genericons.css +197 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/circle.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/dotted-line-2x.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/dotted-line-light-2x.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/dotted-line-light.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/dotted-line.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/headers/circle-thumbnail.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/headers/circle.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/headers/diamond-thumbnail.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/headers/diamond.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/headers/star-thumbnail.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/headers/star.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/image.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/search-icon-2x.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/assets/images/search-icon.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/config/config.json +19 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/default_helper.rb +36 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/admin/settings.html.erb +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/category.html.erb +16 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/index.html.erb +35 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/layouts/index.html.erb +83 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/page.html.erb +22 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_breadcrumb.html.erb +10 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_categories_list.html.erb +23 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_comments.html.erb +25 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_comments_list.html.erb +20 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_flash_messages.html.erb +26 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_forms.html.erb +19 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_post_list_item.html.erb +34 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_search_form.html.erb +8 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/partials/_sidebar.html.erb +50 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/post.html.erb +22 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/post_tag.html.erb +14 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/post_type.html.erb +33 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/default/views/search.html.erb +17 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/css/bootstrap/bootstrap.min.css +6735 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/css/main.css +13 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/css/styles.css.scss +175 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/images/image.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/js/main.js +15 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/js/plugins/bootstrap/bootstrap.min.js +6 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/js/plugins/jquery/jquery.min.js +4 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/assets/js/plugins/modal_elfinder.js +29 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/config/config.json +26 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/custom_helper.rb +37 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/data.json +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/image.png +0 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/admin/settings.html.erb +1 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/category.html.erb +33 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/index.html.erb +70 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/layouts/_footer.html.erb +18 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/layouts/_header.html.erb +38 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/layouts/index.html.erb +34 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/page.html.erb +24 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_breadcrumb.html.erb +10 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_categories_list.html.erb +23 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_comments.html.erb +32 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_comments_list.html.erb +21 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_flash_messages.html.erb +26 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_forms.html.erb +19 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_post_list_item.html.erb +13 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_search_form.html.erb +10 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/partials/_sidebar.html.erb +60 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/post.html.erb +20 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/post_tag.html.erb +22 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/post_type.html.erb +33 -0
- data/lib/generators/camaleon_cms/install_template/apps/themes/new/views/search.html.erb +18 -0
- data/lib/generators/camaleon_cms/install_template/plugin_routes.rb +311 -0
- data/lib/generators/camaleon_cms/install_template/system.json +11 -0
- data/lib/generators/cplugin_generator.rb +80 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/admin_controller.rb +9 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/assets/css/readme.txt +1 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/assets/images/readme.txt +1 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/assets/js/readme.txt +1 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/config/config.json +18 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/config/locales/readme.txt +1 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/config/routes_admin.txt +1 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/config/routes_front.txt +1 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/front_controller.rb +9 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/main_helper.rb +21 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/models/my_plugin.rb +12 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/views/admin/index.html.erb +2 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/views/front/index.html.erb +2 -0
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/views/layouts/readme.txt +2 -0
- data/lib/generators/ctheme_generator.rb +63 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/assets/css/main.css +12 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/assets/images/image.png +0 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/assets/js/main.js +14 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/config/config.json +14 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb +25 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/admin/settings.html.erb +4 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/index.html.erb +25 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +71 -0
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/partials/readme.txt +1 -0
- data/lib/tasks/camaleon_cms_tasks.rake +4 -0
- data/test/camaleon_cms_test.rb +7 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +19 -0
- metadata +699 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* =========================================================
|
4
|
+
* bootstrap-datetimepicker.js
|
5
|
+
* http://www.eyecon.ro/bootstrap-datepicker
|
6
|
+
* =========================================================
|
7
|
+
* Copyright 2012 Stefan Petre
|
8
|
+
*
|
9
|
+
* Contributions:
|
10
|
+
* - Andrew Rowls
|
11
|
+
* - Thiago de Arruda
|
12
|
+
*
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
+
* you may not use this file except in compliance with the License.
|
15
|
+
* You may obtain a copy of the License at
|
16
|
+
*
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
+
*
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
+
* See the License for the specific language governing permissions and
|
23
|
+
* limitations under the License.
|
24
|
+
* =========================================================
|
25
|
+
*/
|
26
|
+
(function($){var smartPhone=window.orientation!=undefined;var DateTimePicker=function(element,options){this.id=dpgId++;this.init(element,options)};var dateToDate=function(dt){if(typeof dt==="string"){return new Date(dt)}return dt};DateTimePicker.prototype={constructor:DateTimePicker,init:function(element,options){var icon;if(!(options.pickTime||options.pickDate))throw new Error("Must choose at least one picker");this.options=options;this.$element=$(element);this.language=options.language in dates?options.language:"en";this.pickDate=options.pickDate;this.pickTime=options.pickTime;this.isInput=this.$element.is("input");this.component=false;if(this.$element.find(".input-append")||this.$element.find(".input-prepend"))this.component=this.$element.find(".add-on");this.format=options.format;if(!this.format){if(this.isInput)this.format=this.$element.data("format");else this.format=this.$element.find("input").data("format");if(!this.format)this.format="MM/dd/yyyy"}this._compileFormat();if(this.component){icon=this.component.find("i")}if(this.pickTime){if(icon&&icon.length)this.timeIcon=icon.data("time-icon");if(!this.timeIcon)this.timeIcon="icon-time";icon.addClass(this.timeIcon)}if(this.pickDate){if(icon&&icon.length)this.dateIcon=icon.data("date-icon");if(!this.dateIcon)this.dateIcon="icon-calendar";icon.removeClass(this.timeIcon);icon.addClass(this.dateIcon)}this.widget=$(getTemplate(this.timeIcon,options.pickDate,options.pickTime,options.pick12HourFormat,options.pickSeconds,options.collapse)).appendTo("body");this.minViewMode=options.minViewMode||this.$element.data("date-minviewmode")||0;if(typeof this.minViewMode==="string"){switch(this.minViewMode){case"months":this.minViewMode=1;break;case"years":this.minViewMode=2;break;default:this.minViewMode=0;break}}this.viewMode=options.viewMode||this.$element.data("date-viewmode")||0;if(typeof this.viewMode==="string"){switch(this.viewMode){case"months":this.viewMode=1;break;case"years":this.viewMode=2;break;default:this.viewMode=0;break}}this.startViewMode=this.viewMode;this.weekStart=options.weekStart||this.$element.data("date-weekstart")||0;this.weekEnd=this.weekStart===0?6:this.weekStart-1;this.setStartDate(options.startDate||this.$element.data("date-startdate"));this.setEndDate(options.endDate||this.$element.data("date-enddate"));this.fillDow();this.fillMonths();this.fillHours();this.fillMinutes();this.fillSeconds();this.update();this.showMode();this._attachDatePickerEvents()},show:function(e){this.widget.show();this.height=this.component?this.component.outerHeight():this.$element.outerHeight();this.place();this.$element.trigger({type:"show",date:this._date});this._attachDatePickerGlobalEvents();if(e){e.stopPropagation();e.preventDefault()}},disable:function(){this.$element.find("input").prop("disabled",true);this._detachDatePickerEvents()},enable:function(){this.$element.find("input").prop("disabled",false);this._attachDatePickerEvents()},hide:function(){var collapse=this.widget.find(".collapse");for(var i=0;i<collapse.length;i++){var collapseData=collapse.eq(i).data("collapse");if(collapseData&&collapseData.transitioning)return}this.widget.hide();this.viewMode=this.startViewMode;this.showMode();this.set();this.$element.trigger({type:"hide",date:this._date});this._detachDatePickerGlobalEvents()},set:function(){var formatted="";if(!this._unset)formatted=this.formatDate(this._date);if(!this.isInput){if(this.component){var input=this.$element.find("input");input.val(formatted);this._resetMaskPos(input)}this.$element.data("date",formatted)}else{this.$element.val(formatted);this._resetMaskPos(this.$element)}},setValue:function(newDate){if(!newDate){this._unset=true}else{this._unset=false}if(typeof newDate==="string"){this._date=this.parseDate(newDate)}else if(newDate){this._date=new Date(newDate)}this.set();this.viewDate=UTCDate(this._date.getUTCFullYear(),this._date.getUTCMonth(),1,0,0,0,0);this.fillDate();this.fillTime()},getDate:function(){if(this._unset)return null;return new Date(this._date.valueOf())},setDate:function(date){if(!date)this.setValue(null);else this.setValue(date.valueOf())},setStartDate:function(date){if(date instanceof Date){this.startDate=date}else if(typeof date==="string"){this.startDate=new UTCDate(date);if(!this.startDate.getUTCFullYear()){this.startDate=-Infinity}}else{this.startDate=-Infinity}if(this.viewDate){this.update()}},setEndDate:function(date){if(date instanceof Date){this.endDate=date}else if(typeof date==="string"){this.endDate=new UTCDate(date);if(!this.endDate.getUTCFullYear()){this.endDate=Infinity}}else{this.endDate=Infinity}if(this.viewDate){this.update()}},getLocalDate:function(){if(this._unset)return null;var d=this._date;return new Date(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds())},setLocalDate:function(localDate){if(!localDate)this.setValue(null);else this.setValue(Date.UTC(localDate.getFullYear(),localDate.getMonth(),localDate.getDate(),localDate.getHours(),localDate.getMinutes(),localDate.getSeconds(),localDate.getMilliseconds()))},place:function(){var position="absolute";var offset=this.component?this.component.offset():this.$element.offset();this.width=this.component?this.component.outerWidth():this.$element.outerWidth();offset.top=offset.top+this.height;var $window=$(window);if(this.options.width!=undefined){this.widget.width(this.options.width)}if(this.options.orientation=="left"){this.widget.addClass("left-oriented");offset.left=offset.left-this.widget.width()+20}if(this._isInFixed()){position="fixed";offset.top-=$window.scrollTop();offset.left-=$window.scrollLeft()}if($window.width()<offset.left+this.widget.outerWidth()){offset.right=$window.width()-offset.left-this.width;offset.left="auto";this.widget.addClass("pull-right")}else{offset.right="auto";this.widget.removeClass("pull-right")}this.widget.css({position:position,top:offset.top,left:offset.left,right:offset.right})},notifyChange:function(){this.$element.trigger({type:"changeDate",date:this.getDate(),localDate:this.getLocalDate()})},update:function(newDate){var dateStr=newDate;if(!dateStr){if(this.isInput){dateStr=this.$element.val()}else{dateStr=this.$element.find("input").val()}if(dateStr){this._date=this.parseDate(dateStr)}if(!this._date){var tmp=new Date;this._date=UTCDate(tmp.getFullYear(),tmp.getMonth(),tmp.getDate(),tmp.getHours(),tmp.getMinutes(),tmp.getSeconds(),tmp.getMilliseconds())}}this.viewDate=UTCDate(this._date.getUTCFullYear(),this._date.getUTCMonth(),1,0,0,0,0);this.fillDate();this.fillTime()},fillDow:function(){var dowCnt=this.weekStart;var html=$("<tr>");while(dowCnt<this.weekStart+7){html.append('<th class="dow">'+dates[this.language].daysMin[dowCnt++%7]+"</th>")}this.widget.find(".datepicker-days thead").append(html)},fillMonths:function(){var html="";var i=0;while(i<12){html+='<span class="month">'+dates[this.language].monthsShort[i++]+"</span>"}this.widget.find(".datepicker-months td").append(html)},fillDate:function(){var year=this.viewDate.getUTCFullYear();var month=this.viewDate.getUTCMonth();var currentDate=UTCDate(this._date.getUTCFullYear(),this._date.getUTCMonth(),this._date.getUTCDate(),0,0,0,0);var startYear=typeof this.startDate==="object"?this.startDate.getUTCFullYear():-Infinity;var startMonth=typeof this.startDate==="object"?this.startDate.getUTCMonth():-1;var endYear=typeof this.endDate==="object"?this.endDate.getUTCFullYear():Infinity;var endMonth=typeof this.endDate==="object"?this.endDate.getUTCMonth():12;this.widget.find(".datepicker-days").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-months").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-years").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-days th:eq(1)").text(dates[this.language].months[month]+" "+year);var prevMonth=UTCDate(year,month-1,28,0,0,0,0);var day=DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(),prevMonth.getUTCMonth());prevMonth.setUTCDate(day);prevMonth.setUTCDate(day-(prevMonth.getUTCDay()-this.weekStart+7)%7);if(year==startYear&&month<=startMonth||year<startYear){this.widget.find(".datepicker-days th:eq(0)").addClass("disabled")}if(year==endYear&&month>=endMonth||year>endYear){this.widget.find(".datepicker-days th:eq(2)").addClass("disabled")}var nextMonth=new Date(prevMonth.valueOf());nextMonth.setUTCDate(nextMonth.getUTCDate()+42);nextMonth=nextMonth.valueOf();var html=[];var row;var clsName;while(prevMonth.valueOf()<nextMonth){if(prevMonth.getUTCDay()===this.weekStart){row=$("<tr>");html.push(row)}clsName="";if(prevMonth.getUTCFullYear()<year||prevMonth.getUTCFullYear()==year&&prevMonth.getUTCMonth()<month){clsName+=" old"}else if(prevMonth.getUTCFullYear()>year||prevMonth.getUTCFullYear()==year&&prevMonth.getUTCMonth()>month){clsName+=" new"}if(prevMonth.valueOf()===currentDate.valueOf()){clsName+=" active"}if(prevMonth.valueOf()+864e5<=this.startDate){clsName+=" disabled"}if(prevMonth.valueOf()>this.endDate){clsName+=" disabled"}row.append('<td class="day'+clsName+'">'+prevMonth.getUTCDate()+"</td>");prevMonth.setUTCDate(prevMonth.getUTCDate()+1)}this.widget.find(".datepicker-days tbody").empty().append(html);var currentYear=this._date.getUTCFullYear();var months=this.widget.find(".datepicker-months").find("th:eq(1)").text(year).end().find("span").removeClass("active");if(currentYear===year){months.eq(this._date.getUTCMonth()).addClass("active")}if(currentYear-1<startYear){this.widget.find(".datepicker-months th:eq(0)").addClass("disabled")}if(currentYear+1>endYear){this.widget.find(".datepicker-months th:eq(2)").addClass("disabled")}for(var i=0;i<12;i++){if(year==startYear&&startMonth>i||year<startYear){$(months[i]).addClass("disabled")}else if(year==endYear&&endMonth<i||year>endYear){$(months[i]).addClass("disabled")}}html="";year=parseInt(year/10,10)*10;var yearCont=this.widget.find(".datepicker-years").find("th:eq(1)").text(year+"-"+(year+9)).end().find("td");this.widget.find(".datepicker-years").find("th").removeClass("disabled");if(startYear>year){this.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled")}if(endYear<year+9){this.widget.find(".datepicker-years").find("th:eq(2)").addClass("disabled")}year-=1;for(var i=-1;i<11;i++){html+='<span class="year'+(i===-1||i===10?" old":"")+(currentYear===year?" active":"")+(year<startYear||year>endYear?" disabled":"")+'">'+year+"</span>";year+=1}yearCont.html(html)},fillHours:function(){var table=this.widget.find(".timepicker .timepicker-hours table");table.parent().hide();var html="";if(this.options.pick12HourFormat){var current=1;for(var i=0;i<3;i+=1){html+="<tr>";for(var j=0;j<4;j+=1){var c=current.toString();html+='<td class="hour">'+padLeft(c,2,"0")+"</td>";current++}html+="</tr>"}}else{var current=0;for(var i=0;i<6;i+=1){html+="<tr>";for(var j=0;j<4;j+=1){var c=current.toString();html+='<td class="hour">'+padLeft(c,2,"0")+"</td>";current++}html+="</tr>"}}table.html(html)},fillMinutes:function(){var table=this.widget.find(".timepicker .timepicker-minutes table");table.parent().hide();var html="";var current=0;for(var i=0;i<5;i++){html+="<tr>";for(var j=0;j<4;j+=1){var c=current.toString();html+='<td class="minute">'+padLeft(c,2,"0")+"</td>";current+=3}html+="</tr>"}table.html(html)},fillSeconds:function(){var table=this.widget.find(".timepicker .timepicker-seconds table");table.parent().hide();var html="";var current=0;for(var i=0;i<5;i++){html+="<tr>";for(var j=0;j<4;j+=1){var c=current.toString();html+='<td class="second">'+padLeft(c,2,"0")+"</td>";current+=3}html+="</tr>"}table.html(html)},fillTime:function(){if(!this._date)return;var timeComponents=this.widget.find(".timepicker span[data-time-component]");var table=timeComponents.closest("table");var is12HourFormat=this.options.pick12HourFormat;var hour=this._date.getUTCHours();var period="AM";if(is12HourFormat){if(hour>=12)period="PM";if(hour===0)hour=12;else if(hour!=12)hour=hour%12;this.widget.find(".timepicker [data-action=togglePeriod]").text(period)}hour=padLeft(hour.toString(),2,"0");var minute=padLeft(this._date.getUTCMinutes().toString(),2,"0");var second=padLeft(this._date.getUTCSeconds().toString(),2,"0");timeComponents.filter("[data-time-component=hours]").text(hour);timeComponents.filter("[data-time-component=minutes]").text(minute);timeComponents.filter("[data-time-component=seconds]").text(second)},click:function(e){e.stopPropagation();e.preventDefault();this._unset=false;var target=$(e.target).closest("span, td, th");if(target.length===1){if(!target.is(".disabled")){switch(target[0].nodeName.toLowerCase()){case"th":switch(target[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var vd=this.viewDate;var navFnc=DPGlobal.modes[this.viewMode].navFnc;var step=DPGlobal.modes[this.viewMode].navStep;if(target[0].className==="prev")step=step*-1;vd["set"+navFnc](vd["get"+navFnc]()+step);this.fillDate();this.set();break}break;case"span":if(target.is(".month")){var month=target.parent().find("span").index(target);this.viewDate.setUTCMonth(month)}else{var year=parseInt(target.text(),10)||0;this.viewDate.setUTCFullYear(year)}if(this.viewMode!==0){this._date=UTCDate(this.viewDate.getUTCFullYear(),this.viewDate.getUTCMonth(),this.viewDate.getUTCDate(),this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds());this.notifyChange()}this.showMode(-1);this.fillDate();this.set();break;case"td":if(target.is(".day")){var day=parseInt(target.text(),10)||1;var month=this.viewDate.getUTCMonth();var year=this.viewDate.getUTCFullYear();if(target.is(".old")){if(month===0){month=11;year-=1}else{month-=1}}else if(target.is(".new")){if(month==11){month=0;year+=1}else{month+=1}}this._date=UTCDate(year,month,day,this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds());this.viewDate=UTCDate(year,month,Math.min(28,day),0,0,0,0);this.fillDate();this.set();this.notifyChange()}break}}}},actions:{incrementHours:function(e){this._date.setUTCHours(this._date.getUTCHours()+1)},incrementMinutes:function(e){this._date.setUTCMinutes(this._date.getUTCMinutes()+1)},incrementSeconds:function(e){this._date.setUTCSeconds(this._date.getUTCSeconds()+1)},decrementHours:function(e){this._date.setUTCHours(this._date.getUTCHours()-1)},decrementMinutes:function(e){this._date.setUTCMinutes(this._date.getUTCMinutes()-1)},decrementSeconds:function(e){this._date.setUTCSeconds(this._date.getUTCSeconds()-1)},togglePeriod:function(e){var hour=this._date.getUTCHours();if(hour>=12)hour-=12;else hour+=12;this._date.setUTCHours(hour)},showPicker:function(){this.widget.find(".timepicker > div:not(.timepicker-picker)").hide();this.widget.find(".timepicker .timepicker-picker").show()},showHours:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);if(this.options.pick12HourFormat){var current=this._date.getUTCHours();if(current>=12){if(value!=12)value=(value+12)%24}else{if(value===12)value=0;else value=value%12}}this._date.setUTCHours(value);this.actions.showPicker.call(this)},selectMinute:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);this._date.setUTCMinutes(value);this.actions.showPicker.call(this)},selectSecond:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);this._date.setUTCSeconds(value);this.actions.showPicker.call(this)}},doAction:function(e){e.stopPropagation();e.preventDefault();if(!this._date)this._date=UTCDate(1970,0,0,0,0,0,0);var action=$(e.currentTarget).data("action");var rv=this.actions[action].apply(this,arguments);this.set();this.fillTime();this.notifyChange();return rv},stopEvent:function(e){e.stopPropagation();e.preventDefault()},keydown:function(e){var self=this,k=e.which,input=$(e.target);if(k==8||k==46){setTimeout(function(){self._resetMaskPos(input)})}},keypress:function(e){var k=e.which;if(k==8||k==46){return}var input=$(e.target);var c=String.fromCharCode(k);var val=input.val()||"";val+=c;var mask=this._mask[this._maskPos];if(!mask){return false}if(mask.end!=val.length){return}if(!mask.pattern.test(val.slice(mask.start))){val=val.slice(0,val.length-1);while((mask=this._mask[this._maskPos])&&mask.character){val+=mask.character;this._maskPos++}val+=c;if(mask.end!=val.length){input.val(val);return false}else{if(!mask.pattern.test(val.slice(mask.start))){input.val(val.slice(0,mask.start));return false}else{input.val(val);this._maskPos++;return false}}}else{this._maskPos++}},change:function(e){var input=$(e.target);var val=input.val();if(this._formatPattern.test(val)){this.update();this.setValue(this._date.getTime());this.notifyChange();this.set()}else if(val&&val.trim()){this.setValue(this._date.getTime());if(this._date)this.set();else input.val("")}else{if(this._date){this.setValue(null);this.notifyChange();this._unset=true}}this._resetMaskPos(input)},showMode:function(dir){if(dir){this.viewMode=Math.max(this.minViewMode,Math.min(2,this.viewMode+dir))}this.widget.find(".datepicker > div").hide().filter(".datepicker-"+DPGlobal.modes[this.viewMode].clsName).show()},destroy:function(){this._detachDatePickerEvents();this._detachDatePickerGlobalEvents();this.widget.remove();this.$element.removeData("datetimepicker");this.component.removeData("datetimepicker")},formatDate:function(d){return this.format.replace(formatReplacer,function(match){var methodName,property,rv,len=match.length;if(match==="ms")len=1;property=dateFormatComponents[match].property;if(property==="Hours12"){rv=d.getUTCHours();if(rv===0)rv=12;else if(rv!==12)rv=rv%12}else if(property==="Period12"){if(d.getUTCHours()>=12)return"PM";else return"AM"}else{methodName="get"+property;rv=d[methodName]()}if(methodName==="getUTCMonth")rv=rv+1;if(methodName==="getUTCYear")rv=rv+1900-2e3;return padLeft(rv.toString(),len,"0")})},parseDate:function(str){var match,i,property,methodName,value,parsed={};if(!(match=this._formatPattern.exec(str)))return null;for(i=1;i<match.length;i++){property=this._propertiesByIndex[i];if(!property)continue;value=match[i];if(/^\d+$/.test(value))value=parseInt(value,10);parsed[property]=value}return this._finishParsingDate(parsed)},_resetMaskPos:function(input){var val=input.val();for(var i=0;i<this._mask.length;i++){if(this._mask[i].end>val.length){this._maskPos=i;break}else if(this._mask[i].end===val.length){this._maskPos=i+1;break}}},_finishParsingDate:function(parsed){var year,month,date,hours,minutes,seconds,milliseconds;year=parsed.UTCFullYear;if(parsed.UTCYear)year=2e3+parsed.UTCYear;if(!year)year=1970;if(parsed.UTCMonth)month=parsed.UTCMonth-1;else month=0;date=parsed.UTCDate||1;hours=parsed.UTCHours||0;minutes=parsed.UTCMinutes||0;seconds=parsed.UTCSeconds||0;milliseconds=parsed.UTCMilliseconds||0;if(parsed.Hours12){hours=parsed.Hours12}if(parsed.Period12){if(/pm/i.test(parsed.Period12)){if(hours!=12)hours=(hours+12)%24}else{hours=hours%12}}return UTCDate(year,month,date,hours,minutes,seconds,milliseconds)},_compileFormat:function(){var match,component,components=[],mask=[],str=this.format,propertiesByIndex={},i=0,pos=0;while(match=formatComponent.exec(str)){component=match[0];if(component in dateFormatComponents){i++;propertiesByIndex[i]=dateFormatComponents[component].property;components.push("\\s*"+dateFormatComponents[component].getPattern(this)+"\\s*");mask.push({pattern:new RegExp(dateFormatComponents[component].getPattern(this)),property:dateFormatComponents[component].property,start:pos,end:pos+=component.length})}else{components.push(escapeRegExp(component));mask.push({pattern:new RegExp(escapeRegExp(component)),character:component,start:pos,end:++pos})}str=str.slice(component.length)}this._mask=mask;this._maskPos=0;this._formatPattern=new RegExp("^\\s*"+components.join("")+"\\s*$");this._propertiesByIndex=propertiesByIndex},_attachDatePickerEvents:function(){var self=this;this.widget.on("click",".datepicker *",$.proxy(this.click,this));this.widget.on("click","[data-action]",$.proxy(this.doAction,this));this.widget.on("mousedown",$.proxy(this.stopEvent,this));if(this.pickDate&&this.pickTime){this.widget.on("click.togglePicker",".accordion-toggle",function(e){e.stopPropagation();var $this=$(this);var $parent=$this.closest("ul");var expanded=$parent.find(".collapse.in");var closed=$parent.find(".collapse:not(.in)");if(expanded&&expanded.length){var collapseData=expanded.data("collapse");if(collapseData&&collapseData.transitioning)return;expanded.collapse("hide");closed.collapse("show");$this.find("i").toggleClass(self.timeIcon+" "+self.dateIcon);self.$element.find(".add-on i").toggleClass(self.timeIcon+" "+self.dateIcon)}})}if(this.isInput){this.$element.on({focus:$.proxy(this.show,this),change:$.proxy(this.change,this)});if(this.options.maskInput){this.$element.on({keydown:$.proxy(this.keydown,this),keypress:$.proxy(this.keypress,this)})}}else{this.$element.on({change:$.proxy(this.change,this)},"input");if(this.options.maskInput){this.$element.on({keydown:$.proxy(this.keydown,this),keypress:$.proxy(this.keypress,this)},"input")}if(this.component){this.component.on("click",$.proxy(this.show,this))}else{this.$element.on("click",$.proxy(this.show,this))}}},_attachDatePickerGlobalEvents:function(){$(window).on("resize.datetimepicker"+this.id,$.proxy(this.place,this));if(!this.isInput){$(document).on("mousedown.datetimepicker"+this.id,$.proxy(this.hide,this))}},_detachDatePickerEvents:function(){this.widget.off("click",".datepicker *",this.click);this.widget.off("click","[data-action]");this.widget.off("mousedown",this.stopEvent);if(this.pickDate&&this.pickTime){this.widget.off("click.togglePicker")}if(this.isInput){this.$element.off({focus:this.show,change:this.change});if(this.options.maskInput){this.$element.off({keydown:this.keydown,keypress:this.keypress})}}else{this.$element.off({change:this.change},"input");if(this.options.maskInput){this.$element.off({keydown:this.keydown,keypress:this.keypress},"input")}if(this.component){this.component.off("click",this.show)}else{this.$element.off("click",this.show)}}},_detachDatePickerGlobalEvents:function(){$(window).off("resize.datetimepicker"+this.id);if(!this.isInput){$(document).off("mousedown.datetimepicker"+this.id)}},_isInFixed:function(){if(this.$element){var parents=this.$element.parents();var inFixed=false;for(var i=0;i<parents.length;i++){if($(parents[i]).css("position")=="fixed"){inFixed=true;break}}return inFixed}else{return false}}};$.fn.datetimepicker=function(option,val){return this.each(function(){var $this=$(this),data=$this.data("datetimepicker"),options=typeof option==="object"&&option;if(!data){$this.data("datetimepicker",data=new DateTimePicker(this,$.extend({},$.fn.datetimepicker.defaults,options)))}if(typeof option==="string")data[option](val)})};$.fn.datetimepicker.defaults={maskInput:false,pickDate:true,pickTime:true,pick12HourFormat:false,pickSeconds:true,startDate:-Infinity,endDate:Infinity,collapse:true};$.fn.datetimepicker.Constructor=DateTimePicker;var dpgId=0;var dates=$.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}};var dateFormatComponents={dd:{property:"UTCDate",getPattern:function(){return"(0?[1-9]|[1-2][0-9]|3[0-1])\\b"}},MM:{property:"UTCMonth",getPattern:function(){return"(0?[1-9]|1[0-2])\\b"}},yy:{property:"UTCYear",getPattern:function(){return"(\\d{2})\\b"}},yyyy:{property:"UTCFullYear",getPattern:function(){return"(\\d{4})\\b"}},hh:{property:"UTCHours",getPattern:function(){return"(0?[0-9]|1[0-9]|2[0-3])\\b"}},mm:{property:"UTCMinutes",getPattern:function(){return"(0?[0-9]|[1-5][0-9])\\b"}},ss:{property:"UTCSeconds",getPattern:function(){return"(0?[0-9]|[1-5][0-9])\\b"}},ms:{property:"UTCMilliseconds",getPattern:function(){return"([0-9]{1,3})\\b"}},HH:{property:"Hours12",getPattern:function(){return"(0?[1-9]|1[0-2])\\b"}},PP:{property:"Period12",getPattern:function(){return"(AM|PM|am|pm|Am|aM|Pm|pM)\\b"}}};var keys=[];for(var k in dateFormatComponents)keys.push(k);keys[keys.length-1]+="\\b";keys.push(".");var formatComponent=new RegExp(keys.join("\\b|"));keys.pop();var formatReplacer=new RegExp(keys.join("\\b|"),"g");function escapeRegExp(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function padLeft(s,l,c){if(l<s.length)return s;else return Array(l-s.length+1).join(c||" ")+s}function getTemplate(timeIcon,pickDate,pickTime,is12Hours,showSeconds,collapse){if(pickDate&&pickTime){return'<div class="bootstrap-datetimepicker-widget dropdown-menu">'+"<ul>"+"<li"+(collapse?' class="collapse in"':"")+">"+'<div class="datepicker">'+DPGlobal.template+"</div>"+"</li>"+'<li class="picker-switch accordion-toggle"><a><i class="'+timeIcon+'"></i></a></li>'+"<li"+(collapse?' class="collapse"':"")+">"+'<div class="timepicker">'+TPGlobal.getTemplate(is12Hours,showSeconds)+"</div>"+"</li>"+"</ul>"+"</div>"}else if(pickTime){return'<div class="bootstrap-datetimepicker-widget dropdown-menu">'+'<div class="timepicker">'+TPGlobal.getTemplate(is12Hours,showSeconds)+"</div>"+"</div>"}else{return'<div class="bootstrap-datetimepicker-widget dropdown-menu">'+'<div class="datepicker">'+DPGlobal.template+"</div>"+"</div>"}}function UTCDate(){return new Date(Date.UTC.apply(Date,arguments))}var DPGlobal={modes:[{clsName:"days",navFnc:"UTCMonth",navStep:1},{clsName:"months",navFnc:"UTCFullYear",navStep:1},{clsName:"years",navFnc:"UTCFullYear",navStep:10}],isLeapYear:function(year){return year%4===0&&year%100!==0||year%400===0},getDaysInMonth:function(year,month){return[31,DPGlobal.isLeapYear(year)?29:28,31,30,31,30,31,31,30,31,30,31][month]},headTemplate:"<thead>"+"<tr>"+'<th class="prev">‹</th>'+'<th colspan="5" class="switch"></th>'+'<th class="next">›</th>'+"</tr>"+"</thead>",contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>'};DPGlobal.template='<div class="datepicker-days">'+'<table class="table-condensed">'+DPGlobal.headTemplate+"<tbody></tbody>"+"</table>"+"</div>"+'<div class="datepicker-months">'+'<table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+"</table>"+"</div>"+'<div class="datepicker-years">'+'<table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+"</table>"+"</div>";var TPGlobal={hourTemplate:'<span data-action="showHours" data-time-component="hours" class="timepicker-hour"></span>',minuteTemplate:'<span data-action="showMinutes" data-time-component="minutes" class="timepicker-minute"></span>',secondTemplate:'<span data-action="showSeconds" data-time-component="seconds" class="timepicker-second"></span>'};TPGlobal.getTemplate=function(is12Hours,showSeconds){return'<div class="timepicker-picker">'+'<table class="table-condensed"'+(is12Hours?' data-hour-format="12"':"")+">"+"<tr>"+'<td><a href="#" class="btn" data-action="incrementHours"><i class="icon-chevron-up"></i></a></td>'+'<td class="separator"></td>'+'<td><a href="#" class="btn" data-action="incrementMinutes"><i class="icon-chevron-up"></i></a></td>'+(showSeconds?'<td class="separator"></td>'+'<td><a href="#" class="btn" data-action="incrementSeconds"><i class="icon-chevron-up"></i></a></td>':"")+(is12Hours?'<td class="separator"></td>':"")+"</tr>"+"<tr>"+"<td>"+TPGlobal.hourTemplate+"</td> "+'<td class="separator">:</td>'+"<td>"+TPGlobal.minuteTemplate+"</td> "+(showSeconds?'<td class="separator">:</td>'+"<td>"+TPGlobal.secondTemplate+"</td>":"")+(is12Hours?'<td class="separator"></td>'+"<td>"+'<button type="button" class="btn btn-primary" data-action="togglePeriod"></button>'+"</td>":"")+"</tr>"+"<tr>"+'<td><a href="#" class="btn" data-action="decrementHours"><i class="icon-chevron-down"></i></a></td>'+'<td class="separator"></td>'+'<td><a href="#" class="btn" data-action="decrementMinutes"><i class="icon-chevron-down"></i></a></td>'+(showSeconds?'<td class="separator"></td>'+'<td><a href="#" class="btn" data-action="decrementSeconds"><i class="icon-chevron-down"></i></a></td>':"")+(is12Hours?'<td class="separator"></td>':"")+"</tr>"+"</table>"+"</div>"+'<div class="timepicker-hours" data-action="selectHour">'+'<table class="table-condensed">'+"</table>"+"</div>"+'<div class="timepicker-minutes" data-action="selectMinute">'+'<table class="table-condensed">'+"</table>"+"</div>"+(showSeconds?'<div class="timepicker-seconds" data-action="selectSecond">'+'<table class="table-condensed">'+"</table>"+"</div>":"")}})(window.jQuery);
|
@@ -0,0 +1,1022 @@
|
|
1
|
+
(function ($) {
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
$.expr[':'].icontains = function (obj, index, meta) {
|
6
|
+
return $(obj).text().toUpperCase().indexOf(meta[3].toUpperCase()) >= 0;
|
7
|
+
};
|
8
|
+
|
9
|
+
var Selectpicker = function (element, options, e) {
|
10
|
+
if (e) {
|
11
|
+
e.stopPropagation();
|
12
|
+
e.preventDefault();
|
13
|
+
}
|
14
|
+
|
15
|
+
this.$element = $(element);
|
16
|
+
this.$newElement = null;
|
17
|
+
this.$button = null;
|
18
|
+
this.$menu = null;
|
19
|
+
this.$lis = null;
|
20
|
+
this.options = options;
|
21
|
+
|
22
|
+
//If we have no title yet, check the attribute 'title' (this is missed by jq as its not a data-attribute
|
23
|
+
if (this.options.title === null) {
|
24
|
+
this.options.title = this.$element.attr('title');
|
25
|
+
}
|
26
|
+
|
27
|
+
//Expose public methods
|
28
|
+
this.val = Selectpicker.prototype.val;
|
29
|
+
this.render = Selectpicker.prototype.render;
|
30
|
+
this.refresh = Selectpicker.prototype.refresh;
|
31
|
+
this.setStyle = Selectpicker.prototype.setStyle;
|
32
|
+
this.selectAll = Selectpicker.prototype.selectAll;
|
33
|
+
this.deselectAll = Selectpicker.prototype.deselectAll;
|
34
|
+
this.destroy = Selectpicker.prototype.destroy;
|
35
|
+
this.show = Selectpicker.prototype.show;
|
36
|
+
this.hide = Selectpicker.prototype.hide;
|
37
|
+
|
38
|
+
this.init();
|
39
|
+
};
|
40
|
+
|
41
|
+
Selectpicker.VERSION = '1.5.4';
|
42
|
+
|
43
|
+
Selectpicker.prototype = {
|
44
|
+
|
45
|
+
constructor: Selectpicker,
|
46
|
+
|
47
|
+
init: function () {
|
48
|
+
var that = this,
|
49
|
+
id = this.$element.attr('id');
|
50
|
+
|
51
|
+
this.$element.hide();
|
52
|
+
this.multiple = this.$element.prop('multiple');
|
53
|
+
this.autofocus = this.$element.prop('autofocus');
|
54
|
+
this.$newElement = this.createView();
|
55
|
+
this.$element.after(this.$newElement);
|
56
|
+
this.$menu = this.$newElement.find('> .dropdown-menu');
|
57
|
+
this.$button = this.$newElement.find('> button');
|
58
|
+
this.$searchbox = this.$newElement.find('input');
|
59
|
+
|
60
|
+
if (id !== undefined) {
|
61
|
+
this.$button.attr('data-id', id);
|
62
|
+
$('label[for="' + id + '"]').click(function (e) {
|
63
|
+
e.preventDefault();
|
64
|
+
that.$button.focus();
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
this.checkDisabled();
|
69
|
+
this.clickListener();
|
70
|
+
if (this.options.liveSearch) this.liveSearchListener();
|
71
|
+
this.render();
|
72
|
+
this.liHeight();
|
73
|
+
this.setStyle();
|
74
|
+
this.setWidth();
|
75
|
+
if (this.options.container) this.selectPosition();
|
76
|
+
this.$menu.data('this', this);
|
77
|
+
this.$newElement.data('this', this);
|
78
|
+
if (this.options.mobile) this.mobile();
|
79
|
+
},
|
80
|
+
|
81
|
+
createDropdown: function () {
|
82
|
+
//If we are multiple, then add the show-tick class by default
|
83
|
+
var multiple = this.multiple ? ' show-tick' : '';
|
84
|
+
var inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '';
|
85
|
+
var autofocus = this.autofocus ? ' autofocus' : '';
|
86
|
+
var header = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + '</div>' : '';
|
87
|
+
var searchbox = this.options.liveSearch ? '<div class="bootstrap-select-searchbox"><input type="text" class="input-block-level form-control" autocomplete="off" /></div>' : '';
|
88
|
+
var actionsbox = this.options.actionsBox ? '<div class="bs-actionsbox">' +
|
89
|
+
'<div class="btn-group btn-block">' +
|
90
|
+
'<button class="actions-btn bs-select-all btn btn-sm btn-default">' +
|
91
|
+
'Select All' +
|
92
|
+
'</button>' +
|
93
|
+
'<button class="actions-btn bs-deselect-all btn btn-sm btn-default">' +
|
94
|
+
'Deselect All' +
|
95
|
+
'</button>' +
|
96
|
+
'</div>' +
|
97
|
+
'</div>' : '';
|
98
|
+
var drop =
|
99
|
+
'<div class="btn-group bootstrap-select' + multiple + inputGroup + '">' +
|
100
|
+
'<button type="button" class="btn dropdown-toggle selectpicker" data-toggle="dropdown"' + autofocus + '>' +
|
101
|
+
'<span class="filter-option pull-left"></span> ' +
|
102
|
+
'<span class="caret"></span>' +
|
103
|
+
'</button>' +
|
104
|
+
'<div class="dropdown-menu open">' +
|
105
|
+
header +
|
106
|
+
searchbox +
|
107
|
+
actionsbox +
|
108
|
+
'<ul class="dropdown-menu inner selectpicker" role="menu">' +
|
109
|
+
'</ul>' +
|
110
|
+
'</div>' +
|
111
|
+
'</div>';
|
112
|
+
|
113
|
+
return $(drop);
|
114
|
+
},
|
115
|
+
|
116
|
+
createView: function () {
|
117
|
+
var $drop = this.createDropdown();
|
118
|
+
var $li = this.createLi();
|
119
|
+
$drop.find('ul').append($li);
|
120
|
+
return $drop;
|
121
|
+
},
|
122
|
+
|
123
|
+
reloadLi: function () {
|
124
|
+
//Remove all children.
|
125
|
+
this.destroyLi();
|
126
|
+
//Re build
|
127
|
+
var $li = this.createLi();
|
128
|
+
this.$menu.find('ul').append($li);
|
129
|
+
},
|
130
|
+
|
131
|
+
destroyLi: function () {
|
132
|
+
this.$menu.find('li').remove();
|
133
|
+
},
|
134
|
+
|
135
|
+
createLi: function () {
|
136
|
+
var that = this,
|
137
|
+
_liA = [],
|
138
|
+
_liHtml = '',
|
139
|
+
optID = 0;
|
140
|
+
|
141
|
+
this.$element.find('option').each(function () {
|
142
|
+
var $this = $(this);
|
143
|
+
|
144
|
+
//Get the class and text for the option
|
145
|
+
var optionClass = $this.attr('class') || '';
|
146
|
+
var inline = $this.attr('style') || '';
|
147
|
+
var text = $this.data('content') ? $this.data('content') : $this.html();
|
148
|
+
var subtext = $this.data('subtext') !== undefined ? '<small class="muted text-muted">' + $this.data('subtext') + '</small>' : '';
|
149
|
+
var icon = $this.data('icon') !== undefined ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '';
|
150
|
+
if (icon !== '' && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
|
151
|
+
icon = '<span>' + icon + '</span>';
|
152
|
+
}
|
153
|
+
|
154
|
+
if (!$this.data('content')) {
|
155
|
+
//Prepend any icon and append any subtext to the main text.
|
156
|
+
text = icon + '<span class="text">' + text + subtext + '</span>';
|
157
|
+
}
|
158
|
+
|
159
|
+
if (that.options.hideDisabled && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
|
160
|
+
_liA.push('<a style="min-height: 0; padding: 0"></a>');
|
161
|
+
} else if ($this.parent().is('optgroup') && $this.data('divider') !== true) {
|
162
|
+
if ($this.index() === 0) {
|
163
|
+
//Get the opt group label
|
164
|
+
var label = $this.parent().attr('label');
|
165
|
+
var labelSubtext = $this.parent().data('subtext') !== undefined ? '<small class="muted text-muted">' + $this.parent().data('subtext') + '</small>' : '';
|
166
|
+
var labelIcon = $this.parent().data('icon') ? '<i class="' + that.options.iconBase + ' ' + $this.parent().data('icon') + '"></i> ' : '';
|
167
|
+
label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
|
168
|
+
|
169
|
+
optID += 1;
|
170
|
+
|
171
|
+
if ($this[0].index !== 0) {
|
172
|
+
_liA.push(
|
173
|
+
'<div class="div-contain"><div class="divider"></div></div>' +
|
174
|
+
'<dt>' + label + '</dt>' +
|
175
|
+
that.createA(text, 'opt ' + optionClass, inline, optID)
|
176
|
+
);
|
177
|
+
} else {
|
178
|
+
_liA.push(
|
179
|
+
'<dt>' + label + '</dt>' +
|
180
|
+
that.createA(text, 'opt ' + optionClass, inline, optID));
|
181
|
+
}
|
182
|
+
} else {
|
183
|
+
_liA.push(that.createA(text, 'opt ' + optionClass, inline, optID));
|
184
|
+
}
|
185
|
+
} else if ($this.data('divider') === true) {
|
186
|
+
_liA.push('<div class="div-contain"><div class="divider"></div></div>');
|
187
|
+
} else if ($(this).data('hidden') === true) {
|
188
|
+
_liA.push('<a></a>');
|
189
|
+
} else {
|
190
|
+
_liA.push(that.createA(text, optionClass, inline));
|
191
|
+
}
|
192
|
+
});
|
193
|
+
|
194
|
+
$.each(_liA, function (i, item) {
|
195
|
+
var hide = item === '<a></a>' ? 'class="hide is-hidden"' : '';
|
196
|
+
_liHtml += '<li rel="' + i + '"' + hide + '>' + item + '</li>';
|
197
|
+
});
|
198
|
+
|
199
|
+
//If we are not multiple, and we dont have a selected item, and we dont have a title, select the first element so something is set in the button
|
200
|
+
if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) {
|
201
|
+
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
|
202
|
+
}
|
203
|
+
|
204
|
+
return $(_liHtml);
|
205
|
+
},
|
206
|
+
|
207
|
+
/**
|
208
|
+
*
|
209
|
+
* @param text
|
210
|
+
* @param classes
|
211
|
+
* @param inline
|
212
|
+
* @param [optgroup]
|
213
|
+
* @returns {string}
|
214
|
+
*/
|
215
|
+
createA: function (text, classes, inline, optgroup) {
|
216
|
+
return '<a tabindex="0" class="' + classes + '" style="' + inline + '"' +
|
217
|
+
(typeof optgroup !== 'undefined' ? 'data-optgroup="' + optgroup + '"' : '') + '>' +
|
218
|
+
text +
|
219
|
+
'<i class="' + this.options.iconBase + ' ' + this.options.tickIcon + ' icon-ok check-mark"></i>' +
|
220
|
+
'</a>';
|
221
|
+
},
|
222
|
+
|
223
|
+
/**
|
224
|
+
* @param [updateLi]
|
225
|
+
*/
|
226
|
+
render: function (updateLi) {
|
227
|
+
var that = this;
|
228
|
+
|
229
|
+
//Update the LI to match the SELECT
|
230
|
+
if (updateLi !== false) {
|
231
|
+
this.$element.find('option').each(function (index) {
|
232
|
+
that.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled'));
|
233
|
+
that.setSelected(index, $(this).is(':selected'));
|
234
|
+
});
|
235
|
+
}
|
236
|
+
|
237
|
+
this.tabIndex();
|
238
|
+
|
239
|
+
var selectedItems = this.$element.find('option:selected').map(function () {
|
240
|
+
var $this = $(this);
|
241
|
+
var icon = $this.data('icon') && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '';
|
242
|
+
var subtext;
|
243
|
+
if (that.options.showSubtext && $this.attr('data-subtext') && !that.multiple) {
|
244
|
+
subtext = ' <small class="muted text-muted">' + $this.data('subtext') + '</small>';
|
245
|
+
} else {
|
246
|
+
subtext = '';
|
247
|
+
}
|
248
|
+
if ($this.data('content') && that.options.showContent) {
|
249
|
+
return $this.data('content');
|
250
|
+
} else if ($this.attr('title') !== undefined) {
|
251
|
+
return $this.attr('title');
|
252
|
+
} else {
|
253
|
+
return icon + $this.html() + subtext;
|
254
|
+
}
|
255
|
+
}).toArray();
|
256
|
+
|
257
|
+
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
|
258
|
+
//Convert all the values into a comma delimited string
|
259
|
+
var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator);
|
260
|
+
|
261
|
+
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
|
262
|
+
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
|
263
|
+
var max = this.options.selectedTextFormat.split('>');
|
264
|
+
var notDisabled = this.options.hideDisabled ? ':not([disabled])' : '';
|
265
|
+
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) {
|
266
|
+
title = this.options.countSelectedText.replace('{0}', selectedItems.length).replace('{1}', this.$element.find('option:not([data-divider="true"], [data-hidden="true"])' + notDisabled).length);
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
this.options.title = this.$element.attr('title');
|
271
|
+
|
272
|
+
if (this.options.selectedTextFormat == 'static') {
|
273
|
+
title = this.options.title;
|
274
|
+
}
|
275
|
+
|
276
|
+
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
|
277
|
+
if (!title) {
|
278
|
+
title = this.options.title !== undefined ? this.options.title : this.options.noneSelectedText;
|
279
|
+
}
|
280
|
+
|
281
|
+
this.$button.attr('title', $.trim($("<div/>").html(title).text()).replace(/\s\s+/g, ' '));
|
282
|
+
this.$newElement.find('.filter-option').html(title);
|
283
|
+
},
|
284
|
+
|
285
|
+
/**
|
286
|
+
* @param [style]
|
287
|
+
* @param [status]
|
288
|
+
*/
|
289
|
+
setStyle: function (style, status) {
|
290
|
+
if (this.$element.attr('class')) {
|
291
|
+
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|validate\[.*\]/gi, ''));
|
292
|
+
}
|
293
|
+
|
294
|
+
var buttonClass = style ? style : this.options.style;
|
295
|
+
|
296
|
+
if (status == 'add') {
|
297
|
+
this.$button.addClass(buttonClass);
|
298
|
+
} else if (status == 'remove') {
|
299
|
+
this.$button.removeClass(buttonClass);
|
300
|
+
} else {
|
301
|
+
this.$button.removeClass(this.options.style);
|
302
|
+
this.$button.addClass(buttonClass);
|
303
|
+
}
|
304
|
+
},
|
305
|
+
|
306
|
+
liHeight: function () {
|
307
|
+
if (this.options.size === false) return;
|
308
|
+
|
309
|
+
var $selectClone = this.$menu.parent().clone().find('> .dropdown-toggle').prop('autofocus', false).end().appendTo('body'),
|
310
|
+
$menuClone = $selectClone.addClass('open').find('> .dropdown-menu'),
|
311
|
+
liHeight = $menuClone.find('li > a').outerHeight(),
|
312
|
+
headerHeight = this.options.header ? $menuClone.find('.popover-title').outerHeight() : 0,
|
313
|
+
searchHeight = this.options.liveSearch ? $menuClone.find('.bootstrap-select-searchbox').outerHeight() : 0,
|
314
|
+
actionsHeight = this.options.actionsBox ? $menuClone.find('.bs-actionsbox').outerHeight() : 0;
|
315
|
+
|
316
|
+
$selectClone.remove();
|
317
|
+
|
318
|
+
this.$newElement
|
319
|
+
.data('liHeight', liHeight)
|
320
|
+
.data('headerHeight', headerHeight)
|
321
|
+
.data('searchHeight', searchHeight)
|
322
|
+
.data('actionsHeight', actionsHeight);
|
323
|
+
},
|
324
|
+
|
325
|
+
setSize: function () {
|
326
|
+
var that = this,
|
327
|
+
menu = this.$menu,
|
328
|
+
menuInner = menu.find('.inner'),
|
329
|
+
selectHeight = this.$newElement.outerHeight(),
|
330
|
+
liHeight = this.$newElement.data('liHeight'),
|
331
|
+
headerHeight = this.$newElement.data('headerHeight'),
|
332
|
+
searchHeight = this.$newElement.data('searchHeight'),
|
333
|
+
actionsHeight = this.$newElement.data('actionsHeight'),
|
334
|
+
divHeight = menu.find('li .divider').outerHeight(true),
|
335
|
+
menuPadding = parseInt(menu.css('padding-top')) +
|
336
|
+
parseInt(menu.css('padding-bottom')) +
|
337
|
+
parseInt(menu.css('border-top-width')) +
|
338
|
+
parseInt(menu.css('border-bottom-width')),
|
339
|
+
notDisabled = this.options.hideDisabled ? ':not(.disabled)' : '',
|
340
|
+
$window = $(window),
|
341
|
+
menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2,
|
342
|
+
menuHeight,
|
343
|
+
selectOffsetTop,
|
344
|
+
selectOffsetBot,
|
345
|
+
posVert = function () {
|
346
|
+
//JQuery defines a scrollTop function, but in pure JS it's a property
|
347
|
+
//noinspection JSValidateTypes
|
348
|
+
selectOffsetTop = that.$newElement.offset().top - $window.scrollTop();
|
349
|
+
selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
|
350
|
+
};
|
351
|
+
posVert();
|
352
|
+
if (this.options.header) menu.css('padding-top', 0);
|
353
|
+
|
354
|
+
if (this.options.size == 'auto') {
|
355
|
+
var getSize = function () {
|
356
|
+
var minHeight,
|
357
|
+
lisVis = that.$lis.not('.hide');
|
358
|
+
|
359
|
+
posVert();
|
360
|
+
menuHeight = selectOffsetBot - menuExtras;
|
361
|
+
|
362
|
+
if (that.options.dropupAuto) {
|
363
|
+
that.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && ((menuHeight - menuExtras) < menu.height()));
|
364
|
+
}
|
365
|
+
if (that.$newElement.hasClass('dropup')) {
|
366
|
+
menuHeight = selectOffsetTop - menuExtras;
|
367
|
+
}
|
368
|
+
|
369
|
+
if ((lisVis.length + lisVis.find('dt').length) > 3) {
|
370
|
+
minHeight = liHeight * 3 + menuExtras - 2;
|
371
|
+
} else {
|
372
|
+
minHeight = 0;
|
373
|
+
}
|
374
|
+
|
375
|
+
menu.css({'max-height': menuHeight + 'px', 'overflow': 'hidden', 'min-height': minHeight + headerHeight + searchHeight + actionsHeight + 'px'});
|
376
|
+
menuInner.css({'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - menuPadding + 'px', 'overflow-y': 'auto', 'min-height': Math.max(minHeight - menuPadding, 0) + 'px'});
|
377
|
+
};
|
378
|
+
getSize();
|
379
|
+
this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize);
|
380
|
+
$(window).off('resize.getSize').on('resize.getSize', getSize);
|
381
|
+
$(window).off('scroll.getSize').on('scroll.getSize', getSize);
|
382
|
+
} else if (this.options.size && this.options.size != 'auto' && menu.find('li' + notDisabled).length > this.options.size) {
|
383
|
+
var optIndex = menu.find('li' + notDisabled + ' > *').not('.div-contain').slice(0, this.options.size).last().parent().index();
|
384
|
+
var divLength = menu.find('li').slice(0, optIndex + 1).find('.div-contain').length;
|
385
|
+
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding;
|
386
|
+
if (that.options.dropupAuto) {
|
387
|
+
this.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && (menuHeight < menu.height()));
|
388
|
+
}
|
389
|
+
menu.css({'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + 'px', 'overflow': 'hidden'});
|
390
|
+
menuInner.css({'max-height': menuHeight - menuPadding + 'px', 'overflow-y': 'auto'});
|
391
|
+
}
|
392
|
+
},
|
393
|
+
|
394
|
+
setWidth: function () {
|
395
|
+
if (this.options.width == 'auto') {
|
396
|
+
this.$menu.css('min-width', '0');
|
397
|
+
|
398
|
+
// Get correct width if element hidden
|
399
|
+
var selectClone = this.$newElement.clone().appendTo('body');
|
400
|
+
var ulWidth = selectClone.find('> .dropdown-menu').css('width');
|
401
|
+
var btnWidth = selectClone.css('width', 'auto').find('> button').css('width');
|
402
|
+
selectClone.remove();
|
403
|
+
|
404
|
+
// Set width to whatever's larger, button title or longest option
|
405
|
+
this.$newElement.css('width', Math.max(parseInt(ulWidth), parseInt(btnWidth)) + 'px');
|
406
|
+
} else if (this.options.width == 'fit') {
|
407
|
+
// Remove inline min-width so width can be changed from 'auto'
|
408
|
+
this.$menu.css('min-width', '');
|
409
|
+
this.$newElement.css('width', '').addClass('fit-width');
|
410
|
+
} else if (this.options.width) {
|
411
|
+
// Remove inline min-width so width can be changed from 'auto'
|
412
|
+
this.$menu.css('min-width', '');
|
413
|
+
this.$newElement.css('width', this.options.width);
|
414
|
+
} else {
|
415
|
+
// Remove inline min-width/width so width can be changed
|
416
|
+
this.$menu.css('min-width', '');
|
417
|
+
this.$newElement.css('width', '');
|
418
|
+
}
|
419
|
+
// Remove fit-width class if width is changed programmatically
|
420
|
+
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
|
421
|
+
this.$newElement.removeClass('fit-width');
|
422
|
+
}
|
423
|
+
},
|
424
|
+
|
425
|
+
selectPosition: function () {
|
426
|
+
var that = this,
|
427
|
+
drop = '<div />',
|
428
|
+
$drop = $(drop),
|
429
|
+
pos,
|
430
|
+
actualHeight,
|
431
|
+
getPlacement = function ($element) {
|
432
|
+
$drop.addClass($element.attr('class').replace(/form-control/gi, '')).toggleClass('dropup', $element.hasClass('dropup'));
|
433
|
+
pos = $element.offset();
|
434
|
+
actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
|
435
|
+
$drop.css({'top': pos.top + actualHeight, 'left': pos.left, 'width': $element[0].offsetWidth, 'position': 'absolute'});
|
436
|
+
};
|
437
|
+
this.$newElement.on('click', function () {
|
438
|
+
if (that.isDisabled()) {
|
439
|
+
return;
|
440
|
+
}
|
441
|
+
getPlacement($(this));
|
442
|
+
$drop.appendTo(that.options.container);
|
443
|
+
$drop.toggleClass('open', !$(this).hasClass('open'));
|
444
|
+
$drop.append(that.$menu);
|
445
|
+
});
|
446
|
+
$(window).resize(function () {
|
447
|
+
getPlacement(that.$newElement);
|
448
|
+
});
|
449
|
+
$(window).on('scroll', function () {
|
450
|
+
getPlacement(that.$newElement);
|
451
|
+
});
|
452
|
+
$('html').on('click', function (e) {
|
453
|
+
if ($(e.target).closest(that.$newElement).length < 1) {
|
454
|
+
$drop.removeClass('open');
|
455
|
+
}
|
456
|
+
});
|
457
|
+
},
|
458
|
+
|
459
|
+
mobile: function () {
|
460
|
+
this.$element.addClass('mobile-device').appendTo(this.$newElement);
|
461
|
+
if (this.options.container) this.$menu.hide();
|
462
|
+
},
|
463
|
+
|
464
|
+
refresh: function () {
|
465
|
+
this.$lis = null;
|
466
|
+
this.reloadLi();
|
467
|
+
this.render();
|
468
|
+
this.setWidth();
|
469
|
+
this.setStyle();
|
470
|
+
this.checkDisabled();
|
471
|
+
this.liHeight();
|
472
|
+
},
|
473
|
+
|
474
|
+
update: function () {
|
475
|
+
this.reloadLi();
|
476
|
+
this.setWidth();
|
477
|
+
this.setStyle();
|
478
|
+
this.checkDisabled();
|
479
|
+
this.liHeight();
|
480
|
+
},
|
481
|
+
|
482
|
+
setSelected: function (index, selected) {
|
483
|
+
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
484
|
+
$(this.$lis[index]).toggleClass('selected', selected);
|
485
|
+
},
|
486
|
+
|
487
|
+
setDisabled: function (index, disabled) {
|
488
|
+
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
489
|
+
if (disabled) {
|
490
|
+
$(this.$lis[index]).addClass('disabled').find('a').attr('href', '#').attr('tabindex', -1);
|
491
|
+
} else {
|
492
|
+
$(this.$lis[index]).removeClass('disabled').find('a').removeAttr('href').attr('tabindex', 0);
|
493
|
+
}
|
494
|
+
},
|
495
|
+
|
496
|
+
isDisabled: function () {
|
497
|
+
return this.$element.is(':disabled');
|
498
|
+
},
|
499
|
+
|
500
|
+
checkDisabled: function () {
|
501
|
+
var that = this;
|
502
|
+
|
503
|
+
if (this.isDisabled()) {
|
504
|
+
this.$button.addClass('disabled').attr('tabindex', -1);
|
505
|
+
} else {
|
506
|
+
if (this.$button.hasClass('disabled')) {
|
507
|
+
this.$button.removeClass('disabled');
|
508
|
+
}
|
509
|
+
|
510
|
+
if (this.$button.attr('tabindex') == -1) {
|
511
|
+
if (!this.$element.data('tabindex')) this.$button.removeAttr('tabindex');
|
512
|
+
}
|
513
|
+
}
|
514
|
+
|
515
|
+
this.$button.click(function () {
|
516
|
+
return !that.isDisabled();
|
517
|
+
});
|
518
|
+
},
|
519
|
+
|
520
|
+
tabIndex: function () {
|
521
|
+
if (this.$element.is('[tabindex]')) {
|
522
|
+
this.$element.data('tabindex', this.$element.attr('tabindex'));
|
523
|
+
this.$button.attr('tabindex', this.$element.data('tabindex'));
|
524
|
+
}
|
525
|
+
},
|
526
|
+
|
527
|
+
clickListener: function () {
|
528
|
+
var that = this;
|
529
|
+
|
530
|
+
$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) {
|
531
|
+
e.stopPropagation();
|
532
|
+
});
|
533
|
+
|
534
|
+
this.$newElement.on('click', function () {
|
535
|
+
that.setSize();
|
536
|
+
if (!that.options.liveSearch && !that.multiple) {
|
537
|
+
setTimeout(function () {
|
538
|
+
that.$menu.find('.selected a').focus();
|
539
|
+
}, 10);
|
540
|
+
}
|
541
|
+
});
|
542
|
+
|
543
|
+
this.$menu.on('click', 'li a', function (e) {
|
544
|
+
var clickedIndex = $(this).parent().index(),
|
545
|
+
prevValue = that.$element.val(),
|
546
|
+
prevIndex = that.$element.prop('selectedIndex');
|
547
|
+
|
548
|
+
//Dont close on multi choice menu
|
549
|
+
if (that.multiple) {
|
550
|
+
e.stopPropagation();
|
551
|
+
}
|
552
|
+
|
553
|
+
e.preventDefault();
|
554
|
+
|
555
|
+
//Dont run if we have been disabled
|
556
|
+
if (!that.isDisabled() && !$(this).parent().hasClass('disabled')) {
|
557
|
+
var $options = that.$element.find('option'),
|
558
|
+
$option = $options.eq(clickedIndex),
|
559
|
+
state = $option.prop('selected'),
|
560
|
+
$optgroup = $option.parent('optgroup'),
|
561
|
+
maxOptions = that.options.maxOptions,
|
562
|
+
maxOptionsGrp = $optgroup.data('maxOptions') || false;
|
563
|
+
|
564
|
+
//Deselect all others if not multi select box
|
565
|
+
if (!that.multiple) {
|
566
|
+
$options.prop('selected', false);
|
567
|
+
$option.prop('selected', true);
|
568
|
+
that.$menu.find('.selected').removeClass('selected');
|
569
|
+
that.setSelected(clickedIndex, true);
|
570
|
+
}
|
571
|
+
//Else toggle the one we have chosen if we are multi select.
|
572
|
+
else {
|
573
|
+
$option.prop('selected', !state);
|
574
|
+
that.setSelected(clickedIndex, !state);
|
575
|
+
$(this).blur();
|
576
|
+
|
577
|
+
if ((maxOptions !== false) || (maxOptionsGrp !== false)) {
|
578
|
+
var maxReached = maxOptions < $options.filter(':selected').length,
|
579
|
+
maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length,
|
580
|
+
maxOptionsArr = that.options.maxOptionsText,
|
581
|
+
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
|
582
|
+
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
|
583
|
+
$notify = $('<div class="notify"></div>');
|
584
|
+
|
585
|
+
if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) {
|
586
|
+
if (maxOptions && maxOptions == 1) {
|
587
|
+
$options.prop('selected', false);
|
588
|
+
$option.prop('selected', true);
|
589
|
+
that.$menu.find('.selected').removeClass('selected');
|
590
|
+
that.setSelected(clickedIndex, true);
|
591
|
+
} else if (maxOptionsGrp && maxOptionsGrp == 1) {
|
592
|
+
$optgroup.find('option:selected').prop('selected', false);
|
593
|
+
$option.prop('selected', true);
|
594
|
+
var optgroupID = $(this).data('optgroup');
|
595
|
+
|
596
|
+
that.$menu.find('.selected').has('a[data-optgroup="'+optgroupID+'"]').removeClass('selected');
|
597
|
+
|
598
|
+
that.setSelected(clickedIndex, true);
|
599
|
+
} else {
|
600
|
+
// If {var} is set in array, replace it
|
601
|
+
if (maxOptionsArr[2]) {
|
602
|
+
maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);
|
603
|
+
maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);
|
604
|
+
}
|
605
|
+
|
606
|
+
$option.prop('selected', false);
|
607
|
+
|
608
|
+
that.$menu.append($notify);
|
609
|
+
|
610
|
+
if (maxOptions && maxReached) {
|
611
|
+
$notify.append($('<div>' + maxTxt + '</div>'));
|
612
|
+
that.$element.trigger('maxReached.bs.select');
|
613
|
+
}
|
614
|
+
|
615
|
+
if (maxOptionsGrp && maxReachedGrp) {
|
616
|
+
$notify.append($('<div>' + maxTxtGrp + '</div>'));
|
617
|
+
that.$element.trigger('maxReachedGrp.bs.select');
|
618
|
+
}
|
619
|
+
|
620
|
+
setTimeout(function () {
|
621
|
+
that.setSelected(clickedIndex, false);
|
622
|
+
}, 10);
|
623
|
+
|
624
|
+
$notify.delay(750).fadeOut(300, function () {
|
625
|
+
$(this).remove();
|
626
|
+
});
|
627
|
+
}
|
628
|
+
}
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
if (!that.multiple) {
|
633
|
+
that.$button.focus();
|
634
|
+
} else if (that.options.liveSearch) {
|
635
|
+
that.$searchbox.focus();
|
636
|
+
}
|
637
|
+
|
638
|
+
// Trigger select 'change'
|
639
|
+
if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
|
640
|
+
that.$element.change();
|
641
|
+
}
|
642
|
+
}
|
643
|
+
});
|
644
|
+
|
645
|
+
this.$menu.on('click', 'li.disabled a, li dt, li .div-contain, .popover-title, .popover-title :not(.close)', function (e) {
|
646
|
+
if (e.target == this) {
|
647
|
+
e.preventDefault();
|
648
|
+
e.stopPropagation();
|
649
|
+
if (!that.options.liveSearch) {
|
650
|
+
that.$button.focus();
|
651
|
+
} else {
|
652
|
+
that.$searchbox.focus();
|
653
|
+
}
|
654
|
+
}
|
655
|
+
});
|
656
|
+
|
657
|
+
this.$menu.on('click', '.popover-title .close', function () {
|
658
|
+
that.$button.focus();
|
659
|
+
});
|
660
|
+
|
661
|
+
this.$searchbox.on('click', function (e) {
|
662
|
+
e.stopPropagation();
|
663
|
+
});
|
664
|
+
|
665
|
+
|
666
|
+
this.$menu.on('click', '.actions-btn', function (e) {
|
667
|
+
if (that.options.liveSearch) {
|
668
|
+
that.$searchbox.focus();
|
669
|
+
} else {
|
670
|
+
that.$button.focus();
|
671
|
+
}
|
672
|
+
|
673
|
+
e.preventDefault();
|
674
|
+
e.stopPropagation();
|
675
|
+
|
676
|
+
if ($(this).is('.bs-select-all')) {
|
677
|
+
that.selectAll();
|
678
|
+
} else {
|
679
|
+
that.deselectAll();
|
680
|
+
}
|
681
|
+
that.$element.change();
|
682
|
+
});
|
683
|
+
|
684
|
+
this.$element.change(function () {
|
685
|
+
that.render(false);
|
686
|
+
});
|
687
|
+
},
|
688
|
+
|
689
|
+
liveSearchListener: function () {
|
690
|
+
var that = this,
|
691
|
+
no_results = $('<li class="no-results"></li>');
|
692
|
+
|
693
|
+
this.$newElement.on('click.dropdown.data-api', function () {
|
694
|
+
that.$menu.find('.active').removeClass('active');
|
695
|
+
if (!!that.$searchbox.val()) {
|
696
|
+
that.$searchbox.val('');
|
697
|
+
that.$lis.not('.is-hidden').removeClass('hide');
|
698
|
+
if (!!no_results.parent().length) no_results.remove();
|
699
|
+
}
|
700
|
+
if (!that.multiple) that.$menu.find('.selected').addClass('active');
|
701
|
+
setTimeout(function () {
|
702
|
+
that.$searchbox.focus();
|
703
|
+
}, 10);
|
704
|
+
});
|
705
|
+
|
706
|
+
this.$searchbox.on('input propertychange', function () {
|
707
|
+
if (that.$searchbox.val()) {
|
708
|
+
that.$lis.not('.is-hidden').removeClass('hide').find('a').not(':icontains(' + that.$searchbox.val() + ')').parent().addClass('hide');
|
709
|
+
|
710
|
+
if (!that.$menu.find('li').filter(':visible:not(.no-results)').length) {
|
711
|
+
if (!!no_results.parent().length) no_results.remove();
|
712
|
+
no_results.html(that.options.noneResultsText + ' "' + that.$searchbox.val() + '"').show();
|
713
|
+
that.$menu.find('li').last().after(no_results);
|
714
|
+
} else if (!!no_results.parent().length) {
|
715
|
+
no_results.remove();
|
716
|
+
}
|
717
|
+
|
718
|
+
} else {
|
719
|
+
that.$lis.not('.is-hidden').removeClass('hide');
|
720
|
+
if (!!no_results.parent().length) no_results.remove();
|
721
|
+
}
|
722
|
+
|
723
|
+
that.$menu.find('li.active').removeClass('active');
|
724
|
+
that.$menu.find('li').filter(':visible:not(.divider)').eq(0).addClass('active').find('a').focus();
|
725
|
+
$(this).focus();
|
726
|
+
});
|
727
|
+
|
728
|
+
this.$menu.on('mouseenter', 'a', function (e) {
|
729
|
+
that.$menu.find('.active').removeClass('active');
|
730
|
+
$(e.currentTarget).parent().not('.disabled').addClass('active');
|
731
|
+
});
|
732
|
+
|
733
|
+
this.$menu.on('mouseleave', 'a', function () {
|
734
|
+
that.$menu.find('.active').removeClass('active');
|
735
|
+
});
|
736
|
+
},
|
737
|
+
|
738
|
+
val: function (value) {
|
739
|
+
|
740
|
+
if (value !== undefined) {
|
741
|
+
this.$element.val(value);
|
742
|
+
this.$element.change();
|
743
|
+
this.render();
|
744
|
+
|
745
|
+
return this.$element;
|
746
|
+
} else {
|
747
|
+
return this.$element.val();
|
748
|
+
}
|
749
|
+
},
|
750
|
+
|
751
|
+
selectAll: function () {
|
752
|
+
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
753
|
+
this.$element.find('option:enabled').prop('selected', true);
|
754
|
+
$(this.$lis).not('.disabled').addClass('selected');
|
755
|
+
this.render(false);
|
756
|
+
},
|
757
|
+
|
758
|
+
deselectAll: function () {
|
759
|
+
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
760
|
+
this.$element.find('option:enabled').prop('selected', false);
|
761
|
+
$(this.$lis).not('.disabled').removeClass('selected');
|
762
|
+
this.render(false);
|
763
|
+
},
|
764
|
+
|
765
|
+
keydown: function (e) {
|
766
|
+
var $this,
|
767
|
+
$items,
|
768
|
+
$parent,
|
769
|
+
index,
|
770
|
+
next,
|
771
|
+
first,
|
772
|
+
last,
|
773
|
+
prev,
|
774
|
+
nextPrev,
|
775
|
+
that,
|
776
|
+
prevIndex,
|
777
|
+
isActive,
|
778
|
+
keyCodeMap = {
|
779
|
+
32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', 59: ';',
|
780
|
+
65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l',
|
781
|
+
77: 'm', 78: 'n', 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', 87: 'w', 88: 'x',
|
782
|
+
89: 'y', 90: 'z', 96: '0', 97: '1', 98: '2', 99: '3', 100: '4', 101: '5', 102: '6', 103: '7', 104: '8', 105: '9'
|
783
|
+
};
|
784
|
+
|
785
|
+
$this = $(this);
|
786
|
+
|
787
|
+
$parent = $this.parent();
|
788
|
+
|
789
|
+
if ($this.is('input')) $parent = $this.parent().parent();
|
790
|
+
|
791
|
+
that = $parent.data('this');
|
792
|
+
|
793
|
+
if (that.options.liveSearch) $parent = $this.parent().parent();
|
794
|
+
|
795
|
+
if (that.options.container) $parent = that.$menu;
|
796
|
+
|
797
|
+
$items = $('[role=menu] li:not(.divider) a', $parent);
|
798
|
+
|
799
|
+
isActive = that.$menu.parent().hasClass('open');
|
800
|
+
|
801
|
+
if (!isActive && /([0-9]|[A-z])/.test(String.fromCharCode(e.keyCode))) {
|
802
|
+
if (!that.options.container) {
|
803
|
+
that.setSize();
|
804
|
+
that.$menu.parent().addClass('open');
|
805
|
+
isActive = true;
|
806
|
+
} else {
|
807
|
+
that.$newElement.trigger('click');
|
808
|
+
}
|
809
|
+
that.$searchbox.focus();
|
810
|
+
}
|
811
|
+
|
812
|
+
if (that.options.liveSearch) {
|
813
|
+
if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) {
|
814
|
+
e.preventDefault();
|
815
|
+
that.$menu.parent().removeClass('open');
|
816
|
+
that.$button.focus();
|
817
|
+
}
|
818
|
+
$items = $('[role=menu] li:not(.divider):visible', $parent);
|
819
|
+
if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) {
|
820
|
+
if ($items.filter('.active').length === 0) {
|
821
|
+
$items = that.$newElement.find('li').filter(':icontains(' + keyCodeMap[e.keyCode] + ')');
|
822
|
+
}
|
823
|
+
}
|
824
|
+
}
|
825
|
+
|
826
|
+
if (!$items.length) return;
|
827
|
+
|
828
|
+
if (/(38|40)/.test(e.keyCode.toString(10))) {
|
829
|
+
|
830
|
+
index = $items.index($items.filter(':focus'));
|
831
|
+
first = $items.parent(':not(.disabled):visible').first().index();
|
832
|
+
last = $items.parent(':not(.disabled):visible').last().index();
|
833
|
+
next = $items.eq(index).parent().nextAll(':not(.disabled):visible').eq(0).index();
|
834
|
+
prev = $items.eq(index).parent().prevAll(':not(.disabled):visible').eq(0).index();
|
835
|
+
nextPrev = $items.eq(next).parent().prevAll(':not(.disabled):visible').eq(0).index();
|
836
|
+
|
837
|
+
if (that.options.liveSearch) {
|
838
|
+
$items.each(function (i) {
|
839
|
+
if ($(this).is(':not(.disabled)')) {
|
840
|
+
$(this).data('index', i);
|
841
|
+
}
|
842
|
+
});
|
843
|
+
index = $items.index($items.filter('.active'));
|
844
|
+
first = $items.filter(':not(.disabled):visible').first().data('index');
|
845
|
+
last = $items.filter(':not(.disabled):visible').last().data('index');
|
846
|
+
next = $items.eq(index).nextAll(':not(.disabled):visible').eq(0).data('index');
|
847
|
+
prev = $items.eq(index).prevAll(':not(.disabled):visible').eq(0).data('index');
|
848
|
+
nextPrev = $items.eq(next).prevAll(':not(.disabled):visible').eq(0).data('index');
|
849
|
+
}
|
850
|
+
|
851
|
+
prevIndex = $this.data('prevIndex');
|
852
|
+
|
853
|
+
if (e.keyCode == 38) {
|
854
|
+
if (that.options.liveSearch) index -= 1;
|
855
|
+
if (index != nextPrev && index > prev) index = prev;
|
856
|
+
if (index < first) index = first;
|
857
|
+
if (index == prevIndex) index = last;
|
858
|
+
}
|
859
|
+
|
860
|
+
if (e.keyCode == 40) {
|
861
|
+
if (that.options.liveSearch) index += 1;
|
862
|
+
if (index == -1) index = 0;
|
863
|
+
if (index != nextPrev && index < next) index = next;
|
864
|
+
if (index > last) index = last;
|
865
|
+
if (index == prevIndex) index = first;
|
866
|
+
}
|
867
|
+
|
868
|
+
$this.data('prevIndex', index);
|
869
|
+
|
870
|
+
if (!that.options.liveSearch) {
|
871
|
+
$items.eq(index).focus();
|
872
|
+
} else {
|
873
|
+
e.preventDefault();
|
874
|
+
if (!$this.is('.dropdown-toggle')) {
|
875
|
+
$items.removeClass('active');
|
876
|
+
$items.eq(index).addClass('active').find('a').focus();
|
877
|
+
$this.focus();
|
878
|
+
}
|
879
|
+
}
|
880
|
+
|
881
|
+
} else if (!$this.is('input')) {
|
882
|
+
|
883
|
+
var keyIndex = [],
|
884
|
+
count,
|
885
|
+
prevKey;
|
886
|
+
|
887
|
+
$items.each(function () {
|
888
|
+
if ($(this).parent().is(':not(.disabled)')) {
|
889
|
+
if ($.trim($(this).text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) {
|
890
|
+
keyIndex.push($(this).parent().index());
|
891
|
+
}
|
892
|
+
}
|
893
|
+
});
|
894
|
+
|
895
|
+
count = $(document).data('keycount');
|
896
|
+
count++;
|
897
|
+
$(document).data('keycount', count);
|
898
|
+
|
899
|
+
prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1);
|
900
|
+
|
901
|
+
if (prevKey != keyCodeMap[e.keyCode]) {
|
902
|
+
count = 1;
|
903
|
+
$(document).data('keycount', count);
|
904
|
+
} else if (count >= keyIndex.length) {
|
905
|
+
$(document).data('keycount', 0);
|
906
|
+
if (count > keyIndex.length) count = 1;
|
907
|
+
}
|
908
|
+
|
909
|
+
$items.eq(keyIndex[count - 1]).focus();
|
910
|
+
}
|
911
|
+
|
912
|
+
// Select focused option if "Enter", "Spacebar", "Tab" are pressed inside the menu.
|
913
|
+
if (/(13|32|^9$)/.test(e.keyCode.toString(10)) && isActive) {
|
914
|
+
if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault();
|
915
|
+
if (!that.options.liveSearch) {
|
916
|
+
$(':focus').click();
|
917
|
+
} else if (!/(32)/.test(e.keyCode.toString(10))) {
|
918
|
+
that.$menu.find('.active a').click();
|
919
|
+
$this.focus();
|
920
|
+
}
|
921
|
+
$(document).data('keycount', 0);
|
922
|
+
}
|
923
|
+
|
924
|
+
if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) {
|
925
|
+
that.$menu.parent().removeClass('open');
|
926
|
+
that.$button.focus();
|
927
|
+
}
|
928
|
+
|
929
|
+
},
|
930
|
+
|
931
|
+
hide: function () {
|
932
|
+
this.$newElement.hide();
|
933
|
+
},
|
934
|
+
|
935
|
+
show: function () {
|
936
|
+
this.$newElement.show();
|
937
|
+
},
|
938
|
+
|
939
|
+
destroy: function () {
|
940
|
+
this.$newElement.remove();
|
941
|
+
this.$element.remove();
|
942
|
+
}
|
943
|
+
};
|
944
|
+
|
945
|
+
$.fn.selectpicker = function (option, event) {
|
946
|
+
//get the args of the outer function..
|
947
|
+
var args = arguments;
|
948
|
+
var value;
|
949
|
+
var chain = this.each(function () {
|
950
|
+
if ($(this).is('select')) {
|
951
|
+
var $this = $(this),
|
952
|
+
data = $this.data('selectpicker'),
|
953
|
+
options = typeof option == 'object' && option;
|
954
|
+
|
955
|
+
if (!data) {
|
956
|
+
$this.data('selectpicker', (data = new Selectpicker(this, $.extend({}, $.fn.selectpicker.defaults, $this.data(), options), event)));
|
957
|
+
} else if (options) {
|
958
|
+
for (var i in options) {
|
959
|
+
if (options.hasOwnProperty(i)) {
|
960
|
+
data.options[i] = options[i];
|
961
|
+
}
|
962
|
+
}
|
963
|
+
}
|
964
|
+
|
965
|
+
if (typeof option == 'string') {
|
966
|
+
//Copy the value of option, as once we shift the arguments
|
967
|
+
//it also shifts the value of option.
|
968
|
+
var property = option;
|
969
|
+
if (data[property] instanceof Function) {
|
970
|
+
[].shift.apply(args);
|
971
|
+
value = data[property].apply(data, args);
|
972
|
+
} else {
|
973
|
+
value = data.options[property];
|
974
|
+
}
|
975
|
+
}
|
976
|
+
}
|
977
|
+
});
|
978
|
+
|
979
|
+
if (typeof value !== 'undefined') {
|
980
|
+
//noinspection JSUnusedAssignment
|
981
|
+
return value;
|
982
|
+
} else {
|
983
|
+
return chain;
|
984
|
+
}
|
985
|
+
};
|
986
|
+
|
987
|
+
$.fn.selectpicker.Constructor = Selectpicker;
|
988
|
+
|
989
|
+
$.fn.selectpicker.defaults = {
|
990
|
+
style: 'btn-default',
|
991
|
+
size: 'auto',
|
992
|
+
title: null,
|
993
|
+
selectedTextFormat: 'values',
|
994
|
+
noneSelectedText: 'Nothing selected',
|
995
|
+
noneResultsText: 'No results match',
|
996
|
+
countSelectedText: '{0} of {1} selected',
|
997
|
+
maxOptionsText: ['Limit reached ({n} {var} max)', 'Group limit reached ({n} {var} max)', ['items', 'item']],
|
998
|
+
width: false,
|
999
|
+
container: false,
|
1000
|
+
hideDisabled: false,
|
1001
|
+
showSubtext: false,
|
1002
|
+
showIcon: true,
|
1003
|
+
showContent: true,
|
1004
|
+
dropupAuto: true,
|
1005
|
+
header: false,
|
1006
|
+
liveSearch: false,
|
1007
|
+
actionsBox: false,
|
1008
|
+
multipleSeparator: ', ',
|
1009
|
+
iconBase: 'glyphicon',
|
1010
|
+
tickIcon: 'glyphicon-ok',
|
1011
|
+
maxOptions: false,
|
1012
|
+
mobile: false
|
1013
|
+
};
|
1014
|
+
|
1015
|
+
$(document)
|
1016
|
+
.data('keycount', 0)
|
1017
|
+
.on('keydown', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input', Selectpicker.prototype.keydown)
|
1018
|
+
.on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input', function (e) {
|
1019
|
+
e.stopPropagation();
|
1020
|
+
});
|
1021
|
+
|
1022
|
+
})(jQuery);
|