camaleon_cms 0.2.1 → 1.0
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 +4 -4
- data/README.md +266 -0
- data/app/apps/plugins/attack/config/config.json +1 -1
- data/app/apps/plugins/contact_form/config/config.json +1 -1
- data/app/apps/plugins/contact_form/contact_form_html_helper.rb +15 -10
- data/app/apps/plugins/contact_form/front_controller.rb +1 -0
- data/app/apps/plugins/contact_form/views/admin_forms/edit.html.erb +1 -2
- data/app/apps/plugins/contact_form/views/admin_forms/index.html.erb +1 -1
- data/app/apps/plugins/contact_form/views/admin_forms/responses.html.erb +1 -1
- data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +6 -6
- data/app/apps/plugins/front_cache/config/config.json +1 -1
- data/app/apps/plugins/front_cache/views/admin/settings.html.erb +1 -1
- data/app/apps/plugins/visibility_post/config/config.json +1 -1
- data/app/apps/themes/camaleon_first/assets/css/style-ver.css.scss +59 -32
- data/app/apps/themes/camaleon_first/views/layouts/index.html.erb +2 -2
- data/app/apps/themes/default/assets/css/style.css.scss +3 -0
- data/app/apps/themes/default/views/category.html.erb +1 -1
- data/app/apps/themes/default/views/post_tag.html.erb +1 -1
- data/app/apps/themes/default/views/post_type.html.erb +1 -1
- data/app/apps/themes/default/views/search.html.erb +1 -1
- data/app/apps/themes/new/views/category.html.erb +1 -1
- data/app/apps/themes/new/views/layouts/index.html.erb +2 -2
- data/app/apps/themes/new/views/post_tag.html.erb +1 -1
- data/app/apps/themes/new/views/post_type.html.erb +1 -1
- data/app/apps/themes/new/views/search.html.erb +1 -1
- data/app/assets/{stylesheets/admin/bootstrap/images → images/admin}/glyphicons-halflings.png +0 -0
- data/app/assets/javascripts/admin/actions.js +12 -205
- data/app/assets/javascripts/admin/admin-basic-manifest.js +3 -0
- data/app/assets/javascripts/admin/admin-manifest.js +14 -4
- data/app/assets/javascripts/admin/custom_fields.js +4 -2
- data/app/assets/javascripts/admin/data.js +49 -20
- data/app/assets/javascripts/admin/elfinder/upload_elfinder.js +4 -4
- data/app/assets/javascripts/admin/grid-editor.js +390 -113
- data/app/assets/javascripts/admin/i18n.js +22 -0
- data/app/assets/javascripts/admin/jquery.validate.js +2 -54
- data/app/assets/javascripts/admin/{core.js → libraries.js} +92 -76
- data/app/assets/javascripts/admin/login_manifest.js +0 -3
- data/app/assets/javascripts/admin/lte/app.js +758 -0
- data/app/assets/javascripts/admin/modal.js +76 -22
- data/app/assets/javascripts/admin/nav-menu.js +98 -39
- data/app/assets/javascripts/admin/post.js +28 -29
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/content.min.css.scss +1 -1
- data/app/assets/javascripts/admin/tinymce/tinymce.min.js +11 -11
- data/app/assets/javascripts/admin/translator.js +9 -7
- data/app/assets/javascripts/admin/widgets.js +1 -0
- data/app/assets/stylesheets/admin/admin-basic-manifest.css +15 -0
- data/app/assets/stylesheets/admin/admin-manifest.css +7 -11
- data/app/assets/stylesheets/admin/bootstrap-datepicker.css.scss +472 -0
- data/app/assets/stylesheets/admin/bootstrap-datetimepicker.css.scss +339 -0
- data/app/assets/stylesheets/admin/colorpicker.css.scss +95 -0
- data/app/assets/stylesheets/admin/custom_admin.css.scss +160 -0
- data/app/assets/stylesheets/admin/elfinder-manifest.css +1 -1
- data/app/assets/stylesheets/admin/grid-editor.css.scss +14 -299
- data/app/assets/stylesheets/admin/lte/admin.css.scss +4747 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-black-light.css +176 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-black.css +154 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-blue-light.css +167 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-blue.css +142 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-green-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-green.css +134 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-purple-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-purple.css +134 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-red-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-red.css +134 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-yellow-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-yellow.css +134 -0
- data/app/assets/stylesheets/admin/nav-menu.css.scss +33 -0
- data/app/controllers/admin/appearances/nav_menus_controller.rb +13 -10
- data/app/controllers/admin/appearances/themes_controller.rb +1 -2
- data/app/controllers/admin/appearances_controller.rb +0 -4
- data/app/controllers/admin/categories_controller.rb +9 -15
- data/app/controllers/admin/comments_controller.rb +8 -14
- data/app/controllers/admin/grid_editor_controller.rb +55 -0
- data/app/controllers/admin/installers_controller.rb +1 -1
- data/app/controllers/admin/media_controller.rb +1 -3
- data/app/controllers/admin/plugins_controller.rb +2 -2
- data/app/controllers/admin/post_tags_controller.rb +9 -18
- data/app/controllers/admin/posts/drafts_controller.rb +1 -9
- data/app/controllers/admin/posts_controller.rb +12 -15
- data/app/controllers/admin/sessions_controller.rb +6 -7
- data/app/controllers/admin/settings/custom_fields_controller.rb +4 -9
- data/app/controllers/admin/settings/post_types_controller.rb +6 -16
- data/app/controllers/admin/settings/sites_controller.rb +5 -7
- data/app/controllers/admin/settings_controller.rb +0 -4
- data/app/controllers/admin/user_roles_controller.rb +8 -8
- data/app/controllers/admin/users_controller.rb +8 -9
- data/app/controllers/admin_controller.rb +4 -5
- data/app/controllers/apps/plugins_admin_controller.rb +3 -3
- data/app/controllers/apps/plugins_front_controller.rb +2 -2
- data/app/controllers/apps/themes_admin_controller.rb +2 -2
- data/app/controllers/apps/themes_front_controller.rb +2 -2
- data/app/controllers/camaleon_controller.rb +0 -1
- data/app/controllers/concerns/frontend_concern.rb +1 -2
- data/app/controllers/frontend_controller.rb +25 -9
- data/app/decorators/category_decorator.rb +0 -1
- data/app/decorators/custom_field_decorator.rb +0 -1
- data/app/decorators/custom_fields_concern.rb +9 -3
- data/app/decorators/post_comment_decorator.rb +0 -1
- data/app/decorators/post_decorator.rb +10 -4
- data/app/decorators/post_tag_decorator.rb +0 -1
- data/app/decorators/post_type_decorator.rb +0 -1
- data/app/decorators/site_decorator.rb +35 -11
- data/app/decorators/term_taxonomy_decorator.rb +1 -3
- data/app/decorators/theme_decorator.rb +0 -1
- data/app/decorators/user_decorator.rb +7 -5
- data/app/decorators/widget_decorator.rb +0 -1
- data/app/helpers/admin/application_helper.rb +14 -0
- data/app/helpers/admin/menus_helper.rb +8 -8
- data/app/helpers/camaleon_helper.rb +10 -3
- data/app/helpers/captcha_helper.rb +2 -2
- data/app/helpers/frontend/application_helper.rb +0 -1
- data/app/helpers/frontend/nav_menu_helper.rb +2 -1
- data/app/helpers/frontend/seo_helper.rb +1 -2
- data/app/helpers/frontend/site_helper.rb +4 -4
- data/app/helpers/hooks_helper.rb +2 -5
- data/app/helpers/html_helper.rb +9 -7
- data/app/helpers/plugins_helper.rb +34 -8
- data/app/helpers/session_helper.rb +1 -2
- data/app/helpers/short_code_helper.rb +91 -10
- data/app/helpers/site_helper.rb +17 -8
- data/app/helpers/theme_helper.rb +34 -7
- data/app/helpers/uploader_helper.rb +6 -2
- data/app/mailers/html_mailer.rb +15 -6
- data/app/models/category.rb +2 -1
- data/app/models/concerns/custom_fields_read.rb +14 -3
- data/app/models/concerns/metas.rb +7 -4
- data/app/models/custom_field_group.rb +3 -0
- data/app/models/{concerns/metas_saved.rb → grid_template.rb} +7 -2
- data/app/models/meta.rb +0 -1
- data/app/models/nav_menu.rb +15 -1
- data/app/models/nav_menu_item.rb +10 -0
- data/app/models/post.rb +100 -6
- data/app/models/post_comment.rb +6 -0
- data/app/models/post_default.rb +9 -8
- data/app/models/post_relationship.rb +2 -0
- data/app/models/post_type.rb +36 -24
- data/app/models/site.rb +7 -16
- data/app/models/term_taxonomy.rb +3 -2
- data/app/models/theme.rb +5 -0
- data/app/models/widget/assigned.rb +3 -2
- data/app/views/admin/appearances/nav_menus/_custom_fields.html.erb +6 -0
- data/app/views/admin/appearances/{_external_menu.html.erb → nav_menus/_external_menu.html.erb} +8 -10
- data/app/views/admin/appearances/nav_menus/_menu_form.html.erb +35 -0
- data/app/views/admin/appearances/nav_menus/_menu_list.html.erb +22 -0
- data/app/views/admin/appearances/nav_menus/index.html.erb +110 -0
- data/app/views/admin/appearances/themes/index.html.erb +4 -3
- data/app/views/admin/appearances/widgets/main/_sidebar.html.erb +29 -0
- data/app/views/admin/appearances/widgets/main/form.html.erb +1 -1
- data/app/views/admin/appearances/widgets/main/index.html.erb +19 -41
- data/app/views/admin/categories/edit.html.erb +2 -6
- data/app/views/admin/categories/index.html.erb +7 -11
- data/app/views/admin/comments/form.html.erb +4 -7
- data/app/views/admin/comments/index.html.erb +24 -41
- data/app/views/admin/comments/reply.html.erb +9 -10
- data/app/views/admin/grid_editor/form.html.erb +31 -0
- data/app/views/admin/grid_editor/index.html.erb +29 -0
- data/app/views/admin/media/index.html.erb +3 -15
- data/app/views/admin/plugins/_plugins_list.html.erb +1 -2
- data/app/views/admin/post_tags/edit.html.erb +2 -6
- data/app/views/admin/post_tags/index.html.erb +3 -8
- data/app/views/admin/posts/_sidebar.html.erb +136 -0
- data/app/views/admin/posts/form.html.erb +87 -281
- data/app/views/admin/posts/index.html.erb +89 -104
- data/app/views/admin/sessions/forgot.html.erb +7 -13
- data/app/views/admin/sessions/login.html.erb +21 -11
- data/app/views/admin/sessions/register.html.erb +3 -6
- data/app/views/admin/settings/custom_fields/_meta_data.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/_render.html.erb +6 -14
- data/app/views/admin/settings/custom_fields/fields/audio.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/field_attrs.html.erb +3 -5
- data/app/views/admin/settings/custom_fields/fields/file.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/image.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/posts.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/select.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/users.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/video.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/form.html.erb +11 -9
- data/app/views/admin/settings/custom_fields/get_items.html.erb +3 -6
- data/app/views/admin/settings/custom_fields/index.html.erb +3 -10
- data/app/views/admin/settings/languages.html.erb +2 -10
- data/app/views/admin/settings/post_types/_form.html.erb +1 -1
- data/app/views/admin/settings/post_types/edit.html.erb +2 -6
- data/app/views/admin/settings/post_types/index.html.erb +4 -12
- data/app/views/admin/settings/site.html.erb +143 -149
- data/app/views/admin/settings/sites/form.html.erb +4 -19
- data/app/views/admin/settings/sites/index.html.erb +8 -9
- data/app/views/admin/taxonomy/index.html.erb +1 -1
- data/app/views/admin/user_roles/form.html.erb +2 -3
- data/app/views/admin/user_roles/index.html.erb +2 -8
- data/app/views/admin/users/form.html.erb +14 -9
- data/app/views/admin/users/index.html.erb +3 -8
- data/app/views/admin/users/profile_edit.html.erb +21 -14
- data/app/views/default_theme/custom_fields/audio.html.erb +3 -0
- data/app/views/default_theme/custom_fields/checkbox.html.erb +3 -0
- data/app/views/default_theme/custom_fields/checkboxes.html.erb +3 -0
- data/app/views/default_theme/custom_fields/colorpicker.html.erb +3 -0
- data/app/views/default_theme/custom_fields/date.html.erb +3 -0
- data/app/views/default_theme/custom_fields/editor.html.erb +3 -0
- data/app/views/default_theme/custom_fields/email.html.erb +3 -0
- data/app/views/default_theme/custom_fields/field_attrs.html.erb +3 -0
- data/app/views/default_theme/custom_fields/file.html.erb +3 -0
- data/app/views/default_theme/custom_fields/image.html.erb +3 -0
- data/app/views/default_theme/custom_fields/numeric.html.erb +3 -0
- data/app/views/default_theme/custom_fields/phone.html.erb +3 -0
- data/app/views/default_theme/custom_fields/posts.html.erb +3 -0
- data/app/views/default_theme/custom_fields/radio.html.erb +3 -0
- data/app/views/default_theme/custom_fields/select.html.erb +3 -0
- data/app/views/default_theme/custom_fields/select_eval.html.erb +3 -0
- data/app/views/default_theme/custom_fields/text_area.html.erb +3 -0
- data/app/views/default_theme/custom_fields/text_box.html.erb +3 -0
- data/app/views/default_theme/custom_fields/url.html.erb +3 -0
- data/app/views/default_theme/custom_fields/users.html.erb +3 -0
- data/app/views/default_theme/custom_fields/video.html.erb +3 -0
- data/app/views/default_theme/layouts/index.html.erb +2 -2
- data/app/views/default_theme/{post.html.erb → single.html.erb} +1 -1
- data/app/views/default_theme/{post.rss.builder → single.rss.builder} +0 -0
- data/app/views/layouts/admin.html.erb +35 -133
- data/app/views/layouts/admin/_flash_messages.html.erb +1 -15
- data/app/views/layouts/admin/_footer.html.erb +6 -0
- data/app/views/layouts/admin/_header.html.erb +51 -0
- data/app/views/layouts/admin/_sidebar.html.erb +21 -30
- data/app/views/layouts/admin/installer.html.erb +2 -2
- data/app/views/layouts/login.html.erb +15 -33
- data/config/initializers/active_record_extension.rb +14 -2
- data/config/initializers/assets.rb +21 -7
- data/config/initializers/page_caching.rb +1 -2
- data/config/locales/admin/en.yml +17 -9
- data/config/locales/admin/es.yml +8 -3
- data/config/locales/admin/it.yml +4 -2
- data/config/locales/admin/js.yml +147 -0
- data/config/routes/admin.rb +4 -4
- data/config/routes/frontend.rb +2 -2
- data/config/system.json +1 -0
- data/db/migrate/20150926095310_rename_column_posts.rb +18 -0
- data/lib/camaleon_cms.rb +1 -1
- data/lib/camaleon_cms/engine.rb +17 -2
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +122 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/controllers/plugins/my_plugin/admin_controller.rb +8 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/controllers/plugins/my_plugin/front_controller.rb +8 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/helpers/plugins/my_plugin/main_helper.rb +22 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/models/plugins/my_plugin/my_plugin.rb +12 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/views/plugins/my_plugin/admin/index.html.erb +2 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/views/plugins/my_plugin/front/index.html.erb +2 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/views/plugins/my_plugin/layouts/readme.txt +2 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/config/camaleon_plugin.json +21 -0
- data/lib/generators/camaleon_cms/install_generator.rb +1 -2
- data/lib/generators/camaleon_cms/install_template/plugin_routes.rb +1 -10
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/config/config.json +5 -5
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb +6 -5
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +2 -2
- data/lib/plugin_routes.rb +40 -2
- metadata +257 -22
- data/app/assets/stylesheets/admin/animate/animate.min.css +0 -6
- data/app/assets/stylesheets/admin/bootstrap/bootstrap-datetimepicker.css.scss +0 -339
- data/app/assets/stylesheets/admin/bootstrap/bootstrap.min.css +0 -5
- data/app/assets/stylesheets/admin/core.scss +0 -349
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.eot +0 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.svg +0 -1831
- 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/nav-menu.css +0 -54
- data/app/assets/stylesheets/admin/theme-default.scss +0 -8462
- data/app/models/concerns/site_public.rb +0 -23
- data/app/views/admin/appearances/menu.html.erb +0 -199
- data/lib/Gemfile +0 -25
@@ -0,0 +1,22 @@
|
|
1
|
+
// This library provide a helper to recover current translation
|
2
|
+
// Note: To use this you will need load js translations like this:
|
3
|
+
// <script> var I18n_data = <%= I18n.backend.send(:translations)[current_locale.to_sym][:admin][:js].to_json.html_safe %> </script>
|
4
|
+
|
5
|
+
// return translation of a key
|
6
|
+
// sample: I18n('button.edit') ==> Edit
|
7
|
+
// return String with the translation
|
8
|
+
var I18n = function(key){
|
9
|
+
var res = eval("I18n_data."+key);
|
10
|
+
if(!res) res = (""+key.split(".").pop()).titleize();
|
11
|
+
return res;
|
12
|
+
}
|
13
|
+
|
14
|
+
// helper to convert not found translations key into titleized string
|
15
|
+
String.prototype.titleize = function() {
|
16
|
+
var words = this.split(' ')
|
17
|
+
var array = []
|
18
|
+
for (var i=0; i<words.length; ++i) {
|
19
|
+
array.push(words[i].charAt(0).toUpperCase() + words[i].toLowerCase().slice(1))
|
20
|
+
}
|
21
|
+
return array.join(' ')
|
22
|
+
}
|
@@ -1133,10 +1133,10 @@ $.extend( $.validator, {
|
|
1133
1133
|
url: function( value, element ) {
|
1134
1134
|
// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
|
1135
1135
|
var url = false;
|
1136
|
-
url = this.optional( element ) || /^(https?|
|
1136
|
+
url = this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
|
1137
1137
|
//fix localhost:port
|
1138
1138
|
if(url == false){
|
1139
|
-
url = this.optional( element ) || /^(https?|
|
1139
|
+
url = this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
|
1140
1140
|
}
|
1141
1141
|
//fix localhost:port
|
1142
1142
|
return url;
|
@@ -1360,56 +1360,4 @@ $.extend($.fn, {
|
|
1360
1360
|
});
|
1361
1361
|
}
|
1362
1362
|
});
|
1363
|
-
|
1364
|
-
$.validator.addMethod("file_format", function(value, element) {
|
1365
|
-
function check_url(url) {
|
1366
|
-
var regYoutube = new RegExp(/^.*((youtu.be\/)|(v\/)|(\/u\/w\/)|(embed\/)|(watch?))??v?=?([^#&?]*).*/);
|
1367
|
-
var regVimeo = new RegExp(/^.*(vimeo.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/);
|
1368
|
-
var regDailymotion = new RegExp(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
|
1369
|
-
var regMetacafe = new RegExp(/^.*(metacafe.com)(\/watch\/)(d+)(.*)/i);
|
1370
|
-
if(regYoutube.test(url)) {
|
1371
|
-
return 'youtube';
|
1372
|
-
}else if (regMetacafe.test(url)) {
|
1373
|
-
return 'metacafe';
|
1374
|
-
}else if(regDailymotion.test(url)){
|
1375
|
-
return 'dailymotion';
|
1376
|
-
}else if(regVimeo.test(url)) {
|
1377
|
-
return 'vimeo';
|
1378
|
-
}else{
|
1379
|
-
return false;
|
1380
|
-
}
|
1381
|
-
}
|
1382
|
-
var _formats = {
|
1383
|
-
jpg: "image",
|
1384
|
-
gif: "image",
|
1385
|
-
png: "image",
|
1386
|
-
bmp: "image",
|
1387
|
-
jpeg: "image",
|
1388
|
-
|
1389
|
-
mp3: "audio",
|
1390
|
-
ogg: "audio",
|
1391
|
-
mid: "audio",
|
1392
|
-
mod: "audio",
|
1393
|
-
wav: "audio",
|
1394
|
-
|
1395
|
-
mp4: "video",
|
1396
|
-
wmv: "video",
|
1397
|
-
avi: "video",
|
1398
|
-
swf: "video",
|
1399
|
-
mov: "video",
|
1400
|
-
mpeg: "video",
|
1401
|
-
mjpg: "video"
|
1402
|
-
}
|
1403
|
-
var formats = $(element).attr("data-formats");
|
1404
|
-
var ext = value.split(".").pop().toLowerCase();
|
1405
|
-
if(formats)
|
1406
|
-
return ($.inArray("video", formats.split(",")) >= 0 && check_url(value)) ||
|
1407
|
-
($.inArray(_formats[ext], formats.split(",")) >= 0)
|
1408
|
-
|
1409
|
-
return true;
|
1410
|
-
}, "File format not accepted.");
|
1411
|
-
jQuery.validator.addClassRules({
|
1412
|
-
file_format : { file_format : true }
|
1413
|
-
});
|
1414
|
-
|
1415
1363
|
}));
|
@@ -1,19 +1,3 @@
|
|
1
|
-
jQuery(function($){
|
2
|
-
// init validates and translate render forms
|
3
|
-
init_form_validations();
|
4
|
-
|
5
|
-
$('#admin_content table').addClass('table').wrap('<div class="table-responsive"></div>');
|
6
|
-
|
7
|
-
$('#admin_content a[role="back"]').on('click',function(){
|
8
|
-
window.history.back();
|
9
|
-
return false;
|
10
|
-
});
|
11
|
-
|
12
|
-
$('#admin_content [data-toggle="tooltip"]').tooltip();
|
13
|
-
$('a.btn-xs, a.panel-edit, a.panel-delete, button.btn', "#admin_content").tooltip();
|
14
|
-
|
15
|
-
});
|
16
|
-
|
17
1
|
function log(d){
|
18
2
|
if(console.log)console.log(d);
|
19
3
|
}
|
@@ -23,7 +7,6 @@ function log(d){
|
|
23
7
|
// panel can be a object: $("#my_form")
|
24
8
|
// if panel is null, then this will be replaced by body
|
25
9
|
var init_form_validations = function(form){
|
26
|
-
|
27
10
|
// slug management
|
28
11
|
// you need to add class no_translate to avoid translations in slugs
|
29
12
|
(form ? form : $('#admin_content')).find('input.slug').each(function(){
|
@@ -55,31 +38,16 @@ var init_form_validations = function(form){
|
|
55
38
|
(form ? form : $('#admin_content form')).each(function () {
|
56
39
|
var $form = $(this)
|
57
40
|
if ($form.find('.translatable').size() > 0) {
|
58
|
-
$form.find('.translatable').Translatable(
|
41
|
+
$form.find('.translatable').Translatable();
|
59
42
|
}
|
60
|
-
}).filter("
|
61
|
-
$(this).validate(
|
62
|
-
if(a.text()){
|
63
|
-
if(b.parent().hasClass('form-group')){
|
64
|
-
b.parent().addClass('has-error').append(a.addClass('help-block'));
|
65
|
-
}else if(b.parent().hasClass('tab-pane')){ // tabs
|
66
|
-
var parent = b.parent();
|
67
|
-
$("a[href='#"+ parent.attr('id') +"']").addClass('has-error').trigger('click');
|
68
|
-
parent.addClass('has-error').append(a.addClass('help-block'));
|
69
|
-
}else{
|
70
|
-
b.parent().after(a.addClass('help-block')).parent().addClass('has-error');
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}, success: function(error, element){
|
74
|
-
$(element).parent().removeClass('has-error').parent().removeClass('has-error')
|
75
|
-
if($(element).parent().hasClass('tab-pane')) $("a[href='#"+ $(element).parent().attr('id') +"']").removeClass('has-error');
|
76
|
-
} })
|
43
|
+
}).filter(".validate").each(function(){
|
44
|
+
$(this).validate()
|
77
45
|
});
|
78
46
|
};
|
79
47
|
|
80
48
|
|
81
49
|
!(function($){
|
82
|
-
|
50
|
+
// serialize form into json
|
83
51
|
jQuery.fn.serializeObject=function() {
|
84
52
|
var json = {};
|
85
53
|
jQuery.map(jQuery(this).serializeArray(), function(n, i) {
|
@@ -112,48 +80,13 @@ var init_form_validations = function(form){
|
|
112
80
|
});
|
113
81
|
return json;
|
114
82
|
};
|
115
|
-
|
116
|
-
$.fn.alert = function (options) {
|
117
|
-
var default_options = {title: lang.message_updated_success, content: "", type: "success", icon: "check", close: "Close"};
|
118
|
-
options = $.extend(default_options, options || {});
|
119
|
-
|
120
|
-
if (options.type == "error") options.type = "danger";
|
121
|
-
if (options.type == "alert") options.type = "warning";
|
122
|
-
|
123
|
-
var html = '<div class="message-box message-box-'+options.type+' animated fadeIn open" >'+
|
124
|
-
'<div class="mb-container">'+
|
125
|
-
'<div class="mb-middle">'+
|
126
|
-
'<div class="mb-title"><span class="fa fa-'+options.icon+'"></span> '+options.title+'</div>' +
|
127
|
-
'<div class="mb-content">'+
|
128
|
-
options.content+
|
129
|
-
'</div>'+
|
130
|
-
'<div class="mb-footer">'+
|
131
|
-
'<button class="btn btn-default btn-lg pull-right mb-control-close">'+options.close+'</button>'+
|
132
|
-
'</div>'+
|
133
|
-
'</div>' +
|
134
|
-
'</div>' +
|
135
|
-
'</div>' ;
|
136
|
-
|
137
|
-
if(options.type === 'warning')
|
138
|
-
playAudio('alert');
|
139
|
-
|
140
|
-
if(options.type === 'danger')
|
141
|
-
playAudio('fail');
|
142
|
-
|
143
|
-
var $html = $(html);
|
144
|
-
$html.find('.mb-control-close').click(function(){
|
145
|
-
$html.remove();
|
146
|
-
return false;
|
147
|
-
})
|
148
|
-
$('body').append($html);
|
149
|
-
|
150
|
-
};
|
151
83
|
})(jQuery);
|
152
84
|
|
153
85
|
|
86
|
+
// file uploader
|
154
87
|
(function($){
|
155
88
|
$.fn.input_upload = function (options_init) {
|
156
|
-
var default_options = {label:
|
89
|
+
var default_options = {label: I18n("msg.upload_image"), type: "image", ext: "none", icon: "upload", full_url: true, height: '100px'};
|
157
90
|
default_options = $.extend({}, default_options, options_init || {});
|
158
91
|
$(this).each(function(){
|
159
92
|
var $that = $(this);
|
@@ -186,15 +119,96 @@ var init_form_validations = function(form){
|
|
186
119
|
$content_image.find('strong').html(_.last(url.split('/')));
|
187
120
|
$content_image.show()
|
188
121
|
}
|
189
|
-
|
190
122
|
if($that.val()) set_texts($that.val())
|
191
|
-
|
192
123
|
});
|
124
|
+
};
|
125
|
+
})(jQuery);
|
193
126
|
|
127
|
+
// jquery custom validations and default values
|
128
|
+
(function($){
|
194
129
|
|
195
|
-
|
130
|
+
// helper validate only letters latin
|
131
|
+
var regex = /^[a-z\sÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏàáâãäåæçèéêëìíîïÐÑÒÓÔÕÖØÙÚÛÜÝÞßðñòóôõöøùúûüýþÿ]+$/i;
|
132
|
+
jQuery.validator.addMethod("lettersonly", function(value, element) {
|
133
|
+
return this.optional(element) || regex.test(value);
|
134
|
+
}, "Only alphabetical characters");
|
135
|
+
|
136
|
+
/************ Custom jquery validation as defaults ***************/
|
137
|
+
jQuery.validator.setDefaults({
|
138
|
+
focusInvalid: true, ignore: ".translated-item", errorPlacement: function (a,b) {
|
139
|
+
if(!a.text()) return;
|
140
|
+
if(b.parent().hasClass('trans_tab_item')){ // tabs
|
141
|
+
var parent = b.parent();
|
142
|
+
$("a[href='#"+ parent.attr('id') +"']").addClass('has-error').trigger('click');
|
143
|
+
parent.addClass('has-error').append(a.addClass('help-block'));
|
144
|
+
}else if(b.parent().hasClass('form-group')){
|
145
|
+
b.parent().addClass('has-error').append(a.addClass('help-block'));
|
146
|
+
}else{
|
147
|
+
if(b.attr('name') == 'categories[]')
|
148
|
+
b.parent().before(a.addClass('help-block')).parent().addClass('has-error');
|
149
|
+
else
|
150
|
+
b.parent().after(a.addClass('help-block')).parent().addClass('has-error');
|
151
|
+
}
|
152
|
+
}, success: function(error, element){
|
153
|
+
$(element).parent().removeClass('has-error').parent().removeClass('has-error')
|
154
|
+
if($(element).parent().hasClass('tab-pane')) $("a[href='#"+ $(element).parent().attr('id') +"']").removeClass('has-error');
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
// validate file extension defined in data-formats
|
159
|
+
// data-formats: (default '') image | audio | video (support also external youtube metacafe, dailymotion, vimeo) | or file extension like: jpg|png
|
160
|
+
$.validator.addMethod("file_format", function(value, element) {
|
161
|
+
function check_url(url) {
|
162
|
+
var regYoutube = new RegExp(/^.*((youtu.be\/)|(v\/)|(\/u\/w\/)|(embed\/)|(watch?))??v?=?([^#&?]*).*/);
|
163
|
+
var regVimeo = new RegExp(/^.*(vimeo.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/);
|
164
|
+
var regDailymotion = new RegExp(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
|
165
|
+
var regMetacafe = new RegExp(/^.*(metacafe.com)(\/watch\/)(d+)(.*)/i);
|
166
|
+
if(regYoutube.test(url)) {
|
167
|
+
return 'youtube';
|
168
|
+
}else if (regMetacafe.test(url)) {
|
169
|
+
return 'metacafe';
|
170
|
+
}else if(regDailymotion.test(url)){
|
171
|
+
return 'dailymotion';
|
172
|
+
}else if(regVimeo.test(url)) {
|
173
|
+
return 'vimeo';
|
174
|
+
}else{
|
175
|
+
return false;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
var _formats = {
|
179
|
+
jpg: "image",
|
180
|
+
gif: "image",
|
181
|
+
png: "image",
|
182
|
+
bmp: "image",
|
183
|
+
jpeg: "image",
|
184
|
+
|
185
|
+
mp3: "audio",
|
186
|
+
ogg: "audio",
|
187
|
+
mid: "audio",
|
188
|
+
mod: "audio",
|
189
|
+
wav: "audio",
|
190
|
+
|
191
|
+
mp4: "video",
|
192
|
+
wmv: "video",
|
193
|
+
avi: "video",
|
194
|
+
swf: "video",
|
195
|
+
mov: "video",
|
196
|
+
mpeg: "video",
|
197
|
+
mjpg: "video"
|
198
|
+
}
|
199
|
+
var formats = $(element).attr("data-formats");
|
200
|
+
var ext = value.split(".").pop().toLowerCase();
|
201
|
+
if(formats)
|
202
|
+
return ($.inArray("video", formats.split(",")) >= 0 && check_url(value)) || $.inArray(_formats[ext], formats.split(",")) >= 0 || $.inArray(ext, formats.split(",")) >= 0
|
203
|
+
|
204
|
+
return true;
|
205
|
+
}, "File format not accepted.");
|
206
|
+
jQuery.validator.addClassRules({
|
207
|
+
file_format : { file_format : true }
|
208
|
+
});
|
196
209
|
})(jQuery);
|
197
210
|
|
211
|
+
// Sortable
|
198
212
|
(function($){
|
199
213
|
$.fn.table_order = function (options){
|
200
214
|
var default_options = {url: "", table: ".table", on_success: false, on_change: false};
|
@@ -242,6 +256,7 @@ var init_form_validations = function(form){
|
|
242
256
|
|
243
257
|
})(jQuery);
|
244
258
|
|
259
|
+
// convert string into hashcode
|
245
260
|
String.prototype.hashCode = function() {
|
246
261
|
var message = this;
|
247
262
|
if(message == "") {
|
@@ -264,4 +279,5 @@ String.prototype.hashCode = function() {
|
|
264
279
|
return ret;
|
265
280
|
};
|
266
281
|
|
282
|
+
// jquery browser supoer
|
267
283
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
|
@@ -10,9 +10,6 @@
|
|
10
10
|
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
11
|
// about supported directives.
|
12
12
|
//
|
13
|
-
//= require jquery.js
|
14
|
-
//= require ./jquery.validate
|
15
13
|
//= require ../gibberish-aes.js
|
16
14
|
//= require ./login
|
17
|
-
//= require bootstrap.min
|
18
15
|
|
@@ -0,0 +1,758 @@
|
|
1
|
+
/*! AdminLTE app.js
|
2
|
+
* ================
|
3
|
+
* Main JS application file for AdminLTE v2. This file
|
4
|
+
* should be included in all pages. It controls some layout
|
5
|
+
* options and implements exclusive AdminLTE plugins.
|
6
|
+
*
|
7
|
+
* @Author Almsaeed Studio
|
8
|
+
* @Support <http://www.almsaeedstudio.com>
|
9
|
+
* @Email <support@almsaeedstudio.com>
|
10
|
+
* @version 2.3.1
|
11
|
+
* @license MIT <http://opensource.org/licenses/MIT>
|
12
|
+
*/
|
13
|
+
|
14
|
+
//Make sure jQuery has been loaded before app.js
|
15
|
+
if (typeof jQuery === "undefined") {
|
16
|
+
throw new Error("AdminLTE requires jQuery");
|
17
|
+
}
|
18
|
+
|
19
|
+
/* AdminLTE
|
20
|
+
*
|
21
|
+
* @type Object
|
22
|
+
* @description $.AdminLTE is the main object for the template's app.
|
23
|
+
* It's used for implementing functions and options related
|
24
|
+
* to the template. Keeping everything wrapped in an object
|
25
|
+
* prevents conflict with other plugins and is a better
|
26
|
+
* way to organize our code.
|
27
|
+
*/
|
28
|
+
$.AdminLTE = {};
|
29
|
+
|
30
|
+
/* --------------------
|
31
|
+
* - AdminLTE Options -
|
32
|
+
* --------------------
|
33
|
+
* Modify these options to suit your implementation
|
34
|
+
*/
|
35
|
+
$.AdminLTE.options = {
|
36
|
+
//Add slimscroll to navbar menus
|
37
|
+
//This requires you to load the slimscroll plugin
|
38
|
+
//in every page before app.js
|
39
|
+
navbarMenuSlimscroll: true,
|
40
|
+
navbarMenuSlimscrollWidth: "3px", //The width of the scroll bar
|
41
|
+
navbarMenuHeight: "200px", //The height of the inner menu
|
42
|
+
//General animation speed for JS animated elements such as box collapse/expand and
|
43
|
+
//sidebar treeview slide up/down. This options accepts an integer as milliseconds,
|
44
|
+
//'fast', 'normal', or 'slow'
|
45
|
+
animationSpeed: 500,
|
46
|
+
//Sidebar push menu toggle button selector
|
47
|
+
sidebarToggleSelector: "[data-toggle='offcanvas']",
|
48
|
+
//Activate sidebar push menu
|
49
|
+
sidebarPushMenu: true,
|
50
|
+
//Activate sidebar slimscroll if the fixed layout is set (requires SlimScroll Plugin)
|
51
|
+
sidebarSlimScroll: false,
|
52
|
+
//Enable sidebar expand on hover effect for sidebar mini
|
53
|
+
//This option is forced to true if both the fixed layout and sidebar mini
|
54
|
+
//are used together
|
55
|
+
sidebarExpandOnHover: false,
|
56
|
+
//BoxRefresh Plugin
|
57
|
+
enableBoxRefresh: false,
|
58
|
+
//Bootstrap.js tooltip
|
59
|
+
enableBSToppltip: false,
|
60
|
+
BSTooltipSelector: "[data-toggle='tooltip']",
|
61
|
+
//Enable Fast Click. Fastclick.js creates a more
|
62
|
+
//native touch experience with touch devices. If you
|
63
|
+
//choose to enable the plugin, make sure you load the script
|
64
|
+
//before AdminLTE's app.js
|
65
|
+
enableFastclick: true,
|
66
|
+
//Control Sidebar Options
|
67
|
+
enableControlSidebar: true,
|
68
|
+
controlSidebarOptions: {
|
69
|
+
//Which button should trigger the open/close event
|
70
|
+
toggleBtnSelector: "[data-toggle='control-sidebar']",
|
71
|
+
//The sidebar selector
|
72
|
+
selector: ".control-sidebar",
|
73
|
+
//Enable slide over content
|
74
|
+
slide: true
|
75
|
+
},
|
76
|
+
//Box Widget Plugin. Enable this plugin
|
77
|
+
//to allow boxes to be collapsed and/or removed
|
78
|
+
enableBoxWidget: true,
|
79
|
+
//Box Widget plugin options
|
80
|
+
boxWidgetOptions: {
|
81
|
+
boxWidgetIcons: {
|
82
|
+
//Collapse icon
|
83
|
+
collapse: 'fa-minus',
|
84
|
+
//Open icon
|
85
|
+
open: 'fa-plus',
|
86
|
+
//Remove icon
|
87
|
+
remove: 'fa-times'
|
88
|
+
},
|
89
|
+
boxWidgetSelectors: {
|
90
|
+
//Remove button selector
|
91
|
+
remove: '[data-widget="remove"]',
|
92
|
+
//Collapse button selector
|
93
|
+
collapse: '[data-widget="collapse"]'
|
94
|
+
}
|
95
|
+
},
|
96
|
+
//Direct Chat plugin options
|
97
|
+
directChat: {
|
98
|
+
//Enable direct chat by default
|
99
|
+
enable: false,
|
100
|
+
//The button to open and close the chat contacts pane
|
101
|
+
contactToggleSelector: '[data-widget="chat-pane-toggle"]'
|
102
|
+
},
|
103
|
+
//Define the set of colors to use globally around the website
|
104
|
+
colors: {
|
105
|
+
lightBlue: "#3c8dbc",
|
106
|
+
red: "#f56954",
|
107
|
+
green: "#00a65a",
|
108
|
+
aqua: "#00c0ef",
|
109
|
+
yellow: "#f39c12",
|
110
|
+
blue: "#0073b7",
|
111
|
+
navy: "#001F3F",
|
112
|
+
teal: "#39CCCC",
|
113
|
+
olive: "#3D9970",
|
114
|
+
lime: "#01FF70",
|
115
|
+
orange: "#FF851B",
|
116
|
+
fuchsia: "#F012BE",
|
117
|
+
purple: "#8E24AA",
|
118
|
+
maroon: "#D81B60",
|
119
|
+
black: "#222222",
|
120
|
+
gray: "#d2d6de"
|
121
|
+
},
|
122
|
+
//The standard screen sizes that bootstrap uses.
|
123
|
+
//If you change these in the variables.less file, change
|
124
|
+
//them here too.
|
125
|
+
screenSizes: {
|
126
|
+
xs: 480,
|
127
|
+
sm: 768,
|
128
|
+
md: 992,
|
129
|
+
lg: 1200
|
130
|
+
}
|
131
|
+
};
|
132
|
+
|
133
|
+
/* ------------------
|
134
|
+
* - Implementation -
|
135
|
+
* ------------------
|
136
|
+
* The next block of code implements AdminLTE's
|
137
|
+
* functions and plugins as specified by the
|
138
|
+
* options above.
|
139
|
+
*/
|
140
|
+
$(function () {
|
141
|
+
"use strict";
|
142
|
+
|
143
|
+
//Fix for IE page transitions
|
144
|
+
$("body").removeClass("hold-transition");
|
145
|
+
|
146
|
+
//Extend options if external options exist
|
147
|
+
if (typeof AdminLTEOptions !== "undefined") {
|
148
|
+
$.extend(true,
|
149
|
+
$.AdminLTE.options,
|
150
|
+
AdminLTEOptions);
|
151
|
+
}
|
152
|
+
|
153
|
+
//Easy access to options
|
154
|
+
var o = $.AdminLTE.options;
|
155
|
+
|
156
|
+
//Set up the object
|
157
|
+
_init();
|
158
|
+
|
159
|
+
//Activate the layout maker
|
160
|
+
$.AdminLTE.layout.activate();
|
161
|
+
|
162
|
+
//Enable sidebar tree view controls
|
163
|
+
$.AdminLTE.tree('.sidebar');
|
164
|
+
|
165
|
+
//Enable control sidebar
|
166
|
+
if (o.enableControlSidebar) {
|
167
|
+
$.AdminLTE.controlSidebar.activate();
|
168
|
+
}
|
169
|
+
|
170
|
+
//Add slimscroll to navbar dropdown
|
171
|
+
if (o.navbarMenuSlimscroll && typeof $.fn.slimscroll != 'undefined') {
|
172
|
+
$(".navbar .menu").slimscroll({
|
173
|
+
height: o.navbarMenuHeight,
|
174
|
+
alwaysVisible: false,
|
175
|
+
size: o.navbarMenuSlimscrollWidth
|
176
|
+
}).css("width", "100%");
|
177
|
+
}
|
178
|
+
|
179
|
+
//Activate sidebar push menu
|
180
|
+
if (o.sidebarPushMenu) {
|
181
|
+
$.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
|
182
|
+
}
|
183
|
+
|
184
|
+
//Activate Bootstrap tooltip
|
185
|
+
if (o.enableBSToppltip) {
|
186
|
+
$('body').tooltip({
|
187
|
+
selector: o.BSTooltipSelector
|
188
|
+
});
|
189
|
+
}
|
190
|
+
|
191
|
+
//Activate box widget
|
192
|
+
if (o.enableBoxWidget) {
|
193
|
+
$.AdminLTE.boxWidget.activate();
|
194
|
+
}
|
195
|
+
|
196
|
+
//Activate fast click
|
197
|
+
if (o.enableFastclick && typeof FastClick != 'undefined') {
|
198
|
+
FastClick.attach(document.body);
|
199
|
+
}
|
200
|
+
|
201
|
+
//Activate direct chat widget
|
202
|
+
if (o.directChat.enable) {
|
203
|
+
$(document).on('click', o.directChat.contactToggleSelector, function () {
|
204
|
+
var box = $(this).parents('.direct-chat').first();
|
205
|
+
box.toggleClass('direct-chat-contacts-open');
|
206
|
+
});
|
207
|
+
}
|
208
|
+
|
209
|
+
/*
|
210
|
+
* INITIALIZE BUTTON TOGGLE
|
211
|
+
* ------------------------
|
212
|
+
*/
|
213
|
+
$('.btn-group[data-toggle="btn-toggle"]').each(function () {
|
214
|
+
var group = $(this);
|
215
|
+
$(this).find(".btn").on('click', function (e) {
|
216
|
+
group.find(".btn.active").removeClass("active");
|
217
|
+
$(this).addClass("active");
|
218
|
+
e.preventDefault();
|
219
|
+
});
|
220
|
+
|
221
|
+
});
|
222
|
+
});
|
223
|
+
|
224
|
+
/* ----------------------------------
|
225
|
+
* - Initialize the AdminLTE Object -
|
226
|
+
* ----------------------------------
|
227
|
+
* All AdminLTE functions are implemented below.
|
228
|
+
*/
|
229
|
+
function _init() {
|
230
|
+
'use strict';
|
231
|
+
/* Layout
|
232
|
+
* ======
|
233
|
+
* Fixes the layout height in case min-height fails.
|
234
|
+
*
|
235
|
+
* @type Object
|
236
|
+
* @usage $.AdminLTE.layout.activate()
|
237
|
+
* $.AdminLTE.layout.fix()
|
238
|
+
* $.AdminLTE.layout.fixSidebar()
|
239
|
+
*/
|
240
|
+
$.AdminLTE.layout = {
|
241
|
+
activate: function () {
|
242
|
+
var _this = this;
|
243
|
+
_this.fix();
|
244
|
+
_this.fixSidebar();
|
245
|
+
$(window, ".wrapper").resize(function () {
|
246
|
+
_this.fix();
|
247
|
+
_this.fixSidebar();
|
248
|
+
});
|
249
|
+
},
|
250
|
+
fix: function () {
|
251
|
+
//Get window height and the wrapper height
|
252
|
+
var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
|
253
|
+
var window_height = $(window).height();
|
254
|
+
var sidebar_height = $(".sidebar").height();
|
255
|
+
//Set the min-height of the content and sidebar based on the
|
256
|
+
//the height of the document.
|
257
|
+
if ($("body").hasClass("fixed")) {
|
258
|
+
$(".content-wrapper, .right-side").css('min-height', window_height - $('.main-footer').outerHeight());
|
259
|
+
} else {
|
260
|
+
var postSetWidth;
|
261
|
+
if (window_height >= sidebar_height) {
|
262
|
+
$(".content-wrapper, .right-side").css('min-height', window_height - neg);
|
263
|
+
postSetWidth = window_height - neg;
|
264
|
+
} else {
|
265
|
+
$(".content-wrapper, .right-side").css('min-height', sidebar_height);
|
266
|
+
postSetWidth = sidebar_height;
|
267
|
+
}
|
268
|
+
|
269
|
+
//Fix for the control sidebar height
|
270
|
+
var controlSidebar = $($.AdminLTE.options.controlSidebarOptions.selector);
|
271
|
+
if (typeof controlSidebar !== "undefined") {
|
272
|
+
if (controlSidebar.height() > postSetWidth)
|
273
|
+
$(".content-wrapper, .right-side").css('min-height', controlSidebar.height());
|
274
|
+
}
|
275
|
+
|
276
|
+
}
|
277
|
+
},
|
278
|
+
fixSidebar: function () {
|
279
|
+
//Make sure the body tag has the .fixed class
|
280
|
+
if (!$("body").hasClass("fixed")) {
|
281
|
+
if (typeof $.fn.slimScroll != 'undefined') {
|
282
|
+
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
283
|
+
}
|
284
|
+
return;
|
285
|
+
} else if (typeof $.fn.slimScroll == 'undefined' && window.console) {
|
286
|
+
window.console.error("Error: the fixed layout requires the slimscroll plugin!");
|
287
|
+
}
|
288
|
+
//Enable slimscroll for fixed layout
|
289
|
+
if ($.AdminLTE.options.sidebarSlimScroll) {
|
290
|
+
if (typeof $.fn.slimScroll != 'undefined') {
|
291
|
+
//Destroy if it exists
|
292
|
+
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
293
|
+
//Add slimscroll
|
294
|
+
$(".sidebar").slimscroll({
|
295
|
+
height: ($(window).height() - $(".main-header").height()) + "px",
|
296
|
+
color: "rgba(0,0,0,0.2)",
|
297
|
+
size: "3px"
|
298
|
+
});
|
299
|
+
}
|
300
|
+
}
|
301
|
+
}
|
302
|
+
};
|
303
|
+
|
304
|
+
/* PushMenu()
|
305
|
+
* ==========
|
306
|
+
* Adds the push menu functionality to the sidebar.
|
307
|
+
*
|
308
|
+
* @type Function
|
309
|
+
* @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
|
310
|
+
*/
|
311
|
+
$.AdminLTE.pushMenu = {
|
312
|
+
activate: function (toggleBtn) {
|
313
|
+
//Get the screen sizes
|
314
|
+
var screenSizes = $.AdminLTE.options.screenSizes;
|
315
|
+
|
316
|
+
//Enable sidebar toggle
|
317
|
+
$(document).on('click', toggleBtn, function (e) {
|
318
|
+
e.preventDefault();
|
319
|
+
|
320
|
+
//Enable sidebar push menu
|
321
|
+
if ($(window).width() > (screenSizes.sm - 1)) {
|
322
|
+
if ($("body").hasClass('sidebar-collapse')) {
|
323
|
+
$("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu');
|
324
|
+
} else {
|
325
|
+
$("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu');
|
326
|
+
}
|
327
|
+
}
|
328
|
+
//Handle sidebar push menu for small screens
|
329
|
+
else {
|
330
|
+
if ($("body").hasClass('sidebar-open')) {
|
331
|
+
$("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu');
|
332
|
+
} else {
|
333
|
+
$("body").addClass('sidebar-open').trigger('expanded.pushMenu');
|
334
|
+
}
|
335
|
+
}
|
336
|
+
});
|
337
|
+
|
338
|
+
$(".content-wrapper").click(function () {
|
339
|
+
//Enable hide menu when clicking on the content-wrapper on small screens
|
340
|
+
if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
|
341
|
+
$("body").removeClass('sidebar-open');
|
342
|
+
}
|
343
|
+
});
|
344
|
+
|
345
|
+
//Enable expand on hover for sidebar mini
|
346
|
+
if ($.AdminLTE.options.sidebarExpandOnHover
|
347
|
+
|| ($('body').hasClass('fixed')
|
348
|
+
&& $('body').hasClass('sidebar-mini'))) {
|
349
|
+
this.expandOnHover();
|
350
|
+
}
|
351
|
+
},
|
352
|
+
expandOnHover: function () {
|
353
|
+
var _this = this;
|
354
|
+
var screenWidth = $.AdminLTE.options.screenSizes.sm - 1;
|
355
|
+
//Expand sidebar on hover
|
356
|
+
$('.main-sidebar').hover(function () {
|
357
|
+
if ($('body').hasClass('sidebar-mini')
|
358
|
+
&& $("body").hasClass('sidebar-collapse')
|
359
|
+
&& $(window).width() > screenWidth) {
|
360
|
+
_this.expand();
|
361
|
+
}
|
362
|
+
}, function () {
|
363
|
+
if ($('body').hasClass('sidebar-mini')
|
364
|
+
&& $('body').hasClass('sidebar-expanded-on-hover')
|
365
|
+
&& $(window).width() > screenWidth) {
|
366
|
+
_this.collapse();
|
367
|
+
}
|
368
|
+
});
|
369
|
+
},
|
370
|
+
expand: function () {
|
371
|
+
$("body").removeClass('sidebar-collapse').addClass('sidebar-expanded-on-hover');
|
372
|
+
},
|
373
|
+
collapse: function () {
|
374
|
+
if ($('body').hasClass('sidebar-expanded-on-hover')) {
|
375
|
+
$('body').removeClass('sidebar-expanded-on-hover').addClass('sidebar-collapse');
|
376
|
+
}
|
377
|
+
}
|
378
|
+
};
|
379
|
+
|
380
|
+
/* Tree()
|
381
|
+
* ======
|
382
|
+
* Converts the sidebar into a multilevel
|
383
|
+
* tree view menu.
|
384
|
+
*
|
385
|
+
* @type Function
|
386
|
+
* @Usage: $.AdminLTE.tree('.sidebar')
|
387
|
+
*/
|
388
|
+
$.AdminLTE.tree = function (menu) {
|
389
|
+
var _this = this;
|
390
|
+
var animationSpeed = $.AdminLTE.options.animationSpeed;
|
391
|
+
$(document).on('click', menu + ' li a', function (e) {
|
392
|
+
//Get the clicked link and the next element
|
393
|
+
var $this = $(this);
|
394
|
+
var checkElement = $this.next();
|
395
|
+
|
396
|
+
//Check if the next element is a menu and is visible
|
397
|
+
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
|
398
|
+
//Close the menu
|
399
|
+
checkElement.slideUp(animationSpeed, function () {
|
400
|
+
checkElement.removeClass('menu-open');
|
401
|
+
//Fix the layout in case the sidebar stretches over the height of the window
|
402
|
+
//_this.layout.fix();
|
403
|
+
});
|
404
|
+
checkElement.parent("li").removeClass("active");
|
405
|
+
}
|
406
|
+
//If the menu is not visible
|
407
|
+
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
|
408
|
+
//Get the parent menu
|
409
|
+
var parent = $this.parents('ul').first();
|
410
|
+
//Close all open menus within the parent
|
411
|
+
var ul = parent.find('ul:visible').slideUp(animationSpeed);
|
412
|
+
//Remove the menu-open class from the parent
|
413
|
+
ul.removeClass('menu-open');
|
414
|
+
//Get the parent li
|
415
|
+
var parent_li = $this.parent("li");
|
416
|
+
|
417
|
+
//Open the target menu and add the menu-open class
|
418
|
+
checkElement.slideDown(animationSpeed, function () {
|
419
|
+
//Add the class active to the parent li
|
420
|
+
checkElement.addClass('menu-open');
|
421
|
+
parent.find('li.active').removeClass('active');
|
422
|
+
parent_li.addClass('active');
|
423
|
+
//Fix the layout in case the sidebar stretches over the height of the window
|
424
|
+
_this.layout.fix();
|
425
|
+
});
|
426
|
+
}
|
427
|
+
//if this isn't a link, prevent the page from being redirected
|
428
|
+
if (checkElement.is('.treeview-menu')) {
|
429
|
+
e.preventDefault();
|
430
|
+
}
|
431
|
+
});
|
432
|
+
};
|
433
|
+
|
434
|
+
/* ControlSidebar
|
435
|
+
* ==============
|
436
|
+
* Adds functionality to the right sidebar
|
437
|
+
*
|
438
|
+
* @type Object
|
439
|
+
* @usage $.AdminLTE.controlSidebar.activate(options)
|
440
|
+
*/
|
441
|
+
$.AdminLTE.controlSidebar = {
|
442
|
+
//instantiate the object
|
443
|
+
activate: function () {
|
444
|
+
//Get the object
|
445
|
+
var _this = this;
|
446
|
+
//Update options
|
447
|
+
var o = $.AdminLTE.options.controlSidebarOptions;
|
448
|
+
//Get the sidebar
|
449
|
+
var sidebar = $(o.selector);
|
450
|
+
//The toggle button
|
451
|
+
var btn = $(o.toggleBtnSelector);
|
452
|
+
|
453
|
+
//Listen to the click event
|
454
|
+
btn.on('click', function (e) {
|
455
|
+
e.preventDefault();
|
456
|
+
//If the sidebar is not open
|
457
|
+
if (!sidebar.hasClass('control-sidebar-open')
|
458
|
+
&& !$('body').hasClass('control-sidebar-open')) {
|
459
|
+
//Open the sidebar
|
460
|
+
_this.open(sidebar, o.slide);
|
461
|
+
} else {
|
462
|
+
_this.close(sidebar, o.slide);
|
463
|
+
}
|
464
|
+
});
|
465
|
+
|
466
|
+
//If the body has a boxed layout, fix the sidebar bg position
|
467
|
+
var bg = $(".control-sidebar-bg");
|
468
|
+
_this._fix(bg);
|
469
|
+
|
470
|
+
//If the body has a fixed layout, make the control sidebar fixed
|
471
|
+
if ($('body').hasClass('fixed')) {
|
472
|
+
_this._fixForFixed(sidebar);
|
473
|
+
} else {
|
474
|
+
//If the content height is less than the sidebar's height, force max height
|
475
|
+
if ($('.content-wrapper, .right-side').height() < sidebar.height()) {
|
476
|
+
_this._fixForContent(sidebar);
|
477
|
+
}
|
478
|
+
}
|
479
|
+
},
|
480
|
+
//Open the control sidebar
|
481
|
+
open: function (sidebar, slide) {
|
482
|
+
//Slide over content
|
483
|
+
if (slide) {
|
484
|
+
sidebar.addClass('control-sidebar-open');
|
485
|
+
} else {
|
486
|
+
//Push the content by adding the open class to the body instead
|
487
|
+
//of the sidebar itself
|
488
|
+
$('body').addClass('control-sidebar-open');
|
489
|
+
}
|
490
|
+
},
|
491
|
+
//Close the control sidebar
|
492
|
+
close: function (sidebar, slide) {
|
493
|
+
if (slide) {
|
494
|
+
sidebar.removeClass('control-sidebar-open');
|
495
|
+
} else {
|
496
|
+
$('body').removeClass('control-sidebar-open');
|
497
|
+
}
|
498
|
+
},
|
499
|
+
_fix: function (sidebar) {
|
500
|
+
var _this = this;
|
501
|
+
if ($("body").hasClass('layout-boxed')) {
|
502
|
+
sidebar.css('position', 'absolute');
|
503
|
+
sidebar.height($(".wrapper").height());
|
504
|
+
$(window).resize(function () {
|
505
|
+
_this._fix(sidebar);
|
506
|
+
});
|
507
|
+
} else {
|
508
|
+
sidebar.css({
|
509
|
+
'position': 'fixed',
|
510
|
+
'height': 'auto'
|
511
|
+
});
|
512
|
+
}
|
513
|
+
},
|
514
|
+
_fixForFixed: function (sidebar) {
|
515
|
+
sidebar.css({
|
516
|
+
'position': 'fixed',
|
517
|
+
'max-height': '100%',
|
518
|
+
'overflow': 'auto',
|
519
|
+
'padding-bottom': '50px'
|
520
|
+
});
|
521
|
+
},
|
522
|
+
_fixForContent: function (sidebar) {
|
523
|
+
$(".content-wrapper, .right-side").css('min-height', sidebar.height());
|
524
|
+
}
|
525
|
+
};
|
526
|
+
|
527
|
+
/* BoxWidget
|
528
|
+
* =========
|
529
|
+
* BoxWidget is a plugin to handle collapsing and
|
530
|
+
* removing boxes from the screen.
|
531
|
+
*
|
532
|
+
* @type Object
|
533
|
+
* @usage $.AdminLTE.boxWidget.activate()
|
534
|
+
* Set all your options in the main $.AdminLTE.options object
|
535
|
+
*/
|
536
|
+
$.AdminLTE.boxWidget = {
|
537
|
+
selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
|
538
|
+
icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
|
539
|
+
animationSpeed: $.AdminLTE.options.animationSpeed,
|
540
|
+
activate: function (_box) {
|
541
|
+
var _this = this;
|
542
|
+
if (!_box) {
|
543
|
+
_box = document; // activate all boxes per default
|
544
|
+
}
|
545
|
+
//Listen for collapse event triggers
|
546
|
+
$(_box).on('click', _this.selectors.collapse, function (e) {
|
547
|
+
e.preventDefault();
|
548
|
+
_this.collapse($(this));
|
549
|
+
});
|
550
|
+
|
551
|
+
//Listen for remove event triggers
|
552
|
+
$(_box).on('click', _this.selectors.remove, function (e) {
|
553
|
+
e.preventDefault();
|
554
|
+
_this.remove($(this));
|
555
|
+
});
|
556
|
+
},
|
557
|
+
collapse: function (element) {
|
558
|
+
var _this = this;
|
559
|
+
//Find the box parent
|
560
|
+
var box = element.parents(".box").first();
|
561
|
+
//Find the body and the footer
|
562
|
+
var box_content = box.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");
|
563
|
+
if (!box.hasClass("collapsed-box")) {
|
564
|
+
//Convert minus into plus
|
565
|
+
element.children(":first")
|
566
|
+
.removeClass(_this.icons.collapse)
|
567
|
+
.addClass(_this.icons.open);
|
568
|
+
//Hide the content
|
569
|
+
box_content.slideUp(_this.animationSpeed, function () {
|
570
|
+
box.addClass("collapsed-box");
|
571
|
+
});
|
572
|
+
} else {
|
573
|
+
//Convert plus into minus
|
574
|
+
element.children(":first")
|
575
|
+
.removeClass(_this.icons.open)
|
576
|
+
.addClass(_this.icons.collapse);
|
577
|
+
//Show the content
|
578
|
+
box_content.slideDown(_this.animationSpeed, function () {
|
579
|
+
box.removeClass("collapsed-box");
|
580
|
+
});
|
581
|
+
}
|
582
|
+
},
|
583
|
+
remove: function (element) {
|
584
|
+
//Find the box parent
|
585
|
+
var box = element.parents(".box").first();
|
586
|
+
box.slideUp(this.animationSpeed);
|
587
|
+
}
|
588
|
+
};
|
589
|
+
}
|
590
|
+
|
591
|
+
/* ------------------
|
592
|
+
* - Custom Plugins -
|
593
|
+
* ------------------
|
594
|
+
* All custom plugins are defined below.
|
595
|
+
*/
|
596
|
+
|
597
|
+
/*
|
598
|
+
* BOX REFRESH BUTTON
|
599
|
+
* ------------------
|
600
|
+
* This is a custom plugin to use with the component BOX. It allows you to add
|
601
|
+
* a refresh button to the box. It converts the box's state to a loading state.
|
602
|
+
*
|
603
|
+
* @type plugin
|
604
|
+
* @usage $("#box-widget").boxRefresh( options );
|
605
|
+
*/
|
606
|
+
(function ($) {
|
607
|
+
|
608
|
+
"use strict";
|
609
|
+
|
610
|
+
$.fn.boxRefresh = function (options) {
|
611
|
+
|
612
|
+
// Render options
|
613
|
+
var settings = $.extend({
|
614
|
+
//Refresh button selector
|
615
|
+
trigger: ".refresh-btn",
|
616
|
+
//File source to be loaded (e.g: ajax/src.php)
|
617
|
+
source: "",
|
618
|
+
//Callbacks
|
619
|
+
onLoadStart: function (box) {
|
620
|
+
return box;
|
621
|
+
}, //Right after the button has been clicked
|
622
|
+
onLoadDone: function (box) {
|
623
|
+
return box;
|
624
|
+
} //When the source has been loaded
|
625
|
+
|
626
|
+
}, options);
|
627
|
+
|
628
|
+
//The overlay
|
629
|
+
var overlay = $('<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>');
|
630
|
+
|
631
|
+
return this.each(function () {
|
632
|
+
//if a source is specified
|
633
|
+
if (settings.source === "") {
|
634
|
+
if (window.console) {
|
635
|
+
window.console.log("Please specify a source first - boxRefresh()");
|
636
|
+
}
|
637
|
+
return;
|
638
|
+
}
|
639
|
+
//the box
|
640
|
+
var box = $(this);
|
641
|
+
//the button
|
642
|
+
var rBtn = box.find(settings.trigger).first();
|
643
|
+
|
644
|
+
//On trigger click
|
645
|
+
rBtn.on('click', function (e) {
|
646
|
+
e.preventDefault();
|
647
|
+
//Add loading overlay
|
648
|
+
start(box);
|
649
|
+
|
650
|
+
//Perform ajax call
|
651
|
+
box.find(".box-body").load(settings.source, function () {
|
652
|
+
done(box);
|
653
|
+
});
|
654
|
+
});
|
655
|
+
});
|
656
|
+
|
657
|
+
function start(box) {
|
658
|
+
//Add overlay and loading img
|
659
|
+
box.append(overlay);
|
660
|
+
|
661
|
+
settings.onLoadStart.call(box);
|
662
|
+
}
|
663
|
+
|
664
|
+
function done(box) {
|
665
|
+
//Remove overlay and loading img
|
666
|
+
box.find(overlay).remove();
|
667
|
+
|
668
|
+
settings.onLoadDone.call(box);
|
669
|
+
}
|
670
|
+
|
671
|
+
};
|
672
|
+
|
673
|
+
})(jQuery);
|
674
|
+
|
675
|
+
/*
|
676
|
+
* EXPLICIT BOX CONTROLS
|
677
|
+
* -----------------------
|
678
|
+
* This is a custom plugin to use with the component BOX. It allows you to activate
|
679
|
+
* a box inserted in the DOM after the app.js was loaded, toggle and remove box.
|
680
|
+
*
|
681
|
+
* @type plugin
|
682
|
+
* @usage $("#box-widget").activateBox();
|
683
|
+
* @usage $("#box-widget").toggleBox();
|
684
|
+
* @usage $("#box-widget").removeBox();
|
685
|
+
*/
|
686
|
+
(function ($) {
|
687
|
+
|
688
|
+
'use strict';
|
689
|
+
|
690
|
+
$.fn.activateBox = function () {
|
691
|
+
$.AdminLTE.boxWidget.activate(this);
|
692
|
+
};
|
693
|
+
|
694
|
+
$.fn.toggleBox = function(){
|
695
|
+
var button = $($.AdminLTE.boxWidget.selectors.collapse, this);
|
696
|
+
$.AdminLTE.boxWidget.collapse(button);
|
697
|
+
};
|
698
|
+
|
699
|
+
$.fn.removeBox = function(){
|
700
|
+
var button = $($.AdminLTE.boxWidget.selectors.remove, this);
|
701
|
+
$.AdminLTE.boxWidget.remove(button);
|
702
|
+
};
|
703
|
+
|
704
|
+
})(jQuery);
|
705
|
+
|
706
|
+
/*
|
707
|
+
* TODO LIST CUSTOM PLUGIN
|
708
|
+
* -----------------------
|
709
|
+
* This plugin depends on iCheck plugin for checkbox and radio inputs
|
710
|
+
*
|
711
|
+
* @type plugin
|
712
|
+
* @usage $("#todo-widget").todolist( options );
|
713
|
+
*/
|
714
|
+
(function ($) {
|
715
|
+
|
716
|
+
'use strict';
|
717
|
+
|
718
|
+
$.fn.todolist = function (options) {
|
719
|
+
// Render options
|
720
|
+
var settings = $.extend({
|
721
|
+
//When the user checks the input
|
722
|
+
onCheck: function (ele) {
|
723
|
+
return ele;
|
724
|
+
},
|
725
|
+
//When the user unchecks the input
|
726
|
+
onUncheck: function (ele) {
|
727
|
+
return ele;
|
728
|
+
}
|
729
|
+
}, options);
|
730
|
+
|
731
|
+
return this.each(function () {
|
732
|
+
|
733
|
+
if (typeof $.fn.iCheck != 'undefined') {
|
734
|
+
$('input', this).on('ifChecked', function () {
|
735
|
+
var ele = $(this).parents("li").first();
|
736
|
+
ele.toggleClass("done");
|
737
|
+
settings.onCheck.call(ele);
|
738
|
+
});
|
739
|
+
|
740
|
+
$('input', this).on('ifUnchecked', function () {
|
741
|
+
var ele = $(this).parents("li").first();
|
742
|
+
ele.toggleClass("done");
|
743
|
+
settings.onUncheck.call(ele);
|
744
|
+
});
|
745
|
+
} else {
|
746
|
+
$('input', this).on('change', function () {
|
747
|
+
var ele = $(this).parents("li").first();
|
748
|
+
ele.toggleClass("done");
|
749
|
+
if ($('input', ele).is(":checked")) {
|
750
|
+
settings.onCheck.call(ele);
|
751
|
+
} else {
|
752
|
+
settings.onUncheck.call(ele);
|
753
|
+
}
|
754
|
+
});
|
755
|
+
}
|
756
|
+
});
|
757
|
+
};
|
758
|
+
}(jQuery));
|