comfortable_mexican_sofa 1.10.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.js +9 -1
- data/app/views/admin/cms/pages/_index_branch.html.haml +1 -1
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/lib/comfortable_mexican_sofa/view_methods.rb +4 -1
- data/test/controllers/admin/cms/pages_controller_test.rb +15 -1
- data/test/lib/view_methods_test.rb +15 -0
- metadata +2 -2
@@ -4,6 +4,7 @@
|
|
4
4
|
* Copyright 2012 Stefan Petre
|
5
5
|
* Improvements by Andrew Rowls
|
6
6
|
* Improvements by Sébastien Malot
|
7
|
+
* Improvements by Yun Lai
|
7
8
|
* Project URL : http://www.malot.fr/bootstrap-datetimepicker
|
8
9
|
*
|
9
10
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,4 +19,11 @@
|
|
18
19
|
* See the License for the specific language governing permissions and
|
19
20
|
* limitations under the License.
|
20
21
|
* ========================================================= */
|
21
|
-
!function(e){function t(){return new Date(Date.UTC.apply(Date,arguments))}function n(){var e=new Date;return t(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())}var r=function(t,n){var r=this;this.element=e(t);this.language=n.language||this.element.data("date-language")||"en";this.language=this.language in i?this.language:"en";this.isRTL=i[this.language].rtl||false;this.formatType=n.formatType||this.element.data("format-type")||"standard";this.format=s.parseFormat(n.format||this.element.data("date-format")||s.getDefaultFormat(this.formatType,"input"),this.formatType);this.isInline=false;this.isInput=this.element.is("input");this.component=this.element.is(".date")?this.element.find(".add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar").parent():false;this.componentReset=this.element.is(".date")?this.element.find(".add-on .icon-remove").parent():false;this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0){this.component=false}this.linkField=n.linkField||this.element.data("link-field")||false;this.linkFormat=s.parseFormat(n.linkFormat||this.element.data("link-format")||s.getDefaultFormat(this.formatType,"link"),this.formatType);this.minuteStep=n.minuteStep||this.element.data("minute-step")||5;this.pickerPosition=n.pickerPosition||this.element.data("picker-position")||"bottom-right";this._attachEvents();this.minView=0;if("minView"in n){this.minView=n.minView}else if("minView"in this.element.data()){this.minView=this.element.data("min-view")}this.minView=s.convertViewMode(this.minView);this.maxView=s.modes.length-1;if("maxView"in n){this.maxView=n.maxView}else if("maxView"in this.element.data()){this.maxView=this.element.data("max-view")}this.maxView=s.convertViewMode(this.maxView);this.startViewMode=2;if("startView"in n){this.startViewMode=n.startView}else if("startView"in this.element.data()){this.startViewMode=this.element.data("start-view")}this.startViewMode=s.convertViewMode(this.startViewMode);this.viewMode=this.startViewMode;this.forceParse=true;if("forceParse"in n){this.forceParse=n.forceParse}else if("dateForceParse"in this.element.data()){this.forceParse=this.element.data("date-force-parse")}this.picker=e(s.template).appendTo(this.isInline?this.element:"body").on({click:e.proxy(this.click,this),mousedown:e.proxy(this.mousedown,this)});if(this.isInline){this.picker.addClass("datetimepicker-inline")}else{if(this.component&&this.pickerPosition=="bottom-left"){this.picker.addClass("datetimepicker-dropdown-left dropdown-menu")}else{this.picker.addClass("datetimepicker-dropdown dropdown-menu")}}if(this.isRTL){this.picker.addClass("datetimepicker-rtl");this.picker.find(".prev i, .next i").toggleClass("icon-arrow-left icon-arrow-right")}e(document).on("mousedown",function(t){if(e(t.target).closest(".datetimepicker").length===0){r.hide()}});this.autoclose=false;if("autoclose"in n){this.autoclose=n.autoclose}else if("dateAutoclose"in this.element.data()){this.autoclose=this.element.data("date-autoclose")}this.keyboardNavigation=true;if("keyboardNavigation"in n){this.keyboardNavigation=n.keyboardNavigation}else if("dateKeyboardNavigation"in this.element.data()){this.keyboardNavigation=this.element.data("date-keyboard-navigation")}this.todayBtn=n.todayBtn||this.element.data("date-today-btn")||false;this.todayHighlight=n.todayHighlight||this.element.data("date-today-highlight")||false;this.weekStart=(n.weekStart||this.element.data("date-weekstart")||i[this.language].weekStart||0)%7;this.weekEnd=(this.weekStart+6)%7;this.startDate=-Infinity;this.endDate=Infinity;this.daysOfWeekDisabled=[];this.setStartDate(n.startDate||this.element.data("date-startdate"));this.setEndDate(n.endDate||this.element.data("date-enddate"));this.setDaysOfWeekDisabled(n.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};r.prototype={constructor:r,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:e.proxy(this.show,this),keyup:e.proxy(this.update,this),keydown:e.proxy(this.keydown,this)}]]}else if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:e.proxy(this.show,this),keyup:e.proxy(this.update,this),keydown:e.proxy(this.keydown,this)}],[this.component,{click:e.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:e.proxy(this.reset,this)}])}}else if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:e.proxy(this.show,this)}]]}for(var t=0,n,r;t<this._events.length;t++){n=this._events[t][0];r=this._events[t][1];n.on(r)}},_detachEvents:function(){for(var e=0,t,n;e<this._events.length;e++){t=this._events[e][0];n=this._events[e][1];t.off(n)}this._events=[]},show:function(t){this.picker.show();this.height=this.component?this.component.outerHeight():this.element.outerHeight();if(this.forceParse){this.update()}this.place();e(window).on("resize",e.proxy(this.place,this));if(t){t.stopPropagation();t.preventDefault()}this.element.trigger({type:"show",date:this.date})},hide:function(t){if(this.isInline)return;this.picker.hide();e(window).off("resize",this.place);this.viewMode=this.startViewMode;this.showMode();if(!this.isInput){e(document).off("mousedown",this.hide)}if(this.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val()))this.setValue();this.element.trigger({type:"hide",date:this.date})},remove:function(){this._detachEvents();this.picker.remove();delete this.element.data().datetimepicker},getDate:function(){var e=this.getUTCDate();return new Date(e.getTime()+e.getTimezoneOffset()*6e4)},getUTCDate:function(){return this.date},setDate:function(e){this.setUTCDate(new Date(e.getTime()-e.getTimezoneOffset()*6e4))},setUTCDate:function(e){if(e>=this.startDate&&e<=this.endDate){this.date=e;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:e,startDate:this.startDate,endDate:this.endDate})}},setValue:function(){var t=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").prop("value",t)}this.element.data("date",t)}else{this.element.prop("value",t)}if(this.linkField){e("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(e){if(e==undefined)e=this.format;return s.formatDate(this.date,e,this.language,this.formatType)},setStartDate:function(e){this.startDate=e||-Infinity;if(this.startDate!==-Infinity){this.startDate=s.parseDate(this.startDate,this.format,this.language,this.formatType)}this.update();this.updateNavArrows()},setEndDate:function(e){this.endDate=e||Infinity;if(this.endDate!==Infinity){this.endDate=s.parseDate(this.endDate,this.format,this.language,this.formatType)}this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(t){this.daysOfWeekDisabled=t||[];if(!e.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=e.map(this.daysOfWeekDisabled,function(e){return parseInt(e,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline)return;var t=parseInt(this.element.parents().filter(function(){return e(this).css("z-index")!="auto"}).first().css("z-index"))+10;var n,r;if(this.component){n=this.component.offset();r=n.left;if(this.pickerPosition=="bottom-left"){r+=this.component.outerWidth()-this.picker.outerWidth()}}else{n=this.element.offset();r=n.left}this.picker.css({top:n.top+this.height,left:r,zIndex:t})},update:function(){var e,t=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0]instanceof Date)){e=arguments[0];t=true}else{e=this.isInput?this.element.prop("value"):this.element.data("date")||this.element.find("input").prop("value")||new Date}if(!e){e=new Date;t=false}this.date=s.parseDate(e,this.format,this.language,this.formatType);if(t)this.setValue();if(this.date<this.startDate){this.viewDate=new Date(this.startDate)}else if(this.date>this.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}this.fill()},fillDow:function(){var e=this.weekStart,t="<tr>";while(e<this.weekStart+7){t+='<th class="dow">'+i[this.language].daysMin[e++%7]+"</th>"}t+="</tr>";this.picker.find(".datetimepicker-days thead").append(t)},fillMonths:function(){var e="",t=0;while(t<12){e+='<span class="month">'+i[this.language].monthsShort[t++]+"</span>"}this.picker.find(".datetimepicker-months td").html(e)},fill:function(){if(this.date==null||this.viewDate==null){return}var n=new Date(this.viewDate),r=n.getUTCFullYear(),o=n.getUTCMonth(),u=n.getUTCDate(),a=n.getUTCHours(),f=n.getUTCMinutes(),l=this.startDate!==-Infinity?this.startDate.getUTCFullYear():-Infinity,c=this.startDate!==-Infinity?this.startDate.getUTCMonth():-Infinity,h=this.endDate!==Infinity?this.endDate.getUTCFullYear():Infinity,p=this.endDate!==Infinity?this.endDate.getUTCMonth():Infinity,d=(new t(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),v=new Date;this.picker.find(".datetimepicker-days thead th:eq(1)").text(i[this.language].months[o]+" "+r);this.picker.find(".datetimepicker-hours thead th:eq(1)").text(u+" "+i[this.language].months[o]+" "+r);this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(u+" "+i[this.language].months[o]+" "+r);this.picker.find("tfoot th.today").text(i[this.language].today).toggle(this.todayBtn!==false);this.updateNavArrows();this.fillMonths();var m=t(r,o-1,28,0,0,0,0),g=s.getDaysInMonth(m.getUTCFullYear(),m.getUTCMonth());m.setUTCDate(g);m.setUTCDate(g-(m.getUTCDay()-this.weekStart+7)%7);var y=new Date(m);y.setUTCDate(y.getUTCDate()+42);y=y.valueOf();var b=[];var w;while(m.valueOf()<y){if(m.getUTCDay()==this.weekStart){b.push("<tr>")}w="";if(m.getUTCFullYear()<r||m.getUTCFullYear()==r&&m.getUTCMonth()<o){w+=" old"}else if(m.getUTCFullYear()>r||m.getUTCFullYear()==r&&m.getUTCMonth()>o){w+=" new"}if(this.todayHighlight&&m.getUTCFullYear()==v.getFullYear()&&m.getUTCMonth()==v.getMonth()&&m.getUTCDate()==v.getDate()){w+=" today"}if(m.valueOf()==d){w+=" active"}if(m.valueOf()+864e5<this.startDate||m.valueOf()>this.endDate||e.inArray(m.getUTCDay(),this.daysOfWeekDisabled)!==-1){w+=" disabled"}b.push('<td class="day'+w+'">'+m.getUTCDate()+"</td>");if(m.getUTCDay()==this.weekEnd){b.push("</tr>")}m.setUTCDate(m.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(b.join(""));b=[];for(var E=0;E<24;E++){var S=t(r,o,u,E);w="";if(S.valueOf()+36e5<this.startDate||S.valueOf()>this.endDate){w+=" disabled"}else if(a==E){w+=" active"}b.push('<span class="hour'+w+'">'+E+":00</span>")}this.picker.find(".datetimepicker-hours td").html(b.join(""));b=[];for(var E=0;E<60;E+=this.minuteStep){var S=t(r,o,u,a,E);w="";if(S.valueOf()<this.startDate||S.valueOf()>this.endDate){w+=" disabled"}else if(Math.floor(f/this.minuteStep)==Math.floor(E/this.minuteStep)){w+=" active"}b.push('<span class="minute'+w+'">'+a+":"+(E<10?"0"+E:E)+"</span>")}this.picker.find(".datetimepicker-minutes td").html(b.join(""));var x=this.date.getUTCFullYear();var T=this.picker.find(".datetimepicker-months").find("th:eq(1)").text(r).end().find("span").removeClass("active");if(x==r){T.eq(this.date.getUTCMonth()).addClass("active")}if(r<l||r>h){T.addClass("disabled")}if(r==l){T.slice(0,c).addClass("disabled")}if(r==h){T.slice(p+1).addClass("disabled")}b="";r=parseInt(r/10,10)*10;var N=this.picker.find(".datetimepicker-years").find("th:eq(1)").text(r+"-"+(r+9)).end().find("td");r-=1;for(var E=-1;E<11;E++){b+='<span class="year'+(E==-1||E==10?" old":"")+(x==r?" active":"")+(r<l||r>h?" disabled":"")+'">'+r+"</span>";r+=1}N.html(b)},updateNavArrows:function(){var e=new Date(this.viewDate),t=e.getUTCFullYear(),n=e.getUTCMonth(),r=e.getUTCDate(),i=e.getUTCHours();switch(this.viewMode){case 0:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()&&n<=this.startDate.getUTCMonth()&&r<=this.startDate.getUTCDate()&&i<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()&&n>=this.endDate.getUTCMonth()&&r>=this.endDate.getUTCDate()&&i>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()&&n<=this.startDate.getUTCMonth()&&r<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()&&n>=this.endDate.getUTCMonth()&&r>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()&&n<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()&&n>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},click:function(n){n.stopPropagation();n.preventDefault();var r=e(n.target).closest("span, td, th");if(r.length==1){if(r.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(r[0].nodeName.toLowerCase()){case"th":switch(r[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var i=s.modes[this.viewMode].navStep*(r[0].className=="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,i);break;case 1:this.viewDate=this.moveDate(this.viewDate,i);break;case 2:this.viewDate=this.moveMonth(this.viewDate,i);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,i);break}this.fill();break;case"today":var o=new Date;o=t(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds());this.viewMode=this.startViewMode;this.showMode(0);this._setDate(o);break}break;case"span":if(!r.is(".disabled")){if(r.is(".month")){this.viewDate.setUTCDate(1);var u=r.parent().find("span").index(r);this.viewDate.setUTCMonth(u);this.element.trigger({type:"changeMonth",date:this.viewDate})}else if(r.is(".year")){this.viewDate.setUTCDate(1);var a=parseInt(r.text(),10)||0;this.viewDate.setUTCFullYear(a);this.element.trigger({type:"changeYear",date:this.viewDate})}else if(r.is(".hour")){var f=parseInt(r.text(),10)||0;var a=this.viewDate.getUTCFullYear(),u=this.viewDate.getUTCMonth(),l=this.viewDate.getUTCDate(),c=this.viewDate.getUTCMinutes(),h=this.viewDate.getUTCSeconds();this._setDate(t(a,u,l,f,c,h,0))}else if(r.is(".minute")){var c=parseInt(r.text().substr(r.text().indexOf(":")+1),10)||0;var a=this.viewDate.getUTCFullYear(),u=this.viewDate.getUTCMonth(),l=this.viewDate.getUTCDate(),f=this.viewDate.getUTCHours(),h=this.viewDate.getUTCSeconds();this._setDate(t(a,u,l,f,c,h,0))}if(this.viewMode!=0){var p=this.viewMode;this.showMode(-1);this.fill();if(p==this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(r.is(".day")&&!r.is(".disabled")){var l=parseInt(r.text(),10)||1;var a=this.viewDate.getUTCFullYear(),u=this.viewDate.getUTCMonth(),f=this.viewDate.getUTCHours(),c=this.viewDate.getUTCMinutes(),h=this.viewDate.getUTCSeconds();if(r.is(".old")){if(u===0){u=11;a-=1}else{u-=1}}else if(r.is(".new")){if(u==11){u=0;a+=1}else{u+=1}}this._setDate(t(a,u,l,f,c,h,0))}var p=this.viewMode;this.showMode(-1);this.fill();if(p==this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(e,t){if(!t||t=="date")this.date=e;if(!t||t=="view")this.viewDate=e;this.fill();this.element.trigger({type:"changeDate",date:this.date});this.setValue();var n;if(this.isInput){n=this.element}else if(this.component){n=this.element.find("input")}if(n){n.change();if(this.autoclose&&(!t||t=="date")){}}},moveHour:function(e,t){if(!t)return e;var n=new Date(e.valueOf());t=t>0?1:-1;n.setUTCHours(n.getUTCHours()+t);return n},moveDate:function(e,t){if(!t)return e;var n=new Date(e.valueOf());t=t>0?1:-1;n.setUTCDate(n.getUTCDate()+t);return n},moveMonth:function(e,t){if(!t)return e;var n=new Date(e.valueOf()),r=n.getUTCDate(),i=n.getUTCMonth(),s=Math.abs(t),o,u;t=t>0?1:-1;if(s==1){u=t==-1?function(){return n.getUTCMonth()==i}:function(){return n.getUTCMonth()!=o};o=i+t;n.setUTCMonth(o);if(o<0||o>11)o=(o+12)%12}else{for(var a=0;a<s;a++)n=this.moveMonth(n,t);o=n.getUTCMonth();n.setUTCDate(r);u=function(){return o!=n.getUTCMonth()}}while(u()){n.setUTCDate(--r);n.setUTCMonth(o)}return n},moveYear:function(e,t){return this.moveMonth(e,t*12)},dateWithinRange:function(e){return e>=this.startDate&&e<=this.endDate},keydown:function(e){if(this.picker.is(":not(:visible)")){if(e.keyCode==27)this.show();return}var t=false,n,r,i,s,o;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation)break;n=e.keyCode==37?-1:1;if(e.ctrlKey){s=this.moveYear(this.date,n);o=this.moveYear(this.viewDate,n)}else if(e.shiftKey){s=this.moveMonth(this.date,n);o=this.moveMonth(this.viewDate,n)}else{s=new Date(this.date);s.setUTCDate(this.date.getUTCDate()+n);o=new Date(this.viewDate);o.setUTCDate(this.viewDate.getUTCDate()+n)}if(this.dateWithinRange(s)){this.date=s;this.viewDate=o;this.setValue();this.update();e.preventDefault();t=true}break;case 38:case 40:if(!this.keyboardNavigation)break;n=e.keyCode==38?-1:1;if(e.ctrlKey){s=this.moveYear(this.date,n);o=this.moveYear(this.viewDate,n)}else if(e.shiftKey){s=this.moveMonth(this.date,n);o=this.moveMonth(this.viewDate,n)}else{s=new Date(this.date);s.setUTCDate(this.date.getUTCDate()+n*7);o=new Date(this.viewDate);o.setUTCDate(this.viewDate.getUTCDate()+n*7)}if(this.dateWithinRange(s)){this.date=s;this.viewDate=o;this.setValue();this.update();e.preventDefault();t=true}break;case 13:this.hide();e.preventDefault();break;case 9:this.hide();break}if(t){this.element.trigger({type:"changeDate",date:this.date});var u;if(this.isInput){u=this.element}else if(this.component){u=this.element.find("input")}if(u){u.change()}}},showMode:function(e){if(e){var t=Math.max(0,Math.min(s.modes.length-1,this.viewMode+e));if(t>=this.minView&&t<=this.maxView){this.viewMode=t}}this.picker.find(">div").hide().filter(".datetimepicker-"+s.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(e){this._setDate(null,"date")}};e.fn.datetimepicker=function(t){var n=Array.apply(null,arguments);n.shift();return this.each(function(){var i=e(this),s=i.data("datetimepicker"),o=typeof t=="object"&&t;if(!s){i.data("datetimepicker",s=new r(this,e.extend({},e.fn.datetimepicker.defaults,o)))}if(typeof t=="string"&&typeof s[t]=="function"){s[t].apply(s,n)}})};e.fn.datetimepicker.defaults={};e.fn.datetimepicker.Constructor=r;var i=e.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today"}};var s={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(e){return e%4===0&&e%100!==0||e%400===0},getDaysInMonth:function(e,t){return[31,s.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},getDefaultFormat:function(e,t){if(e=="standard"){if(t=="input")return"yyyy-mm-dd hh:ii";else return"yyyy-mm-dd hh:ii:ss"}else if(e=="php"){if(t=="input")return"Y-m-d H:i";else return"Y-m-d H:i:s"}else{throw new Error("Invalid format type.")}},validParts:function(e){if(e=="standard"){return/hh?|ii?|ss?|dd?|mm?|MM?|yy(?:yy)?/g}else if(e=="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(e,t){var n=e.replace(this.validParts(t),"\0").split("\0"),r=e.match(this.validParts(t));if(!n||!n.length||!r||r.length==0){throw new Error("Invalid date format.")}return{separators:n,parts:r}},parseDate:function(n,s,o,u){if(n instanceof Date){var a=new Date(n.valueOf()-n.getTimezoneOffset()*6e4);return a}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(n)){s=this.parseFormat("yyyy-mm-dd",u)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(n)){s=this.parseFormat("yyyy-mm-dd hh:ii",u)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(n)){s=this.parseFormat("yyyy-mm-dd hh:ii:ss",u)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(n)){var f=/([-+]\d+)([dmwy])/,l=n.match(/([-+]\d+)([dmwy])/g),c,h;n=new Date;for(var p=0;p<l.length;p++){c=f.exec(l[p]);h=parseInt(c[1]);switch(c[2]){case"d":n.setUTCDate(n.getUTCDate()+h);break;case"m":n=r.prototype.moveMonth.call(r.prototype,n,h);break;case"w":n.setUTCDate(n.getUTCDate()+h*7);break;case"y":n=r.prototype.moveYear.call(r.prototype,n,h);break}}return t(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())}var l=n&&n.match(this.nonpunctuation)||[],n=new Date(0,0,0,0,0,0),d={},v=["hh","h","ii","i","ss","s","yyyy","yy","M","MM","m","mm","d","dd"],m={hh:function(e,t){return e.setUTCHours(t)},h:function(e,t){return e.setUTCHours(t)},ii:function(e,t){return e.setUTCMinutes(t)},i:function(e,t){return e.setUTCMinutes(t)},ss:function(e,t){return e.setUTCSeconds(t)},s:function(e,t){return e.setUTCSeconds(t)},yyyy:function(e,t){return e.setUTCFullYear(t)},yy:function(e,t){return e.setUTCFullYear(2e3+t)},m:function(e,t){t-=1;while(t<0)t+=12;t%=12;e.setUTCMonth(t);while(e.getUTCMonth()!=t)e.setUTCDate(e.getUTCDate()-1);return e},d:function(e,t){return e.setUTCDate(t)}},g,y,c;m["M"]=m["MM"]=m["mm"]=m["m"];m["dd"]=m["d"];n=t(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds());if(l.length==s.parts.length){for(var p=0,b=s.parts.length;p<b;p++){g=parseInt(l[p],10);c=s.parts[p];if(isNaN(g)){switch(c){case"MM":y=e(i[o].months).filter(function(){var e=this.slice(0,l[p].length),t=l[p].slice(0,e.length);return e==t});g=e.inArray(y[0],i[o].months)+1;break;case"M":y=e(i[o].monthsShort).filter(function(){var e=this.slice(0,l[p].length),t=l[p].slice(0,e.length);return e==t});g=e.inArray(y[0],i[o].monthsShort)+1;break}}d[c]=g}for(var p=0,w;p<v.length;p++){w=v[p];if(w in d&&!isNaN(d[w]))m[w](n,d[w])}}return n},formatDate:function(t,n,r,o){if(t==null){return""}var u;if(o=="standard"){u={yy:t.getUTCFullYear().toString().substring(2),yyyy:t.getUTCFullYear(),m:t.getUTCMonth()+1,M:i[r].monthsShort[t.getUTCMonth()],MM:i[r].months[t.getUTCMonth()],d:t.getUTCDate(),h:t.getUTCHours(),i:t.getUTCMinutes(),s:t.getUTCSeconds()};u.hh=(u.h<10?"0":"")+u.h;u.ii=(u.i<10?"0":"")+u.i;u.ss=(u.s<10?"0":"")+u.s;u.dd=(u.d<10?"0":"")+u.d;u.mm=(u.m<10?"0":"")+u.m}else if(o=="php"){u={y:t.getUTCFullYear().toString().substring(2),Y:t.getUTCFullYear(),F:i[r].months[t.getUTCMonth()],M:i[r].monthsShort[t.getUTCMonth()],n:t.getUTCMonth()+1,t:s.getDaysInMonth(t.getUTCFullYear(),t.getUTCMonth()),j:t.getUTCDate(),l:i[r].days[t.getUTCDay()],D:i[r].daysShort[t.getUTCDay()],w:t.getUTCDay(),N:t.getUTCDay()==0?7:t.getUTCDay(),S:t.getUTCDate()%10<=i[r].suffix.length?i[r].suffix[t.getUTCDate()%10-1]:"",a:i[r].meridiem.length==2?i[r].meridiem[t.getUTCHours()<12?0:1]:"",g:t.getUTCHours()%12==0?12:t.getUTCHours()%12,G:t.getUTCHours(),i:t.getUTCMinutes(),s:t.getUTCSeconds()};u.m=(u.n<10?"0":"")+u.n;u.d=(u.j<10?"0":"")+u.j;u.A=u.a.toString().toUpperCase();u.h=(u.g<10?"0":"")+u.g;u.H=(u.G<10?"0":"")+u.G;u.i=(u.i<10?"0":"")+u.i;u.s=(u.s<10?"0":"")+u.s}else{throw new Error("Invalid format type.")}var t=[],a=e.extend([],n.separators);for(var f=0,l=n.parts.length;f<l;f++){if(a.length)t.push(a.shift());t.push(u[n.parts[f]])}return t.join("")},convertViewMode:function(e){switch(e){case 4:case"decade":e=4;break;case 3:case"year":e=3;break;case 2:case"month":e=2;break;case 1:case"day":e=1;break;case 0:case"hour":e=0;break}return e},headTemplate:"<thead>"+"<tr>"+'<th class="prev"><i class="icon-arrow-left"/></th>'+'<th colspan="5" class="switch"></th>'+'<th class="next"><i class="icon-arrow-right"/></th>'+"</tr>"+"</thead>",contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'};s.template='<div class="datetimepicker">'+'<div class="datetimepicker-minutes">'+'<table class=" table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-hours">'+'<table class=" table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-days">'+'<table class=" table-condensed">'+s.headTemplate+"<tbody></tbody>"+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-months">'+'<table class="table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-years">'+'<table class="table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+"</div>";e.fn.datetimepicker.DPGlobal=s}(window.jQuery)
|
22
|
+
|
23
|
+
/*
|
24
|
+
* Improvement by CuGBabyBeaR @ 2013-09-12
|
25
|
+
*
|
26
|
+
* Make it work in bootstrap v3
|
27
|
+
*/
|
28
|
+
|
29
|
+
!function(e){function t(){return new Date(Date.UTC.apply(Date,arguments))}function n(){var e=new Date;return t(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),0)}var r=function(t,n){var r=this;this.element=e(t);this.language=n.language||this.element.data("date-language")||"en";this.language=this.language in i?this.language:"en";this.isRTL=i[this.language].rtl||false;this.formatType=n.formatType||this.element.data("format-type")||"standard";this.format=s.parseFormat(n.format||this.element.data("date-format")||i[this.language].format||s.getDefaultFormat(this.formatType,"input"),this.formatType);this.isInline=false;this.isVisible=false;this.isInput=this.element.is("input");this.bootcssVer=this.isInput?this.element.is(".form-control")?3:2:this.bootcssVer=this.element.is(".input-group")?3:2;this.component=this.element.is(".date")?this.bootcssVer==3?this.element.find(".input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-calendar").parent():this.element.find(".add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar").parent():false;this.componentReset=this.element.is(".date")?this.bootcssVer==3?this.element.find(".input-group-addon .glyphicon-remove").parent():this.element.find(".add-on .icon-remove").parent():false;this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0){this.component=false}this.linkField=n.linkField||this.element.data("link-field")||false;this.linkFormat=s.parseFormat(n.linkFormat||this.element.data("link-format")||s.getDefaultFormat(this.formatType,"link"),this.formatType);this.minuteStep=n.minuteStep||this.element.data("minute-step")||5;this.pickerPosition=n.pickerPosition||this.element.data("picker-position")||"bottom-right";this.showMeridian=n.showMeridian||this.element.data("show-meridian")||false;this.initialDate=n.initialDate||new Date;this._attachEvents();this.formatViewType="datetime";if("formatViewType"in n){this.formatViewType=n.formatViewType}else if("formatViewType"in this.element.data()){this.formatViewType=this.element.data("formatViewType")}this.minView=0;if("minView"in n){this.minView=n.minView}else if("minView"in this.element.data()){this.minView=this.element.data("min-view")}this.minView=s.convertViewMode(this.minView);this.maxView=s.modes.length-1;if("maxView"in n){this.maxView=n.maxView}else if("maxView"in this.element.data()){this.maxView=this.element.data("max-view")}this.maxView=s.convertViewMode(this.maxView);this.wheelViewModeNavigation=false;if("wheelViewModeNavigation"in n){this.wheelViewModeNavigation=n.wheelViewModeNavigation}else if("wheelViewModeNavigation"in this.element.data()){this.wheelViewModeNavigation=this.element.data("view-mode-wheel-navigation")}this.wheelViewModeNavigationInverseDirection=false;if("wheelViewModeNavigationInverseDirection"in n){this.wheelViewModeNavigationInverseDirection=n.wheelViewModeNavigationInverseDirection}else if("wheelViewModeNavigationInverseDirection"in this.element.data()){this.wheelViewModeNavigationInverseDirection=this.element.data("view-mode-wheel-navigation-inverse-dir")}this.wheelViewModeNavigationDelay=100;if("wheelViewModeNavigationDelay"in n){this.wheelViewModeNavigationDelay=n.wheelViewModeNavigationDelay}else if("wheelViewModeNavigationDelay"in this.element.data()){this.wheelViewModeNavigationDelay=this.element.data("view-mode-wheel-navigation-delay")}this.startViewMode=2;if("startView"in n){this.startViewMode=n.startView}else if("startView"in this.element.data()){this.startViewMode=this.element.data("start-view")}this.startViewMode=s.convertViewMode(this.startViewMode);this.viewMode=this.startViewMode;this.viewSelect=this.minView;if("viewSelect"in n){this.viewSelect=n.viewSelect}else if("viewSelect"in this.element.data()){this.viewSelect=this.element.data("view-select")}this.viewSelect=s.convertViewMode(this.viewSelect);this.forceParse=true;if("forceParse"in n){this.forceParse=n.forceParse}else if("dateForceParse"in this.element.data()){this.forceParse=this.element.data("date-force-parse")}this.picker=e(this.bootcssVer==3?s.templateV3:s.template).appendTo(this.isInline?this.element:"body").on({click:e.proxy(this.click,this),mousedown:e.proxy(this.mousedown,this)});if(this.wheelViewModeNavigation){if(e.fn.mousewheel){this.picker.on({mousewheel:e.proxy(this.mousewheel,this)})}else{console.log("Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option")}}if(this.isInline){this.picker.addClass("datetimepicker-inline")}else{this.picker.addClass("datetimepicker-dropdown-"+this.pickerPosition+" dropdown-menu")}if(this.isRTL){this.picker.addClass("datetimepicker-rtl");if(this.bootcssVer==3){this.picker.find(".prev span, .next span").toggleClass("glyphicon-arrow-left glyphicon-arrow-right")}else{this.picker.find(".prev i, .next i").toggleClass("icon-arrow-left icon-arrow-right")}}e(document).on("mousedown",function(t){if(e(t.target).closest(".datetimepicker").length===0){r.hide()}});this.autoclose=false;if("autoclose"in n){this.autoclose=n.autoclose}else if("dateAutoclose"in this.element.data()){this.autoclose=this.element.data("date-autoclose")}this.keyboardNavigation=true;if("keyboardNavigation"in n){this.keyboardNavigation=n.keyboardNavigation}else if("dateKeyboardNavigation"in this.element.data()){this.keyboardNavigation=this.element.data("date-keyboard-navigation")}this.todayBtn=n.todayBtn||this.element.data("date-today-btn")||false;this.todayHighlight=n.todayHighlight||this.element.data("date-today-highlight")||false;this.weekStart=(n.weekStart||this.element.data("date-weekstart")||i[this.language].weekStart||0)%7;this.weekEnd=(this.weekStart+6)%7;this.startDate=-Infinity;this.endDate=Infinity;this.daysOfWeekDisabled=[];this.setStartDate(n.startDate||this.element.data("date-startdate"));this.setEndDate(n.endDate||this.element.data("date-enddate"));this.setDaysOfWeekDisabled(n.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};r.prototype={constructor:r,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:e.proxy(this.show,this),keyup:e.proxy(this.update,this),keydown:e.proxy(this.keydown,this)}]]}else if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:e.proxy(this.show,this),keyup:e.proxy(this.update,this),keydown:e.proxy(this.keydown,this)}],[this.component,{click:e.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:e.proxy(this.reset,this)}])}}else if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:e.proxy(this.show,this)}]]}for(var t=0,n,r;t<this._events.length;t++){n=this._events[t][0];r=this._events[t][1];n.on(r)}},_detachEvents:function(){for(var e=0,t,n;e<this._events.length;e++){t=this._events[e][0];n=this._events[e][1];t.off(n)}this._events=[]},show:function(t){this.picker.show();this.height=this.component?this.component.outerHeight():this.element.outerHeight();if(this.forceParse){this.update()}this.place();e(window).on("resize",e.proxy(this.place,this));if(t){t.stopPropagation();t.preventDefault()}this.isVisible=true;this.element.trigger({type:"show",date:this.date})},hide:function(t){if(!this.isVisible)return;if(this.isInline)return;this.picker.hide();e(window).off("resize",this.place);this.viewMode=this.startViewMode;this.showMode();if(!this.isInput){e(document).off("mousedown",this.hide)}if(this.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val()))this.setValue();this.isVisible=false;this.element.trigger({type:"hide",date:this.date})},remove:function(){this._detachEvents();this.picker.remove();delete this.picker;delete this.element.data().datetimepicker},getDate:function(){var e=this.getUTCDate();return new Date(e.getTime()+e.getTimezoneOffset()*6e4)},getUTCDate:function(){return this.date},setDate:function(e){this.setUTCDate(new Date(e.getTime()-e.getTimezoneOffset()*6e4))},setUTCDate:function(e){if(e>=this.startDate&&e<=this.endDate){this.date=e;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:e,startDate:this.startDate,endDate:this.endDate})}},setFormat:function(e){this.format=s.parseFormat(e,this.formatType);var t;if(this.isInput){t=this.element}else if(this.component){t=this.element.find("input")}if(t&&t.val()){this.setValue()}},setValue:function(){var t=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(t)}this.element.data("date",t)}else{this.element.val(t)}if(this.linkField){e("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(e){if(e==undefined)e=this.format;return s.formatDate(this.date,e,this.language,this.formatType)},setStartDate:function(e){this.startDate=e||-Infinity;if(this.startDate!==-Infinity){this.startDate=s.parseDate(this.startDate,this.format,this.language,this.formatType)}this.update();this.updateNavArrows()},setEndDate:function(e){this.endDate=e||Infinity;if(this.endDate!==Infinity){this.endDate=s.parseDate(this.endDate,this.format,this.language,this.formatType)}this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(t){this.daysOfWeekDisabled=t||[];if(!e.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=e.map(this.daysOfWeekDisabled,function(e){return parseInt(e,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline)return;var t=0;e("div").each(function(){var n=parseInt(e(this).css("zIndex"),10);if(n>t){t=n}});var n=t+10;var r,i,s;if(this.component){r=this.component.offset();s=r.left;if(this.pickerPosition=="bottom-left"||this.pickerPosition=="top-left"){s+=this.component.outerWidth()-this.picker.outerWidth()}}else{r=this.element.offset();s=r.left}if(this.pickerPosition=="top-left"||this.pickerPosition=="top-right"){i=r.top-this.picker.outerHeight()}else{i=r.top+this.height}this.picker.css({top:i,left:s,zIndex:n})},update:function(){var e,t=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0]instanceof Date)){e=arguments[0];t=true}else{e=this.element.data("date")||(this.isInput?this.element.val():this.element.find("input").val())||this.initialDate;e=e.replace(/^\s+|\s+$/g,"")}if(!e){e=new Date;t=false}this.date=s.parseDate(e,this.format,this.language,this.formatType);if(t)this.setValue();if(this.date<this.startDate){this.viewDate=new Date(this.startDate)}else if(this.date>this.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}this.fill()},fillDow:function(){var e=this.weekStart,t="<tr>";while(e<this.weekStart+7){t+='<th class="dow">'+i[this.language].daysMin[e++%7]+"</th>"}t+="</tr>";this.picker.find(".datetimepicker-days thead").append(t)},fillMonths:function(){var e="",t=0;while(t<12){e+='<span class="month">'+i[this.language].monthsShort[t++]+"</span>"}this.picker.find(".datetimepicker-months td").html(e)},fill:function(){if(this.date==null||this.viewDate==null){return}var n=new Date(this.viewDate),r=n.getUTCFullYear(),o=n.getUTCMonth(),u=n.getUTCDate(),a=n.getUTCHours(),f=n.getUTCMinutes(),l=this.startDate!==-Infinity?this.startDate.getUTCFullYear():-Infinity,c=this.startDate!==-Infinity?this.startDate.getUTCMonth():-Infinity,h=this.endDate!==Infinity?this.endDate.getUTCFullYear():Infinity,p=this.endDate!==Infinity?this.endDate.getUTCMonth():Infinity,d=(new t(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),v=new Date;this.picker.find(".datetimepicker-days thead th:eq(1)").text(i[this.language].months[o]+" "+r);if(this.formatViewType=="time"){var m=a%12?a%12:12;var g=(m<10?"0":"")+m;var y=(f<10?"0":"")+f;var b=i[this.language].meridiem[a<12?0:1];this.picker.find(".datetimepicker-hours thead th:eq(1)").text(g+":"+y+" "+b.toUpperCase());this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(g+":"+y+" "+b.toUpperCase())}else{this.picker.find(".datetimepicker-hours thead th:eq(1)").text(u+" "+i[this.language].months[o]+" "+r);this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(u+" "+i[this.language].months[o]+" "+r)}this.picker.find("tfoot th.today").text(i[this.language].today).toggle(this.todayBtn!==false);this.updateNavArrows();this.fillMonths();var w=t(r,o-1,28,0,0,0,0),E=s.getDaysInMonth(w.getUTCFullYear(),w.getUTCMonth());w.setUTCDate(E);w.setUTCDate(E-(w.getUTCDay()-this.weekStart+7)%7);var S=new Date(w);S.setUTCDate(S.getUTCDate()+42);S=S.valueOf();var x=[];var T;while(w.valueOf()<S){if(w.getUTCDay()==this.weekStart){x.push("<tr>")}T="";if(w.getUTCFullYear()<r||w.getUTCFullYear()==r&&w.getUTCMonth()<o){T+=" old"}else if(w.getUTCFullYear()>r||w.getUTCFullYear()==r&&w.getUTCMonth()>o){T+=" new"}if(this.todayHighlight&&w.getUTCFullYear()==v.getFullYear()&&w.getUTCMonth()==v.getMonth()&&w.getUTCDate()==v.getDate()){T+=" today"}if(w.valueOf()==d){T+=" active"}if(w.valueOf()+864e5<=this.startDate||w.valueOf()>this.endDate||e.inArray(w.getUTCDay(),this.daysOfWeekDisabled)!==-1){T+=" disabled"}x.push('<td class="day'+T+'">'+w.getUTCDate()+"</td>");if(w.getUTCDay()==this.weekEnd){x.push("</tr>")}w.setUTCDate(w.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(x.join(""));x=[];var N="",C="",k="";for(var L=0;L<24;L++){var A=t(r,o,u,L);T="";if(A.valueOf()+36e5<=this.startDate||A.valueOf()>this.endDate){T+=" disabled"}else if(a==L){T+=" active"}if(this.showMeridian&&i[this.language].meridiem.length==2){C=L<12?i[this.language].meridiem[0]:i[this.language].meridiem[1];if(C!=k){if(k!=""){x.push("</fieldset>")}x.push('<fieldset class="hour"><legend>'+C.toUpperCase()+"</legend>")}k=C;N=L%12?L%12:12;x.push('<span class="hour'+T+" hour_"+(L<12?"am":"pm")+'">'+N+"</span>");if(L==23){x.push("</fieldset>")}}else{N=L+":00";x.push('<span class="hour'+T+'">'+N+"</span>")}}this.picker.find(".datetimepicker-hours td").html(x.join(""));x=[];N="",C="",k="";for(var L=0;L<60;L+=this.minuteStep){var A=t(r,o,u,a,L,0);T="";if(A.valueOf()<this.startDate||A.valueOf()>this.endDate){T+=" disabled"}else if(Math.floor(f/this.minuteStep)==Math.floor(L/this.minuteStep)){T+=" active"}if(this.showMeridian&&i[this.language].meridiem.length==2){C=a<12?i[this.language].meridiem[0]:i[this.language].meridiem[1];if(C!=k){if(k!=""){x.push("</fieldset>")}x.push('<fieldset class="minute"><legend>'+C.toUpperCase()+"</legend>")}k=C;N=a%12?a%12:12;x.push('<span class="minute'+T+'">'+N+":"+(L<10?"0"+L:L)+"</span>");if(L==59){x.push("</fieldset>")}}else{N=L+":00";x.push('<span class="minute'+T+'">'+a+":"+(L<10?"0"+L:L)+"</span>")}}this.picker.find(".datetimepicker-minutes td").html(x.join(""));var O=this.date.getUTCFullYear();var M=this.picker.find(".datetimepicker-months").find("th:eq(1)").text(r).end().find("span").removeClass("active");if(O==r){M.eq(this.date.getUTCMonth()).addClass("active")}if(r<l||r>h){M.addClass("disabled")}if(r==l){M.slice(0,c).addClass("disabled")}if(r==h){M.slice(p+1).addClass("disabled")}x="";r=parseInt(r/10,10)*10;var _=this.picker.find(".datetimepicker-years").find("th:eq(1)").text(r+"-"+(r+9)).end().find("td");r-=1;for(var L=-1;L<11;L++){x+='<span class="year'+(L==-1||L==10?" old":"")+(O==r?" active":"")+(r<l||r>h?" disabled":"")+'">'+r+"</span>";r+=1}_.html(x);this.place()},updateNavArrows:function(){var e=new Date(this.viewDate),t=e.getUTCFullYear(),n=e.getUTCMonth(),r=e.getUTCDate(),i=e.getUTCHours();switch(this.viewMode){case 0:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()&&n<=this.startDate.getUTCMonth()&&r<=this.startDate.getUTCDate()&&i<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()&&n>=this.endDate.getUTCMonth()&&r>=this.endDate.getUTCDate()&&i>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()&&n<=this.startDate.getUTCMonth()&&r<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()&&n>=this.endDate.getUTCMonth()&&r>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()&&n<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()&&n>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(this.startDate!==-Infinity&&t<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&t>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},mousewheel:function(t){t.preventDefault();t.stopPropagation();if(this.wheelPause){return}this.wheelPause=true;var n=t.originalEvent;var r=n.wheelDelta;var i=r>0?1:r===0?0:-1;if(this.wheelViewModeNavigationInverseDirection){i=-i}this.showMode(i);setTimeout(e.proxy(function(){this.wheelPause=false},this),this.wheelViewModeNavigationDelay)},click:function(n){n.stopPropagation();n.preventDefault();var r=e(n.target).closest("span, td, th, legend");if(r.length==1){if(r.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(r[0].nodeName.toLowerCase()){case"th":switch(r[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var i=s.modes[this.viewMode].navStep*(r[0].className=="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,i);break;case 1:this.viewDate=this.moveDate(this.viewDate,i);break;case 2:this.viewDate=this.moveMonth(this.viewDate,i);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,i);break}this.fill();break;case"today":var o=new Date;o=t(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),0);if(o<this.startDate)o=this.startDate;else if(o>this.endDate)o=this.endDate;this.viewMode=this.startViewMode;this.showMode(0);this._setDate(o);this.fill();if(this.autoclose){this.hide()}break}break;case"span":if(!r.is(".disabled")){var u=this.viewDate.getUTCFullYear(),a=this.viewDate.getUTCMonth(),f=this.viewDate.getUTCDate(),l=this.viewDate.getUTCHours(),c=this.viewDate.getUTCMinutes(),h=this.viewDate.getUTCSeconds();if(r.is(".month")){this.viewDate.setUTCDate(1);a=r.parent().find("span").index(r);f=this.viewDate.getUTCDate();this.viewDate.setUTCMonth(a);this.element.trigger({type:"changeMonth",date:this.viewDate});if(this.viewSelect>=3){this._setDate(t(u,a,f,l,c,h,0))}}else if(r.is(".year")){this.viewDate.setUTCDate(1);u=parseInt(r.text(),10)||0;this.viewDate.setUTCFullYear(u);this.element.trigger({type:"changeYear",date:this.viewDate});if(this.viewSelect>=4){this._setDate(t(u,a,f,l,c,h,0))}}else if(r.is(".hour")){l=parseInt(r.text(),10)||0;if(r.hasClass("hour_am")||r.hasClass("hour_pm")){if(l==12&&r.hasClass("hour_am")){l=0}else if(l!=12&&r.hasClass("hour_pm")){l+=12}}this.viewDate.setUTCHours(l);this.element.trigger({type:"changeHour",date:this.viewDate});if(this.viewSelect>=1){this._setDate(t(u,a,f,l,c,h,0))}}else if(r.is(".minute")){c=parseInt(r.text().substr(r.text().indexOf(":")+1),10)||0;this.viewDate.setUTCMinutes(c);this.element.trigger({type:"changeMinute",date:this.viewDate});if(this.viewSelect>=0){this._setDate(t(u,a,f,l,c,h,0))}}if(this.viewMode!=0){var p=this.viewMode;this.showMode(-1);this.fill();if(p==this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(r.is(".day")&&!r.is(".disabled")){var f=parseInt(r.text(),10)||1;var u=this.viewDate.getUTCFullYear(),a=this.viewDate.getUTCMonth(),l=this.viewDate.getUTCHours(),c=this.viewDate.getUTCMinutes(),h=this.viewDate.getUTCSeconds();if(r.is(".old")){if(a===0){a=11;u-=1}else{a-=1}}else if(r.is(".new")){if(a==11){a=0;u+=1}else{a+=1}}this.viewDate.setUTCFullYear(u);this.viewDate.setUTCMonth(a);this.viewDate.setUTCDate(f);this.element.trigger({type:"changeDay",date:this.viewDate});if(this.viewSelect>=2){this._setDate(t(u,a,f,l,c,h,0))}}var p=this.viewMode;this.showMode(-1);this.fill();if(p==this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(e,t){if(!t||t=="date")this.date=e;if(!t||t=="view")this.viewDate=e;this.fill();this.setValue();var n;if(this.isInput){n=this.element}else if(this.component){n=this.element.find("input")}if(n){n.change();if(this.autoclose&&(!t||t=="date")){}}this.element.trigger({type:"changeDate",date:this.date})},moveMinute:function(e,t){if(!t)return e;var n=new Date(e.valueOf());n.setUTCMinutes(n.getUTCMinutes()+t*this.minuteStep);return n},moveHour:function(e,t){if(!t)return e;var n=new Date(e.valueOf());n.setUTCHours(n.getUTCHours()+t);return n},moveDate:function(e,t){if(!t)return e;var n=new Date(e.valueOf());n.setUTCDate(n.getUTCDate()+t);return n},moveMonth:function(e,t){if(!t)return e;var n=new Date(e.valueOf()),r=n.getUTCDate(),i=n.getUTCMonth(),s=Math.abs(t),o,u;t=t>0?1:-1;if(s==1){u=t==-1?function(){return n.getUTCMonth()==i}:function(){return n.getUTCMonth()!=o};o=i+t;n.setUTCMonth(o);if(o<0||o>11)o=(o+12)%12}else{for(var a=0;a<s;a++)n=this.moveMonth(n,t);o=n.getUTCMonth();n.setUTCDate(r);u=function(){return o!=n.getUTCMonth()}}while(u()){n.setUTCDate(--r);n.setUTCMonth(o)}return n},moveYear:function(e,t){return this.moveMonth(e,t*12)},dateWithinRange:function(e){return e>=this.startDate&&e<=this.endDate},keydown:function(e){if(this.picker.is(":not(:visible)")){if(e.keyCode==27)this.show();return}var t=false,n,r,i,s,o;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation)break;n=e.keyCode==37?-1:1;viewMode=this.viewMode;if(e.ctrlKey){viewMode+=2}else if(e.shiftKey){viewMode+=1}if(viewMode==4){s=this.moveYear(this.date,n);o=this.moveYear(this.viewDate,n)}else if(viewMode==3){s=this.moveMonth(this.date,n);o=this.moveMonth(this.viewDate,n)}else if(viewMode==2){s=this.moveDate(this.date,n);o=this.moveDate(this.viewDate,n)}else if(viewMode==1){s=this.moveHour(this.date,n);o=this.moveHour(this.viewDate,n)}else if(viewMode==0){s=this.moveMinute(this.date,n);o=this.moveMinute(this.viewDate,n)}if(this.dateWithinRange(s)){this.date=s;this.viewDate=o;this.setValue();this.update();e.preventDefault();t=true}break;case 38:case 40:if(!this.keyboardNavigation)break;n=e.keyCode==38?-1:1;viewMode=this.viewMode;if(e.ctrlKey){viewMode+=2}else if(e.shiftKey){viewMode+=1}if(viewMode==4){s=this.moveYear(this.date,n);o=this.moveYear(this.viewDate,n)}else if(viewMode==3){s=this.moveMonth(this.date,n);o=this.moveMonth(this.viewDate,n)}else if(viewMode==2){s=this.moveDate(this.date,n*7);o=this.moveDate(this.viewDate,n*7)}else if(viewMode==1){if(this.showMeridian){s=this.moveHour(this.date,n*6);o=this.moveHour(this.viewDate,n*6)}else{s=this.moveHour(this.date,n*4);o=this.moveHour(this.viewDate,n*4)}}else if(viewMode==0){s=this.moveMinute(this.date,n*4);o=this.moveMinute(this.viewDate,n*4)}if(this.dateWithinRange(s)){this.date=s;this.viewDate=o;this.setValue();this.update();e.preventDefault();t=true}break;case 13:if(this.viewMode!=0){var u=this.viewMode;this.showMode(-1);this.fill();if(u==this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}e.preventDefault();break;case 9:this.hide();break}if(t){var a;if(this.isInput){a=this.element}else if(this.component){a=this.element.find("input")}if(a){a.change()}this.element.trigger({type:"changeDate",date:this.date})}},showMode:function(e){if(e){var t=Math.max(0,Math.min(s.modes.length-1,this.viewMode+e));if(t>=this.minView&&t<=this.maxView){this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:t});this.viewMode=t}}this.picker.find(">div").hide().filter(".datetimepicker-"+s.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(e){this._setDate(null,"date")}};e.fn.datetimepicker=function(t){var n=Array.apply(null,arguments);n.shift();return this.each(function(){var i=e(this),s=i.data("datetimepicker"),o=typeof t=="object"&&t;if(!s){i.data("datetimepicker",s=new r(this,e.extend({},e.fn.datetimepicker.defaults,o)))}if(typeof t=="string"&&typeof s[t]=="function"){s[t].apply(s,n)}})};e.fn.datetimepicker.defaults={};e.fn.datetimepicker.Constructor=r;var i=e.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today"}};var s={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(e){return e%4===0&&e%100!==0||e%400===0},getDaysInMonth:function(e,t){return[31,s.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},getDefaultFormat:function(e,t){if(e=="standard"){if(t=="input")return"yyyy-mm-dd hh:ii";else return"yyyy-mm-dd hh:ii:ss"}else if(e=="php"){if(t=="input")return"Y-m-d H:i";else return"Y-m-d H:i:s"}else{throw new Error("Invalid format type.")}},validParts:function(e){if(e=="standard"){return/hh?|HH?|p|P|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g}else if(e=="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(e,t){var n=e.replace(this.validParts(t),"\0").split("\0"),r=e.match(this.validParts(t));if(!n||!n.length||!r||r.length==0){throw new Error("Invalid date format.")}return{separators:n,parts:r}},parseDate:function(n,s,o,u){if(n instanceof Date){var a=new Date(n.valueOf()-n.getTimezoneOffset()*6e4);a.setMilliseconds(0);return a}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(n)){s=this.parseFormat("yyyy-mm-dd",u)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(n)){s=this.parseFormat("yyyy-mm-dd hh:ii",u)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(n)){s=this.parseFormat("yyyy-mm-dd hh:ii:ss",u)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(n)){var f=/([-+]\d+)([dmwy])/,l=n.match(/([-+]\d+)([dmwy])/g),c,h;n=new Date;for(var p=0;p<l.length;p++){c=f.exec(l[p]);h=parseInt(c[1]);switch(c[2]){case"d":n.setUTCDate(n.getUTCDate()+h);break;case"m":n=r.prototype.moveMonth.call(r.prototype,n,h);break;case"w":n.setUTCDate(n.getUTCDate()+h*7);break;case"y":n=r.prototype.moveYear.call(r.prototype,n,h);break}}return t(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),0)}var l=n&&n.match(this.nonpunctuation)||[],n=new Date(0,0,0,0,0,0,0),d={},v=["hh","h","ii","i","ss","s","yyyy","yy","M","MM","m","mm","D","DD","d","dd","H","HH","p","P"],m={hh:function(e,t){return e.setUTCHours(t)},h:function(e,t){return e.setUTCHours(t)},HH:function(e,t){return e.setUTCHours(t==12?0:t)},H:function(e,t){return e.setUTCHours(t==12?0:t)},ii:function(e,t){return e.setUTCMinutes(t)},i:function(e,t){return e.setUTCMinutes(t)},ss:function(e,t){return e.setUTCSeconds(t)},s:function(e,t){return e.setUTCSeconds(t)},yyyy:function(e,t){return e.setUTCFullYear(t)},yy:function(e,t){return e.setUTCFullYear(2e3+t)},m:function(e,t){t-=1;while(t<0)t+=12;t%=12;e.setUTCMonth(t);while(e.getUTCMonth()!=t)e.setUTCDate(e.getUTCDate()-1);return e},d:function(e,t){return e.setUTCDate(t)},p:function(e,t){return e.setUTCHours(t==1?e.getUTCHours()+12:e.getUTCHours())}},g,y,c;m["M"]=m["MM"]=m["mm"]=m["m"];m["dd"]=m["d"];m["P"]=m["p"];n=t(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds());if(l.length==s.parts.length){for(var p=0,b=s.parts.length;p<b;p++){g=parseInt(l[p],10);c=s.parts[p];if(isNaN(g)){switch(c){case"MM":y=e(i[o].months).filter(function(){var e=this.slice(0,l[p].length),t=l[p].slice(0,e.length);return e==t});g=e.inArray(y[0],i[o].months)+1;break;case"M":y=e(i[o].monthsShort).filter(function(){var e=this.slice(0,l[p].length),t=l[p].slice(0,e.length);return e==t});g=e.inArray(y[0],i[o].monthsShort)+1;break;case"p":case"P":g=e.inArray(l[p].toLowerCase(),i[o].meridiem);break}}d[c]=g}for(var p=0,w;p<v.length;p++){w=v[p];if(w in d&&!isNaN(d[w]))m[w](n,d[w])}}return n},formatDate:function(t,n,r,o){if(t==null){return""}var u;if(o=="standard"){u={yy:t.getUTCFullYear().toString().substring(2),yyyy:t.getUTCFullYear(),m:t.getUTCMonth()+1,M:i[r].monthsShort[t.getUTCMonth()],MM:i[r].months[t.getUTCMonth()],d:t.getUTCDate(),D:i[r].daysShort[t.getUTCDay()],DD:i[r].days[t.getUTCDay()],p:i[r].meridiem.length==2?i[r].meridiem[t.getUTCHours()<12?0:1]:"",h:t.getUTCHours(),i:t.getUTCMinutes(),s:t.getUTCSeconds()};if(i[r].meridiem.length==2){u.H=u.h%12==0?12:u.h%12}else{u.H=u.h}u.HH=(u.H<10?"0":"")+u.H;u.P=u.p.toUpperCase();u.hh=(u.h<10?"0":"")+u.h;u.ii=(u.i<10?"0":"")+u.i;u.ss=(u.s<10?"0":"")+u.s;u.dd=(u.d<10?"0":"")+u.d;u.mm=(u.m<10?"0":"")+u.m}else if(o=="php"){u={y:t.getUTCFullYear().toString().substring(2),Y:t.getUTCFullYear(),F:i[r].months[t.getUTCMonth()],M:i[r].monthsShort[t.getUTCMonth()],n:t.getUTCMonth()+1,t:s.getDaysInMonth(t.getUTCFullYear(),t.getUTCMonth()),j:t.getUTCDate(),l:i[r].days[t.getUTCDay()],D:i[r].daysShort[t.getUTCDay()],w:t.getUTCDay(),N:t.getUTCDay()==0?7:t.getUTCDay(),S:t.getUTCDate()%10<=i[r].suffix.length?i[r].suffix[t.getUTCDate()%10-1]:"",a:i[r].meridiem.length==2?i[r].meridiem[t.getUTCHours()<12?0:1]:"",g:t.getUTCHours()%12==0?12:t.getUTCHours()%12,G:t.getUTCHours(),i:t.getUTCMinutes(),s:t.getUTCSeconds()};u.m=(u.n<10?"0":"")+u.n;u.d=(u.j<10?"0":"")+u.j;u.A=u.a.toString().toUpperCase();u.h=(u.g<10?"0":"")+u.g;u.H=(u.G<10?"0":"")+u.G;u.i=(u.i<10?"0":"")+u.i;u.s=(u.s<10?"0":"")+u.s}else{throw new Error("Invalid format type.")}var t=[],a=e.extend([],n.separators);for(var f=0,l=n.parts.length;f<l;f++){if(a.length){t.push(a.shift())}t.push(u[n.parts[f]])}if(a.length){t.push(a.shift())}return t.join("")},convertViewMode:function(e){switch(e){case 4:case"decade":e=4;break;case 3:case"year":e=3;break;case 2:case"month":e=2;break;case 1:case"day":e=1;break;case 0:case"hour":e=0;break}return e},headTemplate:"<thead>"+"<tr>"+'<th class="prev"><i class="icon-arrow-left"/></th>'+'<th colspan="5" class="switch"></th>'+'<th class="next"><i class="icon-arrow-right"/></th>'+"</tr>"+"</thead>",headTemplateV3:"<thead>"+"<tr>"+'<th class="prev"><i class="glyphicon glyphicon-arrow-left"></i> </th>'+'<th colspan="5" class="switch"></th>'+'<th class="next"><i class="glyphicon glyphicon-arrow-right"></i> </th>'+"</tr>"+"</thead>",contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'};s.template='<div class="datetimepicker">'+'<div class="datetimepicker-minutes">'+'<table class=" table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-hours">'+'<table class=" table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-days">'+'<table class=" table-condensed">'+s.headTemplate+"<tbody></tbody>"+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-months">'+'<table class="table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-years">'+'<table class="table-condensed">'+s.headTemplate+s.contTemplate+s.footTemplate+"</table>"+"</div>"+"</div>";s.templateV3='<div class="datetimepicker">'+'<div class="datetimepicker-minutes">'+'<table class=" table-condensed">'+s.headTemplateV3+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-hours">'+'<table class=" table-condensed">'+s.headTemplateV3+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-days">'+'<table class=" table-condensed">'+s.headTemplateV3+"<tbody></tbody>"+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-months">'+'<table class="table-condensed">'+s.headTemplateV3+s.contTemplate+s.footTemplate+"</table>"+"</div>"+'<div class="datetimepicker-years">'+'<table class="table-condensed">'+s.headTemplateV3+s.contTemplate+s.footTemplate+"</table>"+"</div>"+"</div>";e.fn.datetimepicker.DPGlobal=s;e.fn.datetimepicker.noConflict=function(){e.fn.datetimepicker=old;return this};e(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide="datetimepicker"]',function(t){var n=e(this);if(n.data("datetimepicker"))return;t.preventDefault();n.datetimepicker("show")});e(function(){e('[data-provide="datetimepicker-inline"]').datetimepicker()})}(window.jQuery)
|
@@ -10,7 +10,7 @@
|
|
10
10
|
.item
|
11
11
|
.toggle{:class => branch_open ? 'open' : nil}
|
12
12
|
- if !category_view && has_children && !page.root?
|
13
|
-
= link_to
|
13
|
+
= link_to toggle_branch_admin_cms_site_page_path(@site, page), :remote => true do
|
14
14
|
%span= t('.toggle')
|
15
15
|
|
16
16
|
.icon{:class => page.is_published?? 'published' : 'draft'}
|
@@ -22,7 +22,8 @@ module ComfortableMexicanSofa::ViewMethods
|
|
22
22
|
host, path = request.host.downcase, request.fullpath if respond_to?(:request) && request
|
23
23
|
cms_site ||= (@cms_site || Cms::Site.find_site(host, path))
|
24
24
|
end
|
25
|
-
return '' unless cms_site
|
25
|
+
return '' unless cms_site
|
26
|
+
|
26
27
|
snippet = cms_site.snippets.find_by_identifier(identifier)
|
27
28
|
|
28
29
|
if !snippet && block_given?
|
@@ -32,6 +33,8 @@ module ComfortableMexicanSofa::ViewMethods
|
|
32
33
|
:content => capture(&block)
|
33
34
|
)
|
34
35
|
end
|
36
|
+
|
37
|
+
return '' unless snippet
|
35
38
|
render :inline => ComfortableMexicanSofa::Tag.process_content(cms_site.pages.build, snippet.content)
|
36
39
|
end
|
37
40
|
|
@@ -17,7 +17,10 @@ class Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_get_index_with_category
|
20
|
-
category = cms_sites(:default).categories.create!(
|
20
|
+
category = cms_sites(:default).categories.create!(
|
21
|
+
:label => 'Test Category',
|
22
|
+
:categorized_type => 'Cms::Page'
|
23
|
+
)
|
21
24
|
category.categorizations.create!(:categorized => cms_pages(:child))
|
22
25
|
|
23
26
|
get :index, :site_id => cms_sites(:default), :category => category.label
|
@@ -34,6 +37,17 @@ class Admin::Cms::PagesControllerTest < ActionController::TestCase
|
|
34
37
|
assert_equal 0, assigns(:pages).count
|
35
38
|
end
|
36
39
|
|
40
|
+
def test_get_index_with_toggle
|
41
|
+
cms_sites(:default).pages.create!(
|
42
|
+
:label => 'test',
|
43
|
+
:slug => 'test',
|
44
|
+
:parent => cms_pages(:child),
|
45
|
+
:layout => cms_layouts(:default)
|
46
|
+
)
|
47
|
+
get :index, :site_id => cms_sites(:default)
|
48
|
+
assert_response :success
|
49
|
+
end
|
50
|
+
|
37
51
|
def test_get_new
|
38
52
|
site = cms_sites(:default)
|
39
53
|
get :new, :site_id => site
|
@@ -52,6 +52,11 @@ class ViewMethodsTest < ActionView::TestCase
|
|
52
52
|
def test_cms_snippet_content
|
53
53
|
assert_equal 'default_snippet_content', action_result('test_cms_snippet_content')
|
54
54
|
end
|
55
|
+
|
56
|
+
def test_cms_snippet_content_missing
|
57
|
+
Cms::Snippet.delete_all
|
58
|
+
assert_equal '', action_result('test_cms_snippet_content')
|
59
|
+
end
|
55
60
|
|
56
61
|
def test_cms_snippet_content_with_tags
|
57
62
|
cms_snippets(:default).update_columns(:content => '{{cms:helper:hello}}')
|
@@ -66,6 +71,11 @@ class ViewMethodsTest < ActionView::TestCase
|
|
66
71
|
def test_cms_page_block_content
|
67
72
|
assert_equal 'default_field_text_content', action_result('test_cms_page_block_content')
|
68
73
|
end
|
74
|
+
|
75
|
+
def test_cms_page_block_content_missing
|
76
|
+
Cms::Block.delete_all
|
77
|
+
assert_equal '', action_result('test_cms_page_block_content')
|
78
|
+
end
|
69
79
|
|
70
80
|
def test_cms_page_files
|
71
81
|
page = cms_pages(:default)
|
@@ -104,6 +114,11 @@ class ViewMethodsTest < ActionView::TestCase
|
|
104
114
|
def test_cms_page_content
|
105
115
|
assert_equal 'default_field_text_content', action_result('test_cms_page_content')
|
106
116
|
end
|
117
|
+
|
118
|
+
def test_cms_page_content_missing
|
119
|
+
Cms::Page.delete_all
|
120
|
+
assert_equal '', action_result('test_cms_page_content')
|
121
|
+
end
|
107
122
|
|
108
123
|
def test_cms_page_content_with_tags
|
109
124
|
cms_blocks(:default_field_text).update_column(:content, '{{cms:helper:hello}}')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-10-
|
13
|
+
date: 2013-10-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|