').append(this.$clear));
- }
- */
- },
-
- value2html: function(value, element) {
- var text = value ? value.format(this.options.viewformat) : '';
- $(element).text(text);
- },
-
- 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
-*/
-(function ($) {
- "use strict";
-
- $.extend($.fn.editableform.Constructor.prototype, {
- initTemplate: function() {
- this.$form = $($.fn.editableform.template);
- this.$form.find('.editable-error-block').addClass('help-block');
- }
- });
-
- //buttons
- $.fn.editableform.buttons = '
'+
- '
';
-
- //error classes
- $.fn.editableform.errorGroupClass = 'has-error';
- $.fn.editableform.errorBlockClass = null;
-
-}(window.jQuery));
-/**
-* Editable Popover
-* ---------------------
-* requires bootstrap-popover.js
-*/
-(function ($) {
- "use strict";
-
- $.fn.popover.defaults = $.fn.popover.Constructor.DEFAULTS;
-
- //extend methods
- $.extend($.fn.editableContainer.Popup.prototype, {
- containerName: 'popover',
- containerDataName: 'bs.popover',
-
- //for compatibility with bootstrap <= 2.2.1 (content inserted into
instead of directly .popover-content)
- innerCss: $.fn.popover && $($.fn.popover.defaults.template).find('p').length ? '.popover-content p' : '.popover-content',
-
- initContainer: function(){
- $.extend(this.containerOptions, {
- trigger: 'manual',
- selector: false,
- content: ' ',
- template: $.fn.popover.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*/
- 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');
-
- }).call(this.container());
- /*jshint laxcomma: false*/
- }
- });
-
-}(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('fa-angle-left fa-angle-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(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://vitalets.github.com/bootstrap-datepicker
-
- @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: 'form-control input-medium',
-
- /* 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(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: 'form-control input-medium',
-
- /* datetimepicker config */
- datetimepicker:{
- todayHighlight: false,
- autoclose: true
- }
- });
-
- $.fn.editabletypes.datetimefield = DateTimeField;
-
-}(window.jQuery));
-/**
-Typeahead input (bootstrap only). Based on Twitter Bootstrap [typeahead](http://twitter.github.com/bootstrap/javascript.html#typeahead).
-Depending on `source` format typeahead operates in two modes:
-
-* **strings**:
- When `source` defined as array of strings, e.g. `['text1', 'text2', 'text3' ...]`.
- User can submit one of these strings or any text entered in input (even if it is not matching source).
-
-* **objects**:
- When `source` defined as array of objects, e.g. `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`.
- User can submit only values that are in source (otherwise `null` is submitted). This is more like *dropdown* behavior.
-
-@class typeahead
-@extends list
-@since 1.4.1
-@final
-@example
-
-
-**/
-(function ($) {
- "use strict";
-
- var Constructor = function (options) {
- this.init('typeahead', options, Constructor.defaults);
-
- //overriding objects in config (as by default jQuery extend() is not recursive)
- this.options.typeahead = $.extend({}, Constructor.defaults.typeahead, {
- //set default methods for typeahead to work with objects
- matcher: this.matcher,
- sorter: this.sorter,
- highlighter: this.highlighter,
- updater: this.updater
- }, options.typeahead);
- };
-
- $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.list);
-
- $.extend(Constructor.prototype, {
- renderList: function() {
- this.$input = this.$tpl.is('input') ? this.$tpl : this.$tpl.find('input[type="text"]');
-
- //set source of typeahead
- this.options.typeahead.source = this.sourceData;
-
- //apply typeahead
- this.$input.typeahead(this.options.typeahead);
-
- //patch some methods in typeahead
- var ta = this.$input.data('typeahead');
- ta.render = $.proxy(this.typeaheadRender, ta);
- ta.select = $.proxy(this.typeaheadSelect, ta);
- ta.move = $.proxy(this.typeaheadMove, ta);
-
- this.renderClear();
- this.setClass();
- this.setAttr('placeholder');
- },
-
- value2htmlFinal: function(value, element) {
- if(this.getIsObjects()) {
- var items = $.fn.editableutils.itemsByValue(value, this.sourceData);
- $(element).text(items.length ? items[0].text : '');
- } else {
- $(element).text(value);
- }
- },
-
- html2value: function (html) {
- return html ? html : null;
- },
-
- value2input: function(value) {
- if(this.getIsObjects()) {
- var items = $.fn.editableutils.itemsByValue(value, this.sourceData);
- this.$input.data('value', value).val(items.length ? items[0].text : '');
- } else {
- this.$input.val(value);
- }
- },
-
- input2value: function() {
- if(this.getIsObjects()) {
- var value = this.$input.data('value'),
- items = $.fn.editableutils.itemsByValue(value, this.sourceData);
-
- if(items.length && items[0].text.toLowerCase() === this.$input.val().toLowerCase()) {
- return value;
- } else {
- return null; //entered string not found in source
- }
- } else {
- return this.$input.val();
- }
- },
-
- /*
- if in sourceData values <> texts, typeahead in "objects" mode:
- user must pick some value from list, otherwise `null` returned.
- if all values == texts put typeahead in "strings" mode:
- anything what entered is submited.
- */
- getIsObjects: function() {
- if(this.isObjects === undefined) {
- this.isObjects = false;
- for(var i=0; i
- **/
- tpl:'',
- /**
- Configuration of typeahead. [Full list of options](http://twitter.github.com/bootstrap/javascript.html#typeahead).
-
- @property typeahead
- @type object
- @default null
- **/
- typeahead: null,
- /**
- Whether to show `clear` button
-
- @property clear
- @type boolean
- @default true
- **/
- clear: true
- });
-
- $.fn.editabletypes.typeahead = Constructor;
-
-}(window.jQuery));
\ No newline at end of file
diff --git a/app/static/global/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js b/app/static/global/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js
deleted file mode 100644
index 6d20fe2..0000000
--- a/app/static/global/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*! X-editable - v1.4.6
-* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
-* http://github.com/vitalets/x-editable
-* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT
-* Improved by Keenthemes for Bootstrap 3.0 support */
-/**
-Form with single input element, two buttons and two states: normal/loading.
-Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.
-Editableform is linked with one of input types, e.g. 'text', 'select' etc.
-
-@class editableform
-@uses text
-@uses textarea
-**/
-!function(t){"use strict";var e=function(e,i){this.options=t.extend({},t.fn.editableform.defaults,i),this.$div=t(e),this.options.scope||(this.options.scope=this)};e.prototype={constructor:e,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value)},initTemplate:function(){this.$form=t(t.fn.editableform.template)},initButtons:function(){var e=this.$form.find(".editable-buttons");e.append(t.fn.editableform.buttons),"bottom"===this.options.showbuttons&&e.addClass("editable-buttons-bottom")},render:function(){this.$loading=t(t.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.input.prerender(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),t.when(this.input.render()).then(t.proxy(function(){if(this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(t.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(t){t.preventDefault()});else{this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled");var e=null===this.value||void 0===this.value||""===this.value?this.options.defaultValue:this.value;this.input.value2input(e),this.$form.submit(t.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 t,e;this.$form?(t=this.$form.outerWidth(),e=this.$form.outerHeight(),t&&this.$loading.width(t),e&&this.$loading.height(e),this.$form.hide()):(t=this.$loading.parent().width(),t&&this.$loading.width(t)),this.$loading.show()},showForm:function(t){this.$loading.hide(),this.$form.show(),t!==!1&&this.input.activate(),this.$div.triggerHandler("show")},error:function(e){var i,n=this.$form.find(".form-group"),o=this.$form.find(".editable-error-block");if(e===!1)n.removeClass(t.fn.editableform.errorGroupClass),o.removeClass(t.fn.editableform.errorBlockClass).empty().hide();else{if(e){i=e.split("\n");for(var r=0;r").text(i[r]).html();e=i.join("
")}n.addClass(t.fn.editableform.errorGroupClass),o.addClass(t.fn.editableform.errorBlockClass).html(e).show()}},submit:function(e){e.stopPropagation(),e.preventDefault();var i,n=this.input.input2value();if(i=this.validate(n))return this.error(i),this.showForm(),void 0;if(!this.options.savenochange&&this.input.value2str(n)==this.input.value2str(this.value))return this.$div.triggerHandler("nochange"),void 0;var o=this.input.value2submit(n);this.isSaving=!0,t.when(this.save(o)).done(t.proxy(function(t){this.isSaving=!1;var e="function"==typeof this.options.success?this.options.success.call(this.options.scope,t,n):null;return e===!1?(this.error(!1),this.showForm(!1),void 0):"string"==typeof e?(this.error(e),this.showForm(),void 0):(e&&"object"==typeof e&&e.hasOwnProperty("newValue")&&(n=e.newValue),this.error(!1),this.value=n,this.$div.triggerHandler("save",{newValue:n,submitValue:o,response:t}),void 0)},this)).fail(t.proxy(function(t){this.isSaving=!1;var e;e="function"==typeof this.options.error?this.options.error.call(this.options.scope,t,n):"string"==typeof t?t:t.responseText||t.statusText||"Unknown error!",this.error(e),this.showForm()},this))},save:function(e){this.options.pk=t.fn.editableutils.tryParseJson(this.options.pk,!0);var i,n="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk,o=!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!==n&&void 0!==n));return o?(this.showLoading(),i={name:this.options.name||"",value:e,pk:n},"function"==typeof this.options.params?i=this.options.params.call(this.options.scope,i):(this.options.params=t.fn.editableutils.tryParseJson(this.options.params,!0),t.extend(i,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,i):t.ajax(t.extend({url:this.options.url,data:i,type:"POST"},this.options.ajaxOptions))):void 0},validate:function(t){return void 0===t&&(t=this.value),"function"==typeof this.options.validate?this.options.validate.call(this.options.scope,t):void 0},option:function(t,e){t in this.options&&(this.options[t]=e),"value"===t&&this.setValue(e)},setValue:function(t,e){this.value=e?this.input.str2value(t):t,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},t.fn.editableform=function(i){var n=arguments;return this.each(function(){var o=t(this),r=o.data("editableform"),s="object"==typeof i&&i;r||o.data("editableform",r=new e(this,s)),"string"==typeof i&&r[i].apply(r,Array.prototype.slice.call(n,1))})},t.fn.editableform.Constructor=e,t.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},t.fn.editableform.template='',t.fn.editableform.loading='',t.fn.editableform.buttons='',t.fn.editableform.errorGroupClass="has-error",t.fn.editableform.errorBlockClass="editable-error"}(window.jQuery),function(t){"use strict";t.fn.editableutils={inherit:function(t,e){var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=e.prototype},setCursorPosition:function(t,e){if(t.setSelectionRange)t.setSelectionRange(e,e);else if(t.createTextRange){var i=t.createTextRange();i.collapse(!0),i.moveEnd("character",e),i.moveStart("character",e),i.select()}},tryParseJson:function(t,e){if("string"==typeof t&&t.length&&t.match(/^[\{\[].*[\}\]]$/))if(e)try{t=new Function("return "+t)()}catch(i){}finally{return t}else t=new Function("return "+t)();return t},sliceObj:function(e,i,n){var o,r,s={};if(!t.isArray(i)||!i.length)return s;for(var a=0;a").text(e).html()},itemsByValue:function(e,i,n){if(!i||null===e)return[];if("function"!=typeof n){var o=n||"value";n=function(t){return t[o]}}var r=t.isArray(e),s=[],a=this;return t.each(i,function(i,o){if(o.children)s=s.concat(a.itemsByValue(e,o.children,n));else if(r)t.grep(e,function(t){return t==(o&&"object"==typeof o?n(o):o)}).length&&s.push(o);else{var l=o&&"object"==typeof o?n(o):o;e==l&&s.push(o)}}),s},createInput:function(e){var i,n,o,r=e.type;return"date"===r&&("inline"===e.mode?t.fn.editabletypes.datefield?r="datefield":t.fn.editabletypes.dateuifield&&(r="dateuifield"):t.fn.editabletypes.date?r="date":t.fn.editabletypes.dateui&&(r="dateui"),"date"!==r||t.fn.editabletypes.date||(r="combodate")),"datetime"===r&&"inline"===e.mode&&(r="datetimefield"),"wysihtml5"!==r||t.fn.editabletypes[r]||(r="textarea"),"function"==typeof t.fn.editabletypes[r]?(i=t.fn.editabletypes[r],n=this.sliceObj(e,this.objectKeys(i.defaults)),o=new i(n)):(t.error("Unknown type: "+r),!1)},supportsTransitions:function(){var t=document.body||document.documentElement,e=t.style,i="transition",n=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof e[i])return!0;i=i.charAt(0).toUpperCase()+i.substr(1);for(var o=0;o"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(t){if(this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")){if(this.$form.data("editableform").isSaving)return this.delayedHide={reason:t},void 0;this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",t||"manual")}},innerShow:function(){},innerHide:function(){},toggle:function(t){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(t)},setPosition:function(){},save:function(t,e){this.$element.triggerHandler("save",e),this.hide("save")},option:function(t,e){this.options[t]=e,t in this.containerOptions?(this.containerOptions[t]=e,this.setContainerOption(t,e)):(this.formOptions[t]=e,this.$form&&this.$form.editableform("option",t,e))},setContainerOption:function(t,e){this.call("option",t,e)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(e){t(".editable-open").each(function(i,n){if(n!==e&&!t(n).find(e).length){var o=t(n),r=o.data("editableContainer");r&&("cancel"===r.options.onblur?o.data("editableContainer").hide("onblur"):"submit"===r.options.onblur&&o.data("editableContainer").tip().find("form").submit())}})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},t.fn.editableContainer=function(n){var o=arguments;return this.each(function(){var r=t(this),s="editableContainer",a=r.data(s),l="object"==typeof n&&n,c="inline"===l.mode?i:e;a||r.data(s,a=new c(this,l)),"string"==typeof n&&a[n].apply(a,Array.prototype.slice.call(o,1))})},t.fn.editableContainer.Popup=e,t.fn.editableContainer.Inline=i,t.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(t){t.handler&&t.handler()}}}(window.jQuery),function(t){"use strict";t.extend(t.fn.editableContainer.Inline.prototype,t.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=t(""),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,t.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(t){"use strict";var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.editable.defaults,i,t.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!t.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};e.prototype={constructor:e,init:function(){var e,i=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=t.fn.editableutils.createInput(this.options),this.input){switch(void 0===this.options.value||null===this.options.value?(this.value=this.input.html2value(t.trim(this.$element.html())),i=!0):(this.options.value=t.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",t.proxy(function(t){if(this.options.disabled||t.preventDefault(),"mouseenter"===this.options.toggle)this.show();else{var e="click"!==this.options.toggle;this.toggle(e)}},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":e=!0;break;case"auto":e=!t.trim(this.$element.text()).length&&null!==this.value&&void 0!==this.value&&!i;break;default:e=!1}t.when(e?this.render():!0).then(t.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var e=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",e,t.proxy(function(e){var i=t(e.target);i.data("editable")||(i.hasClass(this.options.emptyclass)&&i.empty(),i.editable(this.options).trigger(e))},this))},render:function(t){return this.options.display!==!1?this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,t):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,t):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(e,i){return e&&"object"==typeof e?(t.each(e,t.proxy(function(e,i){this.option(t.trim(e),i)},this)),void 0):(this.options[e]=i,"disabled"===e?i?this.disable():this.enable():("value"===e&&this.setValue(i),this.container&&this.container.option(e,i),this.input.option&&this.input.option(e,i),void 0))},handleEmpty:function(e){this.options.display!==!1&&(this.isEmpty=void 0!==e?e:""===t.trim(this.$element.html())?!0:""!==t.trim(this.$element.text())?!1:!this.$element.height()||!this.$element.width(),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(e){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var i=t.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(i),this.$element.on("save.internal",t.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(e)}},hide:function(){this.container&&this.container.hide()},toggle:function(t){this.container&&this.container.tip().is(":visible")?this.hide():this.show(t)},save:function(t,e){if(this.options.unsavedclass){var i=!1;i=i||"function"==typeof this.options.url,i=i||this.options.display===!1,i=i||void 0!==e.response,i=i||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(e.newValue),i?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var n=this.$element,o=n.css("background-color");n.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===o&&(o=""),n.css("background-color",o),n.addClass("editable-bg-transition"),setTimeout(function(){n.removeClass("editable-bg-transition")},1700)},10)}this.setValue(e.newValue,!1,e.response)},validate:function(){return"function"==typeof this.options.validate?this.options.validate.call(this,this.value):void 0},setValue:function(e,i,n){this.value=i?this.input.str2value(e):e,this.container&&this.container.option("value",this.value),t.when(this.render(n)).then(t.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")}},t.fn.editable=function(i){var n={},o=arguments,r="editable";switch(i){case"validate":return this.each(function(){var e,i=t(this),o=i.data(r);o&&(e=o.validate())&&(n[o.options.name]=e)}),n;case"getValue":return 2===arguments.length&&arguments[1]===!0?n=this.eq(0).data(r).value:this.each(function(){var e=t(this),i=e.data(r);i&&void 0!==i.value&&null!==i.value&&(n[i.options.name]=i.input.value2submit(i.value))}),n;case"submit":var s,a=arguments[1]||{},l=this,c=this.editable("validate");return t.isEmptyObject(c)?(s=this.editable("getValue"),a.data&&t.extend(s,a.data),t.ajax(t.extend({url:a.url,data:s,type:"POST"},a.ajaxOptions)).success(function(t){"function"==typeof a.success&&a.success.call(l,t,a)}).error(function(){"function"==typeof a.error&&a.error.apply(l,arguments)})):"function"==typeof a.error&&a.error.call(l,c),this}return this.each(function(){var n=t(this),s=n.data(r),a="object"==typeof i&&i;return a&&a.selector?(s=new e(this,a),void 0):(s||n.data(r,s=new e(this,a)),"string"==typeof i&&s[i].apply(s,Array.prototype.slice.call(o,1)),void 0)})},t.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(t){"use strict";t.fn.editabletypes={};var e=function(){};e.prototype={init:function(e,i,n){this.type=e,this.options=t.extend({},n,i)},prerender:function(){this.$tpl=t(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(e,i){t(i).text(t.trim(e))},html2value:function(e){return t("").html(e).text()},value2str:function(t){return t},str2value:function(t){return t},value2submit:function(t){return t},value2input:function(t){this.$input.val(t)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(e){return t("
").text(e).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(t){void 0!==this.options[t]&&null!==this.options[t]&&this.$input.attr(t,this.options[t])},option:function(t,e){this.options[t]=e}},e.defaults={tpl:"",inputclass:"input-medium",scope:null,showbuttons:!0},t.extend(t.fn.editabletypes,{abstractinput:e})}(window.jQuery),function(t){"use strict";var e=function(){};t.fn.editableutils.inherit(e,t.fn.editabletypes.abstractinput),t.extend(e.prototype,{render:function(){var e=t.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),e.resolve()},function(){this.error=this.options.sourceError,e.resolve()}),e.promise()},html2value:function(){return null},value2html:function(e,i,n,o){var r=t.Deferred(),s=function(){"function"==typeof n?n.call(i,e,this.sourceData,o):this.value2htmlFinal(e,i),r.resolve()};return null===e?s.call(this):this.onSourceReady(s,function(){r.resolve()}),r.promise()},onSourceReady:function(e,i){var n;if(t.isFunction(this.options.source)?(n=this.options.source.call(this.options.scope),this.sourceData=null):n=this.options.source,this.options.sourceCache&&t.isArray(this.sourceData))return e.call(this),void 0;try{n=t.fn.editableutils.tryParseJson(n,!1)}catch(o){return i.call(this),void 0}if("string"==typeof n){if(this.options.sourceCache){var r,s=n;if(t(document).data(s)||t(document).data(s,{}),r=t(document).data(s),r.loading===!1&&r.sourceData)return this.sourceData=r.sourceData,this.doPrepend(),e.call(this),void 0;if(r.loading===!0)return r.callbacks.push(t.proxy(function(){this.sourceData=r.sourceData,this.doPrepend(),e.call(this)},this)),r.err_callbacks.push(t.proxy(i,this)),void 0;r.loading=!0,r.callbacks=[],r.err_callbacks=[]}t.ajax({url:n,type:"get",cache:!1,dataType:"json",success:t.proxy(function(n){r&&(r.loading=!1),this.sourceData=this.makeArray(n),t.isArray(this.sourceData)?(r&&(r.sourceData=this.sourceData,t.each(r.callbacks,function(){this.call()})),this.doPrepend(),e.call(this)):(i.call(this),r&&t.each(r.err_callbacks,function(){this.call()}))},this),error:t.proxy(function(){i.call(this),r&&(r.loading=!1,t.each(r.err_callbacks,function(){this.call()}))},this)})}else this.sourceData=this.makeArray(n),t.isArray(this.sourceData)?(this.doPrepend(),e.call(this)):i.call(this)},doPrepend:function(){null!==this.options.prepend&&void 0!==this.options.prepend&&(t.isArray(this.prependData)||(t.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=t.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)),t.isArray(this.prependData)&&t.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData)))},renderList:function(){},value2htmlFinal:function(){},makeArray:function(e){var i,n,o,r,s=[];if(!e||"string"==typeof e)return null;if(t.isArray(e)){r=function(t,e){return n={value:t,text:e},i++>=2?!1:void 0};for(var a=0;a
1&&(o.children&&(o.children=this.makeArray(o.children)),s.push(o))):s.push({value:o,text:o})}else t.each(e,function(t,e){s.push({value:t,text:e})});return s},option:function(t,e){this.options[t]=e,"source"===t&&(this.sourceData=null),"prepend"===t&&(this.prependData=null)}}),e.defaults=t.extend({},t.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0}),t.fn.editabletypes.list=e}(window.jQuery),function(t){"use strict";var e=function(t){this.init("text",t,e.defaults)};t.fn.editableutils.inherit(e,t.fn.editabletypes.abstractinput),t.extend(e.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),t.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=t(''),this.$input.after(this.$clear).css("padding-right",24).keyup(t.proxy(function(e){if(!~t.inArray(e.keyCode,[40,38,9,13,27])){clearTimeout(this.t);var i=this;this.t=setTimeout(function(){i.toggleClear(e)},100)}},this)).parent().css("position","relative"),this.$clear.click(t.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(){if(this.$clear){var t=this.$input.val().length,e=this.$clear.is(":visible");t&&!e&&this.$clear.show(),!t&&e&&this.$clear.hide()}},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),e.defaults=t.extend({},t.fn.editabletypes.abstractinput.defaults,{tpl:'',placeholder:null,clear:!0}),t.fn.editabletypes.text=e}(window.jQuery),function(t){"use strict";var e=function(t){this.init("textarea",t,e.defaults)};t.fn.editableutils.inherit(e,t.fn.editabletypes.abstractinput),t.extend(e.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(e){e.ctrlKey&&13===e.which&&t(this).closest("form").submit()})},activate:function(){t.fn.editabletypes.text.prototype.activate.call(this)}}),e.defaults=t.extend({},t.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),t.fn.editabletypes.textarea=e}(window.jQuery),function(t){"use strict";var e=function(t){this.init("select",t,e.defaults)};t.fn.editableutils.inherit(e,t.fn.editabletypes.list),t.extend(e.prototype,{renderList:function(){this.$input.empty();var e=function(i,n){var o;if(t.isArray(n))for(var r=0;r",o),n[r].children))):(o.value=n[r].value,n[r].disabled&&(o.disabled=!0),i.append(t("