diff --git a/bower.json b/bower.json
index f5d4b3328..1a5259475 100644
--- a/bower.json
+++ b/bower.json
@@ -19,7 +19,8 @@
"metisMenu": "latest",
"datatables": "latest",
"colorbox": "latest",
- "admin-lte": "latest"
+ "admin-lte": "latest",
+ "x-editable": "latest"
},
"install": {
"base": "public/default/libs",
@@ -96,6 +97,11 @@
"bower_components/colorbox/jquery.colorbox.js",
"bower_components/colorbox/jquery.colorbox-min.js",
"bower_components/colorbox/example3/images/*.*"
+ ],
+ "x-editable": [
+ "bower_components/x-editable/dist/bootstrap3-editable/js/*.*",
+ "bower_components/x-editable/dist/bootstrap3-editable/css/*.*",
+ "bower_components/x-editable/dist/bootstrap3-editable/img/*.*"
]
}
}
diff --git a/config/sleeping_owl.php b/config/sleeping_owl.php
index ffd8647f9..fb0d46f12 100644
--- a/config/sleeping_owl.php
+++ b/config/sleeping_owl.php
@@ -123,20 +123,21 @@
*/
'aliases' => [
- 'Assets' => KodiCMS\Assets\Facades\Assets::class,
- 'PackageManager' => KodiCMS\Assets\Facades\PackageManager::class,
- 'Meta' => KodiCMS\Assets\Facades\Meta::class,
- 'Form' => Collective\Html\FormFacade::class,
- 'HTML' => Collective\Html\HtmlFacade::class,
-
- 'AdminSection' => SleepingOwl\Admin\Facades\Admin::class,
- 'AdminTemplate' => SleepingOwl\Admin\Facades\Template::class,
- 'AdminNavigation' => SleepingOwl\Admin\Facades\Navigation::class,
- 'AdminColumn' => SleepingOwl\Admin\Facades\TableColumn::class,
- 'AdminColumnFilter' => SleepingOwl\Admin\Facades\TableColumnFilter::class,
- 'AdminDisplayFilter' => SleepingOwl\Admin\Facades\DisplayFilter::class,
- 'AdminForm' => SleepingOwl\Admin\Facades\Form::class,
- 'AdminFormElement' => SleepingOwl\Admin\Facades\FormElement::class,
- 'AdminDisplay' => SleepingOwl\Admin\Facades\Display::class,
+ 'Assets' => KodiCMS\Assets\Facades\Assets::class,
+ 'PackageManager' => KodiCMS\Assets\Facades\PackageManager::class,
+ 'Meta' => KodiCMS\Assets\Facades\Meta::class,
+ 'Form' => Collective\Html\FormFacade::class,
+ 'HTML' => Collective\Html\HtmlFacade::class,
+
+ 'AdminSection' => SleepingOwl\Admin\Facades\Admin::class,
+ 'AdminTemplate' => SleepingOwl\Admin\Facades\Template::class,
+ 'AdminNavigation' => SleepingOwl\Admin\Facades\Navigation::class,
+ 'AdminColumn' => SleepingOwl\Admin\Facades\TableColumn::class,
+ 'AdminColumnEditable' => SleepingOwl\Admin\Facades\TableColumnEditable::class,
+ 'AdminColumnFilter' => SleepingOwl\Admin\Facades\TableColumnFilter::class,
+ 'AdminDisplayFilter' => SleepingOwl\Admin\Facades\DisplayFilter::class,
+ 'AdminForm' => SleepingOwl\Admin\Facades\Form::class,
+ 'AdminFormElement' => SleepingOwl\Admin\Facades\FormElement::class,
+ 'AdminDisplay' => SleepingOwl\Admin\Facades\Display::class,
],
];
diff --git a/gulpfile.js b/gulpfile.js
index d12f1df6b..195ffa133 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -31,6 +31,7 @@ elixir(function(mix) {
'jquery-colorbox/js/jquery.colorbox-min.js',
'moment/js/moment-with-locales.min.js',
'underscore/js/underscore.js',
+ 'x-editable/js/bootstrap-editable.min.js',
'../../../resources/assets/js/core.js'
], 'public/default/js/libraries.js', 'public/default/libs');
diff --git a/public/default/css/common.css b/public/default/css/common.css
index cca7e6095..1232c0ec0 100644
--- a/public/default/css/common.css
+++ b/public/default/css/common.css
@@ -1,4 +1,17 @@
-.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:1px solid #000;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:linear-gradient(180deg,#fff 50%,#eee);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',endColorstr='#FFEEEEEE',GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:linear-gradient(180deg,#eee 50%,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',endColorstr='#FFCCCCCC',GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:linear-gradient(180deg,#fff 0,#eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',endColorstr='#FFEEEEEE',GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:linear-gradient(180deg,#eee 50%,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',endColorstr='#FFFFFFFF',GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}@font-face{font-family:Open Sans;font-style:italic;font-weight:400;src:local('Open Sans Italic'),local('Open-Sans-Italic'),url(../fonts/OpenSans-Italic.ttf) format('truetype')}@font-face{font-family:Open Sans;font-style:bold;font-weight:700;src:local('Open Sans Bold'),local('Open-Sans-Bold'),url(../fonts/OpenSans-Bold.ttf) format('truetype')}@font-face{font-family:Open Sans;font-style:normal;font-weight:400;src:local('Open Sans Regular'),local('Open-Sans-Regular'),url(../fonts/OpenSans-Regular.ttf) format('truetype')}
+.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:1px solid #000;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:linear-gradient(180deg,#fff 50%,#eee);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',endColorstr='#FFEEEEEE',GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:linear-gradient(180deg,#eee 50%,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',endColorstr='#FFCCCCCC',GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:linear-gradient(180deg,#fff 0,#eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',endColorstr='#FFEEEEEE',GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:linear-gradient(180deg,#eee 50%,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',endColorstr='#FFFFFFFF',GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
+/*! X-editable - v1.5.1
+* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
+* http://github.com/vitalets/x-editable
+* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */.editableform{margin-bottom:0}.editableform .control-group{margin-bottom:0;white-space:nowrap;line-height:20px}.editableform .form-control{width:auto}.editable-buttons{display:inline-block;vertical-align:top;margin-left:7px;zoom:1;*display:inline}.editable-buttons.editable-buttons-bottom{display:block;margin-top:7px;margin-left:0}.editable-input{vertical-align:top;display:inline-block;width:auto;white-space:normal;zoom:1;*display:inline}.editable-buttons .editable-cancel{margin-left:7px}.editable-buttons button.ui-button-icon-only{height:24px;width:30px}.editableform-loading{background:url(../img/loading.gif) 50% no-repeat;height:25px;width:auto;min-width:25px}.editable-inline .editableform-loading{background-position:left 5px}.editable-error-block{max-width:300px;margin:5px 0 0;width:auto;white-space:normal}.editable-error-block.ui-state-error{padding:3px}.editable-error{color:red}.editableform .editable-date{padding:0;margin:0;float:left}.editable-inline .add-on .icon-th{margin-top:3px;margin-left:1px}.editable-checklist label input[type=checkbox],.editable-checklist label span{vertical-align:middle;margin:0}.editable-checklist label{white-space:nowrap}.editable-wysihtml5{width:566px;height:250px}.editable-clear{clear:both;font-size:.9em;text-decoration:none;text-align:right}.editable-clear-x{background:url(../img/clear.png) 50% no-repeat;display:block;width:13px;height:13px;position:absolute;opacity:.6;z-index:100;top:50%;right:6px;margin-top:-6px}.editable-clear-x:hover{opacity:1}.editable-pre-wrapped{white-space:pre-wrap}.editable-container.editable-popup{max-width:none!important}.editable-container.popover{width:auto}.editable-container.editable-inline{display:inline-block;vertical-align:middle;width:auto;zoom:1;*display:inline}.editable-container.ui-widget{font-size:inherit;z-index:9990}.editable-click,a.editable-click,a.editable-click:hover{text-decoration:none;border-bottom:1px dashed #08c}.editable-click.editable-disabled,a.editable-click.editable-disabled,a.editable-click.editable-disabled:hover{color:#585858;cursor:default;border-bottom:none}.editable-empty,.editable-empty:focus,.editable-empty:hover{font-style:italic;color:#d14;text-decoration:none}.editable-unsaved{font-weight:700}.editable-bg-transition{transition:background-color 1.4s ease-out}.form-horizontal .editable{padding-top:5px;display:inline-block}
+/*!
+ * Datepicker for Bootstrap
+ *
+ * Copyright 2012 Stefan Petre
+ * Improvements by Andrew Rowls
+ * Licensed under the Apache License v2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */.datepicker{padding:4px;border-radius:4px;direction:ltr}.datepicker-inline{width:220px}.datepicker.datepicker-rtl{direction:rtl}.datepicker.datepicker-rtl table tr td span{float:right}.datepicker-dropdown{top:0;left:0}.datepicker-dropdown:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,.2);position:absolute;top:-7px;left:6px}.datepicker-dropdown:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:7px}.datepicker>div{display:none}.datepicker.days div.datepicker-days,.datepicker.months div.datepicker-months,.datepicker.years div.datepicker-years{display:block}.datepicker table{margin:0}.datepicker td,.datepicker th{text-align:center;width:20px;height:20px;border-radius:4px;border:none}.table-striped .datepicker table tr td,.table-striped .datepicker table tr th{background-color:transparent}.datepicker table tr td.day:hover{background:#eee;cursor:pointer}.datepicker table tr td.new,.datepicker table tr td.old{color:#999}.datepicker table tr td.disabled,.datepicker table tr td.disabled:hover{background:none;color:#999;cursor:default}.datepicker table tr td.today,.datepicker table tr td.today.disabled,.datepicker table tr td.today.disabled:hover,.datepicker table tr td.today:hover{background-color:#fde19a;background-image:linear-gradient(top,#fdd49a,#fdf59a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a',endColorstr='#fdf59a',GradientType=0);border-color:#fdf59a #fdf59a #fbed50;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#000}.datepicker table tr td.today.active,.datepicker table tr td.today.disabled,.datepicker table tr td.today.disabled.active,.datepicker table tr td.today.disabled.disabled,.datepicker table tr td.today.disabled:active,.datepicker table tr td.today.disabled:hover,.datepicker table tr td.today.disabled:hover.active,.datepicker table tr td.today.disabled:hover.disabled,.datepicker table tr td.today.disabled:hover:active,.datepicker table tr td.today.disabled:hover:hover,.datepicker table tr td.today.disabled:hover[disabled],.datepicker table tr td.today.disabled[disabled],.datepicker table tr td.today:active,.datepicker table tr td.today:hover,.datepicker table tr td.today:hover.active,.datepicker table tr td.today:hover.disabled,.datepicker table tr td.today:hover:active,.datepicker table tr td.today:hover:hover,.datepicker table tr td.today:hover[disabled],.datepicker table tr td.today[disabled]{background-color:#fdf59a}.datepicker table tr td.today.active,.datepicker table tr td.today.disabled.active,.datepicker table tr td.today.disabled:active,.datepicker table tr td.today.disabled:hover.active,.datepicker table tr td.today.disabled:hover:active,.datepicker table tr td.today:active,.datepicker table tr td.today:hover.active,.datepicker table tr td.today:hover:active{background-color:#fbf069\9}.datepicker table tr td.today:hover:hover{color:#000}.datepicker table tr td.today.active:hover{color:#fff}.datepicker table tr td.range,.datepicker table tr td.range.disabled,.datepicker table tr td.range.disabled:hover,.datepicker table tr td.range:hover{background:#eee;border-radius:0}.datepicker table tr td.range.today,.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today.disabled:hover,.datepicker table tr td.range.today:hover{background-color:#f3d17a;background-image:linear-gradient(top,#f3c17a,#f3e97a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a',endColorstr='#f3e97a',GradientType=0);border-color:#f3e97a #f3e97a #edde34;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border-radius:0}.datepicker table tr td.range.today.active,.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today.disabled.active,.datepicker table tr td.range.today.disabled.disabled,.datepicker table tr td.range.today.disabled:active,.datepicker table tr td.range.today.disabled:hover,.datepicker table tr td.range.today.disabled:hover.active,.datepicker table tr td.range.today.disabled:hover.disabled,.datepicker table tr td.range.today.disabled:hover:active,.datepicker table tr td.range.today.disabled:hover:hover,.datepicker table tr td.range.today.disabled:hover[disabled],.datepicker table tr td.range.today.disabled[disabled],.datepicker table tr td.range.today:active,.datepicker table tr td.range.today:hover,.datepicker table tr td.range.today:hover.active,.datepicker table tr td.range.today:hover.disabled,.datepicker table tr td.range.today:hover:active,.datepicker table tr td.range.today:hover:hover,.datepicker table tr td.range.today:hover[disabled],.datepicker table tr td.range.today[disabled]{background-color:#f3e97a}.datepicker table tr td.range.today.active,.datepicker table tr td.range.today.disabled.active,.datepicker table tr td.range.today.disabled:active,.datepicker table tr td.range.today.disabled:hover.active,.datepicker table tr td.range.today.disabled:hover:active,.datepicker table tr td.range.today:active,.datepicker table tr td.range.today:hover.active,.datepicker table tr td.range.today:hover:active{background-color:#efe24b\9}.datepicker table tr td.selected,.datepicker table tr td.selected.disabled,.datepicker table tr td.selected.disabled:hover,.datepicker table tr td.selected:hover{background-color:#9e9e9e;background-image:linear-gradient(top,#b3b3b3,gray);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3',endColorstr='#808080',GradientType=0);border-color:gray gray #595959;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td.selected.active,.datepicker table tr td.selected.disabled,.datepicker table tr td.selected.disabled.active,.datepicker table tr td.selected.disabled.disabled,.datepicker table tr td.selected.disabled:active,.datepicker table tr td.selected.disabled:hover,.datepicker table tr td.selected.disabled:hover.active,.datepicker table tr td.selected.disabled:hover.disabled,.datepicker table tr td.selected.disabled:hover:active,.datepicker table tr td.selected.disabled:hover:hover,.datepicker table tr td.selected.disabled:hover[disabled],.datepicker table tr td.selected.disabled[disabled],.datepicker table tr td.selected:active,.datepicker table tr td.selected:hover,.datepicker table tr td.selected:hover.active,.datepicker table tr td.selected:hover.disabled,.datepicker table tr td.selected:hover:active,.datepicker table tr td.selected:hover:hover,.datepicker table tr td.selected:hover[disabled],.datepicker table tr td.selected[disabled]{background-color:gray}.datepicker table tr td.selected.active,.datepicker table tr td.selected.disabled.active,.datepicker table tr td.selected.disabled:active,.datepicker table tr td.selected.disabled:hover.active,.datepicker table tr td.selected.disabled:hover:active,.datepicker table tr td.selected:active,.datepicker table tr td.selected:hover.active,.datepicker table tr td.selected:hover:active{background-color:#666\9}.datepicker table tr td.active,.datepicker table tr td.active.disabled,.datepicker table tr td.active.disabled:hover,.datepicker table tr td.active:hover{background-color:#006dcc;background-image:linear-gradient(top,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td.active.active,.datepicker table tr td.active.disabled,.datepicker table tr td.active.disabled.active,.datepicker table tr td.active.disabled.disabled,.datepicker table tr td.active.disabled:active,.datepicker table tr td.active.disabled:hover,.datepicker table tr td.active.disabled:hover.active,.datepicker table tr td.active.disabled:hover.disabled,.datepicker table tr td.active.disabled:hover:active,.datepicker table tr td.active.disabled:hover:hover,.datepicker table tr td.active.disabled:hover[disabled],.datepicker table tr td.active.disabled[disabled],.datepicker table tr td.active:active,.datepicker table tr td.active:hover,.datepicker table tr td.active:hover.active,.datepicker table tr td.active:hover.disabled,.datepicker table tr td.active:hover:active,.datepicker table tr td.active:hover:hover,.datepicker table tr td.active:hover[disabled],.datepicker table tr td.active[disabled]{background-color:#04c}.datepicker table tr td.active.active,.datepicker table tr td.active.disabled.active,.datepicker table tr td.active.disabled:active,.datepicker table tr td.active.disabled:hover.active,.datepicker table tr td.active.disabled:hover:active,.datepicker table tr td.active:active,.datepicker table tr td.active:hover.active,.datepicker table tr td.active:hover:active{background-color:#039\9}.datepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.datepicker table tr td span:hover{background:#eee}.datepicker table tr td span.disabled,.datepicker table tr td span.disabled:hover{background:none;color:#999;cursor:default}.datepicker table tr td span.active,.datepicker table tr td span.active.disabled,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active:hover{background-color:#006dcc;background-image:linear-gradient(top,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td span.active.active,.datepicker table tr td span.active.disabled,.datepicker table tr td span.active.disabled.active,.datepicker table tr td span.active.disabled.disabled,.datepicker table tr td span.active.disabled:active,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active.disabled:hover.active,.datepicker table tr td span.active.disabled:hover.disabled,.datepicker table tr td span.active.disabled:hover:active,.datepicker table tr td span.active.disabled:hover:hover,.datepicker table tr td span.active.disabled:hover[disabled],.datepicker table tr td span.active.disabled[disabled],.datepicker table tr td span.active:active,.datepicker table tr td span.active:hover,.datepicker table tr td span.active:hover.active,.datepicker table tr td span.active:hover.disabled,.datepicker table tr td span.active:hover:active,.datepicker table tr td span.active:hover:hover,.datepicker table tr td span.active:hover[disabled],.datepicker table tr td span.active[disabled]{background-color:#04c}.datepicker table tr td span.active.active,.datepicker table tr td span.active.disabled.active,.datepicker table tr td span.active.disabled:active,.datepicker table tr td span.active.disabled:hover.active,.datepicker table tr td span.active.disabled:hover:active,.datepicker table tr td span.active:active,.datepicker table tr td span.active:hover.active,.datepicker table tr td span.active:hover:active{background-color:#039\9}.datepicker table tr td span.new,.datepicker table tr td span.old{color:#999}.datepicker th.datepicker-switch{width:145px}.datepicker tfoot tr th,.datepicker thead tr:first-child th{cursor:pointer}.datepicker tfoot tr th:hover,.datepicker thead tr:first-child th:hover{background:#eee}.datepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.datepicker thead tr:first-child th.cw{cursor:default;background-color:transparent}.input-append.date .add-on i,.input-prepend.date .add-on i{display:block;cursor:pointer;width:16px;height:16px}.input-daterange input{text-align:center}.input-daterange input:first-child{border-radius:3px 0 0 3px}.input-daterange input:last-child{border-radius:0 3px 3px 0}.input-daterange .add-on{display:inline-block;width:auto;min-width:16px;height:18px;padding:4px 5px;font-weight:400;line-height:18px;text-align:center;text-shadow:0 1px 0 #fff;vertical-align:middle;background-color:#eee;border:1px solid #ccc;margin-left:-5px;margin-right:-5px}@font-face{font-family:Open Sans;font-style:italic;font-weight:400;src:local('Open Sans Italic'),local('Open-Sans-Italic'),url(../fonts/OpenSans-Italic.ttf) format('truetype')}@font-face{font-family:Open Sans;font-style:bold;font-weight:700;src:local('Open Sans Bold'),local('Open-Sans-Bold'),url(../fonts/OpenSans-Bold.ttf) format('truetype')}@font-face{font-family:Open Sans;font-style:normal;font-weight:400;src:local('Open Sans Regular'),local('Open-Sans-Regular'),url(../fonts/OpenSans-Regular.ttf) format('truetype')}
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
diff --git a/public/default/js/admin-default.js b/public/default/js/admin-default.js
index ff811a770..d92f65091 100644
--- a/public/default/js/admin-default.js
+++ b/public/default/js/admin-default.js
@@ -1 +1 @@
-window.columnFilters={},window.columnFilters.range=function(e,a){var t=$(e),n=t.find("input"),i=n.filter(":first"),o=n.filter(":last"),l=t.closest("td").data("index");i.data("ajax-data-name","from"),o.data("ajax-data-name","to"),$.fn.dataTable.ext.search.push(function(e,t,n){if(a.settings()[0].sTableId!=e.sTableId)return!0;var c=a.data()[n][l];c&&void 0!==c["@data-order"]&&(c=c["@data-order"]);var r=i.val(),s=o.val();return i.closest(".input-date").length>0&&o.closest(".input-date").length>0?(r=""!=r?i.closest(".input-date").data("DateTimePicker").date():Number.NEGATIVE_INFINITY,s=""!=s?o.closest(".input-date").data("DateTimePicker").date():Number.POSITIVE_INFINITY,c=moment(c)):(c=parseInt(c),r=""!=r?parseInt(r):Number.NEGATIVE_INFINITY,s=""!=s?parseInt(s):Number.POSITIVE_INFINITY),c>=r&&s>=c}),n.on("keyup change",function(){a.draw()})},window.columnFilters.select=function(e,a){var t=$(e),n=t.closest("td").data("index");t.on("change",function(){a.column(n).search(t.val()).draw()})},window.columnFilters.text=function(e,a){var t=$(e),n=t.closest("td").data("index");t.on("keyup change",function(){a.column(n).search(t.val()).draw()})},$(function(){$(".adminCheckboxAll").change(function(){var e=$(this).is(":checked");$(".adminCheckboxRow").prop("checked",e).filter(":first").change()}),$(document).delegate(".adminCheckboxRow","change",function(){var e=[];$(".adminCheckboxRow:checked").each(function(){e.push($(this).val())}),$(".tableActions .btnAction").each(function(){var a=$(this),t=a.data("href")+e.join(",");a.attr("href",t)})})}),$(function(){$(document).delegate(".btn-delete","click",function(e){e.preventDefault();var a=$(this).closest("form");bootbox.confirm(window.Admin.Settings.lang.table["delete-confirm"],function(e){e&&a.submit()})}),bootbox.setDefaults("locale",window.Admin.Settings.locale)}),$(function(){$(document).delegate('*[data-toggle="lightbox"]',"click",function(e){e.preventDefault(),$(this).ekkoLightbox({always_show_close:!1})})}),$(function(){$(".input-date").each(function(){var e=$(this);e.datetimepicker({locale:window.Admin.Settings.locale}).trigger("dp.change").on("dp.change",function(){e.change()})})}),$(function(){$(".input-select").select2()}),$(function(){$(".imageUpload").each(function(e,a){var t=$(a),n=t.closest(".form-group"),i=t.find(".errors"),o=t.find(".no-value"),l=t.find(".has-value"),c=t.find(".thumbnail img.has-value"),r=t.find(".imageValue"),s=new Flow({target:t.data("target"),testChunks:!1,chunkSize:1073741824,query:{_token:t.data("token")}});s.assignBrowse(t.find(".imageBrowse"),!1,!0),s.on("filesSubmitted",function(e){s.upload()}),s.on("fileSuccess",function(e,a){s.removeFile(e),i.html(""),n.removeClass("has-error");var t=$.parseJSON(a);c.attr("src",t.url),l.find("span").text(t.value),r.val(t.value),o.addClass("hidden"),l.removeClass("hidden")}),s.on("fileError",function(e,a){s.removeFile(e);var t=$.parseJSON(a),o="";$.each(t,function(e,a){o+='
'+a+"
"}),i.html(o),n.addClass("has-error")}),t.find(".imageRemove").click(function(){r.val(""),o.removeClass("hidden"),l.addClass("hidden")})})}),$(function(){$(".imageUploadMultiple").each(function(e,a){var t=$(a),n=t.closest(".form-group"),i=t.find(".form-group"),o=t.find(".errors"),l=t.find(".imageValue"),c=new Flow({target:t.data("target"),testChunks:!1,chunkSize:1073741824,query:{_token:t.data("token")}}),r=function(){var e=[];t.find("img[data-value]").each(function(){e.push($(this).data("value"))}),l.val(e.join(","))};c.assignBrowse(t.find(".imageBrowse")),c.on("filesSubmitted",function(e){c.upload()}),c.on("fileSuccess",function(e,a){c.removeFile(e),o.html(""),n.removeClass("has-error");var t=$.parseJSON(a);i.append(''),r()}),c.on("fileError",function(e,a){c.removeFile(e);var t=$.parseJSON(a),i="";$.each(t,function(e,a){i+=''+a+"
"}),o.html(i),n.addClass("has-error")}),t.on("click",".imageRemove",function(e){e.preventDefault(),$(this).closest(".imageThumbnail").remove(),r()}),i.sortable({onUpdate:function(){r()}})})}),$(function(){$.ajaxSetup({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")}}),Admin.Components.init(),Admin.Controllers.call()});
\ No newline at end of file
+window.columnFilters={},window.columnFilters.range=function(e,a){var t=$(e),n=t.find("input"),i=n.filter(":first"),o=n.filter(":last"),l=t.closest("td").data("index");i.data("ajax-data-name","from"),o.data("ajax-data-name","to"),$.fn.dataTable.ext.search.push(function(e,t,n){if(a.settings()[0].sTableId!=e.sTableId)return!0;var c=a.data()[n][l];c&&void 0!==c["@data-order"]&&(c=c["@data-order"]);var r=i.val(),s=o.val();return i.closest(".input-date").length>0&&o.closest(".input-date").length>0?(r=""!=r?i.closest(".input-date").data("DateTimePicker").date():Number.NEGATIVE_INFINITY,s=""!=s?o.closest(".input-date").data("DateTimePicker").date():Number.POSITIVE_INFINITY,c=moment(c)):(c=parseInt(c),r=""!=r?parseInt(r):Number.NEGATIVE_INFINITY,s=""!=s?parseInt(s):Number.POSITIVE_INFINITY),c>=r&&s>=c}),n.on("keyup change",function(){a.draw()})},window.columnFilters.select=function(e,a){var t=$(e),n=t.closest("td").data("index");t.on("change",function(){a.column(n).search(t.val()).draw()})},window.columnFilters.text=function(e,a){var t=$(e),n=t.closest("td").data("index");t.on("keyup change",function(){a.column(n).search(t.val()).draw()})},$(function(){$(".adminCheckboxAll").change(function(){var e=$(this).is(":checked");$(".adminCheckboxRow").prop("checked",e).filter(":first").change()}),$(document).delegate(".adminCheckboxRow","change",function(){var e=[];$(".adminCheckboxRow:checked").each(function(){e.push($(this).val())}),$(".tableActions .btnAction").each(function(){var a=$(this),t=a.data("href")+e.join(",");a.attr("href",t)})})}),$(function(){$(document).delegate(".btn-delete","click",function(e){e.preventDefault();var a=$(this).closest("form");bootbox.confirm(window.Admin.Settings.lang.table["delete-confirm"],function(e){e&&a.submit()})}),bootbox.setDefaults("locale",window.Admin.Settings.locale)}),$(function(){$(document).delegate('*[data-toggle="lightbox"]',"click",function(e){e.preventDefault(),$(this).ekkoLightbox({always_show_close:!1})})}),$(function(){$(".input-date").each(function(){var e=$(this);e.datetimepicker({locale:window.Admin.Settings.locale}).trigger("dp.change").on("dp.change",function(){e.change()})})}),$(function(){$(".input-select").select2()}),$(function(){$(".imageUpload").each(function(e,a){var t=$(a),n=t.closest(".form-group"),i=t.find(".errors"),o=t.find(".no-value"),l=t.find(".has-value"),c=t.find(".thumbnail img.has-value"),r=t.find(".imageValue"),s=new Flow({target:t.data("target"),testChunks:!1,chunkSize:1073741824,query:{_token:t.data("token")}});s.assignBrowse(t.find(".imageBrowse"),!1,!0),s.on("filesSubmitted",function(e){s.upload()}),s.on("fileSuccess",function(e,a){s.removeFile(e),i.html(""),n.removeClass("has-error");var t=$.parseJSON(a);c.attr("src",t.url),l.find("span").text(t.value),r.val(t.value),o.addClass("hidden"),l.removeClass("hidden")}),s.on("fileError",function(e,a){s.removeFile(e);var t=$.parseJSON(a),o="";$.each(t,function(e,a){o+=''+a+"
"}),i.html(o),n.addClass("has-error")}),t.find(".imageRemove").click(function(){r.val(""),o.removeClass("hidden"),l.addClass("hidden")})})}),$(function(){$(".imageUploadMultiple").each(function(e,a){var t=$(a),n=t.closest(".form-group"),i=t.find(".form-group"),o=t.find(".errors"),l=t.find(".imageValue"),c=new Flow({target:t.data("target"),testChunks:!1,chunkSize:1073741824,query:{_token:t.data("token")}}),r=function(){var e=[];t.find("img[data-value]").each(function(){e.push($(this).data("value"))}),l.val(e.join(","))};c.assignBrowse(t.find(".imageBrowse")),c.on("filesSubmitted",function(e){c.upload()}),c.on("fileSuccess",function(e,a){c.removeFile(e),o.html(""),n.removeClass("has-error");var t=$.parseJSON(a);i.append(''),r()}),c.on("fileError",function(e,a){c.removeFile(e);var t=$.parseJSON(a),i="";$.each(t,function(e,a){i+=''+a+"
"}),o.html(i),n.addClass("has-error")}),t.on("click",".imageRemove",function(e){e.preventDefault(),$(this).closest(".imageThumbnail").remove(),r()}),i.sortable({onUpdate:function(){r()}})})}),$(function(){$.ajaxSetup({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")}}),$('form[data-type="display-actions"]').on("submit",function(e){$(e.target.action),e.preventDefault()}),$(".inline-editable").editable(),Admin.Components.init(),Admin.Controllers.call()});
\ No newline at end of file
diff --git a/public/default/js/libraries.js b/public/default/js/libraries.js
index 6e8e25d56..3da9962df 100644
--- a/public/default/js/libraries.js
+++ b/public/default/js/libraries.js
@@ -1,12 +1,14 @@
-if(!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=!!e&&"length"in e&&e.length,n=re.type(e);return"function"===n||re.isWindow(e)?!1:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function i(e,t,n){if(re.isFunction(t))return re.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return re.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(pe.test(t))return re.filter(t,e,n);t=re.filter(t,e)}return re.grep(e,function(e){return Z.call(t,e)>-1!==n})}function a(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function r(e){var t={};return re.each(e.match(ve)||[],function(e,n){t[n]=!0}),t}function o(){G.removeEventListener("DOMContentLoaded",o),e.removeEventListener("load",o),re.ready()}function s(){this.expando=re.expando+s.uid++}function d(e,t,n){var i;if(void 0===n&&1===e.nodeType)if(i="data-"+t.replace(xe,"-$&").toLowerCase(),n=e.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:De.test(n)?re.parseJSON(n):n}catch(a){}Te.set(e,t,n)}else n=void 0;return n}function l(e,t,n,i){var a,r=1,o=20,s=i?function(){return i.cur()}:function(){return re.css(e,t,"")},d=s(),l=n&&n[3]||(re.cssNumber[t]?"":"px"),u=(re.cssNumber[t]||"px"!==l&&+d)&&He.exec(re.css(e,t));if(u&&u[3]!==l){l=l||u[3],n=n||[],u=+d||1;do r=r||".5",u/=r,re.style(e,t,u+l);while(r!==(r=s()/d)&&1!==r&&--o)}return n&&(u=+u||+d||0,a=n[1]?u+(n[1]+1)*n[2]:+n[2],i&&(i.unit=l,i.start=u,i.end=a)),a}function u(e,t){var n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&re.nodeName(e,t)?re.merge([e],n):n}function c(e,t){for(var n=0,i=e.length;i>n;n++)ke.set(e[n],"globalEval",!t||ke.get(t[n],"globalEval"))}function h(e,t,n,i,a){for(var r,o,s,d,l,h,m=t.createDocumentFragment(),_=[],p=0,f=e.length;f>p;p++)if(r=e[p],r||0===r)if("object"===re.type(r))re.merge(_,r.nodeType?[r]:r);else if(We.test(r)){for(o=o||m.appendChild(t.createElement("div")),s=(Ee.exec(r)||["",""])[1].toLowerCase(),d=Fe[s]||Fe._default,o.innerHTML=d[1]+re.htmlPrefilter(r)+d[2],h=d[0];h--;)o=o.lastChild;re.merge(_,o.childNodes),o=m.firstChild,o.textContent=""}else _.push(t.createTextNode(r));for(m.textContent="",p=0;r=_[p++];)if(i&&re.inArray(r,i)>-1)a&&a.push(r);else if(l=re.contains(r.ownerDocument,r),o=u(m.appendChild(r),"script"),l&&c(o),n)for(h=0;r=o[h++];)Oe.test(r.type||"")&&n.push(r);return m}function m(){return!0}function _(){return!1}function p(){try{return G.activeElement}catch(e){}}function f(e,t,n,i,a,r){var o,s;if("object"==typeof t){"string"!=typeof n&&(i=i||n,n=void 0);for(s in t)f(e,s,n,i,t[s],r);return e}if(null==i&&null==a?(a=n,i=n=void 0):null==a&&("string"==typeof n?(a=i,i=void 0):(a=i,i=n,n=void 0)),a===!1)a=_;else if(!a)return this;return 1===r&&(o=a,a=function(e){return re().off(e),o.apply(this,arguments)},a.guid=o.guid||(o.guid=re.guid++)),e.each(function(){re.event.add(this,t,a,i,n)})}function y(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function g(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function M(e){var t=qe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function L(e,t){var n,i,a,r,o,s,d,l;if(1===t.nodeType){if(ke.hasData(e)&&(r=ke.access(e),o=ke.set(t,r),l=r.events)){delete o.handle,o.events={};for(a in l)for(n=0,i=l[a].length;i>n;n++)re.event.add(t,a,l[a][n])}Te.hasData(e)&&(s=Te.access(e),d=re.extend({},s),Te.set(t,d))}}function v(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ae.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function b(e,t,n,i){t=Q.apply([],t);var a,r,o,s,d,l,c=0,m=e.length,_=m-1,p=t[0],f=re.isFunction(p);if(f||m>1&&"string"==typeof p&&!ie.checkClone&&ze.test(p))return e.each(function(a){var r=e.eq(a);f&&(t[0]=p.call(this,a,r.html())),b(r,t,n,i)});if(m&&(a=h(t,e[0].ownerDocument,!1,e,i),r=a.firstChild,1===a.childNodes.length&&(a=r),r||i)){for(o=re.map(u(a,"script"),g),s=o.length;m>c;c++)d=a,c!==_&&(d=re.clone(d,!0,!0),s&&re.merge(o,u(d,"script"))),n.call(e[c],d,c);if(s)for(l=o[o.length-1].ownerDocument,re.map(o,M),c=0;s>c;c++)d=o[c],Oe.test(d.type||"")&&!ke.access(d,"globalEval")&&re.contains(l,d)&&(d.src?re._evalUrl&&re._evalUrl(d.src):re.globalEval(d.textContent.replace(Je,"")))}return e}function Y(e,t,n){for(var i,a=t?re.filter(t,e):e,r=0;null!=(i=a[r]);r++)n||1!==i.nodeType||re.cleanData(u(i)),i.parentNode&&(n&&re.contains(i.ownerDocument,i)&&c(u(i,"script")),i.parentNode.removeChild(i));return e}function w(e,t){var n=re(t.createElement(e)).appendTo(t.body),i=re.css(n[0],"display");return n.detach(),i}function k(e){var t=G,n=Be[e];return n||(n=w(e,t),"none"!==n&&n||(Ue=(Ue||re("")).appendTo(t.documentElement),t=Ue[0].contentDocument,t.write(),t.close(),n=w(e,t),Ue.detach()),Be[e]=n),n}function T(e,t,n){var i,a,r,o,s=e.style;return n=n||Ve(e),n&&(o=n.getPropertyValue(t)||n[t],""!==o||re.contains(e.ownerDocument,e)||(o=re.style(e,t)),!ie.pixelMarginRight()&&Ge.test(o)&&Ke.test(t)&&(i=s.width,a=s.minWidth,r=s.maxWidth,s.minWidth=s.maxWidth=s.width=o,o=n.width,s.width=i,s.minWidth=a,s.maxWidth=r)),void 0!==o?o+"":o}function D(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function x(e){if(e in it)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=nt.length;n--;)if(e=nt[n]+t,e in it)return e}function S(e,t,n){var i=He.exec(t);return i?Math.max(0,i[2]-(n||0))+(i[3]||"px"):t}function H(e,t,n,i,a){for(var r=n===(i?"border":"content")?4:"width"===t?1:0,o=0;4>r;r+=2)"margin"===n&&(o+=re.css(e,n+je[r],!0,a)),i?("content"===n&&(o-=re.css(e,"padding"+je[r],!0,a)),"margin"!==n&&(o-=re.css(e,"border"+je[r]+"Width",!0,a))):(o+=re.css(e,"padding"+je[r],!0,a),"padding"!==n&&(o+=re.css(e,"border"+je[r]+"Width",!0,a)));return o}function j(t,n,i){var a=!0,r="width"===n?t.offsetWidth:t.offsetHeight,o=Ve(t),s="border-box"===re.css(t,"boxSizing",!1,o);if(G.msFullscreenElement&&e.top!==e&&t.getClientRects().length&&(r=Math.round(100*t.getBoundingClientRect()[n])),0>=r||null==r){if(r=T(t,n,o),(0>r||null==r)&&(r=t.style[n]),Ge.test(r))return r;a=s&&(ie.boxSizingReliable()||r===t.style[n]),r=parseFloat(r)||0}return r+H(t,n,i||(s?"border":"content"),a,o)+"px"}function C(e,t){for(var n,i,a,r=[],o=0,s=e.length;s>o;o++)i=e[o],i.style&&(r[o]=ke.get(i,"olddisplay"),n=i.style.display,t?(r[o]||"none"!==n||(i.style.display=""),""===i.style.display&&Ce(i)&&(r[o]=ke.access(i,"olddisplay",k(i.nodeName)))):(a=Ce(i),"none"===n&&a||ke.set(i,"olddisplay",a?n:re.css(i,"display"))));for(o=0;s>o;o++)i=e[o],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?r[o]||"":"none"));return e}function A(e,t,n,i,a){return new A.prototype.init(e,t,n,i,a)}function E(){return e.setTimeout(function(){at=void 0}),at=re.now()}function O(e,t){var n,i=0,a={height:e};for(t=t?1:0;4>i;i+=2-t)n=je[i],a["margin"+n]=a["padding"+n]=e;return t&&(a.opacity=a.width=e),a}function F(e,t,n){for(var i,a=($.tweeners[t]||[]).concat($.tweeners["*"]),r=0,o=a.length;o>r;r++)if(i=a[r].call(n,t,e))return i}function W(e,t,n){var i,a,r,o,s,d,l,u,c=this,h={},m=e.style,_=e.nodeType&&Ce(e),p=ke.get(e,"fxshow");n.queue||(s=re._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,d=s.empty.fire,s.empty.fire=function(){s.unqueued||d()}),s.unqueued++,c.always(function(){c.always(function(){s.unqueued--,re.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[m.overflow,m.overflowX,m.overflowY],l=re.css(e,"display"),u="none"===l?ke.get(e,"olddisplay")||k(e.nodeName):l,"inline"===u&&"none"===re.css(e,"float")&&(m.display="inline-block")),n.overflow&&(m.overflow="hidden",c.always(function(){m.overflow=n.overflow[0],m.overflowX=n.overflow[1],m.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],ot.exec(a)){if(delete t[i],r=r||"toggle"===a,a===(_?"hide":"show")){if("show"!==a||!p||void 0===p[i])continue;_=!0}h[i]=p&&p[i]||re.style(e,i)}else l=void 0;if(re.isEmptyObject(h))"inline"===("none"===l?k(e.nodeName):l)&&(m.display=l);else{p?"hidden"in p&&(_=p.hidden):p=ke.access(e,"fxshow",{}),r&&(p.hidden=!_),_?re(e).show():c.done(function(){re(e).hide()}),c.done(function(){var t;ke.remove(e,"fxshow");for(t in h)re.style(e,t,h[t])});for(i in h)o=F(_?p[i]:0,i,c),i in p||(p[i]=o.start,_&&(o.end=o.start,o.start="width"===i||"height"===i?1:0))}}function N(e,t){var n,i,a,r,o;for(n in e)if(i=re.camelCase(n),a=t[i],r=e[n],re.isArray(r)&&(a=r[1],r=e[n]=r[0]),n!==i&&(e[i]=r,delete e[n]),o=re.cssHooks[i],o&&"expand"in o){r=o.expand(r),delete e[i];for(n in r)n in e||(e[n]=r[n],t[n]=a)}else t[i]=a}function $(e,t,n){var i,a,r=0,o=$.prefilters.length,s=re.Deferred().always(function(){delete d.elem}),d=function(){if(a)return!1;for(var t=at||E(),n=Math.max(0,l.startTime+l.duration-t),i=n/l.duration||0,r=1-i,o=0,d=l.tweens.length;d>o;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),1>r&&d?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:re.extend({},t),opts:re.extend(!0,{specialEasing:{},easing:re.easing._default},n),originalProperties:t,originalOptions:n,startTime:at||E(),duration:n.duration,tweens:[],createTween:function(t,n){var i=re.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(i),i},stop:function(t){var n=0,i=t?l.tweens.length:0;if(a)return this;for(a=!0;i>n;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),u=l.props;for(N(u,l.opts.specialEasing);o>r;r++)if(i=$.prefilters[r].call(l,e,u,l.opts))return re.isFunction(i.stop)&&(re._queueHooks(l.elem,l.opts.queue).stop=re.proxy(i.stop,i)),i;return re.map(u,F,l),re.isFunction(l.opts.start)&&l.opts.start.call(e,l),re.fx.timer(re.extend(d,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function P(e){return e.getAttribute&&e.getAttribute("class")||""}function R(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,a=0,r=t.toLowerCase().match(ve)||[];if(re.isFunction(n))for(;i=r[a++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function I(e,t,n,i){function a(s){var d;return r[s]=!0,re.each(e[s]||[],function(e,s){var l=s(t,n,i);return"string"!=typeof l||o||r[l]?o?!(d=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),d}var r={},o=e===kt;return a(t.dataTypes[0])||!r["*"]&&a("*")}function z(e,t){var n,i,a=re.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((a[n]?e:i||(i={}))[n]=t[n]);return i&&re.extend(!0,e,i),e}function q(e,t,n){for(var i,a,r,o,s=e.contents,d=e.dataTypes;"*"===d[0];)d.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(a in s)if(s[a]&&s[a].test(i)){d.unshift(a);break}if(d[0]in n)r=d[0];else{for(a in n){if(!d[0]||e.converters[a+" "+d[0]]){r=a;break}o||(o=a)}r=r||o}return r?(r!==d[0]&&d.unshift(r),n[r]):void 0}function J(e,t,n,i){var a,r,o,s,d,l={},u=e.dataTypes.slice();if(u[1])for(o in e.converters)l[o.toLowerCase()]=e.converters[o];for(r=u.shift();r;)if(e.responseFields[r]&&(n[e.responseFields[r]]=t),!d&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),d=r,r=u.shift())if("*"===r)r=d;else if("*"!==d&&d!==r){if(o=l[d+" "+r]||l["* "+r],!o)for(a in l)if(s=a.split(" "),s[1]===r&&(o=l[d+" "+s[0]]||l["* "+s[0]])){o===!0?o=l[a]:l[a]!==!0&&(r=s[0],u.unshift(s[1]));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+d+" to "+r}}}return{state:"success",data:t}}function U(e,t,n,i){var a;if(re.isArray(t))re.each(t,function(t,a){n||St.test(e)?i(e,a):U(e+"["+("object"==typeof a&&null!=a?t:"")+"]",a,n,i)});else if(n||"object"!==re.type(t))i(e,t);else for(a in t)U(e+"["+a+"]",t[a],n,i)}function B(e){return re.isWindow(e)?e:9===e.nodeType&&e.defaultView}var K=[],G=e.document,V=K.slice,Q=K.concat,X=K.push,Z=K.indexOf,ee={},te=ee.toString,ne=ee.hasOwnProperty,ie={},ae="2.2.0",re=function(e,t){return new re.fn.init(e,t)},oe=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,se=/^-ms-/,de=/-([\da-z])/gi,le=function(e,t){return t.toUpperCase()};re.fn=re.prototype={jquery:ae,constructor:re,selector:"",length:0,toArray:function(){return V.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:V.call(this)},pushStack:function(e){var t=re.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return re.each(this,e)},map:function(e){return this.pushStack(re.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(V.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:X,sort:K.sort,splice:K.splice},re.extend=re.fn.extend=function(){var e,t,n,i,a,r,o=arguments[0]||{},s=1,d=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[s]||{},s++),"object"==typeof o||re.isFunction(o)||(o={}),s===d&&(o=this,s--);d>s;s++)if(null!=(e=arguments[s]))for(t in e)n=o[t],i=e[t],o!==i&&(l&&i&&(re.isPlainObject(i)||(a=re.isArray(i)))?(a?(a=!1,r=n&&re.isArray(n)?n:[]):r=n&&re.isPlainObject(n)?n:{},o[t]=re.extend(l,r,i)):void 0!==i&&(o[t]=i));return o},re.extend({expando:"jQuery"+(ae+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===re.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){var t=e&&e.toString();return!re.isArray(e)&&t-parseFloat(t)+1>=0},isPlainObject:function(e){return"object"!==re.type(e)||e.nodeType||re.isWindow(e)?!1:e.constructor&&!ne.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ee[te.call(e)]||"object":typeof e},globalEval:function(e){var t,n=eval;e=re.trim(e),e&&(1===e.indexOf("use strict")?(t=G.createElement("script"),t.text=e,G.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(se,"ms-").replace(de,le)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var i,a=0;if(n(e))for(i=e.length;i>a&&t.call(e[a],a,e[a])!==!1;a++);else for(a in e)if(t.call(e[a],a,e[a])===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(oe,"")},makeArray:function(e,t){var i=t||[];return null!=e&&(n(Object(e))?re.merge(i,"string"==typeof e?[e]:e):X.call(i,e)),i},inArray:function(e,t,n){return null==t?-1:Z.call(t,e,n)},merge:function(e,t){for(var n=+t.length,i=0,a=e.length;n>i;i++)e[a++]=t[i];return e.length=a,e},grep:function(e,t,n){for(var i,a=[],r=0,o=e.length,s=!n;o>r;r++)i=!t(e[r],r),i!==s&&a.push(e[r]);return a},map:function(e,t,i){var a,r,o=0,s=[];if(n(e))for(a=e.length;a>o;o++)r=t(e[o],o,i),null!=r&&s.push(r);else for(o in e)r=t(e[o],o,i),null!=r&&s.push(r);return Q.apply([],s)},guid:1,proxy:function(e,t){var n,i,a;return"string"==typeof t&&(n=e[t],t=e,e=n),re.isFunction(e)?(i=V.call(arguments,2),a=function(){return e.apply(t||this,i.concat(V.call(arguments)))},a.guid=e.guid=e.guid||re.guid++,a):void 0},now:Date.now,support:ie}),"function"==typeof Symbol&&(re.fn[Symbol.iterator]=K[Symbol.iterator]),re.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){ee["[object "+t+"]"]=t.toLowerCase()});var ue=function(e){function t(e,t,n,i){var a,r,o,s,d,l,c,m,_=t&&t.ownerDocument,p=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==p&&9!==p&&11!==p)return n;if(!i&&((t?t.ownerDocument||t:P)!==C&&j(t),t=t||C,E)){if(11!==p&&(l=ye.exec(e)))if(a=l[1]){if(9===p){if(!(o=t.getElementById(a)))return n;if(o.id===a)return n.push(o),n}else if(_&&(o=_.getElementById(a))&&N(t,o)&&o.id===a)return n.push(o),n}else{if(l[2])return X.apply(n,t.getElementsByTagName(e)),n;if((a=l[3])&&v.getElementsByClassName&&t.getElementsByClassName)return X.apply(n,t.getElementsByClassName(a)),n}if(v.qsa&&!J[e+" "]&&(!O||!O.test(e))){if(1!==p)_=t,m=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(Me,"\\$&"):t.setAttribute("id",s=$),c=k(e),r=c.length,d=he.test(s)?"#"+s:"[id='"+s+"']";r--;)c[r]=d+" "+h(c[r]);m=c.join(","),_=ge.test(e)&&u(t.parentNode)||t}if(m)try{return X.apply(n,_.querySelectorAll(m)),n}catch(f){}finally{s===$&&t.removeAttribute("id")}}}return D(e.replace(se,"$1"),t,n,i)}function n(){function e(n,i){return t.push(n+" ")>b.cacheLength&&delete e[t.shift()],e[n+" "]=i}var t=[];return e}function i(e){return e[$]=!0,e}function a(e){var t=C.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function r(e,t){for(var n=e.split("|"),i=n.length;i--;)b.attrHandle[n[i]]=t}function o(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||B)-(~e.sourceIndex||B);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function d(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return i(function(t){return t=+t,i(function(n,i){for(var a,r=e([],n.length,t),o=r.length;o--;)n[a=r[o]]&&(n[a]=!(i[a]=n[a]))})})}function u(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function c(){}function h(e){for(var t=0,n=e.length,i="";n>t;t++)i+=e[t].value;return i}function m(e,t,n){var i=t.dir,a=n&&"parentNode"===i,r=I++;return t.first?function(t,n,r){for(;t=t[i];)if(1===t.nodeType||a)return e(t,n,r)}:function(t,n,o){var s,d,l,u=[R,r];if(o){for(;t=t[i];)if((1===t.nodeType||a)&&e(t,n,o))return!0}else for(;t=t[i];)if(1===t.nodeType||a){if(l=t[$]||(t[$]={}),d=l[t.uniqueID]||(l[t.uniqueID]={}),(s=d[i])&&s[0]===R&&s[1]===r)return u[2]=s[2];if(d[i]=u,u[2]=e(t,n,o))return!0}}}function _(e){return e.length>1?function(t,n,i){for(var a=e.length;a--;)if(!e[a](t,n,i))return!1;return!0}:e[0]}function p(e,n,i){for(var a=0,r=n.length;r>a;a++)t(e,n[a],i);return i}function f(e,t,n,i,a){for(var r,o=[],s=0,d=e.length,l=null!=t;d>s;s++)(r=e[s])&&(!n||n(r,i,a))&&(o.push(r),l&&t.push(s));return o}function y(e,t,n,a,r,o){return a&&!a[$]&&(a=y(a)),r&&!r[$]&&(r=y(r,o)),i(function(i,o,s,d){var l,u,c,h=[],m=[],_=o.length,y=i||p(t||"*",s.nodeType?[s]:s,[]),g=!e||!i&&t?y:f(y,h,e,s,d),M=n?r||(i?e:_||a)?[]:o:g;if(n&&n(g,M,s,d),a)for(l=f(M,m),a(l,[],s,d),u=l.length;u--;)(c=l[u])&&(M[m[u]]=!(g[m[u]]=c));if(i){if(r||e){if(r){for(l=[],u=M.length;u--;)(c=M[u])&&l.push(g[u]=c);r(null,M=[],l,d)}for(u=M.length;u--;)(c=M[u])&&(l=r?ee(i,c):h[u])>-1&&(i[l]=!(o[l]=c))}}else M=f(M===o?M.splice(_,M.length):M),r?r(null,o,M,d):X.apply(o,M)})}function g(e){for(var t,n,i,a=e.length,r=b.relative[e[0].type],o=r||b.relative[" "],s=r?1:0,d=m(function(e){return e===t},o,!0),l=m(function(e){return ee(t,e)>-1},o,!0),u=[function(e,n,i){var a=!r&&(i||n!==x)||((t=n).nodeType?d(e,n,i):l(e,n,i));return t=null,a}];a>s;s++)if(n=b.relative[e[s].type])u=[m(_(u),n)];else{if(n=b.filter[e[s].type].apply(null,e[s].matches),n[$]){for(i=++s;a>i&&!b.relative[e[i].type];i++);return y(s>1&&_(u),s>1&&h(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,i>s&&g(e.slice(s,i)),a>i&&g(e=e.slice(i)),a>i&&h(e))}u.push(n)}return _(u)}function M(e,n){var a=n.length>0,r=e.length>0,o=function(i,o,s,d,l){var u,c,h,m=0,_="0",p=i&&[],y=[],g=x,M=i||r&&b.find.TAG("*",l),L=R+=null==g?1:Math.random()||.1,v=M.length;for(l&&(x=o===C||o||l);_!==v&&null!=(u=M[_]);_++){if(r&&u){for(c=0,o||u.ownerDocument===C||(j(u),s=!E);h=e[c++];)if(h(u,o||C,s)){d.push(u);break}l&&(R=L)}a&&((u=!h&&u)&&m--,i&&p.push(u))}if(m+=_,a&&_!==m){for(c=0;h=n[c++];)h(p,y,o,s);if(i){if(m>0)for(;_--;)p[_]||y[_]||(y[_]=V.call(d));y=f(y)}X.apply(d,y),l&&!i&&y.length>0&&m+n.length>1&&t.uniqueSort(d)}return l&&(R=L,x=g),p};return a?i(o):o}var L,v,b,Y,w,k,T,D,x,S,H,j,C,A,E,O,F,W,N,$="sizzle"+1*new Date,P=e.document,R=0,I=0,z=n(),q=n(),J=n(),U=function(e,t){return e===t&&(H=!0),0},B=1<<31,K={}.hasOwnProperty,G=[],V=G.pop,Q=G.push,X=G.push,Z=G.slice,ee=function(e,t){for(var n=0,i=e.length;i>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",ie="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ae="\\["+ne+"*("+ie+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ie+"))|)"+ne+"*\\]",re=":("+ie+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ae+")*)|.*)\\)|)",oe=new RegExp(ne+"+","g"),se=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),de=new RegExp("^"+ne+"*,"+ne+"*"),le=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),ue=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),ce=new RegExp(re),he=new RegExp("^"+ie+"$"),me={ID:new RegExp("^#("+ie+")"),CLASS:new RegExp("^\\.("+ie+")"),TAG:new RegExp("^("+ie+"|[*])"),ATTR:new RegExp("^"+ae),PSEUDO:new RegExp("^"+re),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},_e=/^(?:input|select|textarea|button)$/i,pe=/^h\d$/i,fe=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ge=/[+~]/,Me=/'|\\/g,Le=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),ve=function(e,t,n){var i="0x"+t-65536;return i!==i||n?t:0>i?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},be=function(){j()};try{X.apply(G=Z.call(P.childNodes),P.childNodes),G[P.childNodes.length].nodeType}catch(Ye){X={apply:G.length?function(e,t){Q.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}v=t.support={},w=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},j=t.setDocument=function(e){var t,n,i=e?e.ownerDocument||e:P;return i!==C&&9===i.nodeType&&i.documentElement?(C=i,A=C.documentElement,E=!w(C),(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",be,!1):n.attachEvent&&n.attachEvent("onunload",be)),v.attributes=a(function(e){return e.className="i",!e.getAttribute("className")}),v.getElementsByTagName=a(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),v.getElementsByClassName=fe.test(C.getElementsByClassName),v.getById=a(function(e){return A.appendChild(e).id=$,!C.getElementsByName||!C.getElementsByName($).length}),v.getById?(b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}},b.filter.ID=function(e){var t=e.replace(Le,ve);return function(e){return e.getAttribute("id")===t}}):(delete b.find.ID,b.filter.ID=function(e){var t=e.replace(Le,ve);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),b.find.TAG=v.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):v.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],a=0,r=t.getElementsByTagName(e);if("*"===e){for(;n=r[a++];)1===n.nodeType&&i.push(n);return i}return r},b.find.CLASS=v.getElementsByClassName&&function(e,t){return"undefined"!=typeof t.getElementsByClassName&&E?t.getElementsByClassName(e):void 0},F=[],O=[],(v.qsa=fe.test(C.querySelectorAll))&&(a(function(e){A.appendChild(e).innerHTML=" ",e.querySelectorAll("[msallowcapture^='']").length&&O.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||O.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+$+"-]").length||O.push("~="),e.querySelectorAll(":checked").length||O.push(":checked"),e.querySelectorAll("a#"+$+"+*").length||O.push(".#.+[+~]")}),a(function(e){var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&O.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||O.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),O.push(",.*:")})),(v.matchesSelector=fe.test(W=A.matches||A.webkitMatchesSelector||A.mozMatchesSelector||A.oMatchesSelector||A.msMatchesSelector))&&a(function(e){v.disconnectedMatch=W.call(e,"div"),W.call(e,"[s!='']:x"),F.push("!=",re)}),O=O.length&&new RegExp(O.join("|")),F=F.length&&new RegExp(F.join("|")),t=fe.test(A.compareDocumentPosition),N=t||fe.test(A.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return H=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!v.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===P&&N(P,e)?-1:t===C||t.ownerDocument===P&&N(P,t)?1:S?ee(S,e)-ee(S,t):0:4&n?-1:1)}:function(e,t){if(e===t)return H=!0,0;var n,i=0,a=e.parentNode,r=t.parentNode,s=[e],d=[t];if(!a||!r)return e===C?-1:t===C?1:a?-1:r?1:S?ee(S,e)-ee(S,t):0;if(a===r)return o(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)d.unshift(n);for(;s[i]===d[i];)i++;return i?o(s[i],d[i]):s[i]===P?-1:d[i]===P?1:0},C):C},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==C&&j(e),n=n.replace(ue,"='$1']"),v.matchesSelector&&E&&!J[n+" "]&&(!F||!F.test(n))&&(!O||!O.test(n)))try{var i=W.call(e,n);if(i||v.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(a){}return t(n,C,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==C&&j(e),N(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==C&&j(e);var n=b.attrHandle[t.toLowerCase()],i=n&&K.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==i?i:v.attributes||!E?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],i=0,a=0;if(H=!v.detectDuplicates,S=!v.sortStable&&e.slice(0),e.sort(U),H){for(;t=e[a++];)t===e[a]&&(i=n.push(a));for(;i--;)e.splice(n[i],1)}return S=null,e},Y=t.getText=function(e){var t,n="",i=0,a=e.nodeType;if(a){if(1===a||9===a||11===a){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=Y(e)}else if(3===a||4===a)return e.nodeValue}else for(;t=e[i++];)n+=Y(t);return n},b=t.selectors={cacheLength:50,createPseudo:i,match:me,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Le,ve),e[3]=(e[3]||e[4]||e[5]||"").replace(Le,ve),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return me.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&ce.test(n)&&(t=k(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Le,ve).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=z[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&z(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,i){return function(a){var r=t.attr(a,e);return null==r?"!="===n:n?(r+="","="===n?r===i:"!="===n?r!==i:"^="===n?i&&0===r.indexOf(i):"*="===n?i&&r.indexOf(i)>-1:"$="===n?i&&r.slice(-i.length)===i:"~="===n?(" "+r.replace(oe," ")+" ").indexOf(i)>-1:"|="===n?r===i||r.slice(0,i.length+1)===i+"-":!1):!0}},CHILD:function(e,t,n,i,a){var r="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===i&&0===a?function(e){return!!e.parentNode}:function(t,n,d){var l,u,c,h,m,_,p=r!==o?"nextSibling":"previousSibling",f=t.parentNode,y=s&&t.nodeName.toLowerCase(),g=!d&&!s,M=!1;if(f){if(r){for(;p;){for(h=t;h=h[p];)if(s?h.nodeName.toLowerCase()===y:1===h.nodeType)return!1;_=p="only"===e&&!_&&"nextSibling"}return!0}if(_=[o?f.firstChild:f.lastChild],o&&g){for(h=f,c=h[$]||(h[$]={}),u=c[h.uniqueID]||(c[h.uniqueID]={}),l=u[e]||[],m=l[0]===R&&l[1],M=m&&l[2],h=m&&f.childNodes[m];h=++m&&h&&h[p]||(M=m=0)||_.pop();)if(1===h.nodeType&&++M&&h===t){u[e]=[R,m,M];break}}else if(g&&(h=t,c=h[$]||(h[$]={}),u=c[h.uniqueID]||(c[h.uniqueID]={}),l=u[e]||[],m=l[0]===R&&l[1],M=m),M===!1)for(;(h=++m&&h&&h[p]||(M=m=0)||_.pop())&&((s?h.nodeName.toLowerCase()!==y:1!==h.nodeType)||!++M||(g&&(c=h[$]||(h[$]={}),u=c[h.uniqueID]||(c[h.uniqueID]={}),u[e]=[R,M]),h!==t)););return M-=a,M===i||M%i===0&&M/i>=0}}},PSEUDO:function(e,n){var a,r=b.pseudos[e]||b.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return r[$]?r(n):r.length>1?(a=[e,e,"",n],b.setFilters.hasOwnProperty(e.toLowerCase())?i(function(e,t){for(var i,a=r(e,n),o=a.length;o--;)i=ee(e,a[o]),e[i]=!(t[i]=a[o])}):function(e){return r(e,0,a)}):r}},pseudos:{not:i(function(e){var t=[],n=[],a=T(e.replace(se,"$1"));return a[$]?i(function(e,t,n,i){for(var r,o=a(e,null,i,[]),s=e.length;s--;)(r=o[s])&&(e[s]=!(t[s]=r))}):function(e,i,r){return t[0]=e,a(t,null,r,n),t[0]=null,!n.pop()}}),has:i(function(e){return function(n){return t(e,n).length>0}}),contains:i(function(e){return e=e.replace(Le,ve),function(t){return(t.textContent||t.innerText||Y(t)).indexOf(e)>-1}}),lang:i(function(e){return he.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(Le,ve).toLowerCase(),function(t){var n;do if(n=E?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===A},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return pe.test(e.nodeName)},input:function(e){return _e.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[0>n?n+t:n]}),even:l(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:l(function(e,t){for(var n=1;t>n;n+=2)e.push(n);
-return e}),lt:l(function(e,t,n){for(var i=0>n?n+t:n;--i>=0;)e.push(i);return e}),gt:l(function(e,t,n){for(var i=0>n?n+t:n;++i2&&"ID"===(o=r[0]).type&&v.getById&&9===t.nodeType&&E&&b.relative[r[1].type]){if(t=(b.find.ID(o.matches[0].replace(Le,ve),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(r.shift().value.length)}for(a=me.needsContext.test(e)?0:r.length;a--&&(o=r[a],!b.relative[s=o.type]);)if((d=b.find[s])&&(i=d(o.matches[0].replace(Le,ve),ge.test(r[0].type)&&u(t.parentNode)||t))){if(r.splice(a,1),e=i.length&&h(r),!e)return X.apply(n,i),n;break}}return(l||T(e,c))(i,t,!E,n,!t||ge.test(e)&&u(t.parentNode)||t),n},v.sortStable=$.split("").sort(U).join("")===$,v.detectDuplicates=!!H,j(),v.sortDetached=a(function(e){return 1&e.compareDocumentPosition(C.createElement("div"))}),a(function(e){return e.innerHTML=" ","#"===e.firstChild.getAttribute("href")})||r("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),v.attributes&&a(function(e){return e.innerHTML=" ",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||r("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),a(function(e){return null==e.getAttribute("disabled")})||r(te,function(e,t,n){var i;return n?void 0:e[t]===!0?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null}),t}(e);re.find=ue,re.expr=ue.selectors,re.expr[":"]=re.expr.pseudos,re.uniqueSort=re.unique=ue.uniqueSort,re.text=ue.getText,re.isXMLDoc=ue.isXML,re.contains=ue.contains;var ce=function(e,t,n){for(var i=[],a=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(a&&re(e).is(n))break;i.push(e)}return i},he=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},me=re.expr.match.needsContext,_e=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,pe=/^.[^:#\[\.,]*$/;re.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?re.find.matchesSelector(i,e)?[i]:[]:re.find.matches(e,re.grep(t,function(e){return 1===e.nodeType}))},re.fn.extend({find:function(e){var t,n=this.length,i=[],a=this;if("string"!=typeof e)return this.pushStack(re(e).filter(function(){for(t=0;n>t;t++)if(re.contains(a[t],this))return!0}));for(t=0;n>t;t++)re.find(e,a[t],i);return i=this.pushStack(n>1?re.unique(i):i),i.selector=this.selector?this.selector+" "+e:e,i},filter:function(e){return this.pushStack(i(this,e||[],!1))},not:function(e){return this.pushStack(i(this,e||[],!0))},is:function(e){return!!i(this,"string"==typeof e&&me.test(e)?re(e):e||[],!1).length}});var fe,ye=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ge=re.fn.init=function(e,t,n){var i,a;if(!e)return this;if(n=n||fe,"string"==typeof e){if(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:ye.exec(e),!i||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof re?t[0]:t,re.merge(this,re.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:G,!0)),_e.test(i[1])&&re.isPlainObject(t))for(i in t)re.isFunction(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return a=G.getElementById(i[2]),a&&a.parentNode&&(this.length=1,this[0]=a),this.context=G,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):re.isFunction(e)?void 0!==n.ready?n.ready(e):e(re):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),re.makeArray(e,this))};ge.prototype=re.fn,fe=re(G);var Me=/^(?:parents|prev(?:Until|All))/,Le={children:!0,contents:!0,next:!0,prev:!0};re.fn.extend({has:function(e){var t=re(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++)if(re.contains(this,t[e]))return!0})},closest:function(e,t){for(var n,i=0,a=this.length,r=[],o=me.test(e)||"string"!=typeof e?re(e,t||this.context):0;a>i;i++)for(n=this[i];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:1===n.nodeType&&re.find.matchesSelector(n,e))){r.push(n);break}return this.pushStack(r.length>1?re.uniqueSort(r):r)},index:function(e){return e?"string"==typeof e?Z.call(re(e),this[0]):Z.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(re.uniqueSort(re.merge(this.get(),re(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),re.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return ce(e,"parentNode")},parentsUntil:function(e,t,n){return ce(e,"parentNode",n)},next:function(e){return a(e,"nextSibling")},prev:function(e){return a(e,"previousSibling")},nextAll:function(e){return ce(e,"nextSibling")},prevAll:function(e){return ce(e,"previousSibling")},nextUntil:function(e,t,n){return ce(e,"nextSibling",n)},prevUntil:function(e,t,n){return ce(e,"previousSibling",n)},siblings:function(e){return he((e.parentNode||{}).firstChild,e)},children:function(e){return he(e.firstChild)},contents:function(e){return e.contentDocument||re.merge([],e.childNodes)}},function(e,t){re.fn[e]=function(n,i){var a=re.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(a=re.filter(i,a)),this.length>1&&(Le[e]||re.uniqueSort(a),Me.test(e)&&a.reverse()),this.pushStack(a)}});var ve=/\S+/g;re.Callbacks=function(e){e="string"==typeof e?r(e):re.extend({},e);var t,n,i,a,o=[],s=[],d=-1,l=function(){for(a=e.once,i=t=!0;s.length;d=-1)for(n=s.shift();++d-1;)o.splice(n,1),d>=n&&d--}),this},has:function(e){return e?re.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return a=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return a=s=[],n||(o=n=""),this},locked:function(){return!!a},fireWith:function(e,n){return a||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},re.extend({Deferred:function(e){var t=[["resolve","done",re.Callbacks("once memory"),"resolved"],["reject","fail",re.Callbacks("once memory"),"rejected"],["notify","progress",re.Callbacks("memory")]],n="pending",i={state:function(){return n},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var e=arguments;return re.Deferred(function(n){re.each(t,function(t,r){var o=re.isFunction(e[t])&&e[t];a[r[1]](function(){var e=o&&o.apply(this,arguments);e&&re.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this===i?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?re.extend(e,i):i}},a={};return i.pipe=i.then,re.each(t,function(e,r){var o=r[2],s=r[3];i[r[1]]=o.add,s&&o.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),a[r[0]]=function(){return a[r[0]+"With"](this===a?i:this,arguments),this},a[r[0]+"With"]=o.fireWith}),i.promise(a),e&&e.call(a,a),a},when:function(e){var t,n,i,a=0,r=V.call(arguments),o=r.length,s=1!==o||e&&re.isFunction(e.promise)?o:0,d=1===s?e:re.Deferred(),l=function(e,n,i){return function(a){n[e]=this,i[e]=arguments.length>1?V.call(arguments):a,i===t?d.notifyWith(n,i):--s||d.resolveWith(n,i)}};if(o>1)for(t=new Array(o),n=new Array(o),i=new Array(o);o>a;a++)r[a]&&re.isFunction(r[a].promise)?r[a].promise().progress(l(a,n,t)).done(l(a,i,r)).fail(d.reject):--s;return s||d.resolveWith(i,r),d.promise()}});var be;re.fn.ready=function(e){return re.ready.promise().done(e),this},re.extend({isReady:!1,readyWait:1,holdReady:function(e){e?re.readyWait++:re.ready(!0)},ready:function(e){(e===!0?--re.readyWait:re.isReady)||(re.isReady=!0,e!==!0&&--re.readyWait>0||(be.resolveWith(G,[re]),re.fn.triggerHandler&&(re(G).triggerHandler("ready"),re(G).off("ready"))))}}),re.ready.promise=function(t){return be||(be=re.Deferred(),"complete"===G.readyState||"loading"!==G.readyState&&!G.documentElement.doScroll?e.setTimeout(re.ready):(G.addEventListener("DOMContentLoaded",o),e.addEventListener("load",o))),be.promise(t)},re.ready.promise();var Ye=function(e,t,n,i,a,r,o){var s=0,d=e.length,l=null==n;if("object"===re.type(n)){a=!0;for(s in n)Ye(e,t,s,n[s],!0,r,o)}else if(void 0!==i&&(a=!0,re.isFunction(i)||(o=!0),l&&(o?(t.call(e,i),t=null):(l=t,t=function(e,t,n){return l.call(re(e),n)})),t))for(;d>s;s++)t(e[s],n,o?i:i.call(e[s],s,t(e[s],n)));return a?e:l?t.call(e):d?t(e[0],n):r},we=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};s.uid=1,s.prototype={register:function(e,t){var n=t||{};return e.nodeType?e[this.expando]=n:Object.defineProperty(e,this.expando,{value:n,writable:!0,configurable:!0}),e[this.expando]},cache:function(e){if(!we(e))return{};var t=e[this.expando];return t||(t={},we(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var i,a=this.cache(e);if("string"==typeof t)a[t]=n;else for(i in t)a[i]=t[i];return a},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][t]},access:function(e,t,n){var i;return void 0===t||t&&"string"==typeof t&&void 0===n?(i=this.get(e,t),void 0!==i?i:this.get(e,re.camelCase(t))):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,i,a,r=e[this.expando];if(void 0!==r){if(void 0===t)this.register(e);else{re.isArray(t)?i=t.concat(t.map(re.camelCase)):(a=re.camelCase(t),t in r?i=[t,a]:(i=a,i=i in r?[i]:i.match(ve)||[])),n=i.length;for(;n--;)delete r[i[n]]}(void 0===t||re.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!re.isEmptyObject(t)}};var ke=new s,Te=new s,De=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,xe=/[A-Z]/g;re.extend({hasData:function(e){return Te.hasData(e)||ke.hasData(e)},data:function(e,t,n){return Te.access(e,t,n)},removeData:function(e,t){Te.remove(e,t)},_data:function(e,t,n){return ke.access(e,t,n)},_removeData:function(e,t){ke.remove(e,t)}}),re.fn.extend({data:function(e,t){var n,i,a,r=this[0],o=r&&r.attributes;if(void 0===e){if(this.length&&(a=Te.get(r),1===r.nodeType&&!ke.get(r,"hasDataAttrs"))){for(n=o.length;n--;)o[n]&&(i=o[n].name,0===i.indexOf("data-")&&(i=re.camelCase(i.slice(5)),d(r,i,a[i])));ke.set(r,"hasDataAttrs",!0)}return a}return"object"==typeof e?this.each(function(){Te.set(this,e)}):Ye(this,function(t){var n,i;if(r&&void 0===t){if(n=Te.get(r,e)||Te.get(r,e.replace(xe,"-$&").toLowerCase()),void 0!==n)return n;if(i=re.camelCase(e),n=Te.get(r,i),void 0!==n)return n;if(n=d(r,i,void 0),void 0!==n)return n}else i=re.camelCase(e),this.each(function(){var n=Te.get(this,i);Te.set(this,i,t),e.indexOf("-")>-1&&void 0!==n&&Te.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Te.remove(this,e)})}}),re.extend({queue:function(e,t,n){var i;return e?(t=(t||"fx")+"queue",i=ke.get(e,t),n&&(!i||re.isArray(n)?i=ke.access(e,t,re.makeArray(n)):i.push(n)),i||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=re.queue(e,t),i=n.length,a=n.shift(),r=re._queueHooks(e,t),o=function(){re.dequeue(e,t)};"inprogress"===a&&(a=n.shift(),i--),a&&("fx"===t&&n.unshift("inprogress"),delete r.stop,a.call(e,o,r)),!i&&r&&r.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ke.get(e,n)||ke.access(e,n,{empty:re.Callbacks("once memory").add(function(){ke.remove(e,[t+"queue",n])})})}}),re.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length",""],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};Fe.optgroup=Fe.option,Fe.tbody=Fe.tfoot=Fe.colgroup=Fe.caption=Fe.thead,Fe.th=Fe.td;var We=/<|?\w+;/;!function(){var e=G.createDocumentFragment(),t=e.appendChild(G.createElement("div")),n=G.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),ie.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",ie.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Ne=/^key/,$e=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Pe=/^([^.]*)(?:\.(.+)|)/;re.event={global:{},add:function(e,t,n,i,a){var r,o,s,d,l,u,c,h,m,_,p,f=ke.get(e);if(f)for(n.handler&&(r=n,n=r.handler,a=r.selector),n.guid||(n.guid=re.guid++),(d=f.events)||(d=f.events={}),(o=f.handle)||(o=f.handle=function(t){return"undefined"!=typeof re&&re.event.triggered!==t.type?re.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(ve)||[""],l=t.length;l--;)s=Pe.exec(t[l])||[],m=p=s[1],_=(s[2]||"").split(".").sort(),m&&(c=re.event.special[m]||{},m=(a?c.delegateType:c.bindType)||m,c=re.event.special[m]||{},u=re.extend({type:m,origType:p,data:i,handler:n,guid:n.guid,selector:a,needsContext:a&&re.expr.match.needsContext.test(a),namespace:_.join(".")},r),(h=d[m])||(h=d[m]=[],h.delegateCount=0,c.setup&&c.setup.call(e,i,_,o)!==!1||e.addEventListener&&e.addEventListener(m,o)),c.add&&(c.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),a?h.splice(h.delegateCount++,0,u):h.push(u),re.event.global[m]=!0)},remove:function(e,t,n,i,a){var r,o,s,d,l,u,c,h,m,_,p,f=ke.hasData(e)&&ke.get(e);if(f&&(d=f.events)){for(t=(t||"").match(ve)||[""],l=t.length;l--;)if(s=Pe.exec(t[l])||[],m=p=s[1],_=(s[2]||"").split(".").sort(),m){for(c=re.event.special[m]||{},m=(i?c.delegateType:c.bindType)||m,h=d[m]||[],s=s[2]&&new RegExp("(^|\\.)"+_.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=r=h.length;r--;)u=h[r],!a&&p!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(h.splice(r,1),u.selector&&h.delegateCount--,c.remove&&c.remove.call(e,u));o&&!h.length&&(c.teardown&&c.teardown.call(e,_,f.handle)!==!1||re.removeEvent(e,m,f.handle),delete d[m])}else for(m in d)re.event.remove(e,m+t[l],n,i,!0);re.isEmptyObject(d)&&ke.remove(e,"handle events")}},dispatch:function(e){e=re.event.fix(e);var t,n,i,a,r,o=[],s=V.call(arguments),d=(ke.get(this,"events")||{})[e.type]||[],l=re.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(o=re.event.handlers.call(this,e,d),t=0;(a=o[t++])&&!e.isPropagationStopped();)for(e.currentTarget=a.elem,n=0;(r=a.handlers[n++])&&!e.isImmediatePropagationStopped();)(!e.rnamespace||e.rnamespace.test(r.namespace))&&(e.handleObj=r,e.data=r.data,i=((re.event.special[r.origType]||{}).handle||r.handler).apply(a.elem,s),void 0!==i&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,i,a,r,o=[],s=t.delegateCount,d=e.target;if(s&&d.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;d!==this;d=d.parentNode||this)if(1===d.nodeType&&(d.disabled!==!0||"click"!==e.type)){for(i=[],n=0;s>n;n++)r=t[n],a=r.selector+" ",void 0===i[a]&&(i[a]=r.needsContext?re(a,this).index(d)>-1:re.find(a,this,null,[d]).length),i[a]&&i.push(r);i.length&&o.push({elem:d,handlers:i})}return s]*)\/>/gi,Ie=/
+
+ @property value
+ @type mixed
+ @default element's text
+ **/
+ value: null,
+ /**
+ Callback to perform custom displaying of value in element's text.
+ If `null`, default input's display used.
+ If `false`, no displaying methods will be called, element's text will never change.
+ Runs under element's scope.
+ _**Parameters:**_
+
+ * `value` current value to be displayed
+ * `response` server response (if display called after ajax submit), since 1.4.0
+
+ For _inputs with source_ (select, checklist) parameters are different:
+
+ * `value` current value to be displayed
+ * `sourceData` array of items for current input (e.g. dropdown items)
+ * `response` server response (if display called after ajax submit), since 1.4.0
+
+ To get currently selected items use `$.fn.editableutils.itemsByValue(value, sourceData)`.
+
+ @property display
+ @type function|boolean
+ @default null
+ @since 1.2.0
+ @example
+ display: function(value, sourceData) {
+ //display checklist as comma-separated values
+ var html = [],
+ checked = $.fn.editableutils.itemsByValue(value, sourceData);
+
+ if(checked.length) {
+ $.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });
+ $(this).html(html.join(', '));
+ } else {
+ $(this).empty();
+ }
+ }
+ **/
+ display: null,
+ /**
+ Css class applied when editable text is empty.
+
+ @property emptyclass
+ @type string
+ @since 1.4.1
+ @default editable-empty
+ **/
+ emptyclass: 'editable-empty',
+ /**
+ Css class applied when value was stored but not sent to server (`pk` is empty or `send = 'never'`).
+ You may set it to `null` if you work with editables locally and submit them together.
+
+ @property unsavedclass
+ @type string
+ @since 1.4.1
+ @default editable-unsaved
+ **/
+ unsavedclass: 'editable-unsaved',
+ /**
+ If selector is provided, editable will be delegated to the specified targets.
+ Usefull for dynamically generated DOM elements.
+ **Please note**, that delegated targets can't be initialized with `emptytext` and `autotext` options,
+ as they actually become editable only after first click.
+ You should manually set class `editable-click` to these elements.
+ Also, if element originally empty you should add class `editable-empty`, set `data-value=""` and write emptytext into element:
+
+ @property selector
+ @type string
+ @since 1.4.1
+ @default null
+ @example
+
+
+
+ **/
+ selector: null,
+ /**
+ Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers.
+
+ @property highlight
+ @type string|boolean
+ @since 1.4.5
+ @default #FFFF80
+ **/
+ highlight: '#FFFF80'
+ };
+
+}(window.jQuery));
+
+/**
+AbstractInput - base class for all editable inputs.
+It defines interface to be implemented by any input type.
+To create your own input you can inherit from this class.
+
+@class abstractinput
+**/
+(function ($) {
+ "use strict";
+
+ //types
+ $.fn.editabletypes = {};
+
+ var AbstractInput = function () { };
+
+ AbstractInput.prototype = {
+ /**
+ Initializes input
+
+ @method init()
+ **/
+ init: function(type, options, defaults) {
+ this.type = type;
+ this.options = $.extend({}, defaults, options);
+ },
+
+ /*
+ this method called before render to init $tpl that is inserted in DOM
+ */
+ prerender: function() {
+ this.$tpl = $(this.options.tpl); //whole tpl as jquery object
+ this.$input = this.$tpl; //control itself, can be changed in render method
+ this.$clear = null; //clear button
+ this.error = null; //error message, if input cannot be rendered
+ },
+
+ /**
+ Renders input from tpl. Can return jQuery deferred object.
+ Can be overwritten in child objects
+
+ @method render()
+ **/
+ render: function() {
+
+ },
+
+ /**
+ Sets element's html by value.
+
+ @method value2html(value, element)
+ @param {mixed} value
+ @param {DOMElement} element
+ **/
+ value2html: function(value, element) {
+ $(element)[this.options.escape ? 'text' : 'html']($.trim(value));
+ },
+
+ /**
+ Converts element's html to value
+
+ @method html2value(html)
+ @param {string} html
+ @returns {mixed}
+ **/
+ html2value: function(html) {
+ return $('').html(html).text();
+ },
+
+ /**
+ Converts value to string (for internal compare). For submitting to server used value2submit().
+
+ @method value2str(value)
+ @param {mixed} value
+ @returns {string}
+ **/
+ value2str: function(value) {
+ return value;
+ },
+
+ /**
+ Converts string received from server into value. Usually from `data-value` attribute.
+
+ @method str2value(str)
+ @param {string} str
+ @returns {mixed}
+ **/
+ str2value: function(str) {
+ return str;
+ },
+
+ /**
+ Converts value for submitting to server. Result can be string or object.
+
+ @method value2submit(value)
+ @param {mixed} value
+ @returns {mixed}
+ **/
+ value2submit: function(value) {
+ return value;
+ },
+
+ /**
+ Sets value of input.
+
+ @method value2input(value)
+ @param {mixed} value
+ **/
+ value2input: function(value) {
+ this.$input.val(value);
+ },
+
+ /**
+ Returns value of input. Value can be object (e.g. datepicker)
+
+ @method input2value()
+ **/
+ input2value: function() {
+ return this.$input.val();
+ },
+
+ /**
+ Activates input. For text it sets focus.
+
+ @method activate()
+ **/
+ activate: function() {
+ if(this.$input.is(':visible')) {
+ this.$input.focus();
+ }
+ },
+
+ /**
+ Creates input.
+
+ @method clear()
+ **/
+ clear: function() {
+ this.$input.val(null);
+ },
+
+ /**
+ method to escape html.
+ **/
+ escape: function(str) {
+ return $('
').text(str).html();
+ },
+
+ /**
+ attach handler to automatically submit form when value changed (useful when buttons not shown)
+ **/
+ autosubmit: function() {
+
+ },
+
+ /**
+ Additional actions when destroying element
+ **/
+ destroy: function() {
+ },
+
+ // -------- helper functions --------
+ setClass: function() {
+ if(this.options.inputclass) {
+ this.$input.addClass(this.options.inputclass);
+ }
+ },
+
+ setAttr: function(attr) {
+ if (this.options[attr] !== undefined && this.options[attr] !== null) {
+ this.$input.attr(attr, this.options[attr]);
+ }
+ },
+
+ option: function(key, value) {
+ this.options[key] = value;
+ }
+
+ };
+
+ AbstractInput.defaults = {
+ /**
+ HTML template of input. Normally you should not change it.
+
+ @property tpl
+ @type string
+ @default ''
+ **/
+ tpl: '',
+ /**
+ CSS class automatically applied to input
+
+ @property inputclass
+ @type string
+ @default null
+ **/
+ inputclass: null,
+
+ /**
+ If `true` - html will be escaped in content of element via $.text() method.
+ If `false` - html will not be escaped, $.html() used.
+ When you use own `display` function, this option obviosly has no effect.
+
+ @property escape
+ @type boolean
+ @since 1.5.0
+ @default true
+ **/
+ escape: true,
+
+ //scope for external methods (e.g. source defined as function)
+ //for internal use only
+ scope: null,
+
+ //need to re-declare showbuttons here to get it's value from common config (passed only options existing in defaults)
+ showbuttons: true
+ };
+
+ $.extend($.fn.editabletypes, {abstractinput: AbstractInput});
+
+}(window.jQuery));
+
+/**
+List - abstract class for inputs that have source option loaded from js array or via ajax
+
+@class list
+@extends abstractinput
+**/
+(function ($) {
+ "use strict";
+
+ var List = function (options) {
+
+ };
+
+ $.fn.editableutils.inherit(List, $.fn.editabletypes.abstractinput);
+
+ $.extend(List.prototype, {
+ render: function () {
+ var deferred = $.Deferred();
+
+ this.error = null;
+ this.onSourceReady(function () {
+ this.renderList();
+ deferred.resolve();
+ }, function () {
+ this.error = this.options.sourceError;
+ deferred.resolve();
+ });
+
+ return deferred.promise();
+ },
+
+ html2value: function (html) {
+ return null; //can't set value by text
+ },
+
+ value2html: function (value, element, display, response) {
+ var deferred = $.Deferred(),
+ success = function () {
+ if(typeof display === 'function') {
+ //custom display method
+ display.call(element, value, this.sourceData, response);
+ } else {
+ this.value2htmlFinal(value, element);
+ }
+ deferred.resolve();
+ };
+
+ //for null value just call success without loading source
+ if(value === null) {
+ success.call(this);
+ } else {
+ this.onSourceReady(success, function () { deferred.resolve(); });
+ }
+
+ return deferred.promise();
+ },
+
+ // ------------- additional functions ------------
+
+ onSourceReady: function (success, error) {
+ //run source if it function
+ var source;
+ if ($.isFunction(this.options.source)) {
+ source = this.options.source.call(this.options.scope);
+ this.sourceData = null;
+ //note: if function returns the same source as URL - sourceData will be taken from cahce and no extra request performed
+ } else {
+ source = this.options.source;
+ }
+
+ //if allready loaded just call success
+ if(this.options.sourceCache && $.isArray(this.sourceData)) {
+ success.call(this);
+ return;
+ }
+
+ //try parse json in single quotes (for double quotes jquery does automatically)
+ try {
+ source = $.fn.editableutils.tryParseJson(source, false);
+ } catch (e) {
+ error.call(this);
+ return;
+ }
+
+ //loading from url
+ if (typeof source === 'string') {
+ //try to get sourceData from cache
+ if(this.options.sourceCache) {
+ var cacheID = source,
+ cache;
+
+ if (!$(document).data(cacheID)) {
+ $(document).data(cacheID, {});
+ }
+ cache = $(document).data(cacheID);
+
+ //check for cached data
+ if (cache.loading === false && cache.sourceData) { //take source from cache
+ this.sourceData = cache.sourceData;
+ this.doPrepend();
+ success.call(this);
+ return;
+ } else if (cache.loading === true) { //cache is loading, put callback in stack to be called later
+ cache.callbacks.push($.proxy(function () {
+ this.sourceData = cache.sourceData;
+ this.doPrepend();
+ success.call(this);
+ }, this));
+
+ //also collecting error callbacks
+ cache.err_callbacks.push($.proxy(error, this));
+ return;
+ } else { //no cache yet, activate it
+ cache.loading = true;
+ cache.callbacks = [];
+ cache.err_callbacks = [];
+ }
+ }
+
+ //ajaxOptions for source. Can be overwritten bt options.sourceOptions
+ var ajaxOptions = $.extend({
+ url: source,
+ type: 'get',
+ cache: false,
+ dataType: 'json',
+ success: $.proxy(function (data) {
+ if(cache) {
+ cache.loading = false;
+ }
+ this.sourceData = this.makeArray(data);
+ if($.isArray(this.sourceData)) {
+ if(cache) {
+ //store result in cache
+ cache.sourceData = this.sourceData;
+ //run success callbacks for other fields waiting for this source
+ $.each(cache.callbacks, function () { this.call(); });
+ }
+ this.doPrepend();
+ success.call(this);
+ } else {
+ error.call(this);
+ if(cache) {
+ //run error callbacks for other fields waiting for this source
+ $.each(cache.err_callbacks, function () { this.call(); });
+ }
+ }
+ }, this),
+ error: $.proxy(function () {
+ error.call(this);
+ if(cache) {
+ cache.loading = false;
+ //run error callbacks for other fields
+ $.each(cache.err_callbacks, function () { this.call(); });
+ }
+ }, this)
+ }, this.options.sourceOptions);
+
+ //loading sourceData from server
+ $.ajax(ajaxOptions);
+
+ } else { //options as json/array
+ this.sourceData = this.makeArray(source);
+
+ if($.isArray(this.sourceData)) {
+ this.doPrepend();
+ success.call(this);
+ } else {
+ error.call(this);
+ }
+ }
+ },
+
+ doPrepend: function () {
+ if(this.options.prepend === null || this.options.prepend === undefined) {
+ return;
+ }
+
+ if(!$.isArray(this.prependData)) {
+ //run prepend if it is function (once)
+ if ($.isFunction(this.options.prepend)) {
+ this.options.prepend = this.options.prepend.call(this.options.scope);
+ }
+
+ //try parse json in single quotes
+ this.options.prepend = $.fn.editableutils.tryParseJson(this.options.prepend, true);
+
+ //convert prepend from string to object
+ if (typeof this.options.prepend === 'string') {
+ this.options.prepend = {'': this.options.prepend};
+ }
+
+ this.prependData = this.makeArray(this.options.prepend);
+ }
+
+ if($.isArray(this.prependData) && $.isArray(this.sourceData)) {
+ this.sourceData = this.prependData.concat(this.sourceData);
+ }
+ },
+
+ /*
+ renders input list
+ */
+ renderList: function() {
+ // this method should be overwritten in child class
+ },
+
+ /*
+ set element's html by value
+ */
+ value2htmlFinal: function(value, element) {
+ // this method should be overwritten in child class
+ },
+
+ /**
+ * convert data to array suitable for sourceData, e.g. [{value: 1, text: 'abc'}, {...}]
+ */
+ makeArray: function(data) {
+ var count, obj, result = [], item, iterateItem;
+ if(!data || typeof data === 'string') {
+ return null;
+ }
+
+ if($.isArray(data)) { //array
+ /*
+ function to iterate inside item of array if item is object.
+ Caclulates count of keys in item and store in obj.
+ */
+ iterateItem = function (k, v) {
+ obj = {value: k, text: v};
+ if(count++ >= 2) {
+ return false;// exit from `each` if item has more than one key.
+ }
+ };
+
+ for(var i = 0; i < data.length; i++) {
+ item = data[i];
+ if(typeof item === 'object') {
+ count = 0; //count of keys inside item
+ $.each(item, iterateItem);
+ //case: [{val1: 'text1'}, {val2: 'text2} ...]
+ if(count === 1) {
+ result.push(obj);
+ //case: [{value: 1, text: 'text1'}, {value: 2, text: 'text2'}, ...]
+ } else if(count > 1) {
+ //removed check of existance: item.hasOwnProperty('value') && item.hasOwnProperty('text')
+ if(item.children) {
+ item.children = this.makeArray(item.children);
+ }
+ result.push(item);
+ }
+ } else {
+ //case: ['text1', 'text2' ...]
+ result.push({value: item, text: item});
+ }
+ }
+ } else { //case: {val1: 'text1', val2: 'text2, ...}
+ $.each(data, function (k, v) {
+ result.push({value: k, text: v});
+ });
+ }
+ return result;
+ },
+
+ option: function(key, value) {
+ this.options[key] = value;
+ if(key === 'source') {
+ this.sourceData = null;
+ }
+ if(key === 'prepend') {
+ this.prependData = null;
+ }
+ }
+
+ });
+
+ List.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ /**
+ Source data for list.
+ If **array** - it should be in format: `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`
+ For compability, object format is also supported: `{"1": "text1", "2": "text2" ...}` but it does not guarantee elements order.
+
+ If **string** - considered ajax url to load items. In that case results will be cached for fields with the same source and name. See also `sourceCache` option.
+
+ If **function**, it should return data in format above (since 1.4.0).
+
+ Since 1.4.1 key `children` supported to render OPTGROUP (for **select** input only).
+ `[{text: "group1", children: [{value: 1, text: "text1"}, {value: 2, text: "text2"}]}, ...]`
+
+
+ @property source
+ @type string | array | object | function
+ @default null
+ **/
+ source: null,
+ /**
+ Data automatically prepended to the beginning of dropdown list.
+
+ @property prepend
+ @type string | array | object | function
+ @default false
+ **/
+ prepend: false,
+ /**
+ Error message when list cannot be loaded (e.g. ajax error)
+
+ @property sourceError
+ @type string
+ @default Error when loading list
+ **/
+ sourceError: 'Error when loading list',
+ /**
+ if
true
and source is **string url** - results will be cached for fields with the same source.
+ Usefull for editable column in grid to prevent extra requests.
+
+ @property sourceCache
+ @type boolean
+ @default true
+ @since 1.2.0
+ **/
+ sourceCache: true,
+ /**
+ Additional ajax options to be used in $.ajax() when loading list from server.
+ Useful to send extra parameters (`data` key) or change request method (`type` key).
+
+ @property sourceOptions
+ @type object|function
+ @default null
+ @since 1.5.0
+ **/
+ sourceOptions: null
+ });
+
+ $.fn.editabletypes.list = List;
+
+}(window.jQuery));
+
+/**
+Text input
+
+@class text
+@extends abstractinput
+@final
+@example
+
awesome
+
+**/
+(function ($) {
+ "use strict";
+
+ var Text = function (options) {
+ this.init('text', options, Text.defaults);
+ };
+
+ $.fn.editableutils.inherit(Text, $.fn.editabletypes.abstractinput);
+
+ $.extend(Text.prototype, {
+ render: function() {
+ this.renderClear();
+ this.setClass();
+ this.setAttr('placeholder');
+ },
+
+ activate: function() {
+ if(this.$input.is(':visible')) {
+ this.$input.focus();
+ $.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
+ if(this.toggleClear) {
+ this.toggleClear();
+ }
+ }
+ },
+
+ //render clear button
+ renderClear: function() {
+ if (this.options.clear) {
+ this.$clear = $('
');
+ this.$input.after(this.$clear)
+ .css('padding-right', 24)
+ .keyup($.proxy(function(e) {
+ //arrows, enter, tab, etc
+ if(~$.inArray(e.keyCode, [40,38,9,13,27])) {
+ return;
+ }
+
+ clearTimeout(this.t);
+ var that = this;
+ this.t = setTimeout(function() {
+ that.toggleClear(e);
+ }, 100);
+
+ }, this))
+ .parent().css('position', 'relative');
+
+ this.$clear.click($.proxy(this.clear, this));
+ }
+ },
+
+ postrender: function() {
+ /*
+ //now `clear` is positioned via css
+ if(this.$clear) {
+ //can position clear button only here, when form is shown and height can be calculated
+// var h = this.$input.outerHeight(true) || 20,
+ var h = this.$clear.parent().height(),
+ delta = (h - this.$clear.height()) / 2;
+
+ //this.$clear.css({bottom: delta, right: delta});
+ }
+ */
+ },
+
+ //show / hide clear button
+ toggleClear: function(e) {
+ if(!this.$clear) {
+ return;
+ }
+
+ var len = this.$input.val().length,
+ visible = this.$clear.is(':visible');
+
+ if(len && !visible) {
+ this.$clear.show();
+ }
+
+ if(!len && visible) {
+ this.$clear.hide();
+ }
+ },
+
+ clear: function() {
+ this.$clear.hide();
+ this.$input.val('').focus();
+ }
+ });
+
+ Text.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl: '
',
+ /**
+ Placeholder attribute of input. Shown when input is empty.
+
+ @property placeholder
+ @type string
+ @default null
+ **/
+ placeholder: null,
+
+ /**
+ Whether to show `clear` button
+
+ @property clear
+ @type boolean
+ @default true
+ **/
+ clear: true
+ });
+
+ $.fn.editabletypes.text = Text;
+
+}(window.jQuery));
+
+/**
+Textarea input
+
+@class textarea
+@extends abstractinput
+@final
+@example
+
+
+**/
+(function ($) {
+ "use strict";
+
+ var Textarea = function (options) {
+ this.init('textarea', options, Textarea.defaults);
+ };
+
+ $.fn.editableutils.inherit(Textarea, $.fn.editabletypes.abstractinput);
+
+ $.extend(Textarea.prototype, {
+ render: function () {
+ this.setClass();
+ this.setAttr('placeholder');
+ this.setAttr('rows');
+
+ //ctrl + enter
+ this.$input.keydown(function (e) {
+ if (e.ctrlKey && e.which === 13) {
+ $(this).closest('form').submit();
+ }
+ });
+ },
+
+ //using `white-space: pre-wrap` solves \n <--> BR conversion very elegant!
+ /*
+ value2html: function(value, element) {
+ var html = '', lines;
+ if(value) {
+ lines = value.split("\n");
+ for (var i = 0; i < lines.length; i++) {
+ lines[i] = $('
').text(lines[i]).html();
+ }
+ html = lines.join('
');
+ }
+ $(element).html(html);
+ },
+
+ html2value: function(html) {
+ if(!html) {
+ return '';
+ }
+
+ var regex = new RegExp(String.fromCharCode(10), 'g');
+ var lines = html.split(/
/i);
+ for (var i = 0; i < lines.length; i++) {
+ var text = $('
').html(lines[i]).text();
+
+ // Remove newline characters (\n) to avoid them being converted by value2html() method
+ // thus adding extra
tags
+ text = text.replace(regex, '');
+
+ lines[i] = text;
+ }
+ return lines.join("\n");
+ },
+ */
+ activate: function() {
+ $.fn.editabletypes.text.prototype.activate.call(this);
+ }
+ });
+
+ Textarea.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl:'
',
+ /**
+ @property inputclass
+ @default input-large
+ **/
+ inputclass: 'input-large',
+ /**
+ Placeholder attribute of input. Shown when input is empty.
+
+ @property placeholder
+ @type string
+ @default null
+ **/
+ placeholder: null,
+ /**
+ Number of rows in textarea
+
+ @property rows
+ @type integer
+ @default 7
+ **/
+ rows: 7
+ });
+
+ $.fn.editabletypes.textarea = Textarea;
+
+}(window.jQuery));
+
+/**
+Select (dropdown)
+
+@class select
+@extends list
+@final
+@example
+
+
+**/
+(function ($) {
+ "use strict";
+
+ var Select = function (options) {
+ this.init('select', options, Select.defaults);
+ };
+
+ $.fn.editableutils.inherit(Select, $.fn.editabletypes.list);
+
+ $.extend(Select.prototype, {
+ renderList: function() {
+ this.$input.empty();
+
+ var fillItems = function($el, data) {
+ var attr;
+ if($.isArray(data)) {
+ for(var i=0; i
', attr), data[i].children));
+ } else {
+ attr.value = data[i].value;
+ if(data[i].disabled) {
+ attr.disabled = true;
+ }
+ $el.append($('', attr).text(data[i].text));
+ }
+ }
+ }
+ return $el;
+ };
+
+ fillItems(this.$input, this.sourceData);
+
+ this.setClass();
+
+ //enter submit
+ this.$input.on('keydown.editable', function (e) {
+ if (e.which === 13) {
+ $(this).closest('form').submit();
+ }
+ });
+ },
+
+ value2htmlFinal: function(value, element) {
+ var text = '',
+ items = $.fn.editableutils.itemsByValue(value, this.sourceData);
+
+ if(items.length) {
+ text = items[0].text;
+ }
+
+ //$(element).text(text);
+ $.fn.editabletypes.abstractinput.prototype.value2html.call(this, text, element);
+ },
+
+ autosubmit: function() {
+ this.$input.off('keydown.editable').on('change.editable', function(){
+ $(this).closest('form').submit();
+ });
+ }
+ });
+
+ Select.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl:' '
+ });
+
+ $.fn.editabletypes.select = Select;
+
+}(window.jQuery));
+
+/**
+List of checkboxes.
+Internally value stored as javascript array of values.
+
+@class checklist
+@extends list
+@final
+@example
+
+
+**/
+(function ($) {
+ "use strict";
+
+ var Checklist = function (options) {
+ this.init('checklist', options, Checklist.defaults);
+ };
+
+ $.fn.editableutils.inherit(Checklist, $.fn.editabletypes.list);
+
+ $.extend(Checklist.prototype, {
+ renderList: function() {
+ var $label, $div;
+
+ this.$tpl.empty();
+
+ if(!$.isArray(this.sourceData)) {
+ return;
+ }
+
+ for(var i=0; i').append($(' ', {
+ type: 'checkbox',
+ value: this.sourceData[i].value
+ }))
+ .append($('').text(' '+this.sourceData[i].text));
+
+ $('').append($label).appendTo(this.$tpl);
+ }
+
+ this.$input = this.$tpl.find('input[type="checkbox"]');
+ this.setClass();
+ },
+
+ value2str: function(value) {
+ return $.isArray(value) ? value.sort().join($.trim(this.options.separator)) : '';
+ },
+
+ //parse separated string
+ str2value: function(str) {
+ var reg, value = null;
+ if(typeof str === 'string' && str.length) {
+ reg = new RegExp('\\s*'+$.trim(this.options.separator)+'\\s*');
+ value = str.split(reg);
+ } else if($.isArray(str)) {
+ value = str;
+ } else {
+ value = [str];
+ }
+ return value;
+ },
+
+ //set checked on required checkboxes
+ value2input: function(value) {
+ this.$input.prop('checked', false);
+ if($.isArray(value) && value.length) {
+ this.$input.each(function(i, el) {
+ var $el = $(el);
+ // cannot use $.inArray as it performs strict comparison
+ $.each(value, function(j, val){
+ /*jslint eqeq: true*/
+ if($el.val() == val) {
+ /*jslint eqeq: false*/
+ $el.prop('checked', true);
+ }
+ });
+ });
+ }
+ },
+
+ input2value: function() {
+ var checked = [];
+ this.$input.filter(':checked').each(function(i, el) {
+ checked.push($(el).val());
+ });
+ return checked;
+ },
+
+ //collect text of checked boxes
+ value2htmlFinal: function(value, element) {
+ var html = [],
+ checked = $.fn.editableutils.itemsByValue(value, this.sourceData),
+ escape = this.options.escape;
+
+ if(checked.length) {
+ $.each(checked, function(i, v) {
+ var text = escape ? $.fn.editableutils.escape(v.text) : v.text;
+ html.push(text);
+ });
+ $(element).html(html.join('
'));
+ } else {
+ $(element).empty();
+ }
+ },
+
+ activate: function() {
+ this.$input.first().focus();
+ },
+
+ autosubmit: function() {
+ this.$input.on('keydown', function(e){
+ if (e.which === 13) {
+ $(this).closest('form').submit();
+ }
+ });
+ }
+ });
+
+ Checklist.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl:'
',
+
+ /**
+ @property inputclass
+ @type string
+ @default null
+ **/
+ inputclass: null,
+
+ /**
+ Separator of values when reading from `data-value` attribute
+
+ @property separator
+ @type string
+ @default ','
+ **/
+ separator: ','
+ });
+
+ $.fn.editabletypes.checklist = Checklist;
+
+}(window.jQuery));
+
+/**
+HTML5 input types.
+Following types are supported:
+
+* password
+* email
+* url
+* tel
+* number
+* range
+* time
+
+Learn more about html5 inputs:
+http://www.w3.org/wiki/HTML5_form_additions
+To check browser compatibility please see:
+https://developer.mozilla.org/en-US/docs/HTML/Element/Input
+
+@class html5types
+@extends text
+@final
+@since 1.3.0
+@example
+
admin@example.com
+
+**/
+
+/**
+@property tpl
+@default depends on type
+**/
+
+/*
+Password
+*/
+(function ($) {
+ "use strict";
+
+ var Password = function (options) {
+ this.init('password', options, Password.defaults);
+ };
+ $.fn.editableutils.inherit(Password, $.fn.editabletypes.text);
+ $.extend(Password.prototype, {
+ //do not display password, show '[hidden]' instead
+ value2html: function(value, element) {
+ if(value) {
+ $(element).text('[hidden]');
+ } else {
+ $(element).empty();
+ }
+ },
+ //as password not displayed, should not set value by html
+ html2value: function(html) {
+ return null;
+ }
+ });
+ Password.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
+ tpl: '
'
+ });
+ $.fn.editabletypes.password = Password;
+}(window.jQuery));
+
+
+/*
+Email
+*/
+(function ($) {
+ "use strict";
+
+ var Email = function (options) {
+ this.init('email', options, Email.defaults);
+ };
+ $.fn.editableutils.inherit(Email, $.fn.editabletypes.text);
+ Email.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
+ tpl: '
'
+ });
+ $.fn.editabletypes.email = Email;
+}(window.jQuery));
+
+
+/*
+Url
+*/
+(function ($) {
+ "use strict";
+
+ var Url = function (options) {
+ this.init('url', options, Url.defaults);
+ };
+ $.fn.editableutils.inherit(Url, $.fn.editabletypes.text);
+ Url.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
+ tpl: '
'
+ });
+ $.fn.editabletypes.url = Url;
+}(window.jQuery));
+
+
+/*
+Tel
+*/
+(function ($) {
+ "use strict";
+
+ var Tel = function (options) {
+ this.init('tel', options, Tel.defaults);
+ };
+ $.fn.editableutils.inherit(Tel, $.fn.editabletypes.text);
+ Tel.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
+ tpl: '
'
+ });
+ $.fn.editabletypes.tel = Tel;
+}(window.jQuery));
+
+
+/*
+Number
+*/
+(function ($) {
+ "use strict";
+
+ var NumberInput = function (options) {
+ this.init('number', options, NumberInput.defaults);
+ };
+ $.fn.editableutils.inherit(NumberInput, $.fn.editabletypes.text);
+ $.extend(NumberInput.prototype, {
+ render: function () {
+ NumberInput.superclass.render.call(this);
+ this.setAttr('min');
+ this.setAttr('max');
+ this.setAttr('step');
+ },
+ postrender: function() {
+ if(this.$clear) {
+ //increase right ffset for up/down arrows
+ this.$clear.css({right: 24});
+ /*
+ //can position clear button only here, when form is shown and height can be calculated
+ var h = this.$input.outerHeight(true) || 20,
+ delta = (h - this.$clear.height()) / 2;
+
+ //add 12px to offset right for up/down arrows
+ this.$clear.css({top: delta, right: delta + 16});
+ */
+ }
+ }
+ });
+ NumberInput.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
+ tpl: '
',
+ inputclass: 'input-mini',
+ min: null,
+ max: null,
+ step: null
+ });
+ $.fn.editabletypes.number = NumberInput;
+}(window.jQuery));
+
+
+/*
+Range (inherit from number)
+*/
+(function ($) {
+ "use strict";
+
+ var Range = function (options) {
+ this.init('range', options, Range.defaults);
+ };
+ $.fn.editableutils.inherit(Range, $.fn.editabletypes.number);
+ $.extend(Range.prototype, {
+ render: function () {
+ this.$input = this.$tpl.filter('input');
+
+ this.setClass();
+ this.setAttr('min');
+ this.setAttr('max');
+ this.setAttr('step');
+
+ this.$input.on('input', function(){
+ $(this).siblings('output').text($(this).val());
+ });
+ },
+ activate: function() {
+ this.$input.focus();
+ }
+ });
+ Range.defaults = $.extend({}, $.fn.editabletypes.number.defaults, {
+ tpl: '
',
+ inputclass: 'input-medium'
+ });
+ $.fn.editabletypes.range = Range;
+}(window.jQuery));
+
+/*
+Time
+*/
+(function ($) {
+ "use strict";
+
+ var Time = function (options) {
+ this.init('time', options, Time.defaults);
+ };
+ //inherit from abstract, as inheritance from text gives selection error.
+ $.fn.editableutils.inherit(Time, $.fn.editabletypes.abstractinput);
+ $.extend(Time.prototype, {
+ render: function() {
+ this.setClass();
+ }
+ });
+ Time.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ tpl: '
'
+ });
+ $.fn.editabletypes.time = Time;
+}(window.jQuery));
+
+/**
+Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.
+Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options.
+
+You should manually download and include select2 distributive:
+
+
+
+
+To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css):
+
+
+
+**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.
+You need initially put both `data-value` and element's text youself:
+
+
Text1
+
+
+@class select2
+@extends abstractinput
+@since 1.4.1
+@final
+@example
+
+
+**/
+(function ($) {
+ "use strict";
+
+ var Constructor = function (options) {
+ this.init('select2', options, Constructor.defaults);
+
+ options.select2 = options.select2 || {};
+
+ this.sourceData = null;
+
+ //placeholder
+ if(options.placeholder) {
+ options.select2.placeholder = options.placeholder;
+ }
+
+ //if not `tags` mode, use source
+ if(!options.select2.tags && options.source) {
+ var source = options.source;
+ //if source is function, call it (once!)
+ if ($.isFunction(options.source)) {
+ source = options.source.call(options.scope);
+ }
+
+ if (typeof source === 'string') {
+ options.select2.ajax = options.select2.ajax || {};
+ //some default ajax params
+ if(!options.select2.ajax.data) {
+ options.select2.ajax.data = function(term) {return { query:term };};
+ }
+ if(!options.select2.ajax.results) {
+ options.select2.ajax.results = function(data) { return {results:data };};
+ }
+ options.select2.ajax.url = source;
+ } else {
+ //check format and convert x-editable format to select2 format (if needed)
+ this.sourceData = this.convertSource(source);
+ options.select2.data = this.sourceData;
+ }
+ }
+
+ //overriding objects in config (as by default jQuery extend() is not recursive)
+ this.options.select2 = $.extend({}, Constructor.defaults.select2, options.select2);
+
+ //detect whether it is multi-valued
+ this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
+ this.isRemote = ('ajax' in this.options.select2);
+
+ //store function returning ID of item
+ //should be here as used inautotext for local source
+ this.idFunc = this.options.select2.id;
+ if (typeof(this.idFunc) !== "function") {
+ var idKey = this.idFunc || 'id';
+ this.idFunc = function (e) { return e[idKey]; };
+ }
+
+ //store function that renders text in select2
+ this.formatSelection = this.options.select2.formatSelection;
+ if (typeof(this.formatSelection) !== "function") {
+ this.formatSelection = function (e) { return e.text; };
+ }
+ };
+
+ $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
+
+ $.extend(Constructor.prototype, {
+ render: function() {
+ this.setClass();
+
+ //can not apply select2 here as it calls initSelection
+ //over input that does not have correct value yet.
+ //apply select2 only in value2input
+ //this.$input.select2(this.options.select2);
+
+ //when data is loaded via ajax, we need to know when it's done to populate listData
+ if(this.isRemote) {
+ //listen to loaded event to populate data
+ this.$input.on('select2-loaded', $.proxy(function(e) {
+ this.sourceData = e.items.results;
+ }, this));
+ }
+
+ //trigger resize of editableform to re-position container in multi-valued mode
+ if(this.isMultiple) {
+ this.$input.on('change', function() {
+ $(this).closest('form').parent().triggerHandler('resize');
+ });
+ }
+ },
+
+ value2html: function(value, element) {
+ var text = '', data,
+ that = this;
+
+ if(this.options.select2.tags) { //in tags mode just assign value
+ data = value;
+ //data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc);
+ } else if(this.sourceData) {
+ data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
+ } else {
+ //can not get list of possible values
+ //(e.g. autotext for select2 with ajax source)
+ }
+
+ //data may be array (when multiple values allowed)
+ if($.isArray(data)) {
+ //collect selected data and show with separator
+ text = [];
+ $.each(data, function(k, v){
+ text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);
+ });
+ } else if(data) {
+ text = that.formatSelection(data);
+ }
+
+ text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
+
+ //$(element).text(text);
+ Constructor.superclass.value2html.call(this, text, element);
+ },
+
+ html2value: function(html) {
+ return this.options.select2.tags ? this.str2value(html, this.options.viewseparator) : null;
+ },
+
+ value2input: function(value) {
+ // if value array => join it anyway
+ if($.isArray(value)) {
+ value = value.join(this.getSeparator());
+ }
+
+ //for remote source just set value, text is updated by initSelection
+ if(!this.$input.data('select2')) {
+ this.$input.val(value);
+ this.$input.select2(this.options.select2);
+ } else {
+ //second argument needed to separate initial change from user's click (for autosubmit)
+ this.$input.val(value).trigger('change', true);
+
+ //Uncaught Error: cannot call val() if initSelection() is not defined
+ //this.$input.select2('val', value);
+ }
+
+ // if defined remote source AND no multiple mode AND no user's initSelection provided -->
+ // we should somehow get text for provided id.
+ // The solution is to use element's text as text for that id (exclude empty)
+ if(this.isRemote && !this.isMultiple && !this.options.select2.initSelection) {
+ // customId and customText are methods to extract `id` and `text` from data object
+ // we can use this workaround only if user did not define these methods
+ // otherwise we cant construct data object
+ var customId = this.options.select2.id,
+ customText = this.options.select2.formatSelection;
+
+ if(!customId && !customText) {
+ var $el = $(this.options.scope);
+ if (!$el.data('editable').isEmpty) {
+ var data = {id: value, text: $el.text()};
+ this.$input.select2('data', data);
+ }
+ }
+ }
+ },
+
+ input2value: function() {
+ return this.$input.select2('val');
+ },
+
+ str2value: function(str, separator) {
+ if(typeof str !== 'string' || !this.isMultiple) {
+ return str;
+ }
+
+ separator = separator || this.getSeparator();
+
+ var val, i, l;
+
+ if (str === null || str.length < 1) {
+ return null;
+ }
+ val = str.split(separator);
+ for (i = 0, l = val.length; i < l; i = i + 1) {
+ val[i] = $.trim(val[i]);
+ }
+
+ return val;
+ },
+
+ autosubmit: function() {
+ this.$input.on('change', function(e, isInitial){
+ if(!isInitial) {
+ $(this).closest('form').submit();
+ }
+ });
+ },
+
+ getSeparator: function() {
+ return this.options.select2.separator || $.fn.select2.defaults.separator;
+ },
+
+ /*
+ Converts source from x-editable format: {value: 1, text: "1"} to
+ select2 format: {id: 1, text: "1"}
+ */
+ convertSource: function(source) {
+ if($.isArray(source) && source.length && source[0].value !== undefined) {
+ for(var i = 0; i
+ **/
+ tpl:' ',
+ /**
+ Configuration of select2. [Full list of options](http://ivaynberg.github.com/select2).
+
+ @property select2
+ @type object
+ @default null
+ **/
+ select2: null,
+ /**
+ Placeholder attribute of select
+
+ @property placeholder
+ @type string
+ @default null
+ **/
+ placeholder: null,
+ /**
+ Source data for select. It will be assigned to select2 `data` property and kept here just for convenience.
+ Please note, that format is different from simple `select` input: use 'id' instead of 'value'.
+ E.g. `[{id: 1, text: "text1"}, {id: 2, text: "text2"}, ...]`.
+
+ @property source
+ @type array|string|function
+ @default null
+ **/
+ source: null,
+ /**
+ Separator used to display tags.
+
+ @property viewseparator
+ @type string
+ @default ', '
+ **/
+ viewseparator: ', '
+ });
+
+ $.fn.editabletypes.select2 = Constructor;
+
+}(window.jQuery));
+
+/**
+* Combodate - 1.0.5
+* Dropdown date and time picker.
+* Converts text input into dropdowns to pick day, month, year, hour, minute and second.
+* Uses momentjs as datetime library http://momentjs.com.
+* For i18n include corresponding file from https://github.com/timrwood/moment/tree/master/lang
+*
+* Confusion at noon and midnight - see http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight
+* In combodate:
+* 12:00 pm --> 12:00 (24-h format, midday)
+* 12:00 am --> 00:00 (24-h format, midnight, start of day)
+*
+* Differs from momentjs parse rules:
+* 00:00 pm, 12:00 pm --> 12:00 (24-h format, day not change)
+* 00:00 am, 12:00 am --> 00:00 (24-h format, day not change)
+*
+*
+* Author: Vitaliy Potapov
+* Project page: http://github.com/vitalets/combodate
+* Copyright (c) 2012 Vitaliy Potapov. Released under MIT License.
+**/
+(function ($) {
+
+ var Combodate = function (element, options) {
+ this.$element = $(element);
+ if(!this.$element.is('input')) {
+ $.error('Combodate should be applied to INPUT element');
+ return;
+ }
+ this.options = $.extend({}, $.fn.combodate.defaults, options, this.$element.data());
+ this.init();
+ };
+
+ Combodate.prototype = {
+ constructor: Combodate,
+ init: function () {
+ this.map = {
+ //key regexp moment.method
+ day: ['D', 'date'],
+ month: ['M', 'month'],
+ year: ['Y', 'year'],
+ hour: ['[Hh]', 'hours'],
+ minute: ['m', 'minutes'],
+ second: ['s', 'seconds'],
+ ampm: ['[Aa]', '']
+ };
+
+ this.$widget = $(' ').html(this.getTemplate());
+
+ this.initCombos();
+
+ //update original input on change
+ this.$widget.on('change', 'select', $.proxy(function(e) {
+ this.$element.val(this.getValue()).change();
+ // update days count if month or year changes
+ if (this.options.smartDays) {
+ if ($(e.target).is('.month') || $(e.target).is('.year')) {
+ this.fillCombo('day');
+ }
+ }
+ }, this));
+
+ this.$widget.find('select').css('width', 'auto');
+
+ // hide original input and insert widget
+ this.$element.hide().after(this.$widget);
+
+ // set initial value
+ this.setValue(this.$element.val() || this.options.value);
+ },
+
+ /*
+ Replace tokens in template with elements
+ */
+ getTemplate: function() {
+ var tpl = this.options.template;
+
+ //first pass
+ $.each(this.map, function(k, v) {
+ v = v[0];
+ var r = new RegExp(v+'+'),
+ token = v.length > 1 ? v.substring(1, 2) : v;
+
+ tpl = tpl.replace(r, '{'+token+'}');
+ });
+
+ //replace spaces with
+ tpl = tpl.replace(/ /g, ' ');
+
+ //second pass
+ $.each(this.map, function(k, v) {
+ v = v[0];
+ var token = v.length > 1 ? v.substring(1, 2) : v;
+
+ tpl = tpl.replace('{'+token+'}', ' ');
+ });
+
+ return tpl;
+ },
+
+ /*
+ Initialize combos that presents in template
+ */
+ initCombos: function() {
+ for (var k in this.map) {
+ var $c = this.$widget.find('.'+k);
+ // set properties like this.$day, this.$month etc.
+ this['$'+k] = $c.length ? $c : null;
+ // fill with items
+ this.fillCombo(k);
+ }
+ },
+
+ /*
+ Fill combo with items
+ */
+ fillCombo: function(k) {
+ var $combo = this['$'+k];
+ if (!$combo) {
+ return;
+ }
+
+ // define method name to fill items, e.g `fillDays`
+ var f = 'fill' + k.charAt(0).toUpperCase() + k.slice(1);
+ var items = this[f]();
+ var value = $combo.val();
+
+ $combo.empty();
+ for(var i=0; i'+items[i][1]+'');
+ }
+
+ $combo.val(value);
+ },
+
+ /*
+ Initialize items of combos. Handles `firstItem` option
+ */
+ fillCommon: function(key) {
+ var values = [],
+ relTime;
+
+ if(this.options.firstItem === 'name') {
+ //need both to support moment ver < 2 and >= 2
+ relTime = moment.relativeTime || moment.langData()._relativeTime;
+ var header = typeof relTime[key] === 'function' ? relTime[key](1, true, key, false) : relTime[key];
+ //take last entry (see momentjs lang files structure)
+ header = header.split(' ').reverse()[0];
+ values.push(['', header]);
+ } else if(this.options.firstItem === 'empty') {
+ values.push(['', '']);
+ }
+ return values;
+ },
+
+
+ /*
+ fill day
+ */
+ fillDay: function() {
+ var items = this.fillCommon('d'), name, i,
+ twoDigit = this.options.template.indexOf('DD') !== -1,
+ daysCount = 31;
+
+ // detect days count (depends on month and year)
+ // originally https://github.com/vitalets/combodate/pull/7
+ if (this.options.smartDays && this.$month && this.$year) {
+ var month = parseInt(this.$month.val(), 10);
+ var year = parseInt(this.$year.val(), 10);
+
+ if (!isNaN(month) && !isNaN(year)) {
+ daysCount = moment([year, month]).daysInMonth();
+ }
+ }
+
+ for (i = 1; i <= daysCount; i++) {
+ name = twoDigit ? this.leadZero(i) : i;
+ items.push([i, name]);
+ }
+ return items;
+ },
+
+ /*
+ fill month
+ */
+ fillMonth: function() {
+ var items = this.fillCommon('M'), name, i,
+ longNames = this.options.template.indexOf('MMMM') !== -1,
+ shortNames = this.options.template.indexOf('MMM') !== -1,
+ twoDigit = this.options.template.indexOf('MM') !== -1;
+
+ for(i=0; i<=11; i++) {
+ if(longNames) {
+ //see https://github.com/timrwood/momentjs.com/pull/36
+ name = moment().date(1).month(i).format('MMMM');
+ } else if(shortNames) {
+ name = moment().date(1).month(i).format('MMM');
+ } else if(twoDigit) {
+ name = this.leadZero(i+1);
+ } else {
+ name = i+1;
+ }
+ items.push([i, name]);
+ }
+ return items;
+ },
+
+ /*
+ fill year
+ */
+ fillYear: function() {
+ var items = [], name, i,
+ longNames = this.options.template.indexOf('YYYY') !== -1;
+
+ for(i=this.options.maxYear; i>=this.options.minYear; i--) {
+ name = longNames ? i : (i+'').substring(2);
+ items[this.options.yearDescending ? 'push' : 'unshift']([i, name]);
+ }
+
+ items = this.fillCommon('y').concat(items);
+
+ return items;
+ },
+
+ /*
+ fill hour
+ */
+ fillHour: function() {
+ var items = this.fillCommon('h'), name, i,
+ h12 = this.options.template.indexOf('h') !== -1,
+ h24 = this.options.template.indexOf('H') !== -1,
+ twoDigit = this.options.template.toLowerCase().indexOf('hh') !== -1,
+ min = h12 ? 1 : 0,
+ max = h12 ? 12 : 23;
+
+ for(i=min; i<=max; i++) {
+ name = twoDigit ? this.leadZero(i) : i;
+ items.push([i, name]);
+ }
+ return items;
+ },
+
+ /*
+ fill minute
+ */
+ fillMinute: function() {
+ var items = this.fillCommon('m'), name, i,
+ twoDigit = this.options.template.indexOf('mm') !== -1;
+
+ for(i=0; i<=59; i+= this.options.minuteStep) {
+ name = twoDigit ? this.leadZero(i) : i;
+ items.push([i, name]);
+ }
+ return items;
+ },
+
+ /*
+ fill second
+ */
+ fillSecond: function() {
+ var items = this.fillCommon('s'), name, i,
+ twoDigit = this.options.template.indexOf('ss') !== -1;
+
+ for(i=0; i<=59; i+= this.options.secondStep) {
+ name = twoDigit ? this.leadZero(i) : i;
+ items.push([i, name]);
+ }
+ return items;
+ },
+
+ /*
+ fill ampm
+ */
+ fillAmpm: function() {
+ var ampmL = this.options.template.indexOf('a') !== -1,
+ ampmU = this.options.template.indexOf('A') !== -1,
+ items = [
+ ['am', ampmL ? 'am' : 'AM'],
+ ['pm', ampmL ? 'pm' : 'PM']
+ ];
+ return items;
+ },
+
+ /*
+ Returns current date value from combos.
+ If format not specified - `options.format` used.
+ If format = `null` - Moment object returned.
+ */
+ getValue: function(format) {
+ var dt, values = {},
+ that = this,
+ notSelected = false;
+
+ //getting selected values
+ $.each(this.map, function(k, v) {
+ if(k === 'ampm') {
+ return;
+ }
+ var def = k === 'day' ? 1 : 0;
+
+ values[k] = that['$'+k] ? parseInt(that['$'+k].val(), 10) : def;
+
+ if(isNaN(values[k])) {
+ notSelected = true;
+ return false;
+ }
+ });
+
+ //if at least one visible combo not selected - return empty string
+ if(notSelected) {
+ return '';
+ }
+
+ //convert hours 12h --> 24h
+ if(this.$ampm) {
+ //12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
+ if(values.hour === 12) {
+ values.hour = this.$ampm.val() === 'am' ? 0 : 12;
+ } else {
+ values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12;
+ }
+ }
+
+ dt = moment([values.year, values.month, values.day, values.hour, values.minute, values.second]);
+
+ //highlight invalid date
+ this.highlight(dt);
+
+ format = format === undefined ? this.options.format : format;
+ if(format === null) {
+ return dt.isValid() ? dt : null;
+ } else {
+ return dt.isValid() ? dt.format(format) : '';
+ }
+ },
+
+ setValue: function(value) {
+ if(!value) {
+ return;
+ }
+
+ var dt = typeof value === 'string' ? moment(value, this.options.format) : moment(value),
+ that = this,
+ values = {};
+
+ //function to find nearest value in select options
+ function getNearest($select, value) {
+ var delta = {};
+ $select.children('option').each(function(i, opt){
+ var optValue = $(opt).attr('value'),
+ distance;
+
+ if(optValue === '') return;
+ distance = Math.abs(optValue - value);
+ if(typeof delta.distance === 'undefined' || distance < delta.distance) {
+ delta = {value: optValue, distance: distance};
+ }
+ });
+ return delta.value;
+ }
+
+ if(dt.isValid()) {
+ //read values from date object
+ $.each(this.map, function(k, v) {
+ if(k === 'ampm') {
+ return;
+ }
+ values[k] = dt[v[1]]();
+ });
+
+ if(this.$ampm) {
+ //12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
+ if(values.hour >= 12) {
+ values.ampm = 'pm';
+ if(values.hour > 12) {
+ values.hour -= 12;
+ }
+ } else {
+ values.ampm = 'am';
+ if(values.hour === 0) {
+ values.hour = 12;
+ }
+ }
+ }
+
+ $.each(values, function(k, v) {
+ //call val() for each existing combo, e.g. this.$hour.val()
+ if(that['$'+k]) {
+
+ if(k === 'minute' && that.options.minuteStep > 1 && that.options.roundTime) {
+ v = getNearest(that['$'+k], v);
+ }
+
+ if(k === 'second' && that.options.secondStep > 1 && that.options.roundTime) {
+ v = getNearest(that['$'+k], v);
+ }
+
+ that['$'+k].val(v);
+ }
+ });
+
+ // update days count
+ if (this.options.smartDays) {
+ this.fillCombo('day');
+ }
+
+ this.$element.val(dt.format(this.options.format)).change();
+ }
+ },
+
+ /*
+ highlight combos if date is invalid
+ */
+ highlight: function(dt) {
+ if(!dt.isValid()) {
+ if(this.options.errorClass) {
+ this.$widget.addClass(this.options.errorClass);
+ } else {
+ //store original border color
+ if(!this.borderColor) {
+ this.borderColor = this.$widget.find('select').css('border-color');
+ }
+ this.$widget.find('select').css('border-color', 'red');
+ }
+ } else {
+ if(this.options.errorClass) {
+ this.$widget.removeClass(this.options.errorClass);
+ } else {
+ this.$widget.find('select').css('border-color', this.borderColor);
+ }
+ }
+ },
+
+ leadZero: function(v) {
+ return v <= 9 ? '0' + v : v;
+ },
+
+ destroy: function() {
+ this.$widget.remove();
+ this.$element.removeData('combodate').show();
+ }
+
+ //todo: clear method
+ };
+
+ $.fn.combodate = function ( option ) {
+ var d, args = Array.apply(null, arguments);
+ args.shift();
+
+ //getValue returns date as string / object (not jQuery object)
+ if(option === 'getValue' && this.length && (d = this.eq(0).data('combodate'))) {
+ return d.getValue.apply(d, args);
+ }
+
+ return this.each(function () {
+ var $this = $(this),
+ data = $this.data('combodate'),
+ options = typeof option == 'object' && option;
+ if (!data) {
+ $this.data('combodate', (data = new Combodate(this, options)));
+ }
+ if (typeof option == 'string' && typeof data[option] == 'function') {
+ data[option].apply(data, args);
+ }
+ });
+ };
+
+ $.fn.combodate.defaults = {
+ //in this format value stored in original input
+ format: 'DD-MM-YYYY HH:mm',
+ //in this format items in dropdowns are displayed
+ template: 'D / MMM / YYYY H : mm',
+ //initial value, can be `new Date()`
+ value: null,
+ minYear: 1970,
+ maxYear: 2015,
+ yearDescending: true,
+ minuteStep: 5,
+ secondStep: 1,
+ firstItem: 'empty', //'name', 'empty', 'none'
+ errorClass: null,
+ roundTime: true, // whether to round minutes and seconds if step > 1
+ smartDays: false // whether days in combo depend on selected month: 31, 30, 28
+ };
+
+}(window.jQuery));
+/**
+Combodate input - dropdown date and time picker.
+Based on [combodate](http://vitalets.github.com/combodate) plugin (included). To use it you should manually include [momentjs](http://momentjs.com).
+
+
+
+Allows to input:
+
+* only date
+* only time
+* both date and time
+
+Please note, that format is taken from momentjs and **not compatible** with bootstrap-datepicker / jquery UI datepicker.
+Internally value stored as `momentjs` object.
+
+@class combodate
+@extends abstractinput
+@final
+@since 1.4.0
+@example
+
+
+**/
+
+/*global moment*/
+
+(function ($) {
+ "use strict";
+
+ var Constructor = function (options) {
+ this.init('combodate', options, Constructor.defaults);
+
+ //by default viewformat equals to format
+ if(!this.options.viewformat) {
+ this.options.viewformat = this.options.format;
+ }
+
+ //try parse combodate config defined as json string in data-combodate
+ options.combodate = $.fn.editableutils.tryParseJson(options.combodate, true);
+
+ //overriding combodate config (as by default jQuery extend() is not recursive)
+ this.options.combodate = $.extend({}, Constructor.defaults.combodate, options.combodate, {
+ format: this.options.format,
+ template: this.options.template
+ });
+ };
+
+ $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
+
+ $.extend(Constructor.prototype, {
+ render: function () {
+ this.$input.combodate(this.options.combodate);
+
+ if($.fn.editableform.engine === 'bs3') {
+ this.$input.siblings().find('select').addClass('form-control');
+ }
+
+ if(this.options.inputclass) {
+ this.$input.siblings().find('select').addClass(this.options.inputclass);
+ }
+ //"clear" link
+ /*
+ if(this.options.clear) {
+ this.$clear = $(' ').html(this.options.clear).click($.proxy(function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ this.clear();
+ }, this));
+
+ this.$tpl.parent().append($('').append(this.$clear));
+ }
+ */
+ },
+
+ value2html: function(value, element) {
+ var text = value ? value.format(this.options.viewformat) : '';
+ //$(element).text(text);
+ Constructor.superclass.value2html.call(this, text, element);
+ },
+
+ html2value: function(html) {
+ return html ? moment(html, this.options.viewformat) : null;
+ },
+
+ value2str: function(value) {
+ return value ? value.format(this.options.format) : '';
+ },
+
+ str2value: function(str) {
+ return str ? moment(str, this.options.format) : null;
+ },
+
+ value2submit: function(value) {
+ return this.value2str(value);
+ },
+
+ value2input: function(value) {
+ this.$input.combodate('setValue', value);
+ },
+
+ input2value: function() {
+ return this.$input.combodate('getValue', null);
+ },
+
+ activate: function() {
+ this.$input.siblings('.combodate').find('select').eq(0).focus();
+ },
+
+ /*
+ clear: function() {
+ this.$input.data('datepicker').date = null;
+ this.$input.find('.active').removeClass('active');
+ },
+ */
+
+ autosubmit: function() {
+
+ }
+
+ });
+
+ Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl:'
',
+ /**
+ @property inputclass
+ @default null
+ **/
+ inputclass: null,
+ /**
+ Format used for sending value to server. Also applied when converting date from
data-value
attribute.
+ See list of tokens in [momentjs docs](http://momentjs.com/docs/#/parsing/string-format)
+
+ @property format
+ @type string
+ @default YYYY-MM-DD
+ **/
+ format:'YYYY-MM-DD',
+ /**
+ Format used for displaying date. Also applied when converting date from element's text on init.
+ If not specified equals to `format`.
+
+ @property viewformat
+ @type string
+ @default null
+ **/
+ viewformat: null,
+ /**
+ Template used for displaying dropdowns.
+
+ @property template
+ @type string
+ @default D / MMM / YYYY
+ **/
+ template: 'D / MMM / YYYY',
+ /**
+ Configuration of combodate.
+ Full list of options: http://vitalets.github.com/combodate/#docs
+
+ @property combodate
+ @type object
+ @default null
+ **/
+ combodate: null
+
+ /*
+ (not implemented yet)
+ Text shown as clear date button.
+ If
false
clear button will not be rendered.
+
+ @property clear
+ @type boolean|string
+ @default 'x clear'
+ */
+ //clear: '× clear'
+ });
+
+ $.fn.editabletypes.combodate = Constructor;
+
+}(window.jQuery));
+
+/*
+Editableform based on Twitter Bootstrap 3
+*/
+(function ($) {
+ "use strict";
+
+ //store parent methods
+ var pInitInput = $.fn.editableform.Constructor.prototype.initInput;
+
+ $.extend($.fn.editableform.Constructor.prototype, {
+ initTemplate: function() {
+ this.$form = $($.fn.editableform.template);
+ this.$form.find('.control-group').addClass('form-group');
+ this.$form.find('.editable-error-block').addClass('help-block');
+ },
+ initInput: function() {
+ pInitInput.apply(this);
+
+ //for bs3 set default class `input-sm` to standard inputs
+ var emptyInputClass = this.input.options.inputclass === null || this.input.options.inputclass === false;
+ var defaultClass = 'input-sm';
+
+ //bs3 add `form-control` class to standard inputs
+ var stdtypes = 'text,select,textarea,password,email,url,tel,number,range,time,typeaheadjs'.split(',');
+ if(~$.inArray(this.input.type, stdtypes)) {
+ this.input.$input.addClass('form-control');
+ if(emptyInputClass) {
+ this.input.options.inputclass = defaultClass;
+ this.input.$input.addClass(defaultClass);
+ }
+ }
+
+ //apply bs3 size class also to buttons (to fit size of control)
+ var $btn = this.$form.find('.editable-buttons');
+ var classes = emptyInputClass ? [defaultClass] : this.input.options.inputclass.split(' ');
+ for(var i=0; i
'+
+ ' '+
+ ''+
+ ''+
+ ' '+
+ ' ';
+
+ //error classes
+ $.fn.editableform.errorGroupClass = 'has-error';
+ $.fn.editableform.errorBlockClass = null;
+ //engine
+ $.fn.editableform.engine = 'bs3';
+}(window.jQuery));
+/**
+* Editable Popover3 (for Bootstrap 3)
+* ---------------------
+* requires bootstrap-popover.js
+*/
+(function ($) {
+ "use strict";
+
+ //extend methods
+ $.extend($.fn.editableContainer.Popup.prototype, {
+ containerName: 'popover',
+ containerDataName: 'bs.popover',
+ innerCss: '.popover-content',
+ defaults: $.fn.popover.Constructor.DEFAULTS,
+
+ initContainer: function(){
+ $.extend(this.containerOptions, {
+ trigger: 'manual',
+ selector: false,
+ content: ' ',
+ template: this.defaults.template
+ });
+
+ //as template property is used in inputs, hide it from popover
+ var t;
+ if(this.$element.data('template')) {
+ t = this.$element.data('template');
+ this.$element.removeData('template');
+ }
+
+ this.call(this.containerOptions);
+
+ if(t) {
+ //restore data('template')
+ this.$element.data('template', t);
+ }
+ },
+
+ /* show */
+ innerShow: function () {
+ this.call('show');
+ },
+
+ /* hide */
+ innerHide: function () {
+ this.call('hide');
+ },
+
+ /* destroy */
+ innerDestroy: function() {
+ this.call('destroy');
+ },
+
+ setContainerOption: function(key, value) {
+ this.container().options[key] = value;
+ },
+
+ /**
+ * move popover to new position. This function mainly copied from bootstrap-popover.
+ */
+ /*jshint laxcomma: true, eqeqeq: false*/
+ setPosition: function () {
+
+ (function() {
+ /*
+ var $tip = this.tip()
+ , inside
+ , pos
+ , actualWidth
+ , actualHeight
+ , placement
+ , tp
+ , tpt
+ , tpb
+ , tpl
+ , tpr;
+
+ placement = typeof this.options.placement === 'function' ?
+ this.options.placement.call(this, $tip[0], this.$element[0]) :
+ this.options.placement;
+
+ inside = /in/.test(placement);
+
+ $tip
+ // .detach()
+ //vitalets: remove any placement class because otherwise they dont influence on re-positioning of visible popover
+ .removeClass('top right bottom left')
+ .css({ top: 0, left: 0, display: 'block' });
+ // .insertAfter(this.$element);
+
+ pos = this.getPosition(inside);
+
+ actualWidth = $tip[0].offsetWidth;
+ actualHeight = $tip[0].offsetHeight;
+
+ placement = inside ? placement.split(' ')[1] : placement;
+
+ tpb = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2};
+ tpt = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2};
+ tpl = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth};
+ tpr = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width};
+
+ switch (placement) {
+ case 'bottom':
+ if ((tpb.top + actualHeight) > ($(window).scrollTop() + $(window).height())) {
+ if (tpt.top > $(window).scrollTop()) {
+ placement = 'top';
+ } else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
+ placement = 'right';
+ } else if (tpl.left > $(window).scrollLeft()) {
+ placement = 'left';
+ } else {
+ placement = 'right';
+ }
+ }
+ break;
+ case 'top':
+ if (tpt.top < $(window).scrollTop()) {
+ if ((tpb.top + actualHeight) < ($(window).scrollTop() + $(window).height())) {
+ placement = 'bottom';
+ } else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
+ placement = 'right';
+ } else if (tpl.left > $(window).scrollLeft()) {
+ placement = 'left';
+ } else {
+ placement = 'right';
+ }
+ }
+ break;
+ case 'left':
+ if (tpl.left < $(window).scrollLeft()) {
+ if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
+ placement = 'right';
+ } else if (tpt.top > $(window).scrollTop()) {
+ placement = 'top';
+ } else if (tpt.top > $(window).scrollTop()) {
+ placement = 'bottom';
+ } else {
+ placement = 'right';
+ }
+ }
+ break;
+ case 'right':
+ if ((tpr.left + actualWidth) > ($(window).scrollLeft() + $(window).width())) {
+ if (tpl.left > $(window).scrollLeft()) {
+ placement = 'left';
+ } else if (tpt.top > $(window).scrollTop()) {
+ placement = 'top';
+ } else if (tpt.top > $(window).scrollTop()) {
+ placement = 'bottom';
+ }
+ }
+ break;
+ }
+
+ switch (placement) {
+ case 'bottom':
+ tp = tpb;
+ break;
+ case 'top':
+ tp = tpt;
+ break;
+ case 'left':
+ tp = tpl;
+ break;
+ case 'right':
+ tp = tpr;
+ break;
+ }
+
+ $tip
+ .offset(tp)
+ .addClass(placement)
+ .addClass('in');
+ */
+
+
+ var $tip = this.tip();
+
+ var placement = typeof this.options.placement == 'function' ?
+ this.options.placement.call(this, $tip[0], this.$element[0]) :
+ this.options.placement;
+
+ var autoToken = /\s?auto?\s?/i;
+ var autoPlace = autoToken.test(placement);
+ if (autoPlace) {
+ placement = placement.replace(autoToken, '') || 'top';
+ }
+
+
+ var pos = this.getPosition();
+ var actualWidth = $tip[0].offsetWidth;
+ var actualHeight = $tip[0].offsetHeight;
+
+ if (autoPlace) {
+ var $parent = this.$element.parent();
+
+ var orgPlacement = placement;
+ var docScroll = document.documentElement.scrollTop || document.body.scrollTop;
+ var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth();
+ var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight();
+ var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left;
+
+ placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
+ placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
+ placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
+ placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
+ placement;
+
+ $tip
+ .removeClass(orgPlacement)
+ .addClass(placement);
+ }
+
+
+ var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
+
+ this.applyPlacement(calculatedOffset, placement);
+
+
+ }).call(this.container());
+ /*jshint laxcomma: false, eqeqeq: true*/
+ }
+ });
+
+}(window.jQuery));
+
+/* =========================================================
+ * bootstrap-datepicker.js
+ * http://www.eyecon.ro/bootstrap-datepicker
+ * =========================================================
+ * Copyright 2012 Stefan Petre
+ * Improvements by Andrew Rowls
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================= */
+
+(function( $ ) {
+
+ function UTCDate(){
+ return new Date(Date.UTC.apply(Date, arguments));
+ }
+ function UTCToday(){
+ var today = new Date();
+ return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
+ }
+
+ // Picker object
+
+ var Datepicker = function(element, options) {
+ var that = this;
+
+ this._process_options(options);
+
+ this.element = $(element);
+ this.isInline = false;
+ this.isInput = this.element.is('input');
+ this.component = this.element.is('.date') ? this.element.find('.add-on, .btn') : false;
+ this.hasInput = this.component && this.element.find('input').length;
+ if(this.component && this.component.length === 0)
+ this.component = false;
+
+ this.picker = $(DPGlobal.template);
+ this._buildEvents();
+ this._attachEvents();
+
+ if(this.isInline) {
+ this.picker.addClass('datepicker-inline').appendTo(this.element);
+ } else {
+ this.picker.addClass('datepicker-dropdown dropdown-menu');
+ }
+
+ if (this.o.rtl){
+ this.picker.addClass('datepicker-rtl');
+ this.picker.find('.prev i, .next i')
+ .toggleClass('icon-arrow-left icon-arrow-right');
+ }
+
+
+ this.viewMode = this.o.startView;
+
+ if (this.o.calendarWeeks)
+ this.picker.find('tfoot th.today')
+ .attr('colspan', function(i, val){
+ return parseInt(val) + 1;
+ });
+
+ this._allow_update = false;
+
+ this.setStartDate(this.o.startDate);
+ this.setEndDate(this.o.endDate);
+ this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
+
+ this.fillDow();
+ this.fillMonths();
+
+ this._allow_update = true;
+
+ this.update();
+ this.showMode();
+
+ if(this.isInline) {
+ this.show();
+ }
+ };
+
+ Datepicker.prototype = {
+ constructor: Datepicker,
+
+ _process_options: function(opts){
+ // Store raw options for reference
+ this._o = $.extend({}, this._o, opts);
+ // Processed options
+ var o = this.o = $.extend({}, this._o);
+
+ // Check if "de-DE" style date is available, if not language should
+ // fallback to 2 letter code eg "de"
+ var lang = o.language;
+ if (!dates[lang]) {
+ lang = lang.split('-')[0];
+ if (!dates[lang])
+ lang = defaults.language;
+ }
+ o.language = lang;
+
+ switch(o.startView){
+ case 2:
+ case 'decade':
+ o.startView = 2;
+ break;
+ case 1:
+ case 'year':
+ o.startView = 1;
+ break;
+ default:
+ o.startView = 0;
+ }
+
+ switch (o.minViewMode) {
+ case 1:
+ case 'months':
+ o.minViewMode = 1;
+ break;
+ case 2:
+ case 'years':
+ o.minViewMode = 2;
+ break;
+ default:
+ o.minViewMode = 0;
+ }
+
+ o.startView = Math.max(o.startView, o.minViewMode);
+
+ o.weekStart %= 7;
+ o.weekEnd = ((o.weekStart + 6) % 7);
+
+ var format = DPGlobal.parseFormat(o.format)
+ if (o.startDate !== -Infinity) {
+ o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
+ }
+ if (o.endDate !== Infinity) {
+ o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
+ }
+
+ o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
+ if (!$.isArray(o.daysOfWeekDisabled))
+ o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
+ o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
+ return parseInt(d, 10);
+ });
+ },
+ _events: [],
+ _secondaryEvents: [],
+ _applyEvents: function(evs){
+ for (var i=0, el, ev; i this.o.endDate) {
+ this.viewDate = new Date(this.o.endDate);
+ } else {
+ this.viewDate = new Date(this.date);
+ }
+ this.fill();
+ },
+
+ fillDow: function(){
+ var dowCnt = this.o.weekStart,
+ html = '';
+ if(this.o.calendarWeeks){
+ var cell = ' ';
+ html += cell;
+ this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
+ }
+ while (dowCnt < this.o.weekStart + 7) {
+ html += ''+dates[this.o.language].daysMin[(dowCnt++)%7]+' ';
+ }
+ html += ' ';
+ this.picker.find('.datepicker-days thead').append(html);
+ },
+
+ fillMonths: function(){
+ var html = '',
+ i = 0;
+ while (i < 12) {
+ html += ''+dates[this.o.language].monthsShort[i++]+' ';
+ }
+ this.picker.find('.datepicker-months td').html(html);
+ },
+
+ setRange: function(range){
+ if (!range || !range.length)
+ delete this.range;
+ else
+ this.range = $.map(range, function(d){ return d.valueOf(); });
+ this.fill();
+ },
+
+ getClassNames: function(date){
+ var cls = [],
+ year = this.viewDate.getUTCFullYear(),
+ month = this.viewDate.getUTCMonth(),
+ currentDate = this.date.valueOf(),
+ today = new Date();
+ if (date.getUTCFullYear() < year || (date.getUTCFullYear() == year && date.getUTCMonth() < month)) {
+ cls.push('old');
+ } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() == year && date.getUTCMonth() > month)) {
+ cls.push('new');
+ }
+ // Compare internal UTC date with local today, not UTC today
+ if (this.o.todayHighlight &&
+ date.getUTCFullYear() == today.getFullYear() &&
+ date.getUTCMonth() == today.getMonth() &&
+ date.getUTCDate() == today.getDate()) {
+ cls.push('today');
+ }
+ if (currentDate && date.valueOf() == currentDate) {
+ cls.push('active');
+ }
+ if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
+ $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1) {
+ cls.push('disabled');
+ }
+ if (this.range){
+ if (date > this.range[0] && date < this.range[this.range.length-1]){
+ cls.push('range');
+ }
+ if ($.inArray(date.valueOf(), this.range) != -1){
+ cls.push('selected');
+ }
+ }
+ return cls;
+ },
+
+ fill: function() {
+ var d = new Date(this.viewDate),
+ year = d.getUTCFullYear(),
+ month = d.getUTCMonth(),
+ startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
+ startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
+ endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
+ endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
+ currentDate = this.date && this.date.valueOf(),
+ tooltip;
+ this.picker.find('.datepicker-days thead th.datepicker-switch')
+ .text(dates[this.o.language].months[month]+' '+year);
+ this.picker.find('tfoot th.today')
+ .text(dates[this.o.language].today)
+ .toggle(this.o.todayBtn !== false);
+ this.picker.find('tfoot th.clear')
+ .text(dates[this.o.language].clear)
+ .toggle(this.o.clearBtn !== false);
+ this.updateNavArrows();
+ this.fillMonths();
+ var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
+ day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
+ prevMonth.setUTCDate(day);
+ prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
+ var nextMonth = new Date(prevMonth);
+ nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
+ nextMonth = nextMonth.valueOf();
+ var html = [];
+ var clsName;
+ while(prevMonth.valueOf() < nextMonth) {
+ if (prevMonth.getUTCDay() == this.o.weekStart) {
+ html.push('');
+ if(this.o.calendarWeeks){
+ // ISO 8601: First week contains first thursday.
+ // ISO also states week starts on Monday, but we can be more abstract here.
+ var
+ // Start of current week: based on weekstart/current date
+ ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
+ // Thursday of this week
+ th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
+ // First Thursday of year, year from thursday
+ yth = new Date(+(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
+ // Calendar week: ms between thursdays, div ms per day, div 7 days
+ calWeek = (th - yth) / 864e5 / 7 + 1;
+ html.push(''+ calWeek +' ');
+
+ }
+ }
+ clsName = this.getClassNames(prevMonth);
+ clsName.push('day');
+
+ var before = this.o.beforeShowDay(prevMonth);
+ if (before === undefined)
+ before = {};
+ else if (typeof(before) === 'boolean')
+ before = {enabled: before};
+ else if (typeof(before) === 'string')
+ before = {classes: before};
+ if (before.enabled === false)
+ clsName.push('disabled');
+ if (before.classes)
+ clsName = clsName.concat(before.classes.split(/\s+/));
+ if (before.tooltip)
+ tooltip = before.tooltip;
+
+ clsName = $.unique(clsName);
+ html.push(''+prevMonth.getUTCDate() + ' ');
+ if (prevMonth.getUTCDay() == this.o.weekEnd) {
+ html.push(' ');
+ }
+ prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
+ }
+ this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
+ var currentYear = this.date && this.date.getUTCFullYear();
+
+ var months = this.picker.find('.datepicker-months')
+ .find('th:eq(1)')
+ .text(year)
+ .end()
+ .find('span').removeClass('active');
+ if (currentYear && currentYear == year) {
+ months.eq(this.date.getUTCMonth()).addClass('active');
+ }
+ if (year < startYear || year > endYear) {
+ months.addClass('disabled');
+ }
+ if (year == startYear) {
+ months.slice(0, startMonth).addClass('disabled');
+ }
+ if (year == endYear) {
+ months.slice(endMonth+1).addClass('disabled');
+ }
+
+ html = '';
+ year = parseInt(year/10, 10) * 10;
+ var yearCont = this.picker.find('.datepicker-years')
+ .find('th:eq(1)')
+ .text(year + '-' + (year + 9))
+ .end()
+ .find('td');
+ year -= 1;
+ for (var i = -1; i < 11; i++) {
+ html += ''+year+' ';
+ year += 1;
+ }
+ yearCont.html(html);
+ },
+
+ updateNavArrows: function() {
+ if (!this._allow_update) return;
+
+ var d = new Date(this.viewDate),
+ year = d.getUTCFullYear(),
+ month = d.getUTCMonth();
+ switch (this.viewMode) {
+ case 0:
+ if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()) {
+ this.picker.find('.prev').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.prev').css({visibility: 'visible'});
+ }
+ if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()) {
+ this.picker.find('.next').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.next').css({visibility: 'visible'});
+ }
+ break;
+ case 1:
+ case 2:
+ if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()) {
+ this.picker.find('.prev').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.prev').css({visibility: 'visible'});
+ }
+ if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()) {
+ this.picker.find('.next').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.next').css({visibility: 'visible'});
+ }
+ break;
+ }
+ },
+
+ click: function(e) {
+ e.preventDefault();
+ var target = $(e.target).closest('span, td, th');
+ if (target.length == 1) {
+ switch(target[0].nodeName.toLowerCase()) {
+ case 'th':
+ switch(target[0].className) {
+ case 'datepicker-switch':
+ this.showMode(1);
+ break;
+ case 'prev':
+ case 'next':
+ var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
+ switch(this.viewMode){
+ case 0:
+ this.viewDate = this.moveMonth(this.viewDate, dir);
+ break;
+ case 1:
+ case 2:
+ this.viewDate = this.moveYear(this.viewDate, dir);
+ break;
+ }
+ this.fill();
+ break;
+ case 'today':
+ var date = new Date();
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+
+ this.showMode(-2);
+ var which = this.o.todayBtn == 'linked' ? null : 'view';
+ this._setDate(date, which);
+ break;
+ case 'clear':
+ var element;
+ if (this.isInput)
+ element = this.element;
+ else if (this.component)
+ element = this.element.find('input');
+ if (element)
+ element.val("").change();
+ this._trigger('changeDate');
+ this.update();
+ if (this.o.autoclose)
+ this.hide();
+ break;
+ }
+ break;
+ case 'span':
+ if (!target.is('.disabled')) {
+ this.viewDate.setUTCDate(1);
+ if (target.is('.month')) {
+ var day = 1;
+ var month = target.parent().find('span').index(target);
+ var year = this.viewDate.getUTCFullYear();
+ this.viewDate.setUTCMonth(month);
+ this._trigger('changeMonth', this.viewDate);
+ if (this.o.minViewMode === 1) {
+ this._setDate(UTCDate(year, month, day,0,0,0,0));
+ }
+ } else {
+ var year = parseInt(target.text(), 10)||0;
+ var day = 1;
+ var month = 0;
+ this.viewDate.setUTCFullYear(year);
+ this._trigger('changeYear', this.viewDate);
+ if (this.o.minViewMode === 2) {
+ this._setDate(UTCDate(year, month, day,0,0,0,0));
+ }
+ }
+ this.showMode(-1);
+ this.fill();
+ }
+ break;
+ case 'td':
+ if (target.is('.day') && !target.is('.disabled')){
+ var day = parseInt(target.text(), 10)||1;
+ var year = this.viewDate.getUTCFullYear(),
+ month = this.viewDate.getUTCMonth();
+ 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._setDate(UTCDate(year, month, day,0,0,0,0));
+ }
+ break;
+ }
+ }
+ },
+
+ _setDate: function(date, which){
+ if (!which || which == 'date')
+ this.date = new Date(date);
+ if (!which || which == 'view')
+ this.viewDate = new Date(date);
+ this.fill();
+ this.setValue();
+ this._trigger('changeDate');
+ var element;
+ if (this.isInput) {
+ element = this.element;
+ } else if (this.component){
+ element = this.element.find('input');
+ }
+ if (element) {
+ element.change();
+ if (this.o.autoclose && (!which || which == 'date')) {
+ this.hide();
+ }
+ }
+ },
+
+ moveMonth: function(date, dir){
+ if (!dir) return date;
+ var new_date = new Date(date.valueOf()),
+ day = new_date.getUTCDate(),
+ month = new_date.getUTCMonth(),
+ mag = Math.abs(dir),
+ new_month, test;
+ dir = dir > 0 ? 1 : -1;
+ if (mag == 1){
+ test = dir == -1
+ // If going back one month, make sure month is not current month
+ // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
+ ? function(){ return new_date.getUTCMonth() == month; }
+ // If going forward one month, make sure month is as expected
+ // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
+ : function(){ return new_date.getUTCMonth() != new_month; };
+ new_month = month + dir;
+ new_date.setUTCMonth(new_month);
+ // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
+ if (new_month < 0 || new_month > 11)
+ new_month = (new_month + 12) % 12;
+ } else {
+ // For magnitudes >1, move one month at a time...
+ for (var i=0; i= this.o.startDate && date <= this.o.endDate;
+ },
+
+ keydown: function(e){
+ if (this.picker.is(':not(:visible)')){
+ if (e.keyCode == 27) // allow escape to hide and re-show picker
+ this.show();
+ return;
+ }
+ var dateChanged = false,
+ dir, day, month,
+ newDate, newViewDate;
+ switch(e.keyCode){
+ case 27: // escape
+ this.hide();
+ e.preventDefault();
+ break;
+ case 37: // left
+ case 39: // right
+ if (!this.o.keyboardNavigation) break;
+ dir = e.keyCode == 37 ? -1 : 1;
+ if (e.ctrlKey){
+ newDate = this.moveYear(this.date, dir);
+ newViewDate = this.moveYear(this.viewDate, dir);
+ } else if (e.shiftKey){
+ newDate = this.moveMonth(this.date, dir);
+ newViewDate = this.moveMonth(this.viewDate, dir);
+ } else {
+ newDate = new Date(this.date);
+ newDate.setUTCDate(this.date.getUTCDate() + dir);
+ newViewDate = new Date(this.viewDate);
+ newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
+ }
+ if (this.dateWithinRange(newDate)){
+ this.date = newDate;
+ this.viewDate = newViewDate;
+ this.setValue();
+ this.update();
+ e.preventDefault();
+ dateChanged = true;
+ }
+ break;
+ case 38: // up
+ case 40: // down
+ if (!this.o.keyboardNavigation) break;
+ dir = e.keyCode == 38 ? -1 : 1;
+ if (e.ctrlKey){
+ newDate = this.moveYear(this.date, dir);
+ newViewDate = this.moveYear(this.viewDate, dir);
+ } else if (e.shiftKey){
+ newDate = this.moveMonth(this.date, dir);
+ newViewDate = this.moveMonth(this.viewDate, dir);
+ } else {
+ newDate = new Date(this.date);
+ newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
+ newViewDate = new Date(this.viewDate);
+ newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
+ }
+ if (this.dateWithinRange(newDate)){
+ this.date = newDate;
+ this.viewDate = newViewDate;
+ this.setValue();
+ this.update();
+ e.preventDefault();
+ dateChanged = true;
+ }
+ break;
+ case 13: // enter
+ this.hide();
+ e.preventDefault();
+ break;
+ case 9: // tab
+ this.hide();
+ break;
+ }
+ if (dateChanged){
+ this._trigger('changeDate');
+ var element;
+ if (this.isInput) {
+ element = this.element;
+ } else if (this.component){
+ element = this.element.find('input');
+ }
+ if (element) {
+ element.change();
+ }
+ }
+ },
+
+ showMode: function(dir) {
+ if (dir) {
+ this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
+ }
+ /*
+ vitalets: fixing bug of very special conditions:
+ jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
+ Method show() does not set display css correctly and datepicker is not shown.
+ Changed to .css('display', 'block') solve the problem.
+ See https://github.com/vitalets/x-editable/issues/37
+
+ In jquery 1.7.2+ everything works fine.
+ */
+ //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
+ this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
+ this.updateNavArrows();
+ }
+ };
+
+ var DateRangePicker = function(element, options){
+ this.element = $(element);
+ this.inputs = $.map(options.inputs, function(i){ return i.jquery ? i[0] : i; });
+ delete options.inputs;
+
+ $(this.inputs)
+ .datepicker(options)
+ .bind('changeDate', $.proxy(this.dateUpdated, this));
+
+ this.pickers = $.map(this.inputs, function(i){ return $(i).data('datepicker'); });
+ this.updateDates();
+ };
+ DateRangePicker.prototype = {
+ updateDates: function(){
+ this.dates = $.map(this.pickers, function(i){ return i.date; });
+ this.updateRanges();
+ },
+ updateRanges: function(){
+ var range = $.map(this.dates, function(d){ return d.valueOf(); });
+ $.each(this.pickers, function(i, p){
+ p.setRange(range);
+ });
+ },
+ dateUpdated: function(e){
+ var dp = $(e.target).data('datepicker'),
+ new_date = dp.getUTCDate(),
+ i = $.inArray(e.target, this.inputs),
+ l = this.inputs.length;
+ if (i == -1) return;
+
+ if (new_date < this.dates[i]){
+ // Date being moved earlier/left
+ while (i>=0 && new_date < this.dates[i]){
+ this.pickers[i--].setUTCDate(new_date);
+ }
+ }
+ else if (new_date > this.dates[i]){
+ // Date being moved later/right
+ while (i this.dates[i]){
+ this.pickers[i++].setUTCDate(new_date);
+ }
+ }
+ this.updateDates();
+ },
+ remove: function(){
+ $.map(this.pickers, function(p){ p.remove(); });
+ delete this.element.data().datepicker;
+ }
+ };
+
+ function opts_from_el(el, prefix){
+ // Derive options from element data-attrs
+ var data = $(el).data(),
+ out = {}, inkey,
+ replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'),
+ prefix = new RegExp('^' + prefix.toLowerCase());
+ for (var key in data)
+ if (prefix.test(key)){
+ inkey = key.replace(replace, function(_,a){ return a.toLowerCase(); });
+ out[inkey] = data[key];
+ }
+ return out;
+ }
+
+ function opts_from_locale(lang){
+ // Derive options from locale plugins
+ var out = {};
+ // Check if "de-DE" style date is available, if not language should
+ // fallback to 2 letter code eg "de"
+ if (!dates[lang]) {
+ lang = lang.split('-')[0]
+ if (!dates[lang])
+ return;
+ }
+ var d = dates[lang];
+ $.each(locale_opts, function(i,k){
+ if (k in d)
+ out[k] = d[k];
+ });
+ return out;
+ }
+
+ var old = $.fn.datepicker;
+ var datepicker = $.fn.datepicker = function ( option ) {
+ var args = Array.apply(null, arguments);
+ args.shift();
+ var internal_return,
+ this_return;
+ this.each(function () {
+ var $this = $(this),
+ data = $this.data('datepicker'),
+ options = typeof option == 'object' && option;
+ if (!data) {
+ var elopts = opts_from_el(this, 'date'),
+ // Preliminary otions
+ xopts = $.extend({}, defaults, elopts, options),
+ locopts = opts_from_locale(xopts.language),
+ // Options priority: js args, data-attrs, locales, defaults
+ opts = $.extend({}, defaults, locopts, elopts, options);
+ if ($this.is('.input-daterange') || opts.inputs){
+ var ropts = {
+ inputs: opts.inputs || $this.find('input').toArray()
+ };
+ $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
+ }
+ else{
+ $this.data('datepicker', (data = new Datepicker(this, opts)));
+ }
+ }
+ if (typeof option == 'string' && typeof data[option] == 'function') {
+ internal_return = data[option].apply(data, args);
+ if (internal_return !== undefined)
+ return false;
+ }
+ });
+ if (internal_return !== undefined)
+ return internal_return;
+ else
+ return this;
+ };
+
+ var defaults = $.fn.datepicker.defaults = {
+ autoclose: false,
+ beforeShowDay: $.noop,
+ calendarWeeks: false,
+ clearBtn: false,
+ daysOfWeekDisabled: [],
+ endDate: Infinity,
+ forceParse: true,
+ format: 'mm/dd/yyyy',
+ keyboardNavigation: true,
+ language: 'en',
+ minViewMode: 0,
+ rtl: false,
+ startDate: -Infinity,
+ startView: 0,
+ todayBtn: false,
+ todayHighlight: false,
+ weekStart: 0
+ };
+ var locale_opts = $.fn.datepicker.locale_opts = [
+ 'format',
+ 'rtl',
+ 'weekStart'
+ ];
+ $.fn.datepicker.Constructor = Datepicker;
+ var dates = $.fn.datepicker.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"],
+ today: "Today",
+ clear: "Clear"
+ }
+ };
+
+ var DPGlobal = {
+ modes: [
+ {
+ clsName: 'days',
+ navFnc: 'Month',
+ navStep: 1
+ },
+ {
+ clsName: 'months',
+ navFnc: 'FullYear',
+ navStep: 1
+ },
+ {
+ clsName: 'years',
+ navFnc: 'FullYear',
+ 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];
+ },
+ validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
+ nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
+ parseFormat: function(format){
+ // IE treats \0 as a string end in inputs (truncating the value),
+ // so it's a bad format delimiter, anyway
+ var separators = format.replace(this.validParts, '\0').split('\0'),
+ parts = format.match(this.validParts);
+ if (!separators || !separators.length || !parts || parts.length === 0){
+ throw new Error("Invalid date format.");
+ }
+ return {separators: separators, parts: parts};
+ },
+ parseDate: function(date, format, language) {
+ if (date instanceof Date) return date;
+ if (typeof format === 'string')
+ format = DPGlobal.parseFormat(format);
+ if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
+ var part_re = /([\-+]\d+)([dmwy])/,
+ parts = date.match(/([\-+]\d+)([dmwy])/g),
+ part, dir;
+ date = new Date();
+ for (var i=0; i'+
+ ''+
+ ' '+
+ ' '+
+ ' '+
+ ' '+
+ '',
+ contTemplate: ' ',
+ footTemplate: ' '
+ };
+ DPGlobal.template = ''+
+ '
'+
+ '
'+
+ DPGlobal.headTemplate+
+ ' '+
+ DPGlobal.footTemplate+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ DPGlobal.headTemplate+
+ DPGlobal.contTemplate+
+ DPGlobal.footTemplate+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ DPGlobal.headTemplate+
+ DPGlobal.contTemplate+
+ DPGlobal.footTemplate+
+ '
'+
+ '
'+
+ '
';
+
+ $.fn.datepicker.DPGlobal = DPGlobal;
+
+
+ /* DATEPICKER NO CONFLICT
+ * =================== */
+
+ $.fn.datepicker.noConflict = function(){
+ $.fn.datepicker = old;
+ return this;
+ };
+
+
+ /* DATEPICKER DATA-API
+ * ================== */
+
+ $(document).on(
+ 'focus.datepicker.data-api click.datepicker.data-api',
+ '[data-provide="datepicker"]',
+ function(e){
+ var $this = $(this);
+ if ($this.data('datepicker')) return;
+ e.preventDefault();
+ // component click requires us to explicitly show it
+ datepicker.call($this, 'show');
+ }
+ );
+ $(function(){
+ //$('[data-provide="datepicker-inline"]').datepicker();
+ //vit: changed to support noConflict()
+ datepicker.call($('[data-provide="datepicker-inline"]'));
+ });
+
+}( window.jQuery ));
+
+/**
+Bootstrap-datepicker.
+Description and examples: https://github.com/eternicode/bootstrap-datepicker.
+For **i18n** you should include js file from here: https://github.com/eternicode/bootstrap-datepicker/tree/master/js/locales
+and set `language` option.
+Since 1.4.0 date has different appearance in **popup** and **inline** modes.
+
+@class date
+@extends abstractinput
+@final
+@example
+15/05/1984
+
+**/
+(function ($) {
+ "use strict";
+
+ //store bootstrap-datepicker as bdateicker to exclude conflict with jQuery UI one
+ $.fn.bdatepicker = $.fn.datepicker.noConflict();
+ if(!$.fn.datepicker) { //if there were no other datepickers, keep also original name
+ $.fn.datepicker = $.fn.bdatepicker;
+ }
+
+ var Date = function (options) {
+ this.init('date', options, Date.defaults);
+ this.initPicker(options, Date.defaults);
+ };
+
+ $.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
+
+ $.extend(Date.prototype, {
+ initPicker: function(options, defaults) {
+ //'format' is set directly from settings or data-* attributes
+
+ //by default viewformat equals to format
+ if(!this.options.viewformat) {
+ this.options.viewformat = this.options.format;
+ }
+
+ //try parse datepicker config defined as json string in data-datepicker
+ options.datepicker = $.fn.editableutils.tryParseJson(options.datepicker, true);
+
+ //overriding datepicker config (as by default jQuery extend() is not recursive)
+ //since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only
+ this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, {
+ format: this.options.viewformat
+ });
+
+ //language
+ this.options.datepicker.language = this.options.datepicker.language || 'en';
+
+ //store DPglobal
+ this.dpg = $.fn.bdatepicker.DPGlobal;
+
+ //store parsed formats
+ this.parsedFormat = this.dpg.parseFormat(this.options.format);
+ this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat);
+ },
+
+ render: function () {
+ this.$input.bdatepicker(this.options.datepicker);
+
+ //"clear" link
+ if(this.options.clear) {
+ this.$clear = $(' ').html(this.options.clear).click($.proxy(function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ this.clear();
+ }, this));
+
+ this.$tpl.parent().append($('').append(this.$clear));
+ }
+ },
+
+ value2html: function(value, element) {
+ var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
+ Date.superclass.value2html.call(this, text, element);
+ },
+
+ html2value: function(html) {
+ return this.parseDate(html, this.parsedViewFormat);
+ },
+
+ value2str: function(value) {
+ return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
+ },
+
+ str2value: function(str) {
+ return this.parseDate(str, this.parsedFormat);
+ },
+
+ value2submit: function(value) {
+ return this.value2str(value);
+ },
+
+ value2input: function(value) {
+ this.$input.bdatepicker('update', value);
+ },
+
+ input2value: function() {
+ return this.$input.data('datepicker').date;
+ },
+
+ activate: function() {
+ },
+
+ clear: function() {
+ this.$input.data('datepicker').date = null;
+ this.$input.find('.active').removeClass('active');
+ if(!this.options.showbuttons) {
+ this.$input.closest('form').submit();
+ }
+ },
+
+ autosubmit: function() {
+ this.$input.on('mouseup', '.day', function(e){
+ if($(e.currentTarget).is('.old') || $(e.currentTarget).is('.new')) {
+ return;
+ }
+ var $form = $(this).closest('form');
+ setTimeout(function() {
+ $form.submit();
+ }, 200);
+ });
+ //changedate is not suitable as it triggered when showing datepicker. see #149
+ /*
+ this.$input.on('changeDate', function(e){
+ var $form = $(this).closest('form');
+ setTimeout(function() {
+ $form.submit();
+ }, 200);
+ });
+ */
+ },
+
+ /*
+ For incorrect date bootstrap-datepicker returns current date that is not suitable
+ for datefield.
+ This function returns null for incorrect date.
+ */
+ parseDate: function(str, format) {
+ var date = null, formattedBack;
+ if(str) {
+ date = this.dpg.parseDate(str, format, this.options.datepicker.language);
+ if(typeof str === 'string') {
+ formattedBack = this.dpg.formatDate(date, format, this.options.datepicker.language);
+ if(str !== formattedBack) {
+ date = null;
+ }
+ }
+ }
+ return date;
+ }
+
+ });
+
+ Date.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl:'
',
+ /**
+ @property inputclass
+ @default null
+ **/
+ inputclass: null,
+ /**
+ Format used for sending value to server. Also applied when converting date from
data-value
attribute.
+ Possible tokens are:
d, dd, m, mm, yy, yyyy
+
+ @property format
+ @type string
+ @default yyyy-mm-dd
+ **/
+ format:'yyyy-mm-dd',
+ /**
+ Format used for displaying date. Also applied when converting date from element's text on init.
+ If not specified equals to
format
+
+ @property viewformat
+ @type string
+ @default null
+ **/
+ viewformat: null,
+ /**
+ Configuration of datepicker.
+ Full list of options: http://bootstrap-datepicker.readthedocs.org/en/latest/options.html
+
+ @property datepicker
+ @type object
+ @default {
+ weekStart: 0,
+ startView: 0,
+ minViewMode: 0,
+ autoclose: false
+ }
+ **/
+ datepicker:{
+ weekStart: 0,
+ startView: 0,
+ minViewMode: 0,
+ autoclose: false
+ },
+ /**
+ Text shown as clear date button.
+ If
false
clear button will not be rendered.
+
+ @property clear
+ @type boolean|string
+ @default 'x clear'
+ **/
+ clear: '× clear'
+ });
+
+ $.fn.editabletypes.date = Date;
+
+}(window.jQuery));
+
+/**
+Bootstrap datefield input - modification for inline mode.
+Shows normal
and binds popup datepicker.
+Automatically shown in inline mode.
+
+@class datefield
+@extends date
+
+@since 1.4.0
+**/
+(function ($) {
+ "use strict";
+
+ var DateField = function (options) {
+ this.init('datefield', options, DateField.defaults);
+ this.initPicker(options, DateField.defaults);
+ };
+
+ $.fn.editableutils.inherit(DateField, $.fn.editabletypes.date);
+
+ $.extend(DateField.prototype, {
+ render: function () {
+ this.$input = this.$tpl.find('input');
+ this.setClass();
+ this.setAttr('placeholder');
+
+ //bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js)
+ this.$tpl.bdatepicker(this.options.datepicker);
+
+ //need to disable original event handlers
+ this.$input.off('focus keydown');
+
+ //update value of datepicker
+ this.$input.keyup($.proxy(function(){
+ this.$tpl.removeData('date');
+ this.$tpl.bdatepicker('update');
+ }, this));
+
+ },
+
+ value2input: function(value) {
+ this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
+ this.$tpl.bdatepicker('update');
+ },
+
+ input2value: function() {
+ return this.html2value(this.$input.val());
+ },
+
+ activate: function() {
+ $.fn.editabletypes.text.prototype.activate.call(this);
+ },
+
+ autosubmit: function() {
+ //reset autosubmit to empty
+ }
+ });
+
+ DateField.defaults = $.extend({}, $.fn.editabletypes.date.defaults, {
+ /**
+ @property tpl
+ **/
+ tpl:'
',
+ /**
+ @property inputclass
+ @default 'input-small'
+ **/
+ inputclass: 'input-small',
+
+ /* datepicker config */
+ datepicker: {
+ weekStart: 0,
+ startView: 0,
+ minViewMode: 0,
+ autoclose: true
+ }
+ });
+
+ $.fn.editabletypes.datefield = DateField;
+
+}(window.jQuery));
+/**
+Bootstrap-datetimepicker.
+Based on [smalot bootstrap-datetimepicker plugin](https://github.com/smalot/bootstrap-datetimepicker).
+Before usage you should manually include dependent js and css:
+
+
+
+
+For **i18n** you should include js file from here: https://github.com/smalot/bootstrap-datetimepicker/tree/master/js/locales
+and set `language` option.
+
+@class datetime
+@extends abstractinput
+@final
+@since 1.4.4
+@example
+
15/03/2013 12:45
+
+**/
+(function ($) {
+ "use strict";
+
+ var DateTime = function (options) {
+ this.init('datetime', options, DateTime.defaults);
+ this.initPicker(options, DateTime.defaults);
+ };
+
+ $.fn.editableutils.inherit(DateTime, $.fn.editabletypes.abstractinput);
+
+ $.extend(DateTime.prototype, {
+ initPicker: function(options, defaults) {
+ //'format' is set directly from settings or data-* attributes
+
+ //by default viewformat equals to format
+ if(!this.options.viewformat) {
+ this.options.viewformat = this.options.format;
+ }
+
+ //try parse datetimepicker config defined as json string in data-datetimepicker
+ options.datetimepicker = $.fn.editableutils.tryParseJson(options.datetimepicker, true);
+
+ //overriding datetimepicker config (as by default jQuery extend() is not recursive)
+ //since 1.4 datetimepicker internally uses viewformat instead of format. Format is for submit only
+ this.options.datetimepicker = $.extend({}, defaults.datetimepicker, options.datetimepicker, {
+ format: this.options.viewformat
+ });
+
+ //language
+ this.options.datetimepicker.language = this.options.datetimepicker.language || 'en';
+
+ //store DPglobal
+ this.dpg = $.fn.datetimepicker.DPGlobal;
+
+ //store parsed formats
+ this.parsedFormat = this.dpg.parseFormat(this.options.format, this.options.formatType);
+ this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat, this.options.formatType);
+ },
+
+ render: function () {
+ this.$input.datetimepicker(this.options.datetimepicker);
+
+ //adjust container position when viewMode changes
+ //see https://github.com/smalot/bootstrap-datetimepicker/pull/80
+ this.$input.on('changeMode', function(e) {
+ var f = $(this).closest('form').parent();
+ //timeout here, otherwise container changes position before form has new size
+ setTimeout(function(){
+ f.triggerHandler('resize');
+ }, 0);
+ });
+
+ //"clear" link
+ if(this.options.clear) {
+ this.$clear = $('
').html(this.options.clear).click($.proxy(function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ this.clear();
+ }, this));
+
+ this.$tpl.parent().append($('
').append(this.$clear));
+ }
+ },
+
+ value2html: function(value, element) {
+ //formatDate works with UTCDate!
+ var text = value ? this.dpg.formatDate(this.toUTC(value), this.parsedViewFormat, this.options.datetimepicker.language, this.options.formatType) : '';
+ if(element) {
+ DateTime.superclass.value2html.call(this, text, element);
+ } else {
+ return text;
+ }
+ },
+
+ html2value: function(html) {
+ //parseDate return utc date!
+ var value = this.parseDate(html, this.parsedViewFormat);
+ return value ? this.fromUTC(value) : null;
+ },
+
+ value2str: function(value) {
+ //formatDate works with UTCDate!
+ return value ? this.dpg.formatDate(this.toUTC(value), this.parsedFormat, this.options.datetimepicker.language, this.options.formatType) : '';
+ },
+
+ str2value: function(str) {
+ //parseDate return utc date!
+ var value = this.parseDate(str, this.parsedFormat);
+ return value ? this.fromUTC(value) : null;
+ },
+
+ value2submit: function(value) {
+ return this.value2str(value);
+ },
+
+ value2input: function(value) {
+ if(value) {
+ this.$input.data('datetimepicker').setDate(value);
+ }
+ },
+
+ input2value: function() {
+ //date may be cleared, in that case getDate() triggers error
+ var dt = this.$input.data('datetimepicker');
+ return dt.date ? dt.getDate() : null;
+ },
+
+ activate: function() {
+ },
+
+ clear: function() {
+ this.$input.data('datetimepicker').date = null;
+ this.$input.find('.active').removeClass('active');
+ if(!this.options.showbuttons) {
+ this.$input.closest('form').submit();
+ }
+ },
+
+ autosubmit: function() {
+ this.$input.on('mouseup', '.minute', function(e){
+ var $form = $(this).closest('form');
+ setTimeout(function() {
+ $form.submit();
+ }, 200);
+ });
+ },
+
+ //convert date from local to utc
+ toUTC: function(value) {
+ return value ? new Date(value.valueOf() - value.getTimezoneOffset() * 60000) : value;
+ },
+
+ //convert date from utc to local
+ fromUTC: function(value) {
+ return value ? new Date(value.valueOf() + value.getTimezoneOffset() * 60000) : value;
+ },
+
+ /*
+ For incorrect date bootstrap-datetimepicker returns current date that is not suitable
+ for datetimefield.
+ This function returns null for incorrect date.
+ */
+ parseDate: function(str, format) {
+ var date = null, formattedBack;
+ if(str) {
+ date = this.dpg.parseDate(str, format, this.options.datetimepicker.language, this.options.formatType);
+ if(typeof str === 'string') {
+ formattedBack = this.dpg.formatDate(date, format, this.options.datetimepicker.language, this.options.formatType);
+ if(str !== formattedBack) {
+ date = null;
+ }
+ }
+ }
+ return date;
+ }
+
+ });
+
+ DateTime.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
+ /**
+ @property tpl
+ @default
+ **/
+ tpl:'
',
+ /**
+ @property inputclass
+ @default null
+ **/
+ inputclass: null,
+ /**
+ Format used for sending value to server. Also applied when converting date from
data-value
attribute.
+ Possible tokens are:
d, dd, m, mm, yy, yyyy, h, i
+
+ @property format
+ @type string
+ @default yyyy-mm-dd hh:ii
+ **/
+ format:'yyyy-mm-dd hh:ii',
+ formatType:'standard',
+ /**
+ Format used for displaying date. Also applied when converting date from element's text on init.
+ If not specified equals to
format
+
+ @property viewformat
+ @type string
+ @default null
+ **/
+ viewformat: null,
+ /**
+ Configuration of datetimepicker.
+ Full list of options: https://github.com/smalot/bootstrap-datetimepicker
+
+ @property datetimepicker
+ @type object
+ @default { }
+ **/
+ datetimepicker:{
+ todayHighlight: false,
+ autoclose: false
+ },
+ /**
+ Text shown as clear date button.
+ If
false
clear button will not be rendered.
+
+ @property clear
+ @type boolean|string
+ @default 'x clear'
+ **/
+ clear: '× clear'
+ });
+
+ $.fn.editabletypes.datetime = DateTime;
+
+}(window.jQuery));
+/**
+Bootstrap datetimefield input - datetime input for inline mode.
+Shows normal
and binds popup datetimepicker.
+Automatically shown in inline mode.
+
+@class datetimefield
+@extends datetime
+
+**/
+(function ($) {
+ "use strict";
+
+ var DateTimeField = function (options) {
+ this.init('datetimefield', options, DateTimeField.defaults);
+ this.initPicker(options, DateTimeField.defaults);
+ };
+
+ $.fn.editableutils.inherit(DateTimeField, $.fn.editabletypes.datetime);
+
+ $.extend(DateTimeField.prototype, {
+ render: function () {
+ this.$input = this.$tpl.find('input');
+ this.setClass();
+ this.setAttr('placeholder');
+
+ this.$tpl.datetimepicker(this.options.datetimepicker);
+
+ //need to disable original event handlers
+ this.$input.off('focus keydown');
+
+ //update value of datepicker
+ this.$input.keyup($.proxy(function(){
+ this.$tpl.removeData('date');
+ this.$tpl.datetimepicker('update');
+ }, this));
+
+ },
+
+ value2input: function(value) {
+ this.$input.val(this.value2html(value));
+ this.$tpl.datetimepicker('update');
+ },
+
+ input2value: function() {
+ return this.html2value(this.$input.val());
+ },
+
+ activate: function() {
+ $.fn.editabletypes.text.prototype.activate.call(this);
+ },
+
+ autosubmit: function() {
+ //reset autosubmit to empty
+ }
+ });
+
+ DateTimeField.defaults = $.extend({}, $.fn.editabletypes.datetime.defaults, {
+ /**
+ @property tpl
+ **/
+ tpl:'
',
+ /**
+ @property inputclass
+ @default 'input-medium'
+ **/
+ inputclass: 'input-medium',
+
+ /* datetimepicker config */
+ datetimepicker:{
+ todayHighlight: false,
+ autoclose: true
+ }
+ });
+
+ $.fn.editabletypes.datetimefield = DateTimeField;
+
+}(window.jQuery));
\ No newline at end of file
diff --git a/public/default/libs/x-editable/js/bootstrap-editable.min.js b/public/default/libs/x-editable/js/bootstrap-editable.min.js
new file mode 100644
index 000000000..e2703aee8
--- /dev/null
+++ b/public/default/libs/x-editable/js/bootstrap-editable.min.js
@@ -0,0 +1,7 @@
+/*! X-editable - v1.5.1
+* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
+* http://github.com/vitalets/x-editable
+* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
+!function(a){"use strict";var b=function(b,c){this.options=a.extend({},a.fn.editableform.defaults,c),this.$div=a(b),this.options.scope||(this.options.scope=this)};b.prototype={constructor:b,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value),this.input.prerender()},initTemplate:function(){this.$form=a(a.fn.editableform.template)},initButtons:function(){var b=this.$form.find(".editable-buttons");b.append(a.fn.editableform.buttons),"bottom"===this.options.showbuttons&&b.addClass("editable-buttons-bottom")},render:function(){this.$loading=a(a.fn.editableform.loading),this.$div.empty().append(this.$loading),this.initTemplate(),this.options.showbuttons?this.initButtons():this.$form.find(".editable-buttons").remove(),this.showLoading(),this.isSaving=!1,this.$div.triggerHandler("rendering"),this.initInput(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),a.when(this.input.render()).then(a.proxy(function(){if(this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(a.proxy(this.cancel,this)),this.input.error)this.error(this.input.error),this.$form.find(".editable-submit").attr("disabled",!0),this.input.$input.attr("disabled",!0),this.$form.submit(function(a){a.preventDefault()});else{this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled");var b=null===this.value||void 0===this.value||""===this.value?this.options.defaultValue:this.value;this.input.value2input(b),this.$form.submit(a.proxy(this.submit,this))}this.$div.triggerHandler("rendered"),this.showForm(),this.input.postrender&&this.input.postrender()},this))},cancel:function(){this.$div.triggerHandler("cancel")},showLoading:function(){var a,b;this.$form?(a=this.$form.outerWidth(),b=this.$form.outerHeight(),a&&this.$loading.width(a),b&&this.$loading.height(b),this.$form.hide()):(a=this.$loading.parent().width(),a&&this.$loading.width(a)),this.$loading.show()},showForm:function(a){this.$loading.hide(),this.$form.show(),a!==!1&&this.input.activate(),this.$div.triggerHandler("show")},error:function(b){var c,d=this.$form.find(".control-group"),e=this.$form.find(".editable-error-block");if(b===!1)d.removeClass(a.fn.editableform.errorGroupClass),e.removeClass(a.fn.editableform.errorBlockClass).empty().hide();else{if(b){c=(""+b).split("\n");for(var f=0;f
").text(c[f]).html();b=c.join(" ")}d.addClass(a.fn.editableform.errorGroupClass),e.addClass(a.fn.editableform.errorBlockClass).html(b).show()}},submit:function(b){b.stopPropagation(),b.preventDefault();var c=this.input.input2value(),d=this.validate(c);if("object"===a.type(d)&&void 0!==d.newValue){if(c=d.newValue,this.input.value2input(c),"string"==typeof d.msg)return this.error(d.msg),this.showForm(),void 0}else if(d)return this.error(d),this.showForm(),void 0;if(!this.options.savenochange&&this.input.value2str(c)==this.input.value2str(this.value))return this.$div.triggerHandler("nochange"),void 0;var e=this.input.value2submit(c);this.isSaving=!0,a.when(this.save(e)).done(a.proxy(function(a){this.isSaving=!1;var b="function"==typeof this.options.success?this.options.success.call(this.options.scope,a,c):null;return b===!1?(this.error(!1),this.showForm(!1),void 0):"string"==typeof b?(this.error(b),this.showForm(),void 0):(b&&"object"==typeof b&&b.hasOwnProperty("newValue")&&(c=b.newValue),this.error(!1),this.value=c,this.$div.triggerHandler("save",{newValue:c,submitValue:e,response:a}),void 0)},this)).fail(a.proxy(function(a){this.isSaving=!1;var b;b="function"==typeof this.options.error?this.options.error.call(this.options.scope,a,c):"string"==typeof a?a:a.responseText||a.statusText||"Unknown error!",this.error(b),this.showForm()},this))},save:function(b){this.options.pk=a.fn.editableutils.tryParseJson(this.options.pk,!0);var c,d="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk,e=!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!==d&&void 0!==d));return e?(this.showLoading(),c={name:this.options.name||"",value:b,pk:d},"function"==typeof this.options.params?c=this.options.params.call(this.options.scope,c):(this.options.params=a.fn.editableutils.tryParseJson(this.options.params,!0),a.extend(c,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,c):a.ajax(a.extend({url:this.options.url,data:c,type:"POST"},this.options.ajaxOptions))):void 0},validate:function(a){return void 0===a&&(a=this.value),"function"==typeof this.options.validate?this.options.validate.call(this.options.scope,a):void 0},option:function(a,b){a in this.options&&(this.options[a]=b),"value"===a&&this.setValue(b)},setValue:function(a,b){this.value=b?this.input.str2value(a):a,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},a.fn.editableform=function(c){var d=arguments;return this.each(function(){var e=a(this),f=e.data("editableform"),g="object"==typeof c&&c;f||e.data("editableform",f=new b(this,g)),"string"==typeof c&&f[c].apply(f,Array.prototype.slice.call(d,1))})},a.fn.editableform.Constructor=b,a.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},a.fn.editableform.template='',a.fn.editableform.loading='
',a.fn.editableform.buttons='ok cancel ',a.fn.editableform.errorGroupClass=null,a.fn.editableform.errorBlockClass="editable-error",a.fn.editableform.engine="jquery"}(window.jQuery),function(a){"use strict";a.fn.editableutils={inherit:function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a,a.superclass=b.prototype},setCursorPosition:function(a,b){if(a.setSelectionRange)a.setSelectionRange(b,b);else if(a.createTextRange){var c=a.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",b),c.select()}},tryParseJson:function(a,b){if("string"==typeof a&&a.length&&a.match(/^[\{\[].*[\}\]]$/))if(b)try{a=new Function("return "+a)()}catch(c){}finally{return a}else a=new Function("return "+a)();return a},sliceObj:function(b,c,d){var e,f,g={};if(!a.isArray(c)||!c.length)return g;for(var h=0;h").text(b).html()},itemsByValue:function(b,c,d){if(!c||null===b)return[];if("function"!=typeof d){var e=d||"value";d=function(a){return a[e]}}var f=a.isArray(b),g=[],h=this;return a.each(c,function(c,e){if(e.children)g=g.concat(h.itemsByValue(b,e.children,d));else if(f)a.grep(b,function(a){return a==(e&&"object"==typeof e?d(e):e)}).length&&g.push(e);else{var i=e&&"object"==typeof e?d(e):e;b==i&&g.push(e)}}),g},createInput:function(b){var c,d,e,f=b.type;return"date"===f&&("inline"===b.mode?a.fn.editabletypes.datefield?f="datefield":a.fn.editabletypes.dateuifield&&(f="dateuifield"):a.fn.editabletypes.date?f="date":a.fn.editabletypes.dateui&&(f="dateui"),"date"!==f||a.fn.editabletypes.date||(f="combodate")),"datetime"===f&&"inline"===b.mode&&(f="datetimefield"),"wysihtml5"!==f||a.fn.editabletypes[f]||(f="textarea"),"function"==typeof a.fn.editabletypes[f]?(c=a.fn.editabletypes[f],d=this.sliceObj(b,this.objectKeys(c.defaults)),e=new c(d)):(a.error("Unknown type: "+f),!1)},supportsTransitions:function(){var a=document.body||document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(a){if(this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")){if(this.$form.data("editableform").isSaving)return this.delayedHide={reason:a},void 0;this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",a||"manual")}},innerShow:function(){},innerHide:function(){},toggle:function(a){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(a)},setPosition:function(){},save:function(a,b){this.$element.triggerHandler("save",b),this.hide("save")},option:function(a,b){this.options[a]=b,a in this.containerOptions?(this.containerOptions[a]=b,this.setContainerOption(a,b)):(this.formOptions[a]=b,this.$form&&this.$form.editableform("option",a,b))},setContainerOption:function(a,b){this.call("option",a,b)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(b){a(".editable-open").each(function(c,d){if(d!==b&&!a(d).find(b).length){var e=a(d),f=e.data("editableContainer");f&&("cancel"===f.options.onblur?e.data("editableContainer").hide("onblur"):"submit"===f.options.onblur&&e.data("editableContainer").tip().find("form").submit())}})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},a.fn.editableContainer=function(d){var e=arguments;return this.each(function(){var f=a(this),g="editableContainer",h=f.data(g),i="object"==typeof d&&d,j="inline"===i.mode?c:b;h||f.data(g,h=new j(this,i)),"string"==typeof d&&h[d].apply(h,Array.prototype.slice.call(e,1))})},a.fn.editableContainer.Popup=b,a.fn.editableContainer.Inline=c,a.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(a){a.handler&&a.handler()}}}(window.jQuery),function(a){"use strict";a.extend(a.fn.editableContainer.Inline.prototype,a.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=a(" "),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,a.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.editable.defaults,c,a.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!a.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};b.prototype={constructor:b,init:function(){var b,c=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=a.fn.editableutils.createInput(this.options),this.input){switch(void 0===this.options.value||null===this.options.value?(this.value=this.input.html2value(a.trim(this.$element.html())),c=!0):(this.options.value=a.fn.editableutils.tryParseJson(this.options.value,!0),this.value="string"==typeof this.options.value?this.input.str2value(this.options.value):this.options.value),this.$element.addClass("editable"),"textarea"===this.input.type&&this.$element.addClass("editable-pre-wrapped"),"manual"!==this.options.toggle?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",a.proxy(function(a){if(this.options.disabled||a.preventDefault(),"mouseenter"===this.options.toggle)this.show();else{var b="click"!==this.options.toggle;this.toggle(b)}},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":b=!0;break;case"auto":b=!a.trim(this.$element.text()).length&&null!==this.value&&void 0!==this.value&&!c;break;default:b=!1}a.when(b?this.render():!0).then(a.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var b=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",b,a.proxy(function(b){var c=a(b.target);c.data("editable")||(c.hasClass(this.options.emptyclass)&&c.empty(),c.editable(this.options).trigger(b))},this))},render:function(a){return this.options.display!==!1?this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,a):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,a):this.input.value2html(this.value,this.$element[0]):void 0},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),"manual"!==this.options.toggle&&"-1"===this.$element.attr("tabindex")&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(b,c){return b&&"object"==typeof b?(a.each(b,a.proxy(function(b,c){this.option(a.trim(b),c)},this)),void 0):(this.options[b]=c,"disabled"===b?c?this.disable():this.enable():("value"===b&&this.setValue(c),this.container&&this.container.option(b,c),this.input.option&&this.input.option(b,c),void 0))},handleEmpty:function(b){this.options.display!==!1&&(this.isEmpty=void 0!==b?b:"function"==typeof this.input.isEmpty?this.input.isEmpty(this.$element):""===a.trim(this.$element.html()),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass))},show:function(b){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var c=a.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(c),this.$element.on("save.internal",a.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(b)}},hide:function(){this.container&&this.container.hide()},toggle:function(a){this.container&&this.container.tip().is(":visible")?this.hide():this.show(a)},save:function(a,b){if(this.options.unsavedclass){var c=!1;c=c||"function"==typeof this.options.url,c=c||this.options.display===!1,c=c||void 0!==b.response,c=c||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(b.newValue),c?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var d=this.$element,e=d.css("background-color");d.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===e&&(e=""),d.css("background-color",e),d.addClass("editable-bg-transition"),setTimeout(function(){d.removeClass("editable-bg-transition")},1700)},10)}this.setValue(b.newValue,!1,b.response)},validate:function(){return"function"==typeof this.options.validate?this.options.validate.call(this,this.value):void 0},setValue:function(b,c,d){this.value=c?this.input.str2value(b):b,this.container&&this.container.option("value",this.value),a.when(this.render(d)).then(a.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),"manual"!==this.options.toggle&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},a.fn.editable=function(c){var d={},e=arguments,f="editable";switch(c){case"validate":return this.each(function(){var b,c=a(this),e=c.data(f);e&&(b=e.validate())&&(d[e.options.name]=b)}),d;case"getValue":return 2===arguments.length&&arguments[1]===!0?d=this.eq(0).data(f).value:this.each(function(){var b=a(this),c=b.data(f);c&&void 0!==c.value&&null!==c.value&&(d[c.options.name]=c.input.value2submit(c.value))}),d;case"submit":var g=arguments[1]||{},h=this,i=this.editable("validate");if(a.isEmptyObject(i)){var j={};if(1===h.length){var k=h.data("editable"),l={name:k.options.name||"",value:k.input.value2submit(k.value),pk:"function"==typeof k.options.pk?k.options.pk.call(k.options.scope):k.options.pk};"function"==typeof k.options.params?l=k.options.params.call(k.options.scope,l):(k.options.params=a.fn.editableutils.tryParseJson(k.options.params,!0),a.extend(l,k.options.params)),j={url:k.options.url,data:l,type:"POST"},g.success=g.success||k.options.success,g.error=g.error||k.options.error}else{var m=this.editable("getValue");j={url:g.url,data:m,type:"POST"}}j.success="function"==typeof g.success?function(a){g.success.call(h,a,g)}:a.noop,j.error="function"==typeof g.error?function(){g.error.apply(h,arguments)}:a.noop,g.ajaxOptions&&a.extend(j,g.ajaxOptions),g.data&&a.extend(j.data,g.data),a.ajax(j)}else"function"==typeof g.error&&g.error.call(h,i);return this}return this.each(function(){var d=a(this),g=d.data(f),h="object"==typeof c&&c;return h&&h.selector?(g=new b(this,h),void 0):(g||d.data(f,g=new b(this,h)),"string"==typeof c&&g[c].apply(g,Array.prototype.slice.call(e,1)),void 0)})},a.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}}(window.jQuery),function(a){"use strict";a.fn.editabletypes={};var b=function(){};b.prototype={init:function(b,c,d){this.type=b,this.options=a.extend({},d,c)},prerender:function(){this.$tpl=a(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(b,c){a(c)[this.options.escape?"text":"html"](a.trim(b))},html2value:function(b){return a("").html(b).text()},value2str:function(a){return a},str2value:function(a){return a},value2submit:function(a){return a},value2input:function(a){this.$input.val(a)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(b){return a("
").text(b).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(a){void 0!==this.options[a]&&null!==this.options[a]&&this.$input.attr(a,this.options[a])},option:function(a,b){this.options[a]=b}},b.defaults={tpl:"",inputclass:null,escape:!0,scope:null,showbuttons:!0},a.extend(a.fn.editabletypes,{abstractinput:b})}(window.jQuery),function(a){"use strict";var b=function(){};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){var b=a.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),b.resolve()},function(){this.error=this.options.sourceError,b.resolve()}),b.promise()},html2value:function(){return null},value2html:function(b,c,d,e){var f=a.Deferred(),g=function(){"function"==typeof d?d.call(c,b,this.sourceData,e):this.value2htmlFinal(b,c),f.resolve()};return null===b?g.call(this):this.onSourceReady(g,function(){f.resolve()}),f.promise()},onSourceReady:function(b,c){var d;if(a.isFunction(this.options.source)?(d=this.options.source.call(this.options.scope),this.sourceData=null):d=this.options.source,this.options.sourceCache&&a.isArray(this.sourceData))return b.call(this),void 0;try{d=a.fn.editableutils.tryParseJson(d,!1)}catch(e){return c.call(this),void 0}if("string"==typeof d){if(this.options.sourceCache){var f,g=d;if(a(document).data(g)||a(document).data(g,{}),f=a(document).data(g),f.loading===!1&&f.sourceData)return this.sourceData=f.sourceData,this.doPrepend(),b.call(this),void 0;if(f.loading===!0)return f.callbacks.push(a.proxy(function(){this.sourceData=f.sourceData,this.doPrepend(),b.call(this)},this)),f.err_callbacks.push(a.proxy(c,this)),void 0;f.loading=!0,f.callbacks=[],f.err_callbacks=[]}var h=a.extend({url:d,type:"get",cache:!1,dataType:"json",success:a.proxy(function(d){f&&(f.loading=!1),this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(f&&(f.sourceData=this.sourceData,a.each(f.callbacks,function(){this.call()})),this.doPrepend(),b.call(this)):(c.call(this),f&&a.each(f.err_callbacks,function(){this.call()}))},this),error:a.proxy(function(){c.call(this),f&&(f.loading=!1,a.each(f.err_callbacks,function(){this.call()}))},this)},this.options.sourceOptions);a.ajax(h)}else this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(this.doPrepend(),b.call(this)):c.call(this)},doPrepend:function(){null!==this.options.prepend&&void 0!==this.options.prepend&&(a.isArray(this.prependData)||(a.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=a.fn.editableutils.tryParseJson(this.options.prepend,!0),"string"==typeof this.options.prepend&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),a.isArray(this.prependData)&&a.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData)))},renderList:function(){},value2htmlFinal:function(){},makeArray:function(b){var c,d,e,f,g=[];if(!b||"string"==typeof b)return null;if(a.isArray(b)){f=function(a,b){return d={value:a,text:b},c++>=2?!1:void 0};for(var h=0;h
1&&(e.children&&(e.children=this.makeArray(e.children)),g.push(e))):g.push({value:e,text:e})}else a.each(b,function(a,b){g.push({value:a,text:b})});return g},option:function(a,b){this.options[a]=b,"source"===a&&(this.sourceData=null),"prepend"===a&&(this.prependData=null)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0,sourceOptions:null}),a.fn.editabletypes.list=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("text",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),a.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=a(' '),this.$input.after(this.$clear).css("padding-right",24).keyup(a.proxy(function(b){if(!~a.inArray(b.keyCode,[40,38,9,13,27])){clearTimeout(this.t);var c=this;this.t=setTimeout(function(){c.toggleClear(b)},100)}},this)).parent().css("position","relative"),this.$clear.click(a.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(){if(this.$clear){var a=this.$input.val().length,b=this.$clear.is(":visible");a&&!b&&this.$clear.show(),!a&&b&&this.$clear.hide()}},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:' ',placeholder:null,clear:!0}),a.fn.editabletypes.text=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("textarea",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(b){b.ctrlKey&&13===b.which&&a(this).closest("form").submit()})},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),a.fn.editabletypes.textarea=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("select",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.list),a.extend(b.prototype,{renderList:function(){this.$input.empty();var b=function(c,d){var e;if(a.isArray(d))for(var f=0;f",e),d[f].children))):(e.value=d[f].value,d[f].disabled&&(e.disabled=!0),c.append(a("",e).text(d[f].text)));return c};b(this.$input,this.sourceData),this.setClass(),this.$input.on("keydown.editable",function(b){13===b.which&&a(this).closest("form").submit()})},value2htmlFinal:function(b,c){var d="",e=a.fn.editableutils.itemsByValue(b,this.sourceData);e.length&&(d=e[0].text),a.fn.editabletypes.abstractinput.prototype.value2html.call(this,d,c)},autosubmit:function(){this.$input.off("keydown.editable").on("change.editable",function(){a(this).closest("form").submit()})}}),b.defaults=a.extend({},a.fn.editabletypes.list.defaults,{tpl:" "}),a.fn.editabletypes.select=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("checklist",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.list),a.extend(b.prototype,{renderList:function(){var b;if(this.$tpl.empty(),a.isArray(this.sourceData)){for(var c=0;c").append(a(" ",{type:"checkbox",value:this.sourceData[c].value})).append(a("").text(" "+this.sourceData[c].text)),a("").append(b).appendTo(this.$tpl);this.$input=this.$tpl.find('input[type="checkbox"]'),this.setClass()}},value2str:function(b){return a.isArray(b)?b.sort().join(a.trim(this.options.separator)):""},str2value:function(b){var c,d=null;return"string"==typeof b&&b.length?(c=new RegExp("\\s*"+a.trim(this.options.separator)+"\\s*"),d=b.split(c)):d=a.isArray(b)?b:[b],d},value2input:function(b){this.$input.prop("checked",!1),a.isArray(b)&&b.length&&this.$input.each(function(c,d){var e=a(d);a.each(b,function(a,b){e.val()==b&&e.prop("checked",!0)})})},input2value:function(){var b=[];return this.$input.filter(":checked").each(function(c,d){b.push(a(d).val())}),b},value2htmlFinal:function(b,c){var d=[],e=a.fn.editableutils.itemsByValue(b,this.sourceData),f=this.options.escape;e.length?(a.each(e,function(b,c){var e=f?a.fn.editableutils.escape(c.text):c.text;d.push(e)}),a(c).html(d.join("
"))):a(c).empty()},activate:function(){this.$input.first().focus()},autosubmit:function(){this.$input.on("keydown",function(b){13===b.which&&a(this).closest("form").submit()})}}),b.defaults=a.extend({},a.fn.editabletypes.list.defaults,{tpl:'
',inputclass:null,separator:","}),a.fn.editabletypes.checklist=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("password",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),a.extend(b.prototype,{value2html:function(b,c){b?a(c).text("[hidden]"):a(c).empty()},html2value:function(){return null}}),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'
'}),a.fn.editabletypes.password=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("email",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'
'}),a.fn.editabletypes.email=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("url",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'
'}),a.fn.editabletypes.url=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("tel",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'
'}),a.fn.editabletypes.tel=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("number",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),a.extend(b.prototype,{render:function(){b.superclass.render.call(this),this.setAttr("min"),this.setAttr("max"),this.setAttr("step")},postrender:function(){this.$clear&&this.$clear.css({right:24})}}),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'
',inputclass:"input-mini",min:null,max:null,step:null}),a.fn.editabletypes.number=b}(window.jQuery),function(a){"use strict";
+var b=function(a){this.init("range",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.number),a.extend(b.prototype,{render:function(){this.$input=this.$tpl.filter("input"),this.setClass(),this.setAttr("min"),this.setAttr("max"),this.setAttr("step"),this.$input.on("input",function(){a(this).siblings("output").text(a(this).val())})},activate:function(){this.$input.focus()}}),b.defaults=a.extend({},a.fn.editabletypes.number.defaults,{tpl:'
',inputclass:"input-medium"}),a.fn.editabletypes.range=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("time",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass()}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'
'}),a.fn.editabletypes.time=b}(window.jQuery),function(a){"use strict";var b=function(c){if(this.init("select2",c,b.defaults),c.select2=c.select2||{},this.sourceData=null,c.placeholder&&(c.select2.placeholder=c.placeholder),!c.select2.tags&&c.source){var d=c.source;a.isFunction(c.source)&&(d=c.source.call(c.scope)),"string"==typeof d?(c.select2.ajax=c.select2.ajax||{},c.select2.ajax.data||(c.select2.ajax.data=function(a){return{query:a}}),c.select2.ajax.results||(c.select2.ajax.results=function(a){return{results:a}}),c.select2.ajax.url=d):(this.sourceData=this.convertSource(d),c.select2.data=this.sourceData)}if(this.options.select2=a.extend({},b.defaults.select2,c.select2),this.isMultiple=this.options.select2.tags||this.options.select2.multiple,this.isRemote="ajax"in this.options.select2,this.idFunc=this.options.select2.id,"function"!=typeof this.idFunc){var e=this.idFunc||"id";this.idFunc=function(a){return a[e]}}this.formatSelection=this.options.select2.formatSelection,"function"!=typeof this.formatSelection&&(this.formatSelection=function(a){return a.text})};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass(),this.isRemote&&this.$input.on("select2-loaded",a.proxy(function(a){this.sourceData=a.items.results},this)),this.isMultiple&&this.$input.on("change",function(){a(this).closest("form").parent().triggerHandler("resize")})},value2html:function(c,d){var e,f="",g=this;this.options.select2.tags?e=c:this.sourceData&&(e=a.fn.editableutils.itemsByValue(c,this.sourceData,this.idFunc)),a.isArray(e)?(f=[],a.each(e,function(a,b){f.push(b&&"object"==typeof b?g.formatSelection(b):b)})):e&&(f=g.formatSelection(e)),f=a.isArray(f)?f.join(this.options.viewseparator):f,b.superclass.value2html.call(this,f,d)},html2value:function(a){return this.options.select2.tags?this.str2value(a,this.options.viewseparator):null},value2input:function(b){if(a.isArray(b)&&(b=b.join(this.getSeparator())),this.$input.data("select2")?this.$input.val(b).trigger("change",!0):(this.$input.val(b),this.$input.select2(this.options.select2)),this.isRemote&&!this.isMultiple&&!this.options.select2.initSelection){var c=this.options.select2.id,d=this.options.select2.formatSelection;if(!c&&!d){var e=a(this.options.scope);if(!e.data("editable").isEmpty){var f={id:b,text:e.text()};this.$input.select2("data",f)}}}},input2value:function(){return this.$input.select2("val")},str2value:function(b,c){if("string"!=typeof b||!this.isMultiple)return b;c=c||this.getSeparator();var d,e,f;if(null===b||b.length<1)return null;for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d},autosubmit:function(){this.$input.on("change",function(b,c){c||a(this).closest("form").submit()})},getSeparator:function(){return this.options.select2.separator||a.fn.select2.defaults.separator},convertSource:function(b){if(a.isArray(b)&&b.length&&void 0!==b[0].value)for(var c=0;c
',select2:null,placeholder:null,source:null,viewseparator:", "}),a.fn.editabletypes.select2=b}(window.jQuery),function(a){var b=function(b,c){return this.$element=a(b),this.$element.is("input")?(this.options=a.extend({},a.fn.combodate.defaults,c,this.$element.data()),this.init(),void 0):(a.error("Combodate should be applied to INPUT element"),void 0)};b.prototype={constructor:b,init:function(){this.map={day:["D","date"],month:["M","month"],year:["Y","year"],hour:["[Hh]","hours"],minute:["m","minutes"],second:["s","seconds"],ampm:["[Aa]",""]},this.$widget=a(' ').html(this.getTemplate()),this.initCombos(),this.$widget.on("change","select",a.proxy(function(b){this.$element.val(this.getValue()).change(),this.options.smartDays&&(a(b.target).is(".month")||a(b.target).is(".year"))&&this.fillCombo("day")},this)),this.$widget.find("select").css("width","auto"),this.$element.hide().after(this.$widget),this.setValue(this.$element.val()||this.options.value)},getTemplate:function(){var b=this.options.template;return a.each(this.map,function(a,c){c=c[0];var d=new RegExp(c+"+"),e=c.length>1?c.substring(1,2):c;b=b.replace(d,"{"+e+"}")}),b=b.replace(/ /g," "),a.each(this.map,function(a,c){c=c[0];var d=c.length>1?c.substring(1,2):c;b=b.replace("{"+d+"}",' ')}),b},initCombos:function(){for(var a in this.map){var b=this.$widget.find("."+a);this["$"+a]=b.length?b:null,this.fillCombo(a)}},fillCombo:function(a){var b=this["$"+a];if(b){var c="fill"+a.charAt(0).toUpperCase()+a.slice(1),d=this[c](),e=b.val();b.empty();for(var f=0;f'+d[f][1]+"");b.val(e)}},fillCommon:function(a){var b,c=[];if("name"===this.options.firstItem){b=moment.relativeTime||moment.langData()._relativeTime;var d="function"==typeof b[a]?b[a](1,!0,a,!1):b[a];d=d.split(" ").reverse()[0],c.push(["",d])}else"empty"===this.options.firstItem&&c.push(["",""]);return c},fillDay:function(){var a,b,c=this.fillCommon("d"),d=-1!==this.options.template.indexOf("DD"),e=31;if(this.options.smartDays&&this.$month&&this.$year){var f=parseInt(this.$month.val(),10),g=parseInt(this.$year.val(),10);isNaN(f)||isNaN(g)||(e=moment([g,f]).daysInMonth())}for(b=1;e>=b;b++)a=d?this.leadZero(b):b,c.push([b,a]);return c},fillMonth:function(){var a,b,c=this.fillCommon("M"),d=-1!==this.options.template.indexOf("MMMM"),e=-1!==this.options.template.indexOf("MMM"),f=-1!==this.options.template.indexOf("MM");for(b=0;11>=b;b++)a=d?moment().date(1).month(b).format("MMMM"):e?moment().date(1).month(b).format("MMM"):f?this.leadZero(b+1):b+1,c.push([b,a]);return c},fillYear:function(){var a,b,c=[],d=-1!==this.options.template.indexOf("YYYY");for(b=this.options.maxYear;b>=this.options.minYear;b--)a=d?b:(b+"").substring(2),c[this.options.yearDescending?"push":"unshift"]([b,a]);return c=this.fillCommon("y").concat(c)},fillHour:function(){var a,b,c=this.fillCommon("h"),d=-1!==this.options.template.indexOf("h"),e=(-1!==this.options.template.indexOf("H"),-1!==this.options.template.toLowerCase().indexOf("hh")),f=d?1:0,g=d?12:23;for(b=f;g>=b;b++)a=e?this.leadZero(b):b,c.push([b,a]);return c},fillMinute:function(){var a,b,c=this.fillCommon("m"),d=-1!==this.options.template.indexOf("mm");for(b=0;59>=b;b+=this.options.minuteStep)a=d?this.leadZero(b):b,c.push([b,a]);return c},fillSecond:function(){var a,b,c=this.fillCommon("s"),d=-1!==this.options.template.indexOf("ss");for(b=0;59>=b;b+=this.options.secondStep)a=d?this.leadZero(b):b,c.push([b,a]);return c},fillAmpm:function(){var a=-1!==this.options.template.indexOf("a"),b=(-1!==this.options.template.indexOf("A"),[["am",a?"am":"AM"],["pm",a?"pm":"PM"]]);return b},getValue:function(b){var c,d={},e=this,f=!1;return a.each(this.map,function(a){if("ampm"!==a){var b="day"===a?1:0;return d[a]=e["$"+a]?parseInt(e["$"+a].val(),10):b,isNaN(d[a])?(f=!0,!1):void 0}}),f?"":(this.$ampm&&(d.hour=12===d.hour?"am"===this.$ampm.val()?0:12:"am"===this.$ampm.val()?d.hour:d.hour+12),c=moment([d.year,d.month,d.day,d.hour,d.minute,d.second]),this.highlight(c),b=void 0===b?this.options.format:b,null===b?c.isValid()?c:null:c.isValid()?c.format(b):"")},setValue:function(b){function c(b,c){var d={};return b.children("option").each(function(b,e){var f,g=a(e).attr("value");""!==g&&(f=Math.abs(g-c),("undefined"==typeof d.distance||f=12?(f.ampm="pm",f.hour>12&&(f.hour-=12)):(f.ampm="am",0===f.hour&&(f.hour=12))),a.each(f,function(a,b){e["$"+a]&&("minute"===a&&e.options.minuteStep>1&&e.options.roundTime&&(b=c(e["$"+a],b)),"second"===a&&e.options.secondStep>1&&e.options.roundTime&&(b=c(e["$"+a],b)),e["$"+a].val(b))}),this.options.smartDays&&this.fillCombo("day"),this.$element.val(d.format(this.options.format)).change())}},highlight:function(a){a.isValid()?this.options.errorClass?this.$widget.removeClass(this.options.errorClass):this.$widget.find("select").css("border-color",this.borderColor):this.options.errorClass?this.$widget.addClass(this.options.errorClass):(this.borderColor||(this.borderColor=this.$widget.find("select").css("border-color")),this.$widget.find("select").css("border-color","red"))},leadZero:function(a){return 9>=a?"0"+a:a},destroy:function(){this.$widget.remove(),this.$element.removeData("combodate").show()}},a.fn.combodate=function(c){var d,e=Array.apply(null,arguments);return e.shift(),"getValue"===c&&this.length&&(d=this.eq(0).data("combodate"))?d.getValue.apply(d,e):this.each(function(){var d=a(this),f=d.data("combodate"),g="object"==typeof c&&c;f||d.data("combodate",f=new b(this,g)),"string"==typeof c&&"function"==typeof f[c]&&f[c].apply(f,e)})},a.fn.combodate.defaults={format:"DD-MM-YYYY HH:mm",template:"D / MMM / YYYY H : mm",value:null,minYear:1970,maxYear:2015,yearDescending:!0,minuteStep:5,secondStep:1,firstItem:"empty",errorClass:null,roundTime:!0,smartDays:!1}}(window.jQuery),function(a){"use strict";var b=function(c){this.init("combodate",c,b.defaults),this.options.viewformat||(this.options.viewformat=this.options.format),c.combodate=a.fn.editableutils.tryParseJson(c.combodate,!0),this.options.combodate=a.extend({},b.defaults.combodate,c.combodate,{format:this.options.format,template:this.options.template})};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.$input.combodate(this.options.combodate),"bs3"===a.fn.editableform.engine&&this.$input.siblings().find("select").addClass("form-control"),this.options.inputclass&&this.$input.siblings().find("select").addClass(this.options.inputclass)},value2html:function(a,c){var d=a?a.format(this.options.viewformat):"";b.superclass.value2html.call(this,d,c)},html2value:function(a){return a?moment(a,this.options.viewformat):null},value2str:function(a){return a?a.format(this.options.format):""},str2value:function(a){return a?moment(a,this.options.format):null},value2submit:function(a){return this.value2str(a)},value2input:function(a){this.$input.combodate("setValue",a)},input2value:function(){return this.$input.combodate("getValue",null)},activate:function(){this.$input.siblings(".combodate").find("select").eq(0).focus()},autosubmit:function(){}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:' ',inputclass:null,format:"YYYY-MM-DD",viewformat:null,template:"D / MMM / YYYY",combodate:null}),a.fn.editabletypes.combodate=b}(window.jQuery),function(a){"use strict";var b=a.fn.editableform.Constructor.prototype.initInput;a.extend(a.fn.editableform.Constructor.prototype,{initTemplate:function(){this.$form=a(a.fn.editableform.template),this.$form.find(".control-group").addClass("form-group"),this.$form.find(".editable-error-block").addClass("help-block")},initInput:function(){b.apply(this);var c=null===this.input.options.inputclass||this.input.options.inputclass===!1,d="input-sm",e="text,select,textarea,password,email,url,tel,number,range,time,typeaheadjs".split(",");~a.inArray(this.input.type,e)&&(this.input.$input.addClass("form-control"),c&&(this.input.options.inputclass=d,this.input.$input.addClass(d)));for(var f=this.$form.find(".editable-buttons"),g=c?[d]:this.input.options.inputclass.split(" "),h=0;h ',a.fn.editableform.errorGroupClass="has-error",a.fn.editableform.errorBlockClass=null,a.fn.editableform.engine="bs3"}(window.jQuery),function(a){"use strict";a.extend(a.fn.editableContainer.Popup.prototype,{containerName:"popover",containerDataName:"bs.popover",innerCss:".popover-content",defaults:a.fn.popover.Constructor.DEFAULTS,initContainer:function(){a.extend(this.containerOptions,{trigger:"manual",selector:!1,content:" ",template:this.defaults.template});var b;this.$element.data("template")&&(b=this.$element.data("template"),this.$element.removeData("template")),this.call(this.containerOptions),b&&this.$element.data("template",b)},innerShow:function(){this.call("show")},innerHide:function(){this.call("hide")},innerDestroy:function(){this.call("destroy")},setContainerOption:function(a,b){this.container().options[a]=b},setPosition:function(){!function(){var a=this.tip(),b="function"==typeof this.options.placement?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,c=/\s?auto?\s?/i,d=c.test(b);d&&(b=b.replace(c,"")||"top");var e=this.getPosition(),f=a[0].offsetWidth,g=a[0].offsetHeight;if(d){var h=this.$element.parent(),i=b,j=document.documentElement.scrollTop||document.body.scrollTop,k="body"==this.options.container?window.innerWidth:h.outerWidth(),l="body"==this.options.container?window.innerHeight:h.outerHeight(),m="body"==this.options.container?0:h.offset().left;b="bottom"==b&&e.top+e.height+g-j>l?"top":"top"==b&&e.top-j-g<0?"bottom":"right"==b&&e.right+f>k?"left":"left"==b&&e.left-fthis.o.endDate?new Date(this.o.endDate):new Date(this.date),this.fill()}},fillDow:function(){var a=this.o.weekStart,b="";if(this.o.calendarWeeks){var c=' ';b+=c,this.picker.find(".datepicker-days thead tr:first-child").prepend(c)}for(;a'+k[this.o.language].daysMin[a++%7]+"";b+=" ",this.picker.find(".datepicker-days thead").append(b)},fillMonths:function(){for(var a="",b=0;12>b;)a+=''+k[this.o.language].monthsShort[b++]+" ";this.picker.find(".datepicker-months td").html(a)},setRange:function(b){b&&b.length?this.range=a.map(b,function(a){return a.valueOf()}):delete this.range,this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth(),f=this.date.valueOf(),g=new Date;return b.getUTCFullYear()d||b.getUTCFullYear()==d&&b.getUTCMonth()>e)&&c.push("new"),this.o.todayHighlight&&b.getUTCFullYear()==g.getFullYear()&&b.getUTCMonth()==g.getMonth()&&b.getUTCDate()==g.getDate()&&c.push("today"),f&&b.valueOf()==f&&c.push("active"),(b.valueOf()this.o.endDate||-1!==a.inArray(b.getUTCDay(),this.o.daysOfWeekDisabled))&&c.push("disabled"),this.range&&(b>this.range[0]&&b"),this.o.calendarWeeks)){var r=new Date(+m+864e5*((this.o.weekStart-m.getUTCDay()-7)%7)),s=new Date(+r+864e5*((11-r.getUTCDay())%7)),t=new Date(+(t=b(s.getUTCFullYear(),0,1))+864e5*((11-t.getUTCDay())%7)),u=(s-t)/864e5/7+1;q.push(''+u+" ")}p=this.getClassNames(m),p.push("day");var v=this.o.beforeShowDay(m);void 0===v?v={}:"boolean"==typeof v?v={enabled:v}:"string"==typeof v&&(v={classes:v}),v.enabled===!1&&p.push("disabled"),v.classes&&(p=p.concat(v.classes.split(/\s+/))),v.tooltip&&(c=v.tooltip),p=a.unique(p),q.push('"+m.getUTCDate()+" "),m.getUTCDay()==this.o.weekEnd&&q.push(""),m.setUTCDate(m.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(q.join(""));var w=this.date&&this.date.getUTCFullYear(),x=this.picker.find(".datepicker-months").find("th:eq(1)").text(e).end().find("span").removeClass("active");w&&w==e&&x.eq(this.date.getUTCMonth()).addClass("active"),(g>e||e>i)&&x.addClass("disabled"),e==g&&x.slice(0,h).addClass("disabled"),e==i&&x.slice(j+1).addClass("disabled"),q="",e=10*parseInt(e/10,10);var y=this.picker.find(".datepicker-years").find("th:eq(1)").text(e+"-"+(e+9)).end().find("td");e-=1;for(var z=-1;11>z;z++)q+='e||e>i?" disabled":"")+'">'+e+" ",e+=1;y.html(q)},updateNavArrows:function(){if(this._allow_update){var a=new Date(this.viewDate),b=a.getUTCFullYear(),c=a.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-1/0&&b<=this.o.startDate.getUTCFullYear()&&c<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),1/0!==this.o.endDate&&b>=this.o.endDate.getUTCFullYear()&&c>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-1/0&&b<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),1/0!==this.o.endDate&&b>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(c){c.preventDefault();var d=a(c.target).closest("span, td, th");if(1==d.length)switch(d[0].nodeName.toLowerCase()){case"th":switch(d[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var e=l.modes[this.viewMode].navStep*("prev"==d[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,e);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,e)}this.fill();break;case"today":var f=new Date;f=b(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0),this.showMode(-2);var g="linked"==this.o.todayBtn?null:"view";this._setDate(f,g);break;case"clear":var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.val("").change(),this._trigger("changeDate"),this.update(),this.o.autoclose&&this.hide()}break;case"span":if(!d.is(".disabled")){if(this.viewDate.setUTCDate(1),d.is(".month")){var i=1,j=d.parent().find("span").index(d),k=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(j),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(b(k,j,i,0,0,0,0))}else{var k=parseInt(d.text(),10)||0,i=1,j=0;this.viewDate.setUTCFullYear(k),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(b(k,j,i,0,0,0,0))}this.showMode(-1),this.fill()}break;case"td":if(d.is(".day")&&!d.is(".disabled")){var i=parseInt(d.text(),10)||1,k=this.viewDate.getUTCFullYear(),j=this.viewDate.getUTCMonth();d.is(".old")?0===j?(j=11,k-=1):j-=1:d.is(".new")&&(11==j?(j=0,k+=1):j+=1),this._setDate(b(k,j,i,0,0,0,0))}}},_setDate:function(a,b){b&&"date"!=b||(this.date=new Date(a)),b&&"view"!=b||(this.viewDate=new Date(a)),this.fill(),this.setValue(),this._trigger("changeDate");var c;this.isInput?c=this.element:this.component&&(c=this.element.find("input")),c&&(c.change(),!this.o.autoclose||b&&"date"!=b||this.hide())},moveMonth:function(a,b){if(!b)return a;var c,d,e=new Date(a.valueOf()),f=e.getUTCDate(),g=e.getUTCMonth(),h=Math.abs(b);if(b=b>0?1:-1,1==h)d=-1==b?function(){return e.getUTCMonth()==g}:function(){return e.getUTCMonth()!=c},c=g+b,e.setUTCMonth(c),(0>c||c>11)&&(c=(c+12)%12);else{for(var i=0;h>i;i++)e=this.moveMonth(e,b);c=e.getUTCMonth(),e.setUTCDate(f),d=function(){return c!=e.getUTCMonth()}}for(;d();)e.setUTCDate(--f),e.setUTCMonth(c);return e},moveYear:function(a,b){return this.moveMonth(a,12*b)},dateWithinRange:function(a){return a>=this.o.startDate&&a<=this.o.endDate},keydown:function(a){if(this.picker.is(":not(:visible)"))return 27==a.keyCode&&this.show(),void 0;var b,c,d,e=!1;switch(a.keyCode){case 27:this.hide(),a.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;b=37==a.keyCode?-1:1,a.ctrlKey?(c=this.moveYear(this.date,b),d=this.moveYear(this.viewDate,b)):a.shiftKey?(c=this.moveMonth(this.date,b),d=this.moveMonth(this.viewDate,b)):(c=new Date(this.date),c.setUTCDate(this.date.getUTCDate()+b),d=new Date(this.viewDate),d.setUTCDate(this.viewDate.getUTCDate()+b)),this.dateWithinRange(c)&&(this.date=c,this.viewDate=d,this.setValue(),this.update(),a.preventDefault(),e=!0);break;case 38:case 40:if(!this.o.keyboardNavigation)break;b=38==a.keyCode?-1:1,a.ctrlKey?(c=this.moveYear(this.date,b),d=this.moveYear(this.viewDate,b)):a.shiftKey?(c=this.moveMonth(this.date,b),d=this.moveMonth(this.viewDate,b)):(c=new Date(this.date),c.setUTCDate(this.date.getUTCDate()+7*b),d=new Date(this.viewDate),d.setUTCDate(this.viewDate.getUTCDate()+7*b)),this.dateWithinRange(c)&&(this.date=c,this.viewDate=d,this.setValue(),this.update(),a.preventDefault(),e=!0);break;case 13:this.hide(),a.preventDefault();break;case 9:this.hide()}if(e){this._trigger("changeDate");var f;this.isInput?f=this.element:this.component&&(f=this.element.find("input")),f&&f.change()}},showMode:function(a){a&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+a))),this.picker.find(">div").hide().filter(".datepicker-"+l.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var f=function(b,c){this.element=a(b),this.inputs=a.map(c.inputs,function(a){return a.jquery?a[0]:a}),delete c.inputs,a(this.inputs).datepicker(c).bind("changeDate",a.proxy(this.dateUpdated,this)),this.pickers=a.map(this.inputs,function(b){return a(b).data("datepicker")}),this.updateDates()};f.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.date}),this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(a,c){c.setRange(b)})},dateUpdated:function(b){var c=a(b.target).data("datepicker"),d=c.getUTCDate(),e=a.inArray(b.target,this.inputs),f=this.inputs.length;if(-1!=e){if(d=0&&dthis.dates[e])for(;f>e&&d>this.dates[e];)this.pickers[e++].setUTCDate(d);this.updateDates()}},remove:function(){a.map(this.pickers,function(a){a.remove()}),delete this.element.data().datepicker}};var g=a.fn.datepicker,h=a.fn.datepicker=function(b){var g=Array.apply(null,arguments);g.shift();var h;return this.each(function(){var j=a(this),k=j.data("datepicker"),l="object"==typeof b&&b;if(!k){var m=c(this,"date"),n=a.extend({},i,m,l),o=d(n.language),p=a.extend({},i,o,m,l);if(j.is(".input-daterange")||p.inputs){var q={inputs:p.inputs||j.find("input").toArray()};j.data("datepicker",k=new f(this,a.extend(p,q)))}else j.data("datepicker",k=new e(this,p))}return"string"==typeof b&&"function"==typeof k[b]&&(h=k[b].apply(k,g),void 0!==h)?!1:void 0}),void 0!==h?h:this},i=a.fn.datepicker.defaults={autoclose:!1,beforeShowDay:a.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0},j=a.fn.datepicker.locale_opts=["format","rtl","weekStart"];a.fn.datepicker.Constructor=e;var k=a.fn.datepicker.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"],today:"Today",clear:"Clear"}},l={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return 0===a%4&&0!==a%100||0===a%400
+},getDaysInMonth:function(a,b){return[31,l.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(a){var b=a.replace(this.validParts,"\0").split("\0"),c=a.match(this.validParts);if(!b||!b.length||!c||0===c.length)throw new Error("Invalid date format.");return{separators:b,parts:c}},parseDate:function(c,d,f){if(c instanceof Date)return c;if("string"==typeof d&&(d=l.parseFormat(d)),/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(c)){var g,h,i=/([\-+]\d+)([dmwy])/,j=c.match(/([\-+]\d+)([dmwy])/g);c=new Date;for(var m=0;mb;)b+=12;for(b%=12,a.setUTCMonth(b);a.getUTCMonth()!=b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)}};r.M=r.MM=r.mm=r.m,r.dd=r.d,c=b(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0);var s=d.parts.slice();if(j.length!=s.length&&(s=a(s).filter(function(b,c){return-1!==a.inArray(c,q)}).toArray()),j.length==s.length){for(var m=0,t=s.length;t>m;m++){if(n=parseInt(j[m],10),g=s[m],isNaN(n))switch(g){case"MM":o=a(k[f].months).filter(function(){var a=this.slice(0,j[m].length),b=j[m].slice(0,a.length);return a==b}),n=a.inArray(o[0],k[f].months)+1;break;case"M":o=a(k[f].monthsShort).filter(function(){var a=this.slice(0,j[m].length),b=j[m].slice(0,a.length);return a==b}),n=a.inArray(o[0],k[f].monthsShort)+1}p[g]=n}for(var u,m=0;m=g;g++)f.length&&b.push(f.shift()),b.push(e[c.parts[g]]);return b.join("")},headTemplate:' ',contTemplate:' ',footTemplate:' '};l.template=''+l.headTemplate+" "+l.footTemplate+"
"+"
"+'
'+'
'+l.headTemplate+l.contTemplate+l.footTemplate+"
"+"
"+'
'+'
'+l.headTemplate+l.contTemplate+l.footTemplate+"
"+"
"+"
",a.fn.datepicker.DPGlobal=l,a.fn.datepicker.noConflict=function(){return a.fn.datepicker=g,this},a(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(b){var c=a(this);c.data("datepicker")||(b.preventDefault(),h.call(c,"show"))}),a(function(){h.call(a('[data-provide="datepicker-inline"]'))})}(window.jQuery),function(a){"use strict";a.fn.bdatepicker=a.fn.datepicker.noConflict(),a.fn.datepicker||(a.fn.datepicker=a.fn.bdatepicker);var b=function(a){this.init("date",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{initPicker:function(b,c){this.options.viewformat||(this.options.viewformat=this.options.format),b.datepicker=a.fn.editableutils.tryParseJson(b.datepicker,!0),this.options.datepicker=a.extend({},c.datepicker,b.datepicker,{format:this.options.viewformat}),this.options.datepicker.language=this.options.datepicker.language||"en",this.dpg=a.fn.bdatepicker.DPGlobal,this.parsedFormat=this.dpg.parseFormat(this.options.format),this.parsedViewFormat=this.dpg.parseFormat(this.options.viewformat)},render:function(){this.$input.bdatepicker(this.options.datepicker),this.options.clear&&(this.$clear=a(' ').html(this.options.clear).click(a.proxy(function(a){a.preventDefault(),a.stopPropagation(),this.clear()},this)),this.$tpl.parent().append(a('').append(this.$clear)))},value2html:function(a,c){var d=a?this.dpg.formatDate(a,this.parsedViewFormat,this.options.datepicker.language):"";b.superclass.value2html.call(this,d,c)},html2value:function(a){return this.parseDate(a,this.parsedViewFormat)},value2str:function(a){return a?this.dpg.formatDate(a,this.parsedFormat,this.options.datepicker.language):""},str2value:function(a){return this.parseDate(a,this.parsedFormat)},value2submit:function(a){return this.value2str(a)},value2input:function(a){this.$input.bdatepicker("update",a)},input2value:function(){return this.$input.data("datepicker").date},activate:function(){},clear:function(){this.$input.data("datepicker").date=null,this.$input.find(".active").removeClass("active"),this.options.showbuttons||this.$input.closest("form").submit()},autosubmit:function(){this.$input.on("mouseup",".day",function(b){if(!a(b.currentTarget).is(".old")&&!a(b.currentTarget).is(".new")){var c=a(this).closest("form");setTimeout(function(){c.submit()},200)}})},parseDate:function(a,b){var c,d=null;return a&&(d=this.dpg.parseDate(a,b,this.options.datepicker.language),"string"==typeof a&&(c=this.dpg.formatDate(d,b,this.options.datepicker.language),a!==c&&(d=null))),d}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'
',inputclass:null,format:"yyyy-mm-dd",viewformat:null,datepicker:{weekStart:0,startView:0,minViewMode:0,autoclose:!1},clear:"× clear"}),a.fn.editabletypes.date=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("datefield",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.date),a.extend(b.prototype,{render:function(){this.$input=this.$tpl.find("input"),this.setClass(),this.setAttr("placeholder"),this.$tpl.bdatepicker(this.options.datepicker),this.$input.off("focus keydown"),this.$input.keyup(a.proxy(function(){this.$tpl.removeData("date"),this.$tpl.bdatepicker("update")},this))},value2input:function(a){this.$input.val(a?this.dpg.formatDate(a,this.parsedViewFormat,this.options.datepicker.language):""),this.$tpl.bdatepicker("update")},input2value:function(){return this.html2value(this.$input.val())},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)},autosubmit:function(){}}),b.defaults=a.extend({},a.fn.editabletypes.date.defaults,{tpl:'
',inputclass:"input-small",datepicker:{weekStart:0,startView:0,minViewMode:0,autoclose:!0}}),a.fn.editabletypes.datefield=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("datetime",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{initPicker:function(b,c){this.options.viewformat||(this.options.viewformat=this.options.format),b.datetimepicker=a.fn.editableutils.tryParseJson(b.datetimepicker,!0),this.options.datetimepicker=a.extend({},c.datetimepicker,b.datetimepicker,{format:this.options.viewformat}),this.options.datetimepicker.language=this.options.datetimepicker.language||"en",this.dpg=a.fn.datetimepicker.DPGlobal,this.parsedFormat=this.dpg.parseFormat(this.options.format,this.options.formatType),this.parsedViewFormat=this.dpg.parseFormat(this.options.viewformat,this.options.formatType)},render:function(){this.$input.datetimepicker(this.options.datetimepicker),this.$input.on("changeMode",function(){var b=a(this).closest("form").parent();setTimeout(function(){b.triggerHandler("resize")},0)}),this.options.clear&&(this.$clear=a('
').html(this.options.clear).click(a.proxy(function(a){a.preventDefault(),a.stopPropagation(),this.clear()},this)),this.$tpl.parent().append(a('
').append(this.$clear)))},value2html:function(a,c){var d=a?this.dpg.formatDate(this.toUTC(a),this.parsedViewFormat,this.options.datetimepicker.language,this.options.formatType):"";return c?(b.superclass.value2html.call(this,d,c),void 0):d},html2value:function(a){var b=this.parseDate(a,this.parsedViewFormat);return b?this.fromUTC(b):null},value2str:function(a){return a?this.dpg.formatDate(this.toUTC(a),this.parsedFormat,this.options.datetimepicker.language,this.options.formatType):""},str2value:function(a){var b=this.parseDate(a,this.parsedFormat);return b?this.fromUTC(b):null},value2submit:function(a){return this.value2str(a)},value2input:function(a){a&&this.$input.data("datetimepicker").setDate(a)},input2value:function(){var a=this.$input.data("datetimepicker");return a.date?a.getDate():null},activate:function(){},clear:function(){this.$input.data("datetimepicker").date=null,this.$input.find(".active").removeClass("active"),this.options.showbuttons||this.$input.closest("form").submit()},autosubmit:function(){this.$input.on("mouseup",".minute",function(){var b=a(this).closest("form");setTimeout(function(){b.submit()},200)})},toUTC:function(a){return a?new Date(a.valueOf()-6e4*a.getTimezoneOffset()):a},fromUTC:function(a){return a?new Date(a.valueOf()+6e4*a.getTimezoneOffset()):a},parseDate:function(a,b){var c,d=null;return a&&(d=this.dpg.parseDate(a,b,this.options.datetimepicker.language,this.options.formatType),"string"==typeof a&&(c=this.dpg.formatDate(d,b,this.options.datetimepicker.language,this.options.formatType),a!==c&&(d=null))),d}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'
',inputclass:null,format:"yyyy-mm-dd hh:ii",formatType:"standard",viewformat:null,datetimepicker:{todayHighlight:!1,autoclose:!1},clear:"× clear"}),a.fn.editabletypes.datetime=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("datetimefield",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.datetime),a.extend(b.prototype,{render:function(){this.$input=this.$tpl.find("input"),this.setClass(),this.setAttr("placeholder"),this.$tpl.datetimepicker(this.options.datetimepicker),this.$input.off("focus keydown"),this.$input.keyup(a.proxy(function(){this.$tpl.removeData("date"),this.$tpl.datetimepicker("update")},this))},value2input:function(a){this.$input.val(this.value2html(a)),this.$tpl.datetimepicker("update")},input2value:function(){return this.html2value(this.$input.val())},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)},autosubmit:function(){}}),b.defaults=a.extend({},a.fn.editabletypes.datetime.defaults,{tpl:'
',inputclass:"input-medium",datetimepicker:{todayHighlight:!1,autoclose:!0}}),a.fn.editabletypes.datetimefield=b}(window.jQuery);
\ No newline at end of file
diff --git a/resources/assets/js/init.js b/resources/assets/js/init.js
index d981001c9..860370d12 100644
--- a/resources/assets/js/init.js
+++ b/resources/assets/js/init.js
@@ -5,6 +5,9 @@ $(function () {
}
});
+
+ $('.inline-editable').editable();
+
Admin.Components.init();
Admin.Controllers.call();
});
\ No newline at end of file
diff --git a/resources/assets/less/common.less b/resources/assets/less/common.less
index e4d2193e7..e6db3a44d 100644
--- a/resources/assets/less/common.less
+++ b/resources/assets/less/common.less
@@ -1,4 +1,5 @@
@import (less) "../../../public/default/libs/select2/css/select2.min.css";
+@import (less) "../../../public/default/libs/x-editable/css/bootstrap-editable.css";
@font-face {
font-family: 'Open Sans';
diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php
index 48e705acc..f1354cd45 100644
--- a/resources/lang/en/lang.php
+++ b/resources/lang/en/lang.php
@@ -63,6 +63,12 @@
'last' => 'Last',
],
],
+ 'editable' => [
+ 'checkbox' => [
+ 'checked' => 'Yes',
+ 'unchecked' => 'No',
+ ],
+ ],
'select' => [
'nothing' => 'Nothing selected',
'selected' => 'selected',
diff --git a/resources/lang/ru/lang.php b/resources/lang/ru/lang.php
index 87b4f9f9c..ec9ec879d 100644
--- a/resources/lang/ru/lang.php
+++ b/resources/lang/ru/lang.php
@@ -63,6 +63,12 @@
'last' => 'Последняя',
],
],
+ 'editable' => [
+ 'checkbox' => [
+ 'checked' => 'Да',
+ 'unchecked' => 'Нет',
+ ],
+ ],
'select' => [
'nothing' => 'Ничего не выбрано',
'selected' => 'выбрано',
@@ -77,10 +83,10 @@
'browse' => 'Выбор файла',
'remove' => 'Удалить',
],
- 'message' => [
- 'created' => 'Запись успешно создана',
- 'updated' => 'Запись успешно обновлена',
- 'deleted' => 'Запись успешно удалена',
+ 'message' => [
+ 'created' => 'Запись успешно создана',
+ 'updated' => 'Запись успешно обновлена',
+ 'deleted' => 'Запись успешно удалена',
'restored' => 'Запись успешно восстановлена',
],
];
diff --git a/resources/lang/uk/lang b/resources/lang/uk/lang
deleted file mode 100644
index 13d42c16d..000000000
--- a/resources/lang/uk/lang
+++ /dev/null
@@ -1,77 +0,0 @@
- 'Сторінка не знайдена.,
- 'auth' => [
- 'title' => 'Авторизація',
- 'username' => 'Логін',
- 'password' => 'Пароль',
- 'login' => 'Увійти',
- 'logout' => 'Вийти',
- 'wrong-username' => 'Не вірний логін',
- 'wrong-password' => 'або пароль'
- ],
- 'ckeditor' => [
- 'upload' => [
- 'success' => 'Файл був успішно завантажений: \\n- Розмір: :size кб \\n- ширина/висота: :width x :height',
- 'error' => [
- 'common' => 'Появилась помилка при спробі загрузити файл.',
- 'wrong_extension' => 'Файл ":file" має не вырний тип.',
- 'filesize_limit' => 'Максимальний розмір файлу: :size кб.',
- 'imagesize_max_limit' => 'Ширина x Висота = :width x :height \\n Максимальний розмір зображеня повинен бути: :maxwidth x :maxheight',
- 'imagesize_min_limit' => 'Ширина x Висота = :width x :height \\n Мінімальний розмір зображеня повинен бути: :minwidth x :minheight',
- ]
- ],
- 'image_browser' => [
- 'title' => 'Вставка зображеня с сервера',
- 'subtitle' => 'Виберіт зображеня для вставки',
- ],
- ],
- 'table' => [
- 'new-entry' => 'Новий запис',
- 'edit' => 'Редагувати',
- 'restore' => 'Востановити',
- 'delete' => 'Видалити',
- 'delete-confirm' => 'Ви впевнені що хочете видалити цей запис?',
- 'delete-error' => 'Неможливо видалити цей запис. Потрібно спочатку видалити всі связані записи.',
- 'moveUp' => 'Підвинути вверх',
- 'moveDown' => 'Підвинути вниз',
- 'error' => 'В процесі обробки вашого запросу з'явилась помилка',
- 'filter' => 'Показати подобні записи',
- 'filter-goto' => 'Перейти',
- 'save' => 'Сохранити',
- 'cancel' => 'Скасувати',
- 'download' => 'Завантажити',
- 'all' => 'Все',
- 'processing' => '
',
- 'loadingRecords' => 'Підождіть...',
- 'lengthMenu' => 'Відображати _MENU_ записів',
- 'zeroRecords' => 'Не найдено підходящих записів.',
- 'info' => 'Записи починаючи з _START_ до _END_ з _TOTAL_',
- 'infoEmpty' => 'Записи починаючи з 0 по 0 з 0',
- 'infoFiltered' => '(відфільтровано з _MAX_ записів)',
- 'infoThousands' => '',
- 'infoPostFix' => '',
- 'search' => 'Пошук: ',
- 'emptyTable' => 'Немає записів',
- 'paginate' => [
- 'first' => 'Перша',
- 'previous' => '←',
- 'next' => '→',
- 'last' => 'Остання'
- ]
- ],
- 'select' => [
- 'nothing' => 'Нічого не вибрано',
- 'selected' => 'вибрано',
- 'placeholder' => 'Виберіть зі списку',
- ],
- 'image' => [
- 'browse' => 'Вибір зображеня',
- 'browseMultiple' => 'Вибір зображеня',
- 'remove' => 'Видалити',
- ],
- 'file' => [
- 'browse' => 'Вибір файлу',
- 'remove' => 'Видалити',
- ],
-];
diff --git a/resources/lang/uk/lang.php b/resources/lang/uk/lang.php
new file mode 100644
index 000000000..8c76a5b8b
--- /dev/null
+++ b/resources/lang/uk/lang.php
@@ -0,0 +1,83 @@
+ 'Сторінка не знайдена.',
+ 'auth' => [
+ 'title' => 'Авторизація',
+ 'username' => 'Логін',
+ 'password' => 'Пароль',
+ 'login' => 'Увійти',
+ 'logout' => 'Вийти',
+ 'wrong - username' => 'Не вірний логін',
+ 'wrong - password' => 'або пароль',
+ ],
+ 'ckeditor' => [
+ 'upload' => [
+ 'success' => 'Файл був успішно завантажений: \\n - Розмір: :size кб \\n - ширина / висота: :width x :height',
+ 'error' => [
+ 'common' => 'Появилась помилка при спробі загрузити файл.',
+ 'wrong_extension' => 'Файл ":file" має не вырний тип.',
+ 'filesize_limit' => 'Максимальний розмір файлу: :size кб.',
+ 'imagesize_max_limit' => 'Ширина x Висота = :width x :height \\n Максимальний розмір зображеня повинен бути: :maxwidth x :maxheight',
+ 'imagesize_min_limit' => 'Ширина x Висота = :width x :height \\n Мінімальний розмір зображеня повинен бути: :minwidth x :minheight',
+ ],
+ ],
+ 'image_browser' => [
+ 'title' => 'Вставка зображеня с сервера',
+ 'subtitle' => 'Виберіт зображеня для вставки',
+ ],
+ ],
+ 'table' => [
+ 'new-entry' => 'Новий запис',
+ 'edit' => 'Редагувати',
+ 'restore' => 'Востановити',
+ 'delete' => 'Видалити',
+ 'delete - confirm' => 'Ви впевнені що хочете видалити цей запис ? ',
+ 'delete - error' => 'Неможливо видалити цей запис.Потрібно спочатку видалити всі связані записи.',
+ 'moveUp' => 'Підвинути вверх',
+ 'moveDown' => 'Підвинути вниз',
+ 'error' => 'В процесі обробки вашого запросу з\'явилась помилка',
+ 'filter' => 'Показати подобні записи',
+ 'filter -goto' => 'Перейти',
+ 'save' => 'Сохранити',
+ 'cancel' => 'Скасувати',
+ 'download' => 'Завантажити',
+ 'all' => 'Все',
+ 'processing' => ' < i class="fa fa-5x fa-circle-o-notch fa-spin" > ',
+ 'loadingRecords' => 'Підождіть...',
+ 'lengthMenu' => 'Відображати _MENU_ записів',
+ 'zeroRecords' => 'Не найдено підходящих записів.',
+ 'info' => 'Записи починаючи з _START_ до _END_ з _TOTAL_',
+ 'infoEmpty' => 'Записи починаючи з 0 по 0 з 0',
+ 'infoFiltered' => '(відфільтровано з _MAX_ записів)',
+ 'infoThousands' => '',
+ 'infoPostFix' => '',
+ 'search' => 'Пошук: ',
+ 'emptyTable' => 'Немає записів',
+ 'paginate' => [
+ 'first' => 'Перша',
+ 'previous' => ' & larr;',
+ 'next' => ' & rarr;',
+ 'last' => 'Остання',
+ ],
+ ],
+ 'editable' => [
+ 'checkbox' => [
+ 'checked' => 'Да',
+ 'unchecked' => 'Нет',
+ ],
+ ],
+ 'select' => [
+ 'nothing' => 'Нічого не вибрано',
+ 'selected' => 'вибрано',
+ 'placeholder' => 'Виберіть зі списку',
+ ],
+ 'image' => [
+ 'browse' => 'Вибір зображеня',
+ 'browseMultiple' => 'Вибір зображеня',
+ 'remove' => 'Видалити',
+ ],
+ 'file' => [
+ 'browse' => 'Вибір файлу',
+ 'remove' => 'Видалити',
+ ],
+];
diff --git a/resources/views/default/column/editable/checkbox.blade.php b/resources/views/default/column/editable/checkbox.blade.php
new file mode 100644
index 000000000..e155391e9
--- /dev/null
+++ b/resources/views/default/column/editable/checkbox.blade.php
@@ -0,0 +1,17 @@
+
+ @if($isEditable)
+
+
+ @else
+ @if($value) {{ $checkedLabel }} @else {{ $uncheckedLabel }} @endif
+ @endif
+
\ No newline at end of file
diff --git a/src/Contracts/ColumnInterface.php b/src/Contracts/ColumnInterface.php
index f836f6cff..613c4ebf7 100644
--- a/src/Contracts/ColumnInterface.php
+++ b/src/Contracts/ColumnInterface.php
@@ -3,13 +3,27 @@
namespace SleepingOwl\Admin\Contracts;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Contracts\Support\Arrayable;
+use Illuminate\Contracts\Support\Renderable;
+use SleepingOwl\Admin\Contracts\Display\TableHeaderColumnInterface;
-interface ColumnInterface extends Initializable
+interface ColumnInterface extends Initializable, Renderable, Arrayable
{
+
/**
* @param Model $model
*
* @return $this
*/
public function setModel(Model $model);
+
+ /**
+ * @return int
+ */
+ public function getWidth();
+
+ /**
+ * @return TableHeaderColumnInterface
+ */
+ public function getHeader();
}
diff --git a/src/Contracts/Display/ColumnEditableInterface.php b/src/Contracts/Display/ColumnEditableInterface.php
new file mode 100644
index 000000000..0bf942dec
--- /dev/null
+++ b/src/Contracts/Display/ColumnEditableInterface.php
@@ -0,0 +1,15 @@
+checkedLabel = $checkedLabel;
+ $this->uncheckedLabel = $uncheckedLabel;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getCheckedLabel()
+ {
+ if(is_null($label = $this->checkedLabel)) {
+ $label = trans('sleeping_owl::lang.editable.checkbox.checked');
+ }
+
+ return $label;
+ }
+
+ /**
+ * @param null|string $label
+ *
+ * @return $this
+ */
+ public function setCheckedLabel($label)
+ {
+ $this->checkedLabel = $label;
+
+ return $this;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getUncheckedLabel()
+ {
+ if(is_null($label = $this->uncheckedLabel)) {
+ $label = trans('sleeping_owl::lang.editable.checkbox.unchecked');
+ }
+
+ return $label;
+ }
+
+ /**
+ * @param null|string $label
+ *
+ * @return $this
+ */
+ public function setUncheckedLabel($label)
+ {
+ $this->uncheckedLabel = $label;
+
+ return $this;
+ }
+
+ /**
+ * @return array
+ */
+ public function toArray()
+ {
+ return parent::toArray() + [
+ 'id' => $this->getModel()->getKey(),
+ 'value' => $this->getModelValue(),
+ 'isEditable' => $this->getModelConfiguration()->isEditable($this->getModel()),
+ 'checkedLabel' => $this->getCheckedLabel(),
+ 'uncheckedLabel' => $this->getUncheckedLabel(),
+ ];
+ }
+
+ /**
+ * Save form item.
+ *
+ * @param mixed $value
+ */
+ public function save($value)
+ {
+ if (is_array($value)) {
+ $value = array_shift($value);
+ }
+
+ $this->getModel()->setAttribute($this->getName(), (bool) $value);
+ $this->getModel()->save();
+ }
+}
\ No newline at end of file
diff --git a/src/Display/Column/NamedColumn.php b/src/Display/Column/NamedColumn.php
index b913d4bdc..526fb7208 100644
--- a/src/Display/Column/NamedColumn.php
+++ b/src/Display/Column/NamedColumn.php
@@ -52,6 +52,18 @@ public function getModelValue()
return $this->getValueFromObject($this->getModel(), $this->getName());
}
+ /**
+ * Get the instance as an array.
+ *
+ * @return array
+ */
+ public function toArray()
+ {
+ return parent::toArray() + [
+ 'name' => $this->getName()
+ ];
+ }
+
/**
* Get column value from instance.
*
diff --git a/src/Display/TableColumn.php b/src/Display/TableColumn.php
index ed1ccc9af..fa55e3562 100644
--- a/src/Display/TableColumn.php
+++ b/src/Display/TableColumn.php
@@ -4,14 +4,12 @@
use Meta;
use Illuminate\Database\Eloquent\Model;
-use Illuminate\Contracts\Support\Arrayable;
-use Illuminate\Contracts\Support\Renderable;
use SleepingOwl\Admin\Traits\HtmlAttributes;
use SleepingOwl\Admin\Model\ModelConfiguration;
use SleepingOwl\Admin\Contracts\ColumnInterface;
use SleepingOwl\Admin\Contracts\Display\TableHeaderColumnInterface;
-abstract class TableColumn implements Renderable, ColumnInterface, Arrayable
+abstract class TableColumn implements ColumnInterface
{
use HtmlAttributes;
diff --git a/src/Facades/TableColumnEditable.php b/src/Facades/TableColumnEditable.php
new file mode 100644
index 000000000..cdc0b4ad4
--- /dev/null
+++ b/src/Facades/TableColumnEditable.php
@@ -0,0 +1,16 @@
+with('success_message', $model->getMessageOnUpdate());
}
+ /**
+ * @param ModelConfiguration $model
+ */
+ public function inlineEdit(ModelConfiguration $model)
+ {
+ $field = Request::get('name');
+ $value = Request::get('value');
+ $id = Request::get('pk');
+
+ $display = $model->fireDisplay();
+
+ /** @var ColumnEditableInterface|null $column */
+ $column = $display->getColumns()->all()->filter(function($column) use($field) {
+ return ($column instanceof ColumnEditableInterface) and $field == $column->getName();
+ })->first();
+
+ if (is_null($column)) {
+ abort(404);
+ }
+
+ $repository = $model->getRepository();
+ $item = $repository->find($id);
+
+ if (is_null($item) || ! $model->isEditable($item)) {
+ abort(404);
+ }
+
+ $column->setModel($item);
+ $column->save($value);
+ }
+
/**
* @param ModelConfiguration $model
* @param int $id
diff --git a/src/Http/routes.php b/src/Http/routes.php
index 2d12e5d11..474a11fc3 100644
--- a/src/Http/routes.php
+++ b/src/Http/routes.php
@@ -11,6 +11,11 @@
'uses' => 'AdminController@getDisplay',
]);
+ Route::post('{adminModel}', [
+ 'as' => 'model',
+ 'uses' => 'AdminController@inlineEdit',
+ ]);
+
Route::get('{adminModel}/create', [
'as' => 'model.create',
'uses' => 'AdminController@getCreate',
diff --git a/src/Providers/AliasesServiceProvider.php b/src/Providers/AliasesServiceProvider.php
index 908ad1cbe..df24f296a 100644
--- a/src/Providers/AliasesServiceProvider.php
+++ b/src/Providers/AliasesServiceProvider.php
@@ -10,6 +10,7 @@ class AliasesServiceProvider extends ServiceProvider
public function register()
{
$this->registerColumns();
+ $this->registerColumnEditable();
$this->registerColumnFilters();
$this->registerDisplays();
$this->registerForms();
@@ -72,6 +73,17 @@ protected function registerColumns()
});
}
+ protected function registerColumnEditable()
+ {
+ $alias = (new AliasBinder())->register([
+ 'checkbox' => \SleepingOwl\Admin\Display\Column\Editable\Checkbox::class
+ ]);
+
+ $this->app->singleton('sleeping_owl.table.column.editable', function() use($alias) {
+ return $alias;
+ });
+ }
+
protected function registerFormElements()
{
$alias = (new AliasBinder())->register([