From a0d5589777bc646621542d7b373c18bc84821ece Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Fri, 13 Apr 2018 14:37:23 +0200 Subject: [PATCH 001/135] added static flatpickr js and css --- src/Foundation.hs | 2 ++ static/css/flatpickr.css | 13 +++++++++++++ static/js/flatpickr.js | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 static/css/flatpickr.css create mode 100644 static/js/flatpickr.js diff --git a/src/Foundation.hs b/src/Foundation.hs index 223e9df81..cdac53232 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -452,8 +452,10 @@ defaultMenuLayout menu widget = do pc <- widgetToPageContent $ do addStylesheetRemote "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,800,900" addScript $ StaticR js_featureChecker_js + addScript $ StaticR js_flatpickr_js addStylesheet $ StaticR css_fonts_css addStylesheet $ StaticR css_icons_css + addStylesheet $ StaticR css_flatpickr_css $(widgetFile "default-layout") $(widgetFile "standalone/modal") $(widgetFile "standalone/showHide") diff --git a/static/css/flatpickr.css b/static/css/flatpickr.css new file mode 100644 index 000000000..9d24b0240 --- /dev/null +++ b/static/css/flatpickr.css @@ -0,0 +1,13 @@ +.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px);}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.rightMost:after{left:auto;right:22px}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:28px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;line-height:16px;height:28px;padding:10px;z-index:3;}.flatpickr-months .flatpickr-prev-month.disabled,.flatpickr-months .flatpickr-next-month.disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/* + /*rtl:begin:ignore*/left:0;/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{/* + /*rtl:begin:ignore*/right:0;/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9;}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px;}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto;}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%;}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box;}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0;}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%;}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto;}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05);}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:6.16px 0 0 0;line-height:1;height:28px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0;}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block;}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px;}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px;}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1;}.dayContainer + .dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9;}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange,.flatpickr-day.startRange.startRange + .endRange,.flatpickr-day.endRange.startRange + .endRange{-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.disabled,.flatpickr-day.disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.disabled,.flatpickr-day.disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{display:inline-block;float:left;}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left;}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;cursor:pointer;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;display:inline-block;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400;}.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time .flatpickr-am-pm:focus{background:#f0f0f0}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}} diff --git a/static/js/flatpickr.js b/static/js/flatpickr.js new file mode 100644 index 000000000..226f63df3 --- /dev/null +++ b/static/js/flatpickr.js @@ -0,0 +1,2 @@ +/* flatpickr v4.4.4,, @license MIT */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.flatpickr=t()}(this,function(){"use strict";var Z=function(e){return("0"+e).slice(-2)},Q=function(e){return!0===e?1:0};function X(n,a,i){var o;return void 0===i&&(i=!1),function(){var e=this,t=arguments;null!==o&&clearTimeout(o),o=window.setTimeout(function(){o=null,i||n.apply(e,t)},a),i&&!o&&n.apply(e,t)}}var ee=function(e){return e instanceof Array?e:[e]},e=function(){},te=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},D={D:e,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*Q(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t){var n=parseInt(t);return new Date(e.getFullYear(),0,2+7*(n-1),0,0,0,0)},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:e,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},w:e,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},ne={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},c={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[c.w(e,t,n)]},F:function(e,t,n){return te(c.n(e,t,n)-1,!1,t)},G:function(e,t,n){return Z(c.h(e,t,n))},H:function(e){return Z(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[Q(11Math.min(t,n)&&e",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1};function de(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function se(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function ue(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function fe(e,t){var n=se("div","numInputWrapper"),a=se("input","numInput "+e),i=se("span","arrowUp"),o=se("span","arrowDown");if(a.type="text",a.pattern="\\d*",void 0!==t)for(var r in t)a.setAttribute(r,t[r]);return n.appendChild(a),n.appendChild(i),n.appendChild(o),n}"function"!=typeof Object.assign&&(Object.assign=function(n){if(!n)throw TypeError("Cannot convert undefined or null to object");for(var e=arguments.length,t=new Array(1o)&&(D.amPM.textContent=D.l10n.amPM[Q(D.amPM.textContent===D.l10n.amPM[0])]),n.value=Z(l)}}(e),"input"!==e.type?(m(),G()):setTimeout(function(){m(),G()},me))}function m(){if(void 0!==D.hourElement&&void 0!==D.minuteElement){var e,t,n=(parseInt(D.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(D.minuteElement.value,10)||0)%60,i=void 0!==D.secondElement?(parseInt(D.secondElement.value,10)||0)%60:0;void 0!==D.amPM&&(e=n,t=D.amPM.textContent,n=e%12+12*Q(t===D.l10n.amPM[1]));var o=void 0!==D.config.minTime||D.config.minDate&&D.minDateHasTime&&D.latestSelectedDateObj&&0===re(D.latestSelectedDateObj,D.config.minDate,!0);if(void 0!==D.config.maxTime||D.config.maxDate&&D.maxDateHasTime&&D.latestSelectedDateObj&&0===re(D.latestSelectedDateObj,D.config.maxDate,!0)){var r=void 0!==D.config.maxTime?D.config.maxTime:D.config.maxDate;(n=Math.min(n,r.getHours()))===r.getHours()&&(a=Math.min(a,r.getMinutes())),a===r.getMinutes()&&(i=Math.min(i,r.getSeconds()))}if(o){var c=void 0!==D.config.minTime?D.config.minTime:D.config.minDate;(n=Math.max(n,c.getHours()))===c.getHours()&&(a=Math.max(a,c.getMinutes())),a===c.getMinutes()&&(i=Math.max(i,c.getSeconds()))}l(n,a,i)}}function g(e){var t=e||D.latestSelectedDateObj;t&&l(t.getHours(),t.getMinutes(),t.getSeconds())}function l(e,t,n){void 0!==D.latestSelectedDateObj&&D.latestSelectedDateObj.setHours(e%24,t,n||0,0),D.hourElement&&D.minuteElement&&!D.isMobile&&(D.hourElement.value=Z(D.config.time_24hr?e:(12+e)%12+12*Q(e%12==0)),D.minuteElement.value=Z(t),void 0!==D.amPM&&(D.amPM.textContent=D.l10n.amPM[Q(12<=e)]),void 0!==D.secondElement&&(D.secondElement.value=Z(n)))}function n(e){var t=parseInt(e.target.value)+(e.delta||0);4!==t.toString().length&&"Enter"!==e.key||(e.target.blur(),/[^\d]/.test(t.toString())||S(t))}function o(t,n,a,i){return n instanceof Array?n.forEach(function(e){return o(t,e,a,i)}):t instanceof Array?t.forEach(function(e){return o(e,n,a,i)}):(t.addEventListener(n,a,i),void D._handlers.push({element:t,event:n,handler:a}))}function a(t){return function(e){1===e.which&&t(e)}}function p(){U("onChange")}function i(e){var t=void 0!==e?D.parseDate(e):D.latestSelectedDateObj||(D.config.minDate&&D.config.minDate>D.now?D.config.minDate:D.config.maxDate&&D.config.maxDate"+D.config.getWeek(t)+""),U("onDayCreate",r),r}function b(e){e.focus(),"range"===D.config.mode&&A(e)}function w(e){for(var t=0=Math.abs(t))return b(s)}D.changeMonth(i),M(w(i),0)}(a,t):b(a)}function c(e,t){for(var n=(new Date(e,t,1).getDay()-D.l10n.firstDayOfWeek+7)%7,a=D.utils.getDaysInMonth((t-1+12)%12),i=D.utils.getDaysInMonth(t),o=window.document.createDocumentFragment(),r=1\n "+t.join("")+"\n \n "}function k(e,t){void 0===t&&(t=!0);var n=t?e:e-D.currentMonth;n<0&&!0===D._hidePrevMonthArrow||0D.config.maxDate.getFullYear())){var t=e,n=D.currentYear!==t;D.currentYear=t||D.currentYear,D.config.maxDate&&D.currentYear===D.config.maxDate.getFullYear()?D.currentMonth=Math.min(D.config.maxDate.getMonth(),D.currentMonth):D.config.minDate&&D.currentYear===D.config.minDate.getFullYear()&&(D.currentMonth=Math.max(D.config.minDate.getMonth(),D.currentMonth)),n&&(D.redraw(),U("onYearChange"))}}function P(e,t){void 0===t&&(t=!0);var n=D.parseDate(e,void 0,t);if(D.config.minDate&&n&&re(n,D.config.minDate,void 0!==t?t:!D.minDateHasTime)<0||D.config.maxDate&&n&&0=a.from.getTime()&&n.getTime()<=a.to.getTime())return i}return!i}function _(e){return void 0!==D.daysContainer&&(-1===e.className.indexOf("hidden")&&D.daysContainer.contains(e))}function F(e){e.stopPropagation();var t=e.target===D._input,n=I(e.target),a=D.config.allowInput,i=D.isOpen&&(!a||!t),o=D.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return D.setDate(D._input.value,!0,e.target===D.altInput?D.config.altFormat:D.config.dateFormat),e.target.blur();D.open()}else if(n||i||o){var r=!!D.timeContainer&&D.timeContainer.contains(e.target);switch(e.keyCode){case 13:r?G():R(e);break;case 27:e.preventDefault(),W();break;case 8:case 46:t&&!D.config.allowInput&&(e.preventDefault(),D.clear());break;case 37:case 39:if(r)D.hourElement&&D.hourElement.focus();else if(e.preventDefault(),void 0!==D.daysContainer&&!1===D.config.allowInput){var c=39===e.keyCode?1:-1;e.ctrlKey?(k(c),M(w(1),0)):M(void 0,c)}break;case 38:case 40:e.preventDefault();var l=40===e.keyCode?1:-1;D.daysContainer?e.ctrlKey?(S(D.currentYear-l),M(w(1),0)):r||M(void 0,7*l):D.config.enableTime&&(!r&&D.hourElement&&D.hourElement.focus(),d(e),D._debouncedChange());break;case 9:e.target===D.hourElement?(e.preventDefault(),D.minuteElement.select()):e.target===D.minuteElement&&(D.secondElement||D.amPM)?(e.preventDefault(),void 0!==D.secondElement?D.secondElement.focus():void 0!==D.amPM&&D.amPM.focus()):e.target===D.secondElement&&D.amPM&&(e.preventDefault(),D.amPM.focus())}switch(e.key){case D.l10n.amPM[0].charAt(0):case D.l10n.amPM[0].charAt(0).toLowerCase():void 0!==D.amPM&&e.target===D.amPM&&(D.amPM.textContent=D.l10n.amPM[0],m(),G());break;case D.l10n.amPM[1].charAt(0):case D.l10n.amPM[1].charAt(0).toLowerCase():void 0!==D.amPM&&e.target===D.amPM&&(D.amPM.textContent=D.l10n.amPM[1],m(),G())}U("onKeyDown",e)}}function A(o){if(1===D.selectedDates.length&&o.classList.contains("flatpickr-day")&&!o.classList.contains("disabled")){for(var r=o.dateObj.getTime(),c=D.parseDate(D.selectedDates[0],void 0,!0).getTime(),e=Math.min(r,D.selectedDates[0].getTime()),t=Math.max(r,D.selectedDates[0].getTime()),n=D.daysContainer.children,a=n[0].children[0].dateObj.getTime(),i=n[n.length-1].lastChild.dateObj.getTime(),l=!1,d=0,s=0,u=a;u=a||(cn,l=window.pageYOffset+o.top+(c?-n-2:t.offsetHeight+2);if(de(D.calendarContainer,"arrowTop",!c),de(D.calendarContainer,"arrowBottom",c),!D.config.inline){var d=window.pageXOffset+o.left,s=window.document.body.offsetWidth-o.right,u=d+a>window.document.body.offsetWidth;de(D.calendarContainer,"rightMost",u),D.config.static||(D.calendarContainer.style.top=l+"px",u?(D.calendarContainer.style.left="auto",D.calendarContainer.style.right=s+"px"):(D.calendarContainer.style.left=d+"px",D.calendarContainer.style.right="auto"))}}}function L(){D.config.noCalendar||D.isMobile||(z(),C())}function W(){D._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(D.close,0):D.close()}function R(e){e.preventDefault(),e.stopPropagation();var t=function e(t,n){return n(t)?t:t.parentNode?e(t.parentNode,n):void 0}(e.target,function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("disabled")&&!e.classList.contains("notAllowed")});if(void 0!==t){var n=t,a=D.latestSelectedDateObj=new Date(n.dateObj.getTime()),i=(a.getMonth()D.currentMonth+D.config.showMonths-1)&&"range"!==D.config.mode;if(D.selectedDateElem=n,"single"===D.config.mode)D.selectedDates=[a];else if("multiple"===D.config.mode){var o=$(a);o?D.selectedDates.splice(parseInt(o),1):D.selectedDates.push(a)}else"range"===D.config.mode&&(2===D.selectedDates.length&&D.clear(!1),D.selectedDates.push(a),0!==re(a,D.selectedDates[0],!0)&&D.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));if(m(),i){var r=D.currentYear!==a.getFullYear();D.currentYear=a.getFullYear(),D.currentMonth=a.getMonth(),r&&U("onYearChange"),U("onMonthChange")}if(z(),C(),D.config.minDate&&D.minDateHasTime&&D.config.enableTime&&0===re(a,D.config.minDate)&&g(D.config.minDate),G(),D.config.enableTime&&setTimeout(function(){return D.showTimeInput=!0},50),"range"===D.config.mode&&(1===D.selectedDates.length?A(n):z()),i||"range"===D.config.mode||1!==D.config.showMonths?D.selectedDateElem&&D.selectedDateElem.focus():b(n),void 0!==D.hourElement&&setTimeout(function(){return void 0!==D.hourElement&&D.hourElement.select()},451),D.config.closeOnSelect){var c="single"===D.config.mode&&!D.config.enableTime,l="range"===D.config.mode&&2===D.selectedDates.length&&!D.config.enableTime;(c||l)&&W()}p()}}D.parseDate=oe({config:D.config,l10n:D.l10n}),D._handlers=[],D._bind=o,D._setHoursFromDate=g,D.changeMonth=k,D.changeYear=S,D.clear=function(e){void 0===e&&(e=!0);D.input.value="",void 0!==D.altInput&&(D.altInput.value="");void 0!==D.mobileInput&&(D.mobileInput.value="");D.selectedDates=[],D.latestSelectedDateObj=void 0,!(D.showTimeInput=!1)===D.config.enableTime&&(void 0!==D.config.minDate?g(D.config.minDate):l(D.config.defaultHour,D.config.defaultMinute,D.config.defaultSeconds));D.redraw(),e&&U("onChange")},D.close=function(){D.isOpen=!1,D.isMobile||(D.calendarContainer.classList.remove("open"),D._input.classList.remove("active"));U("onClose")},D._createElement=se,D.destroy=function(){void 0!==D.config&&U("onDestroy");for(var e=D._handlers.length;e--;){var t=D._handlers[e];t.element.removeEventListener(t.event,t.handler)}D._handlers=[],D.mobileInput?(D.mobileInput.parentNode&&D.mobileInput.parentNode.removeChild(D.mobileInput),D.mobileInput=void 0):D.calendarContainer&&D.calendarContainer.parentNode&&D.calendarContainer.parentNode.removeChild(D.calendarContainer);D.altInput&&(D.input.type="text",D.altInput.parentNode&&D.altInput.parentNode.removeChild(D.altInput),delete D.altInput);D.input&&(D.input.type=D.input._type,D.input.classList.remove("flatpickr-input"),D.input.removeAttribute("readonly"),D.input.value="");["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete D[e]}catch(e){}})},D.isEnabled=P,D.jumpToDate=i,D.open=function(e,t){void 0===t&&(t=D._input);if(!0===D.isMobile)return e&&(e.preventDefault(),e.target&&e.target.blur()),setTimeout(function(){void 0!==D.mobileInput&&D.mobileInput.click()},0),void U("onOpen");if(D._input.disabled||D.config.inline)return;var n=D.isOpen;D.isOpen=!0,n||(D.calendarContainer.classList.add("open"),D._input.classList.add("active"),U("onOpen"),H(t));!0===D.config.enableTime&&!0===D.config.noCalendar&&(0===D.selectedDates.length&&(D.setDate(void 0!==D.config.minDate?new Date(D.config.minDate.getTime()):(new Date).setHours(D.config.defaultHour,D.config.defaultMinute,D.config.defaultSeconds,0),!1),m(),G()),setTimeout(function(){return D.hourElement.select()},50))},D.redraw=L,D.set=function(e,t){null!==e&&"object"==typeof e?Object.assign(D.config,e):(D.config[e]=t,void 0!==J[e]&&J[e].forEach(function(e){return e()}));D.redraw(),i()},D.setDate=function(e,t,n){void 0===t&&(t=!1);void 0===n&&(n=D.config.dateFormat);if(0!==e&&!e)return D.clear(t);K(e,n),D.showTimeInput=0D.config.maxDate.getMonth():D.currentYear>D.config.maxDate.getFullYear()))}function G(e){if(void 0===e&&(e=!0),0===D.selectedDates.length)return D.clear(e);void 0!==D.mobileInput&&D.mobileFormatStr&&(D.mobileInput.value=void 0!==D.latestSelectedDateObj?D.formatDate(D.latestSelectedDateObj,D.mobileFormatStr):"");var t="range"!==D.config.mode?D.config.conjunction:D.l10n.rangeSeparator;D.input.value=D.selectedDates.map(function(e){return D.formatDate(e,D.config.dateFormat)}).join(t),void 0!==D.altInput&&(D.altInput.value=D.selectedDates.map(function(e){return D.formatDate(e,D.config.altFormat)}).join(t)),!1!==e&&U("onValueUpdate")}function V(e){var t=D.prevMonthNav.contains(e.target),n=D.nextMonthNav.contains(e.target);t||n?k(t?-1:1):0<=D.yearElements.indexOf(e.target)?(e.preventDefault(),e.target.select()):e.target.classList.contains("arrowUp")?D.changeYear(D.currentYear+1):e.target.classList.contains("arrowDown")&&D.changeYear(D.currentYear-1)}return function(){D.element=D.input=s,D.isOpen=!1,function(){var e=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],n=Object.assign({},u,JSON.parse(JSON.stringify(s.dataset||{}))),a={};D.config.parseDate=n.parseDate,D.config.formatDate=n.formatDate,Object.defineProperty(D.config,"enable",{get:function(){return D.config._enable},set:function(e){D.config._enable=B(e)}}),Object.defineProperty(D.config,"disable",{get:function(){return D.config._disable},set:function(e){D.config._disable=B(e)}}),!n.dateFormat&&n.enableTime&&(a.dateFormat=n.noCalendar?"H:i"+(n.enableSeconds?":S":""):ge.defaultConfig.dateFormat+" H:i"+(n.enableSeconds?":S":"")),n.altInput&&n.enableTime&&!n.altFormat&&(a.altFormat=n.noCalendar?"h:i"+(n.enableSeconds?":S K":" K"):ge.defaultConfig.altFormat+" h:i"+(n.enableSeconds?":S":"")+" K"),Object.defineProperty(D.config,"minDate",{get:function(){return D.config._minDate},set:j("min")}),Object.defineProperty(D.config,"maxDate",{get:function(){return D.config._maxDate},set:j("max")});var i=function(t){return function(e){D.config["min"===t?"_minTime":"_maxTime"]=D.parseDate(e,"H:i")}};Object.defineProperty(D.config,"minTime",{get:function(){return D.config._minTime},set:i("min")}),Object.defineProperty(D.config,"maxTime",{get:function(){return D.config._maxTime},set:i("max")}),Object.assign(D.config,a,n);for(var o=0;oD.now.getTime()?D.config.minDate:D.config.maxDate&&D.config.maxDate.getTime() Date: Mon, 16 Apr 2018 20:59:19 +0200 Subject: [PATCH 002/135] example inputs on homepage --- static/css/flatpickr.css | 741 ++++++++++++++++++++++++++++++++++++++- templates/home.hamlet | 40 +-- templates/home.julius | 19 + 3 files changed, 759 insertions(+), 41 deletions(-) diff --git a/static/css/flatpickr.css b/static/css/flatpickr.css index 9d24b0240..2e9c517e9 100644 --- a/static/css/flatpickr.css +++ b/static/css/flatpickr.css @@ -1,13 +1,740 @@ -.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px);}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.rightMost:after{left:auto;right:22px}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:28px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;line-height:16px;height:28px;padding:10px;z-index:3;}.flatpickr-months .flatpickr-prev-month.disabled,.flatpickr-months .flatpickr-next-month.disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/* - /*rtl:begin:ignore*/left:0;/* - /*rtl:end:ignore*/}/* +.flatpickr-calendar { + background: transparent; + opacity: 0; + display: none; + text-align: center; + visibility: hidden; + padding: 0; + -webkit-animation: none; + animation: none; + direction: ltr; + border: 0; + font-size: 14px; + line-height: 24px; + border-radius: 5px; + position: absolute; + width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -ms-touch-action: manipulation; + touch-action: manipulation; + background: #fff; + -webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); + box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); +} +.flatpickr-calendar.open, +.flatpickr-calendar.inline { + opacity: 1; + max-height: 640px; + visibility: visible; +} +.flatpickr-calendar.open { + display: inline-block; + z-index: 99999; +} +.flatpickr-calendar.animate.open { + -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); + animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.flatpickr-calendar.inline { + display: block; + position: relative; + top: 2px; +} +.flatpickr-calendar.static { + position: absolute; + top: calc(100% + 2px); +} +.flatpickr-calendar.static.open { + z-index: 999; + display: block; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) { + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) { + -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-calendar .hasWeeks .dayContainer, +.flatpickr-calendar .hasTime .dayContainer { + border-bottom: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.flatpickr-calendar .hasWeeks .dayContainer { + border-left: 0; +} +.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time { + height: 40px; + border-top: 1px solid #e6e6e6; +} +.flatpickr-calendar.noCalendar.hasTime .flatpickr-time { + height: auto; +} +.flatpickr-calendar:before, +.flatpickr-calendar:after { + position: absolute; + display: block; + pointer-events: none; + border: solid transparent; + content: ''; + height: 0; + width: 0; + left: 22px; +} +.flatpickr-calendar.rightMost:before, +.flatpickr-calendar.rightMost:after { + left: auto; + right: 22px; +} +.flatpickr-calendar:before { + border-width: 5px; + margin: 0 -5px; +} +.flatpickr-calendar:after { + border-width: 4px; + margin: 0 -4px; +} +.flatpickr-calendar.arrowTop:before, +.flatpickr-calendar.arrowTop:after { + bottom: 100%; +} +.flatpickr-calendar.arrowTop:before { + border-bottom-color: #e6e6e6; +} +.flatpickr-calendar.arrowTop:after { + border-bottom-color: #fff; +} +.flatpickr-calendar.arrowBottom:before, +.flatpickr-calendar.arrowBottom:after { + top: 100%; +} +.flatpickr-calendar.arrowBottom:before { + border-top-color: #e6e6e6; +} +.flatpickr-calendar.arrowBottom:after { + border-top-color: #fff; +} +.flatpickr-calendar:focus { + outline: 0; +} +.flatpickr-wrapper { + position: relative; + display: inline-block; +} +.flatpickr-months { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-months .flatpickr-month { + background: transparent; + color: rgba(0,0,0,0.9); + fill: rgba(0,0,0,0.9); + height: 28px; + line-height: 1; + text-align: center; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +.flatpickr-months .flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month { + text-decoration: none; + cursor: pointer; + position: absolute; + top: 0px; + line-height: 16px; + height: 28px; + padding: 10px; + z-index: 3; +} +.flatpickr-months .flatpickr-prev-month.disabled, +.flatpickr-months .flatpickr-next-month.disabled { + display: none; +} +.flatpickr-months .flatpickr-prev-month i, +.flatpickr-months .flatpickr-next-month i { + position: relative; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month.flatpickr-prev-month { +/* + /*rtl:begin:ignore*/ +/* + */ + left: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* /*rtl:begin:ignore*/ /* /*rtl:end:ignore*/ -.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{/* - /*rtl:begin:ignore*/right:0;/* - /*rtl:end:ignore*/}/* +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month, +.flatpickr-months .flatpickr-next-month.flatpickr-next-month { +/* + /*rtl:begin:ignore*/ +/* + */ + right: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* /*rtl:begin:ignore*/ /* /*rtl:end:ignore*/ -.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9;}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px;}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto;}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%;}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box;}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0;}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%;}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto;}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05);}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:6.16px 0 0 0;line-height:1;height:28px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0;}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block;}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px;}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px;}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1;}.dayContainer + .dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9;}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange,.flatpickr-day.startRange.startRange + .endRange,.flatpickr-day.endRange.startRange + .endRange{-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.disabled,.flatpickr-day.disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.disabled,.flatpickr-day.disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{display:inline-block;float:left;}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left;}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;cursor:pointer;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;display:inline-block;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400;}.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time .flatpickr-am-pm:focus{background:#f0f0f0}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}} +.flatpickr-months .flatpickr-prev-month:hover, +.flatpickr-months .flatpickr-next-month:hover { + color: #959ea9; +} +.flatpickr-months .flatpickr-prev-month:hover svg, +.flatpickr-months .flatpickr-next-month:hover svg { + fill: #f64747; +} +.flatpickr-months .flatpickr-prev-month svg, +.flatpickr-months .flatpickr-next-month svg { + width: 14px; + height: 14px; +} +.flatpickr-months .flatpickr-prev-month svg path, +.flatpickr-months .flatpickr-next-month svg path { + -webkit-transition: fill 0.1s; + transition: fill 0.1s; + fill: inherit; +} +.numInputWrapper { + position: relative; + height: auto; +} +.numInputWrapper input, +.numInputWrapper span { + display: inline-block; +} +.numInputWrapper input { + width: 100%; + min-width: auto !important; +} +.numInputWrapper input::-ms-clear { + display: none; +} +.numInputWrapper span { + position: absolute; + right: 0; + width: 14px; + padding: 0 4px 0 2px; + height: 50%; + line-height: 50%; + opacity: 0; + cursor: pointer; + border: 1px solid rgba(57,57,57,0.15); + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.numInputWrapper span:hover { + background: rgba(0,0,0,0.1); +} +.numInputWrapper span:active { + background: rgba(0,0,0,0.2); +} +.numInputWrapper span:after { + display: block; + content: ""; + position: absolute; +} +.numInputWrapper span.arrowUp { + top: 0; + border-bottom: 0; +} +.numInputWrapper span.arrowUp:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-bottom: 4px solid rgba(57,57,57,0.6); + top: 26%; +} +.numInputWrapper span.arrowDown { + top: 50%; +} +.numInputWrapper span.arrowDown:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid rgba(57,57,57,0.6); + top: 40%; +} +.numInputWrapper span svg { + width: inherit; + height: auto; +} +.numInputWrapper span svg path { + fill: rgba(0,0,0,0.5); +} +.numInputWrapper:hover { + background: rgba(0,0,0,0.05); +} +.numInputWrapper:hover span { + opacity: 1; +} +.flatpickr-current-month { + font-size: 135%; + line-height: inherit; + font-weight: 300; + color: inherit; + position: absolute; + width: 75%; + left: 12.5%; + padding: 6.16px 0 0 0; + line-height: 1; + height: 28px; + display: inline-block; + text-align: center; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); +} +.flatpickr-current-month span.cur-month { + font-family: inherit; + font-weight: 700; + color: inherit; + display: inline-block; + margin-left: 0.5ch; + padding: 0; +} +.flatpickr-current-month span.cur-month:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .numInputWrapper { + width: 6ch; + width: 7ch\0; + display: inline-block; +} +.flatpickr-current-month .numInputWrapper span.arrowUp:after { + border-bottom-color: rgba(0,0,0,0.9); +} +.flatpickr-current-month .numInputWrapper span.arrowDown:after { + border-top-color: rgba(0,0,0,0.9); +} +.flatpickr-current-month input.cur-year { + background: transparent; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: inherit; + cursor: text; + padding: 0 0 0 0.5ch; + margin: 0; + display: inline-block; + font-size: inherit; + font-family: inherit; + font-weight: 300; + line-height: inherit; + height: auto; + border: 0; + border-radius: 0; + vertical-align: initial; +} +.flatpickr-current-month input.cur-year:focus { + outline: 0; +} +.flatpickr-current-month input.cur-year[disabled], +.flatpickr-current-month input.cur-year[disabled]:hover { + font-size: 100%; + color: rgba(0,0,0,0.5); + background: transparent; + pointer-events: none; +} +.flatpickr-weekdays { + background: transparent; + text-align: center; + overflow: hidden; + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + height: 28px; +} +.flatpickr-weekdays .flatpickr-weekdaycontainer { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +span.flatpickr-weekday { + cursor: default; + font-size: 90%; + background: transparent; + color: rgba(0,0,0,0.54); + line-height: 1; + margin: 0; + text-align: center; + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + font-weight: bolder; +} +.dayContainer, +.flatpickr-weeks { + padding: 1px 0 0 0; +} +.flatpickr-days { + position: relative; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; + width: 307.875px; +} +.flatpickr-days:focus { + outline: 0; +} +.dayContainer { + padding: 0; + outline: 0; + text-align: left; + width: 307.875px; + min-width: 307.875px; + max-width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + display: -ms-flexbox; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-wrap: wrap; + flex-wrap: wrap; + -ms-flex-wrap: wrap; + -ms-flex-pack: justify; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); + opacity: 1; +} +.dayContainer + .dayContainer { + -webkit-box-shadow: -1px 0 0 #e6e6e6; + box-shadow: -1px 0 0 #e6e6e6; +} +.flatpickr-day { + background: none; + border: 1px solid transparent; + border-radius: 150px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #393939; + cursor: pointer; + font-weight: 400; + width: 14.2857143%; + -webkit-flex-basis: 14.2857143%; + -ms-flex-preferred-size: 14.2857143%; + flex-basis: 14.2857143%; + max-width: 39px; + height: 39px; + line-height: 39px; + margin: 0; + display: inline-block; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + text-align: center; +} +.flatpickr-day.inRange, +.flatpickr-day.prevMonthDay.inRange, +.flatpickr-day.nextMonthDay.inRange, +.flatpickr-day.today.inRange, +.flatpickr-day.prevMonthDay.today.inRange, +.flatpickr-day.nextMonthDay.today.inRange, +.flatpickr-day:hover, +.flatpickr-day.prevMonthDay:hover, +.flatpickr-day.nextMonthDay:hover, +.flatpickr-day:focus, +.flatpickr-day.prevMonthDay:focus, +.flatpickr-day.nextMonthDay:focus { + cursor: pointer; + outline: 0; + background: #e6e6e6; + border-color: #e6e6e6; +} +.flatpickr-day.today { + border-color: #959ea9; +} +.flatpickr-day.today:hover, +.flatpickr-day.today:focus { + border-color: #959ea9; + background: #959ea9; + color: #fff; +} +.flatpickr-day.selected, +.flatpickr-day.startRange, +.flatpickr-day.endRange, +.flatpickr-day.selected.inRange, +.flatpickr-day.startRange.inRange, +.flatpickr-day.endRange.inRange, +.flatpickr-day.selected:focus, +.flatpickr-day.startRange:focus, +.flatpickr-day.endRange:focus, +.flatpickr-day.selected:hover, +.flatpickr-day.startRange:hover, +.flatpickr-day.endRange:hover, +.flatpickr-day.selected.prevMonthDay, +.flatpickr-day.startRange.prevMonthDay, +.flatpickr-day.endRange.prevMonthDay, +.flatpickr-day.selected.nextMonthDay, +.flatpickr-day.startRange.nextMonthDay, +.flatpickr-day.endRange.nextMonthDay { + background: #569ff7; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #569ff7; +} +.flatpickr-day.selected.startRange, +.flatpickr-day.startRange.startRange, +.flatpickr-day.endRange.startRange { + border-radius: 50px 0 0 50px; +} +.flatpickr-day.selected.endRange, +.flatpickr-day.startRange.endRange, +.flatpickr-day.endRange.endRange { + border-radius: 0 50px 50px 0; +} +.flatpickr-day.selected.startRange + .endRange, +.flatpickr-day.startRange.startRange + .endRange, +.flatpickr-day.endRange.startRange + .endRange { + -webkit-box-shadow: -10px 0 0 #569ff7; + box-shadow: -10px 0 0 #569ff7; +} +.flatpickr-day.selected.startRange.endRange, +.flatpickr-day.startRange.startRange.endRange, +.flatpickr-day.endRange.startRange.endRange { + border-radius: 50px; +} +.flatpickr-day.inRange { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-day.disabled, +.flatpickr-day.disabled:hover, +.flatpickr-day.prevMonthDay, +.flatpickr-day.nextMonthDay, +.flatpickr-day.notAllowed, +.flatpickr-day.notAllowed.prevMonthDay, +.flatpickr-day.notAllowed.nextMonthDay { + color: rgba(57,57,57,0.3); + background: transparent; + border-color: transparent; + cursor: default; +} +.flatpickr-day.disabled, +.flatpickr-day.disabled:hover { + cursor: not-allowed; + color: rgba(57,57,57,0.1); +} +.flatpickr-day.week.selected { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; + box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; +} +.flatpickr-day.hidden { + visibility: hidden; +} +.rangeMode .flatpickr-day { + margin-top: 1px; +} +.flatpickr-weekwrapper { + display: inline-block; + float: left; +} +.flatpickr-weekwrapper .flatpickr-weeks { + padding: 0 12px; + -webkit-box-shadow: 1px 0 0 #e6e6e6; + box-shadow: 1px 0 0 #e6e6e6; +} +.flatpickr-weekwrapper .flatpickr-weekday { + float: none; + width: 100%; + line-height: 28px; +} +.flatpickr-weekwrapper span.flatpickr-day, +.flatpickr-weekwrapper span.flatpickr-day:hover { + display: block; + width: 100%; + max-width: none; + color: rgba(57,57,57,0.3); + background: transparent; + cursor: default; + border: none; +} +.flatpickr-innerContainer { + display: block; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; +} +.flatpickr-rContainer { + display: inline-block; + padding: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.flatpickr-time { + text-align: center; + outline: 0; + display: block; + height: 0; + line-height: 40px; + max-height: 40px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-time:after { + content: ""; + display: table; + clear: both; +} +.flatpickr-time .numInputWrapper { + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + width: 40%; + height: 40px; + float: left; +} +.flatpickr-time .numInputWrapper span.arrowUp:after { + border-bottom-color: #393939; +} +.flatpickr-time .numInputWrapper span.arrowDown:after { + border-top-color: #393939; +} +.flatpickr-time.hasSeconds .numInputWrapper { + width: 26%; +} +.flatpickr-time.time24hr .numInputWrapper { + width: 49%; +} +.flatpickr-time input { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border: 0; + border-radius: 0; + text-align: center; + margin: 0; + padding: 0; + height: inherit; + line-height: inherit; + cursor: pointer; + color: #393939; + font-size: 14px; + position: relative; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.flatpickr-time input.flatpickr-hour { + font-weight: bold; +} +.flatpickr-time input.flatpickr-minute, +.flatpickr-time input.flatpickr-second { + font-weight: 400; +} +.flatpickr-time input:focus { + outline: 0; + border: 0; +} +.flatpickr-time .flatpickr-time-separator, +.flatpickr-time .flatpickr-am-pm { + height: inherit; + display: inline-block; + float: left; + line-height: inherit; + color: #393939; + font-weight: bold; + width: 2%; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-align-self: center; + -ms-flex-item-align: center; + align-self: center; +} +.flatpickr-time .flatpickr-am-pm { + outline: 0; + width: 18%; + cursor: pointer; + text-align: center; + font-weight: 400; +} +.flatpickr-time .flatpickr-am-pm:hover, +.flatpickr-time .flatpickr-am-pm:focus { + background: #f0f0f0; +} +.flatpickr-input[readonly] { + cursor: pointer; + min-width: auto; +} +@-webkit-keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} diff --git a/templates/home.hamlet b/templates/home.hamlet index e5a4a8678..91a0b71cb 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -28,40 +28,12 @@
-

Tabellen - - - - - - - - - - - - - + -
ID - TH1 - TH2 - TH3 -
0 - NT2 - CON2 - 3 -
1 - 5 - ONT2 - 13 -
2 - CONT1 - NT2 - 43 -
3 - 43 - T2C2 - 35 -
4 - 73 - CA62 - 7 +

Date picker +
+ + + +
diff --git a/templates/home.julius b/templates/home.julius index e69de29bb..c62129e2c 100644 --- a/templates/home.julius +++ b/templates/home.julius @@ -0,0 +1,19 @@ +document.addEventListener('DOMContentLoaded', function() { + 'use strict'; + + var config = { + enableTime: true, + altInput: true, + altFormat: "j. F Y, H:i", + dateFormat: "Y-m-d H:i", + time_24hr: true + }; + + flatpickr('#datetime-form1 [type="date"]', { + altFormat: "j. F Y", dateFormat: "Y-m-d", altInput: true + }); + flatpickr('#datetime-form1 [type="time"]', { + enableTime: true, noCalendar: true, altFormat: "H:i", dateFormat: "H:i", altInput: true, time_24hr: true + }); + flatpickr('#datetime-form2 input', config); +}); From 87ab470072ba1a72235832006e9749e0838417de Mon Sep 17 00:00:00 2001 From: SJost Date: Tue, 29 May 2018 10:49:46 +0200 Subject: [PATCH 003/135] Minor refactor andAP and adminAP --- src/Foundation.hs | 25 ++++++++++++------------- src/Utils.hs | 14 ++++++++++---- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 0d610b932..467bb59fc 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -159,14 +159,12 @@ orAR _ _ Authorized = Authorized orAR _ AuthenticationRequired _ = AuthenticationRequired orAR _ _ AuthenticationRequired = AuthenticationRequired orAR mr (Unauthorized x) (Unauthorized y) = Unauthorized . render mr $ MsgUnauthorizedOr x y -andAR _ Authorized Authorized = Authorized -andAR _ Authorized other = other -andAR _ other Authorized = other -andAR _ AuthenticationRequired other = other -andAR _ other AuthenticationRequired = other +-- and andAR mr (Unauthorized x) (Unauthorized y) = Unauthorized . render mr $ MsgUnauthorizedAnd x y - - +andAR _ reason@(Unauthorized x) _ = reason +andAR _ _ reason@(Unauthorized x) = reason +andAR _ Authorized other = other +andAR _ AuthenticationRequired _ = AuthenticationRequired orAP,andAP :: AccessPredicate -> AccessPredicate -> AccessPredicate orAP = liftAR orAR (== Authorized) @@ -190,8 +188,9 @@ trueAP = APPure . const $ return Authorized falseAP = APPure . const $ Unauthorized . ($ MsgUnauthorized) . render <$> ask -- TODO: I believe falseAP := adminAP -adminAP :: AccessPredicate +adminAP :: AccessPredicate -- access for admins (of appropriate school in case of course-routes) adminAP = APDB $ \case + -- Courses: access only to school admins CourseR tid csh _ -> exceptT return return $ do authId <- maybeExceptT AuthenticationRequired $ lift maybeAuthId [E.Value c] <- lift . E.select . E.from $ \(course `E.InnerJoin` userAdmin) -> do @@ -200,15 +199,15 @@ adminAP = APDB $ \case E.&&. course E.^. CourseTerm E.==. E.val tid E.&&. course E.^. CourseShorthand E.==. E.val csh return (E.countRows :: E.SqlExpr (E.Value Int64)) - guardMExceptT (unauthorizedI MsgUnauthorizedSchoolAdmin) (c > 0) + guardMExceptT (c > 0) (unauthorizedI MsgUnauthorizedSchoolAdmin) return Authorized - + -- other routes: access to any admin is granted here _other -> exceptT return return $ do authId <- maybeExceptT AuthenticationRequired $ lift maybeAuthId adrights <- lift $ selectFirst [UserAdminUser ==. authId] [] - case adrights of - (Just _) -> return Authorized - Nothing -> lift $ unauthorizedI $ MsgUnauthorized + guardMExceptT (isJust adrights) (unauthorizedI $ MsgUnauthorized) + return Authorized + knownTags :: Map (CI Text) AccessPredicate knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId diff --git a/src/Utils.hs b/src/Utils.hs index 0024dc117..868049a1f 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -93,11 +93,17 @@ maybeExceptT err act = lift act >>= maybe (throwE err) return maybeMExceptT :: Monad m => (m e) -> m (Maybe b) -> ExceptT e m b maybeMExceptT err act = lift act >>= maybe (lift err >>= throwE) return -guardExceptT :: Monad m => e -> Bool -> ExceptT e m () -guardExceptT err b = unless b $ throwE err +whenExceptT :: Monad m => Bool -> e -> ExceptT e m () +whenExceptT b err = when b $ throwE err -guardMExceptT :: Monad m => (m e) -> Bool -> ExceptT e m () -guardMExceptT err b = unless b $ lift err >>= throwE +whenMExceptT :: Monad m => Bool -> (m e) -> ExceptT e m () +whenMExceptT b err = when b $ lift err >>= throwE + +guardExceptT :: Monad m => Bool -> e -> ExceptT e m () +guardExceptT b err = unless b $ throwE err + +guardMExceptT :: Monad m => Bool -> (m e) -> ExceptT e m () +guardMExceptT b err = unless b $ lift err >>= throwE exceptT :: Monad m => (e -> m b) -> (a -> m b) -> ExceptT e m a -> m b exceptT f g = either f g <=< runExceptT From 457f63ad1909092ea8774de94f1bd00d014cbdb9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 1 Jun 2018 11:56:40 +0200 Subject: [PATCH 004/135] Use deep sql magic (window functions) instead of multiple queries --- src/Handler/Sheet.hs | 8 ++++---- src/Handler/Term.hs | 16 ++++++++-------- src/Handler/Utils/Table/Pagination.hs | 12 +++++++++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index 8f3d895cb..5522b0b89 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -209,10 +209,10 @@ getSheetShowR tid csh shn = do -- return desired columns return $ (file E.^. FileTitle, file E.^. FileModified, sheetFile E.^. SheetFileType) let colonnadeFiles = mconcat - [ sortable (Just "type") "Typ" $ \(_,_, E.Value ftype) -> textCell $ toPathPiece ftype - , sortable (Just "path") "Dateiname" $ anchorCell (\(E.Value fName,_,E.Value fType) -> CSheetR tid csh (SheetFileR shn fType fName)) - (\(E.Value fName,_,_) -> str2widget fName) - , sortable (Just "time") "Modifikation" $ \(_,E.Value modified,_) -> stringCell $ formatTimeGerWDT modified + [ sortable (Just "type") "Typ" $ \(_, (_,_, E.Value ftype)) -> textCell $ toPathPiece ftype + , sortable (Just "path") "Dateiname" $ anchorCell (\(_, (E.Value fName,_,E.Value fType)) -> CSheetR tid csh (SheetFileR shn fType fName)) + (\(_, (E.Value fName,_,_)) -> str2widget fName) + , sortable (Just "time") "Modifikation" $ \(_, (_,E.Value modified,_)) -> stringCell $ formatTimeGerWDT modified ] fileTable <- dbTable def $ DBTable { dbtSQLQuery = fileData diff --git a/src/Handler/Term.hs b/src/Handler/Term.hs index cfbd92ced..1309b666b 100644 --- a/src/Handler/Term.hs +++ b/src/Handler/Term.hs @@ -42,7 +42,7 @@ getTermShowR = do provideRep $ toJSON . map fst <$> runDB (E.select $ E.from termData) provideRep $ do let colonnadeTerms = mconcat - [ sortable Nothing "Kürzel" $ \(Entity tid Term{..},_) -> cell $ do + [ sortable Nothing "Kürzel" $ \(_, (Entity tid Term{..},_)) -> cell $ do -- Scrap this if to slow, create term edit page instead adminLink <- handlerToWidget $ isAuthorized (TermEditExistR tid) False [whamlet| @@ -52,22 +52,22 @@ getTermShowR = do $else #{termToText termName} |] - , sortable (Just "lecture-start") "Beginn Vorlesungen" $ \(Entity _ Term{..},_) -> + , sortable (Just "lecture-start") "Beginn Vorlesungen" $ \(_, (Entity _ Term{..},_)) -> stringCell $ formatTimeGerWD termLectureStart - , sortable (Just "lecture-end") "Ende Vorlesungen" $ \(Entity _ Term{..},_) -> + , sortable (Just "lecture-end") "Ende Vorlesungen" $ \(_, (Entity _ Term{..},_)) -> stringCell $ formatTimeGerWD termLectureEnd - , sortable Nothing "Aktiv" $ \(Entity _ Term{..},_) -> + , sortable Nothing "Aktiv" $ \(_, (Entity _ Term{..},_)) -> textCell $ bool "" tickmark termActive - , sortable Nothing "Kursliste" $ \(Entity tid Term{..}, E.Value numCourses) -> + , sortable Nothing "Kursliste" $ \(_, (Entity tid Term{..}, E.Value numCourses)) -> cell [whamlet| #{show numCourses} Kurse |] - , sortable (Just "start") "Semesteranfang" $ \(Entity _ Term{..},_) -> + , sortable (Just "start") "Semesteranfang" $ \(_, (Entity _ Term{..},_)) -> stringCell $ formatTimeGerWD termStart - , sortable (Just "end") "Semesterende" $ \(Entity _ Term{..},_) -> + , sortable (Just "end") "Semesterende" $ \(_, (Entity _ Term{..},_)) -> stringCell $ formatTimeGerWD termEnd - , sortable Nothing "Feiertage im Semester" $ \(Entity _ Term{..},_) -> + , sortable Nothing "Feiertage im Semester" $ \(_, (Entity _ Term{..},_)) -> stringCell $ (intercalate ", ") $ map formatTimeGerWD termHolidays ] table <- dbTable def $ DBTable diff --git a/src/Handler/Utils/Table/Pagination.hs b/src/Handler/Utils/Table/Pagination.hs index 8969d1a7d..b1f1bcb58 100644 --- a/src/Handler/Utils/Table/Pagination.hs +++ b/src/Handler/Utils/Table/Pagination.hs @@ -22,7 +22,7 @@ import Handler.Utils.Table.Pagination.Types import Import import qualified Database.Esqueleto as E -import qualified Database.Esqueleto.Internal.Sql as E (SqlSelect) +import qualified Database.Esqueleto.Internal.Sql as E (SqlSelect,unsafeSqlValue) import qualified Database.Esqueleto.Internal.Language as E (From) import Text.Blaze (Attribute) import qualified Text.Blaze.Html5.Attributes as Html5 @@ -72,7 +72,7 @@ data DBTable = forall a r h i t. , E.From E.SqlQuery E.SqlExpr E.SqlBackend t ) => DBTable { dbtSQLQuery :: t -> E.SqlQuery a - , dbtColonnade :: Colonnade h r (Cell UniWorX) + , dbtColonnade :: Colonnade h (Int64, r) (Cell UniWorX) , dbtSorting :: Map Text (SortColumn t) , dbtAttrs :: Attribute , dbtIdent :: i @@ -146,7 +146,13 @@ dbTable PSValidator{..} DBTable{ dbtIdent = (toPathPiece -> dbtIdent), .. } = do mapM_ (addMessageI "warning") errs - (rows, [E.Value rowCount]) <- runDB $ (,) <$> E.select sqlQuery' <*> E.select (E.countRows <$ E.from dbtSQLQuery :: E.SqlQuery (E.SqlExpr (E.Value Int64))) + rows' <- runDB . E.select $ (,) <$> pure (E.unsafeSqlValue "row_number() OVER ()" :: E.SqlExpr (E.Value Int64), E.unsafeSqlValue "count(*) OVER ()" :: E.SqlExpr (E.Value Int64)) <*> sqlQuery' + + let + rowCount + | ((_, E.Value n), _):_ <- rows' = n + | otherwise = 0 + rows = map (\((E.Value i, _), r) -> (i, r)) rows' bool return (sendResponse <=< tblLayout) psShortcircuit $ do getParams <- handlerToWidget $ queryToQueryText . Wai.queryString . reqWaiRequest <$> getRequest From e80d883ebdeb266f7e75d28fa64de87d08af9e9f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 1 Jun 2018 12:01:34 +0200 Subject: [PATCH 005/135] Adjust submission file-dbtTable for new SQL --- src/Handler/Submission.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index 08996f47e..28c0639a7 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -215,9 +215,9 @@ postSubmissionR tid csh shn (SubmissionMode mcid) = do -- Maybe construct a table to display uploaded archive files let colonnadeFiles cid = mconcat -- [ sortable (Just "type") "Typ" $ \(_,_, E.Value ftype) -> textCell $ toPathPiece ftype - [ sortable (Just "path") "Dateiname" $ anchorCell (\(Entity _ File{..}) -> SubmissionDownloadSingleR cid fileTitle) - (\(Entity _ File{..}) -> str2widget fileTitle) - , sortable (Just "time") "Modifikation" $ \(Entity _ File{..}) -> stringCell $ formatTimeGerWDT fileModified + [ sortable (Just "path") "Dateiname" $ anchorCell (\(_, (Entity _ File{..})) -> SubmissionDownloadSingleR cid fileTitle) + (\(_, (Entity _ File{..})) -> str2widget fileTitle) + , sortable (Just "time") "Modifikation" $ \(_, (Entity _ File{..})) -> stringCell $ formatTimeGerWDT fileModified ] smid2ArchiveTable (smid,cid) = DBTable { dbtSQLQuery = submissionFileQuery smid From 7badb3536ac4c26ad9ec11c9dc377d327cd7de9c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 1 Jun 2018 12:19:31 +0200 Subject: [PATCH 006/135] Don't allow uploads to shadow rating file --- src/Handler/Submission.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index 28c0639a7..3e4975faf 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -181,7 +181,7 @@ postSubmissionR tid csh shn (SubmissionMode mcid) = do (Nothing, Just smid) -- no new files, existing submission partners updated -> return smid (Just files, _) -- new files - -> runConduit $ transPipe lift files .| Conduit.map Left .| sinkSubmission shid uid ((,False) <$> msmid) + -> runConduit $ transPipe lift files .| extractRatings .| sinkSubmission shid uid ((,False) <$> msmid) _ -> error "Impossible, because of definition of `makeSubmissionForm`" -- Determine members of pre-registered group groupUids <- fmap (setFromList . map E.unValue) . E.select . E.from $ \(submissionGroupUser `E.InnerJoin` submissionGroup `E.InnerJoin` submissionGroupUser') -> do From 5e5c980459273a1fac570f893aa8261672a600be Mon Sep 17 00:00:00 2001 From: SJost Date: Tue, 5 Jun 2018 08:34:14 +0200 Subject: [PATCH 007/135] minor refactors --- src/Foundation.hs | 6 +++--- src/Utils.hs | 4 ++-- src/Utils/Common.hs | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 194d23bb4..e8d7324e3 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -226,7 +226,7 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId E.&&. course E.^. CourseTerm E.==. E.val tid E.&&. course E.^. CourseShorthand E.==. E.val csh return (E.countRows :: E.SqlExpr (E.Value Int64)) - guardMExceptT (unauthorizedI MsgUnauthorizedLecturer) (c > 0) + guardMExceptT (c>0) (unauthorizedI MsgUnauthorizedLecturer) return Authorized _ -> exceptT return return $ do authId <- maybeExceptT AuthenticationRequired $ lift maybeAuthId @@ -259,7 +259,7 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId guard $ cid `Set.member` Map.keysSet resMap return Authorized _ -> do - guardMExceptT (unauthorizedI MsgUnauthorizedCorrectorAny) . not $ Map.null resMap + guardMExceptT (not $ Map.null resMap) (unauthorizedI MsgUnauthorizedCorrectorAny) return Authorized ) ,("time", APDB $ \case @@ -286,7 +286,7 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId E.&&. course E.^. CourseTerm E.==. E.val tid E.&&. course E.^. CourseShorthand E.==. E.val csh return (E.countRows :: E.SqlExpr (E.Value Int64)) - guardMExceptT (unauthorizedI MsgUnauthorizedParticipant) (c > 0) + guardMExceptT (c > 0) (unauthorizedI MsgUnauthorizedParticipant) return Authorized r -> do $logErrorS "AccessControl" $ "'!registered' used on route that doesn't support it: " <> tshow r diff --git a/src/Utils.hs b/src/Utils.hs index 14166ba53..e753dcbf2 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -85,7 +85,7 @@ maybeT :: Monad m => m a -> MaybeT m a -> m a maybeT x m = runMaybeT m >>= maybe x return catchIfMaybeT :: (MonadCatch m, Exception e) => (e -> Bool) -> m a -> MaybeT m a -catchIfMaybeT pred act = catchIf pred (lift act) (const mzero) +catchIfMaybeT p act = catchIf p (lift act) (const mzero) --------------- -- Exception -- @@ -113,7 +113,7 @@ exceptT :: Monad m => (e -> m b) -> (a -> m b) -> ExceptT e m a -> m b exceptT f g = either f g <=< runExceptT catchIfMExceptT :: (MonadCatch m, Exception e) => (e -> m e') -> (e -> Bool) -> m a -> ExceptT e' m a -catchIfMExceptT err pred act = catchIf pred (lift act) (throwE <=< lift . err) +catchIfMExceptT err p act = catchIf p (lift act) (throwE <=< lift . err) ------------ diff --git a/src/Utils/Common.hs b/src/Utils/Common.hs index 56c437905..3a2e6c804 100644 --- a/src/Utils/Common.hs +++ b/src/Utils/Common.hs @@ -5,10 +5,10 @@ module Utils.Common where -- Common Utility Functions import Language.Haskell.TH -import Control.Monad -import Control.Monad.Trans.Class -import Control.Monad.Trans.Maybe -import Control.Monad.Trans.Except +-- import Control.Monad +-- import Control.Monad.Trans.Class +-- import Control.Monad.Trans.Maybe +-- import Control.Monad.Trans.Except ------------ -- Tuples -- From 44776e15065d80e113113bcfe58289d5bbeab939 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 7 Jun 2018 10:29:27 +0200 Subject: [PATCH 008/135] refactor SubmissionR --- routes | 4 +++- src/Foundation.hs | 18 ++++++++++++------ src/Handler/CryptoIDDispatch.hs | 2 +- src/Handler/Submission.hs | 31 +++++++++++++++++++++++++++---- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/routes b/routes index f864ff89c..450bbcd99 100644 --- a/routes +++ b/routes @@ -50,7 +50,9 @@ /#SheetFileType/#FilePath SFileR GET !timeANDregistered !timeANDmaterials !corrector /edit SEditR GET POST /delete SDelR GET POST - !/submission/#SubmissionMode SubmissionR GET POST !timeANDregistered !owner + !/sub/new SubmissionNewR GET POST !timeANDregistered + !/sub/own SubmissionOwnR GET !free + !/sub/#CryptoUUIDSubmission SubmissionR GET POST !owner !corrector !/#UUID CryptoUUIDDispatchR GET !free -- just redirect diff --git a/src/Foundation.hs b/src/Foundation.hs index 3678b20f4..7a11bd875 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -245,7 +245,7 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId resMap :: Map CourseId (Set SheetId) resMap = Map.fromListWith Set.union [ (cid, Set.singleton sid) | (E.Value cid, E.Value sid) <- resList ] case route of - CSheetR _ _ _ (SubmissionR (ExistingSubmission cID)) -> maybeT (unauthorizedI MsgUnauthorizedSubmissionCorrector) $ do + CSheetR _ _ _ (SubmissionR cID) -> maybeT (unauthorizedI MsgUnauthorizedSubmissionCorrector) $ do sid <- catchIfMaybeT (const True :: CryptoIDError -> Bool) $ decrypt cID Submission{..} <- MaybeT . lift $ get sid guard $ maybe False (== authId) submissionRatingBy @@ -271,7 +271,7 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId case subRoute of SFileR SheetHint _ -> guard $ maybe False (<= cTime) sheetHintFrom SFileR SheetSolution _ -> guard $ maybe False (<= cTime) sheetSolutionFrom - SubmissionR NewSubmission -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo + SubmissionNewR -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo _ -> guard $ maybe False (<= cTime) sheetVisibleFrom return Authorized r -> do @@ -303,12 +303,12 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId unauthorizedI MsgUnauthorized ) ,("owner", APDB $ \case - CSheetR _ _ _ (SubmissionR (ExistingSubmission cID)) -> exceptT return return $ do + CSheetR _ _ _ (SubmissionR cID) -> exceptT return return $ do sid <- catchIfMExceptT (const $ unauthorizedI MsgUnauthorizedSubmissionOwner) (const True :: CryptoIDError -> Bool) $ decrypt cID authId <- maybeExceptT AuthenticationRequired $ lift maybeAuthId void . maybeMExceptT (unauthorizedI MsgUnauthorizedSubmissionOwner) . getBy $ UniqueSubmissionUser authId sid return Authorized - CSheetR _ _ _ (SubmissionR NewSubmission) -> unauthorizedI MsgUnauthorizedSubmissionOwner + CSheetR _ _ _ SubmissionNewR -> unauthorizedI MsgUnauthorizedSubmissionOwner r -> do $logErrorS "AccessControl" $ "'!owner' used on route that doesn't support it: " <> tshow r unauthorizedI MsgUnauthorized @@ -652,10 +652,16 @@ pageActions (CourseR tid csh SheetListR) = ] pageActions (CSheetR tid csh shn SShowR) = [ PageActionPrime $ MenuItem + { menuItemLabel = "Abgabe anlegen" + , menuItemIcon = Nothing + , menuItemRoute = CSheetR tid csh shn SubmissionNewR + , menuItemAccessCallback' = return True -- TODO: check that no submission already exists + } + , PageActionPrime $ MenuItem { menuItemLabel = "Abgabe" , menuItemIcon = Nothing - , menuItemRoute = CSheetR tid csh shn (SubmissionR NewSubmission) - , menuItemAccessCallback' = return True + , menuItemRoute = CSheetR tid csh shn SubmissionOwnR + , menuItemAccessCallback' = return True -- TODO: check that a submission already exists } ] pageActions TermShowR = diff --git a/src/Handler/CryptoIDDispatch.hs b/src/Handler/CryptoIDDispatch.hs index b02e95a0c..da31ab516 100644 --- a/src/Handler/CryptoIDDispatch.hs +++ b/src/Handler/CryptoIDDispatch.hs @@ -38,7 +38,7 @@ instance CryptoRoute UUID SubmissionId where Sheet{..} <- get404 shid Course{..} <- get404 sheetCourse return (courseTerm, courseShorthand, sheetName) - return $ CSheetR tid csh shn $ SubmissionR $ SubmissionMode $ Just cID + return $ CSheetR tid csh shn $ SubmissionR cID class Dispatch ciphertext (x :: [*]) where diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index becc5ed2c..70ed42d6a 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -74,10 +74,33 @@ makeSubmissionForm msmid unpackZips grouping buddies = identForm FIDsubmission $ aforced' f fs (Just (Just v)) = Just <$> aforced f fs v aforced' _ _ _ = error "Cannot happen since groupNr==0 if grouping/=Arbitrary" +getSubmissionNewR, postSubmissionNewR :: TermId -> Text -> Text -> Handler Html +getSubmissionNewR = postSubmissionNewR +postSubmissionNewR tid csh shn = submissionHelper tid csh shn NewSubmission -getSubmissionR, postSubmissionR :: TermId -> Text -> Text -> SubmissionMode -> Handler Html + +getSubmissionR, postSubmissionR :: TermId -> Text -> Text -> CryptoUUIDSubmission -> Handler Html getSubmissionR = postSubmissionR -postSubmissionR tid csh shn (SubmissionMode mcid) = do +postSubmissionR tid csh shn cid = submissionHelper tid csh shn $ ExistingSubmission cid + +getSubmissionOwnR :: TermId -> Text -> Text -> Handler Html +getSubmissionOwnR tid csh shn = do + authId <- requireAuthId + sid <- runDB $ do + shid <- fetchSheetId tid csh shn + submissions <- E.select . E.from $ \(submission `E.InnerJoin` submissionUser) -> do + E.on (submission E.^. SubmissionId E.==. submissionUser E.^. SubmissionUserSubmission) + E.where_ $ submissionUser E.^. SubmissionUserUser E.==. E.val authId + E.&&. submission E.^. SubmissionSheet E.==. E.val shid + return $ submission E.^. SubmissionId + case submissions of + ((E.Value sid):_) -> return sid + [] -> notFound + cID <- encrypt sid + redirect . CourseR tid csh . SheetR shn $ SubmissionR cID + +submissionHelper :: TermId -> Text -> Text -> SubmissionMode -> Handler Html +submissionHelper tid csh shn (SubmissionMode mcid) = do uid <- requireAuthId msmid <- traverse decrypt mcid (Entity shid Sheet{..}, buddies, lastEdits) <- runDB $ do @@ -112,7 +135,7 @@ postSubmissionR tid csh shn (SubmissionMode mcid) = do (E.Value smid:_) -> do cID <- encrypt smid addMessageI "info" $ MsgSubmissionAlreadyExists - redirect $ CSheetR tid csh shn $ SubmissionR $ SubmissionMode $ Just cID + redirect $ CSheetR tid csh shn $ SubmissionR cID (Just smid) -> do shid' <- submissionSheet <$> get404 smid when (shid /= shid') $ invalidArgsI [MsgSubmissionWrongSheet] @@ -203,7 +226,7 @@ postSubmissionR tid csh shn (SubmissionMode mcid) = do _other -> return Nothing case mCID of - Just cID -> redirect $ CSheetR tid csh shn $ SubmissionR $ SubmissionMode $ Just cID + Just cID -> redirect $ CSheetR tid csh shn $ SubmissionR cID Nothing -> return () mArCid <- fmap ZIPArchiveName <$> traverse encrypt msmid From ea6c7b776126195d3e8e2b4a2562079bd39570a4 Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 7 Jun 2018 10:39:43 +0200 Subject: [PATCH 009/135] Fix for SheetMarking visible to students --- src/Foundation.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Foundation.hs b/src/Foundation.hs index e8d7324e3..27e688065 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -268,8 +268,10 @@ knownTags = -- should not throw exceptions, i.e. no getBy404 or requireAuthId Entity sid Sheet{..} <- MaybeT . getBy $ CourseSheet cid shn cTime <- liftIO getCurrentTime case subRoute of + SFileR SheetExercise _ -> guard $ maybe False (<= cTime) sheetVisibleFrom SFileR SheetHint _ -> guard $ maybe False (<= cTime) sheetHintFrom SFileR SheetSolution _ -> guard $ maybe False (<= cTime) sheetSolutionFrom + SFileR SheetMarking _ -> return False -- only for correctors and lecturers SubmissionR NewSubmission -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo _ -> guard $ maybe False (<= cTime) sheetVisibleFrom return Authorized From 5cf1840f092b217fe22de15ab8f0ca3a7d4c5bd3 Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 7 Jun 2018 11:35:38 +0200 Subject: [PATCH 010/135] new route: getCurrentTerm --- routes | 9 +++++---- src/Handler/Course.hs | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/routes b/routes index 450bbcd99..2b5511668 100644 --- a/routes +++ b/routes @@ -32,10 +32,11 @@ /profile ProfileR GET !free /users UsersR GET -- no tags, i.e. admins only -/term TermShowR GET !free -/term/edit TermEditR GET POST -/term/#TermId/edit TermEditExistR GET -!/term/#TermId TermCourseListR GET !free +/terms TermShowR GET !free +/terms/current TermCurrentR GET !free +/terms/edit TermEditR GET POST +/terms/#TermId/edit TermEditExistR GET +!/terms/#TermId TermCourseListR GET !free -- For Pattern Synonyms see Foundation /course/ CourseListR GET !free diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 555104172..51fc05fca 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -1,6 +1,7 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE MultiParamTypeClasses #-} @@ -26,6 +27,13 @@ import qualified Data.UUID.Cryptographic as UUID getCourseListR :: Handler TypedContent getCourseListR = redirect TermShowR +getTermCurrentR :: Handler Html +getTermCurrentR = do + termIds <- runDB $ selectKeysList [TermActive ==. True] [] + case fromNullable termIds of + Nothing -> notFound + (Just (maximum -> tid)) -> getTermCourseListR tid + getTermCourseListR :: TermId -> Handler Html getTermCourseListR tidini = do (term,courses) <- runDB $ (,) From 4383f46409c6791751438f02c6ff86726c0d8fca Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 7 Jun 2018 11:37:59 +0200 Subject: [PATCH 011/135] Merge with exercises and getCurrentRoute --- src/Handler/Course.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 51fc05fca..776d4e03b 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -29,7 +29,7 @@ getCourseListR = redirect TermShowR getTermCurrentR :: Handler Html getTermCurrentR = do - termIds <- runDB $ selectKeysList [TermActive ==. True] [] + termIds <- runDB $ selectKeysList [TermActive ==. True] [] -- [Desc TermName] does not work, since database representation has wrong ordering case fromNullable termIds of Nothing -> notFound (Just (maximum -> tid)) -> getTermCourseListR tid From 993366bb600e03066907ed2aed39582d6ead1e7b Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Thu, 7 Jun 2018 00:31:27 +0200 Subject: [PATCH 012/135] removed file upload example form from home --- templates/home.hamlet | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/templates/home.hamlet b/templates/home.hamlet index 33b9c741f..fa3f84243 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -43,21 +43,3 @@ ^{modal ".toggler2" (Just "Test Inhalt für Modal")}
Klick mich für Content-Test - -

  • - Multi-File-Input für bereits hochgeladene Dateien: - -
    -
    -
    - -
    -
    - -
    #{msg} + +

    + #{fromMaybe "default headline" contentHeadline} + + ^{pageactionprime} diff --git a/templates/terms.hamlet b/templates/terms.hamlet index 4d5e14631..df30fd90f 100644 --- a/templates/terms.hamlet +++ b/templates/terms.hamlet @@ -1,4 +1,6 @@

    Semesterübersicht + + ^{table} From 2883dedff77addaa6fb14fbbf86843bd99b72b03 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Thu, 7 Jun 2018 00:34:07 +0200 Subject: [PATCH 014/135] input field styles and less navigation items --- src/Foundation.hs | 14 ++--- static/css/icons.css | 3 ++ templates/default-layout.lucius | 37 +++++++------ templates/standalone/inputs.lucius | 69 ++++++++++++++++++------ templates/widgets/asidenav.hamlet | 3 +- templates/widgets/pageactionprime.lucius | 2 +- 6 files changed, 83 insertions(+), 45 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 4827ad443..9373de9f8 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -713,21 +713,15 @@ defaultLinks = -- Define the menu items of the header. , menuItemAccessCallback' = isJust <$> maybeAuthPair } , NavbarAside $ MenuItem - { menuItemLabel = "Aktuelle Veranstaltungen" + { menuItemLabel = "Veranstaltungen" , menuItemIcon = Just "book" , menuItemRoute = CourseListR -- should be CourseListActiveR or similar in the future , menuItemAccessCallback' = return True } , NavbarAside $ MenuItem - { menuItemLabel = "Alte Veranstaltungen" - , menuItemIcon = Just "book" - , menuItemRoute = CourseListR -- should be CourseListInactiveR or similar in the future - , menuItemAccessCallback' = return True - } - , NavbarAside $ MenuItem - { menuItemLabel = "Veranstaltungen" - , menuItemIcon = Just "book" - , menuItemRoute = CourseListR + { menuItemLabel = "Semester" + , menuItemIcon = Nothing + , menuItemRoute = CourseListR -- should be TermListR ,,, , menuItemAccessCallback' = return True } , NavbarAside $ MenuItem diff --git a/static/css/icons.css b/static/css/icons.css index b836de6e3..e5fdd191d 100644 --- a/static/css/icons.css +++ b/static/css/icons.css @@ -32,3 +32,6 @@ .glyphicon--logout::before { content: '\e163'; } +.glyphicon--none::before { + content: ''; +} diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index ad20ae148..abfcc19a2 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -126,12 +126,11 @@ table { th, td { text-align: left; - padding: 0 13px 0 7px; + padding: 7px; vertical-align: baseline; } th:first-child, td:first-child { - padding-left: 0; border-left: 0; } th { @@ -189,21 +188,15 @@ button, transition: all .1s; font-size: 16px; cursor: pointer; - border-radius: 4px; display: inline-block; -} -input.btn-primary, -button.btn-primary, -a.btn.btn-primary, -.btn.btn-primary { - background-color: var(--primarybase); -} -input.btn-info, -button.btn-info, -a.btn.btn-info, -.btn.btn-info { - background-color: var(--infobase) + a { + color: white; + } + + a:hover { + color: white; + } } input[type="submit"][disabled], @@ -226,6 +219,20 @@ a.btn:not([disabled]):hover, color: white; } +input.btn-primary, +button.btn-primary, +a.btn.btn-primary, +.btn.btn-primary { + background-color: var(--primarybase); +} + +input.btn-info, +button.btn-info, +a.btn.btn-info, +.btn.btn-info { + background-color: var(--infobase) +} + input[type="submit"].btn-info:hover, input[type="button"].btn-info:hover, button.btn-info:hover, diff --git a/templates/standalone/inputs.lucius b/templates/standalone/inputs.lucius index 550fe84ac..1ef824d13 100644 --- a/templates/standalone/inputs.lucius +++ b/templates/standalone/inputs.lucius @@ -13,7 +13,7 @@ form { grid-gap: 5px; justify-content: flex-start; align-items: center; - margin: 10px 0; + margin: 17px 0; padding-left: 10px; border-left: 2px solid transparent; } @@ -44,6 +44,7 @@ input[type="password"], input[type="url"], input[type="number"], input[type="email"] { + /* background-color: rgba(0, 0, 0, 0.05); padding: 7px 3px 7px; outline: 0; @@ -54,6 +55,30 @@ input[type="email"] { transition: all .1s; font-size: 16px; min-width: 400px; + */ + + /* from bulma */ + background-color: #fff; + border-color: #dbdbdb; + color: #363636; + box-shadow: inset 0 1px 2px rgba(10,10,10,.1); + min-width: 400px; + width: 100%; + -webkit-appearance: none; + align-items: center; + border: 1px solid transparent; + border-radius: 4px; + display: inline-flex; + font-size: 1rem; + height: 2.25em; + justify-content: flex-start; + line-height: 1.5; + padding-bottom: calc(.375em - 1px); + padding-left: calc(.625em - 1px); + padding-right: calc(.625em - 1px); + padding-top: calc(.375em - 1px); + position: relative; + vertical-align: top; } .form-group--required { @@ -82,32 +107,42 @@ input[type="password"]:focus, input[type="url"]:focus, input[type="number"]:focus, input[type="email"]:focus { - border-bottom-color: var(--lightbase); + /* border-bottom-color: var(--lightbase); background-color: transparent; - box-shadow: 0 0 13px var(--lighterbase); + box-shadow: 0 0 13px var(--lighterbase); */ + border-color: #3273dc; + box-shadow: 0 0 0 0.125em rgba(50,115,220,.25); + outline: 0; } /* BUTTON STYLE SEE default-layout.lucius */ /* TEXTAREAS */ textarea { - outline: 0; - border: 0; - padding: 7px 4px; - min-width: 400px; - min-height: 100px; - font-family: var(--fontfamilybase); - font-size: 16px; - color: var(--fontbase); - background-color: rgba(0, 0, 0, 0.05); - box-shadow: 0 2px 13px rgba(0, 0, 0, 0.05); - border-bottom: 2px solid var(--darkbase); + -webkit-appearance: none; + border: 1px solid transparent; + border-radius: 2px; + display: inline-flex; + font-size: 1rem; + height: 170px; + width: 400px; + line-height: 1.5; + padding-bottom: calc(.375em - 1px); + padding-left: calc(.625em - 1px); + padding-right: calc(.625em - 1px); + padding-top: calc(.375em - 1px); + position: relative; + vertical-align: top; + background-color: #fff; + border-color: #dbdbdb; + color: #363636; + box-shadow: inset 0 1px 2px rgba(10,10,10,.1); } textarea:focus { - background-color: transparent; - border-bottom-color: var(--lightbase); - box-shadow: 0 0 13px var(--lighterbase); + border-color: #3273dc; + box-shadow: 0 0 0 0.125em rgba(50,115,220,.25); + outline: 0; } /* CUSTOM LEGACY CHECKBOX AND RADIO BOXES */ diff --git a/templates/widgets/asidenav.hamlet b/templates/widgets/asidenav.hamlet index 8126fd770..b34145640 100644 --- a/templates/widgets/asidenav.hamlet +++ b/templates/widgets/asidenav.hamlet @@ -8,8 +8,7 @@ $newline never $of NavbarAside (MenuItem label mIcon route _)
  • - $if isJust mIcon -
    +
    #{label} $of _ diff --git a/templates/widgets/pageactionprime.lucius b/templates/widgets/pageactionprime.lucius index 564603fdf..a1769478d 100644 --- a/templates/widgets/pageactionprime.lucius +++ b/templates/widgets/pageactionprime.lucius @@ -1,10 +1,10 @@ .page-nav-prime { background-color: var(--lightgreybase); padding: 13px; + margin-top: 30px; } .page-nav-prime .pagenav__list { - margin: 7px 0 0; display: block; } .page-nav-prime .pagenav__list-item { From 07eeb32caf6f93c2538e740325d225a7e760fc01 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Thu, 7 Jun 2018 00:34:42 +0200 Subject: [PATCH 015/135] more space for course registration --- templates/course.hamlet | 9 +++++++-- templates/course.lucius | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/templates/course.hamlet b/templates/course.hamlet index 958e4024a..7d50e73ec 100644 --- a/templates/course.hamlet +++ b/templates/course.hamlet @@ -31,8 +31,13 @@ \ bis #{formatTimeGerWD regTo} $# if allowed to register -
    - Anmelden +
    +
  • Do 18.04.18 NotGraded
      -   -   -   - + Neues Übungsblatt anlegen

    Übungsgruppen @@ -87,16 +83,14 @@

    Anmeldung bis
    - Gruppe 1 + Gruppe 1 Montag 10:00 - 12:00 N/A 2/10 Tutor1 Tutoren Do 21.02.2019, 19:00
    - Gruppe 2 + Gruppe 2 Montag 12:00 - 14:00 N/A 0/10 diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index abfcc19a2..16a7599c0 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -244,4 +244,3 @@ a.btn.btn-info:hover, .alert-debug { background-color: rgb(240, 30, 240); } - diff --git a/templates/standalone/inputs.lucius b/templates/standalone/inputs.lucius index 1ef824d13..71402a4b5 100644 --- a/templates/standalone/inputs.lucius +++ b/templates/standalone/inputs.lucius @@ -44,26 +44,12 @@ input[type="password"], input[type="url"], input[type="number"], input[type="email"] { - /* - background-color: rgba(0, 0, 0, 0.05); - padding: 7px 3px 7px; - outline: 0; - border: 0; - border-bottom: 2px solid var(--darkbase); - box-shadow: 0 2px 13px rgba(0, 0, 0, 0.05); - color: var(--fontbase); - transition: all .1s; - font-size: 16px; - min-width: 400px; - */ - - /* from bulma */ + /* from bulma.css */ background-color: #fff; border-color: #dbdbdb; color: #363636; - box-shadow: inset 0 1px 2px rgba(10,10,10,.1); + box-shadow: inset 0 2px 3px 1px rgba(50,50,50,.1); min-width: 400px; - width: 100%; -webkit-appearance: none; align-items: center; border: 1px solid transparent; @@ -83,6 +69,12 @@ input[type="email"] { .form-group--required { + label::before { + content: '*'; + position: absolute; + left: -14px; + } + input, textarea { border-bottom-color: var(--lighterbase); } From f4b6d1e3f5529ca2e9afab9a9d87ba609c54ba04 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 7 Jun 2018 11:26:41 +0200 Subject: [PATCH 017/135] Introduce pageHeading function --- messages/de.msg | 1 + src/Foundation.hs | 11 +++++++++-- templates/default-layout.hamlet | 5 +++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/messages/de.msg b/messages/de.msg index 5332201d5..a4e8637fa 100644 --- a/messages/de.msg +++ b/messages/de.msg @@ -49,3 +49,4 @@ SubmissionAlreadyExistsFor user@Text: #{user} hat bereits eine Abgabe zu diesem EMailUnknown email@Text: E-Mail #{email} gehört zu keinem bekannten Benutzer. NotAParticipant user@Text tid@TermIdentifier csh@Text: #{user} ist nicht im Kurs #{termToText tid}-#{csh} angemeldet. +HomeHeading: Startseite \ No newline at end of file diff --git a/src/Foundation.hs b/src/Foundation.hs index 70c4327a5..c6a43c77b 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -434,13 +434,14 @@ instance Yesod UniWorX where -- value passed to hamletToRepHtml cannot be a widget, this allows -- you to use normal widget features in default-layout. + let navbar :: Widget navbar = $(widgetFile "widgets/navbar") asidenav :: Widget asidenav = $(widgetFile "widgets/asidenav") - contentHeadline :: Maybe String - contentHeadline = Just "Some Headline" -- should be coming from the currently viewed page + contentHeadline :: Maybe Widget + contentHeadline = pageHeading =<< mcurrentRoute breadcrumbs :: Widget breadcrumbs = $(widgetFile "widgets/breadcrumbs") pageactionprime :: Widget @@ -686,6 +687,12 @@ pageActions (TermCourseListR _) = pageActions _ = [] +pageHeading :: Route UniWorx -> Maybe Widget +pageHeading HomeR + = Just [whamlet|_{MsgHomeHeading}|] +pageHeading _ + = Nothing + defaultLinks :: [MenuTypes] defaultLinks = -- Define the menu items of the header. [ NavbarRight $ MenuItem diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index 99b24bfca..165096dfd 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -14,8 +14,9 @@
    #{msg} -

    - #{fromMaybe "default headline" contentHeadline} + $maybe headline <- contentHeadline +

    + ^{headline} From 18c3840276432ec62ae1cfc679352009cd5b0d65 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 7 Jun 2018 11:36:59 +0200 Subject: [PATCH 018/135] Fix build --- src/Foundation.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index c6a43c77b..340285e0f 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -1,7 +1,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedLists #-} -{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TemplateHaskell, QuasiQuotes #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} @@ -687,7 +687,7 @@ pageActions (TermCourseListR _) = pageActions _ = [] -pageHeading :: Route UniWorx -> Maybe Widget +pageHeading :: Route UniWorX -> Maybe Widget pageHeading HomeR = Just [whamlet|_{MsgHomeHeading}|] pageHeading _ From c5beac0eb146cb7a7a5979fb8135954d710ba34d Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 7 Jun 2018 11:46:01 +0200 Subject: [PATCH 019/135] Minor commenting --- src/Foundation.hs | 89 ----------------------------------------------- 1 file changed, 89 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index b29f42d2a..ed93e5a90 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -511,95 +511,6 @@ instance Yesod UniWorX where makeLogger = return . appLogger -{- ALL DEPRECATED and will be deleted, once knownTags is completed - -isAuthorizedDB :: Route UniWorX -> Bool -> YesodDB UniWorX AuthResult -isAuthorizedDB route@(routeAttrs -> attrs) writeable - | "adminAny" `member` attrs = adminAccess Nothing - | "lecturerAny" `member` attrs = lecturerAccess Nothing - -isAuthorizedDB UsersR _ = adminAccess Nothing -isAuthorizedDB (SubmissionDemoR cID) _ = return Authorized -- submissionAccess $ Right cID -isAuthorizedDB (SubmissionDownloadSingleR cID _) _ = submissionAccess $ Right cID -isAuthorizedDB (SubmissionDownloadArchiveR (ZIPArchiveName cID)) _ = submissionAccess $ Left cID -isAuthorizedDB TermEditR _ = adminAccess Nothing -isAuthorizedDB (TermEditExistR _) _ = adminAccess Nothing -isAuthorizedDB CourseNewR _ = lecturerAccess Nothing -isAuthorizedDB (CourseR t c CEditR) _ = courseLecturerAccess . entityKey =<< getBy404 (CourseTermShort t c) -isAuthorizedDB (CourseR t c (SheetR SheetListR)) False = return Authorized -- -isAuthorizedDB (CourseR t c (SheetR SheetListR)) _ = courseLecturerAccess . entityKey =<< getBy404 (CourseTermShort t c) -isAuthorizedDB (CourseR t c (SheetR (SShowR s))) _ = return Authorized -- TODO: nur für angemeldete Kursteilnehmer falls sichtbar, sonst nur Lectrurer oder Korrektor -isAuthorizedDB (CourseR t c (SheetR (SheetFileR s _ _))) _ = return Authorized -- TODO: nur für angemeldete Kursteilnehmer falls sichtbar, sonst nur Lectrurer oder Korrektor -isAuthorizedDB (CourseR t c (SheetR SheetNewR)) _ = courseLecturerAccess . entityKey =<< getBy404 (CourseTermShort t c) -isAuthorizedDB (CourseR t c (SheetR (SEditR s))) _ = courseLecturerAccess . entityKey =<< getBy404 (CourseTermShort t c) -isAuthorizedDB (CourseR t c (SheetR (SDelR s))) _ = courseLecturerAccess . entityKey =<< getBy404 (CourseTermShort t c) -isAuthorizedDB (CourseR t c (SheetR (SubmissionR s m))) _ = return Authorized -- TODO -- submissionAccess $ Right cID -isAuthorizedDB (CourseEditIDR cID) _ = do - courseId <- decrypt cID - courseLecturerAccess courseId -isAuthorizedDB _route _isWrite = return $ Unauthorized "No access to this route." -- Calling isAuthorized here creates infinite loop! - -submissionAccess :: Either CryptoFileNameSubmission CryptoUUIDSubmission -> YesodDB UniWorX AuthResult -submissionAccess cID = do - authId <- lift requireAuthId - submissionId <- either decrypt decrypt cID - Submission{..} <- get404 submissionId - submissionUsers <- map (submissionUserUser . entityVal) <$> selectList [SubmissionUserSubmission ==. submissionId] [] - let auth = authId `elem` submissionUsers || Just authId == submissionRatingBy - return $ case auth of - True -> Authorized - False -> Unauthorized "No access to this submission" - -adminAccess :: Maybe SchoolId -- ^ If @Just@, matched exactly against 'userAdminSchool' - -> YesodDB UniWorX AuthResult -adminAccess school = do - authId <- lift requireAuthId - adrights <- selectList ((UserAdminUser ==. authId) : maybe [] (\s -> [UserAdminSchool ==. s]) school) [] - return $ if (not $ null adrights) - then Authorized - else Unauthorized "No admin access" -- TODO internationalize - -lecturerAccess :: Maybe SchoolId - -> YesodDB UniWorX AuthResult -lecturerAccess school = do - authId <- lift requireAuthId - lecrights <- selectList ((UserLecturerUser ==. authId) : maybe [] (\s -> [UserLecturerSchool ==. s]) school) [] - return $ if (not $ null lecrights) - then Authorized - else Unauthorized "No lecturer access" -- TODO internationalize - -lecturerAccess' :: SchoolId -> YesodDB UniWorX AuthResult -lecturerAccess' = authorizedFor UniqueSchoolLecturer MsgUnauthorizedSchoolLecturer - -courseLecturerAccess :: CourseId -> YesodDB UniWorX AuthResult -courseLecturerAccess = authorizedFor UniqueLecturer MsgUnauthorizedLecturer - ---courseCorrectorAccess :: CourseId -> YesodDB UniWorX AuthResult ---courseCorrectorAccess = authorizedFor UniqueCorrector MsgUnauthorizedCorrector --- TODO: Correctors are no longer unit, could be ByTutorial and also by ByProportion - -courseParticipantAccess :: CourseId -> YesodDB UniWorX AuthResult -courseParticipantAccess = authorizedFor UniqueParticipant MsgUnauthorizedParticipant - -authorizedFor :: ( PersistEntityBackend record ~ BaseBackend backend - , PersistEntity record, PersistUniqueRead backend - , YesodAuth master, RenderMessage master msg - ) - => (AuthId master -> t -> Unique record) -> msg -> t -> ReaderT backend (HandlerT master IO) AuthResult -authorizedFor authType msg courseId = do - authId <- lift requireAuthId - access <- getBy $ authType authId courseId - case access of - (Just _) -> return Authorized - Nothing -> unauthorizedI msg - -isAuthorizedDB' :: Route UniWorX -> Bool -> YesodDB UniWorX Bool -isAuthorizedDB' route isWrite = (== Authorized) <$> isAuthorizedDB route isWrite - -isAuthorized' :: Route UniWorX -> Bool -> Handler Bool -isAuthorized' route isWrite = runDB $ isAuthorizedDB' route isWrite --} - -- Define breadcrumbs. instance YesodBreadcrumbs UniWorX where From 8c4b2d62d34af2a6675e0237643e1073ca02f5ae Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Thu, 7 Jun 2018 11:48:14 +0200 Subject: [PATCH 020/135] got rid of comments and added header for termsList --- messages/de.msg | 3 ++- src/Foundation.hs | 2 ++ templates/default-layout.hamlet | 2 -- templates/terms.hamlet | 4 ---- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/messages/de.msg b/messages/de.msg index a4e8637fa..d5403dc7f 100644 --- a/messages/de.msg +++ b/messages/de.msg @@ -49,4 +49,5 @@ SubmissionAlreadyExistsFor user@Text: #{user} hat bereits eine Abgabe zu diesem EMailUnknown email@Text: E-Mail #{email} gehört zu keinem bekannten Benutzer. NotAParticipant user@Text tid@TermIdentifier csh@Text: #{user} ist nicht im Kurs #{termToText tid}-#{csh} angemeldet. -HomeHeading: Startseite \ No newline at end of file +HomeHeading: Startseite +TermsHeading: Semesterübersicht diff --git a/src/Foundation.hs b/src/Foundation.hs index 340285e0f..13752052b 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -690,6 +690,8 @@ pageActions _ = [] pageHeading :: Route UniWorX -> Maybe Widget pageHeading HomeR = Just [whamlet|_{MsgHomeHeading}|] +pageHeading TermShowR + = Just [whamlet|_{MsgTermsHeading}|] pageHeading _ = Nothing diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index 165096dfd..52b1e584b 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -13,11 +13,9 @@ $with status2 <- bool status "info" (status == "")
    #{msg} - $maybe headline <- contentHeadline

    ^{headline} - ^{pageactionprime} diff --git a/templates/terms.hamlet b/templates/terms.hamlet index df30fd90f..2d2943787 100644 --- a/templates/terms.hamlet +++ b/templates/terms.hamlet @@ -1,6 +1,2 @@
    -

    Semesterübersicht - - - ^{table} From 48888f3706d5d7412646fe8d652b901cbde0a058 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Thu, 7 Jun 2018 12:03:11 +0200 Subject: [PATCH 021/135] got rid of example file in multifileuplaod --- templates/multiFileField.hamlet | 7 ------- 1 file changed, 7 deletions(-) diff --git a/templates/multiFileField.hamlet b/templates/multiFileField.hamlet index 62edf90ec..6a0b9c731 100644 --- a/templates/multiFileField.hamlet +++ b/templates/multiFileField.hamlet @@ -6,13 +6,6 @@ $forall FileUploadInfo{..} <- fileInfos

    + $# if allowed to register
    Do 15.04.18 Do 18.04.18 NotGraded -
    - Neues Übungsblatt anlegen

    Übungsgruppen diff --git a/templates/widgets/asidenav.hamlet b/templates/widgets/asidenav.hamlet index cd00430be..2ab729e25 100644 --- a/templates/widgets/asidenav.hamlet +++ b/templates/widgets/asidenav.hamlet @@ -17,7 +17,8 @@ $newline never WiSe 17/18
    +$newline never +
    $maybe sortableP <- pSortable $with toSortable <- toSortable sortableP - $forall OneColonnade{..} <- getColonnade dbtColonnade - ^{widgetFromCell th $ withSortLinks $ toSortable oneColonnadeHead} + + $forall OneColonnade{..} <- getColonnade dbtColonnade + + + ^{widgetFromCell th $ withSortLinks $ toSortable oneColonnadeHead} $nothing $forall row <- rows - + $forall OneColonnade{..} <- getColonnade dbtColonnade + + ^{widgetFromCell td $ oneColonnadeEncode row} diff --git a/templates/table/colonnade.lucius b/templates/table/colonnade.lucius index c775325d9..63a42bb84 100644 --- a/templates/table/colonnade.lucius +++ b/templates/table/colonnade.lucius @@ -1,16 +1,76 @@ -table th { - position: relative; - padding-right: 20px; - &.sortable { - cursor: pointer; - } +.table { + margin: 21px 0; + width: 100%; +} - a { - font-weight: 800; +.table--striped { + + .table__row:not(.no-stripe):nth-child(even) { + background-color: rgba(0, 0, 0, 0.07); } } +.table--hover { + + .table__row:not(.no-hover):not(.table__row--head):hover { + background-color: rgba(0, 0, 0, 0.15); + } +} + +/* TABLE DESIGN */ +.table__row { + + /* TODO: move outside of table__row as soon as tds and ths get their own class */ + /* .table__td, .table__th { */ + td, th { + padding-top: 14px; + padding-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + vertical-align: top; + max-width: 300px; + } + + /* .table__td { */ + td { + font-size: 16px; + color: #808080; + line-height: 1.4; + } + + &.table__row--head { + background-color: var(--color-dark); + } + + /* .table__th { */ + th { + position: relative; + font-size: 16px; + color: #fff; + line-height: 1.4; + padding-top: 15px; + padding-bottom: 10px; + font-weight: bold; + text-align: left; + } +} + +.table__td-content { + max-height: 100px; + overflow-y: auto; +} + +.table__th-link { + color: white; + font-weight: bold; + + &:hover { + background-color: var(--color-light); + } +} + +/* SORTABLE */ table th.sorted-asc, table th.sorted-desc { color: var(--color-light); diff --git a/templates/table/layout.lucius b/templates/table/layout.lucius index 5b9232406..6dcbed18b 100644 --- a/templates/table/layout.lucius +++ b/templates/table/layout.lucius @@ -1,3 +1,4 @@ +/* PAGINATION */ .pagination { margin-top: 20px; text-align: center; @@ -36,3 +37,8 @@ } } } + +/* SCROLLTABLE */ +.scrolltable { + overflow: auto; +} diff --git a/templates/table/sortable-header.hamlet b/templates/table/sortable-header.hamlet index 68a7806a4..188c3a779 100644 --- a/templates/table/sortable-header.hamlet +++ b/templates/table/sortable-header.hamlet @@ -1,10 +1,10 @@ $maybe flag <- sortableKey $case directions $of [SortAsc] - "-desc")}> + "-desc")}> ^{cellContents} $of _ - "-asc")}> + "-asc")}> ^{cellContents} $nothing ^{cellContents} From c54495fe589778de21fab65e15312a1359a29822 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 10 Jun 2018 19:36:39 +0200 Subject: [PATCH 048/135] renamed a few pageactions --- src/Foundation.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 2a968200c..be28d2245 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -574,7 +574,7 @@ pageActions (CourseR tid csh CShowR) = ] pageActions (CourseR tid csh SheetListR) = [ PageActionPrime $ MenuItem - { menuItemLabel = "Neues Übungsblatt" + { menuItemLabel = "Neues Übungsblatt anlegen" , menuItemIcon = Nothing , menuItemRoute = CourseR tid csh SheetNewR , menuItemAccessCallback' = return True @@ -596,7 +596,7 @@ pageActions (CSheetR tid csh shn SShowR) = ] pageActions TermShowR = [ PageActionPrime $ MenuItem - { menuItemLabel = "Neues Semester" + { menuItemLabel = "Neues Semester anlegen" , menuItemIcon = Nothing , menuItemRoute = TermEditR , menuItemAccessCallback' = return True @@ -604,7 +604,7 @@ pageActions TermShowR = ] pageActions (TermCourseListR _) = [ PageActionPrime $ MenuItem - { menuItemLabel = "Neuer Kurs" + { menuItemLabel = "Neuen Kurs anlegen" , menuItemIcon = Just "book" , menuItemRoute = CourseNewR , menuItemAccessCallback' = return True From b5051306210909e82b921008133ba1bd8f47f7b3 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 10 Jun 2018 20:17:14 +0200 Subject: [PATCH 049/135] fixed styling of sort-buttons in sortable tables --- templates/table/colonnade.lucius | 71 ++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/templates/table/colonnade.lucius b/templates/table/colonnade.lucius index 63a42bb84..1da9b5e60 100644 --- a/templates/table/colonnade.lucius +++ b/templates/table/colonnade.lucius @@ -49,8 +49,8 @@ font-size: 16px; color: #fff; line-height: 1.4; - padding-top: 15px; - padding-bottom: 10px; + padding-top: 20px; + padding-bottom: 15px; font-weight: bold; text-align: left; } @@ -66,40 +66,49 @@ font-weight: bold; &:hover { - background-color: var(--color-light); + color: inherit; } } /* SORTABLE */ -table th.sorted-asc, -table th.sorted-desc { - color: var(--color-light); -} +.table { -table th.sortable::after, -table th.sortable::before { - content: ''; - position: absolute; - right: 0; - width: 0; - height: 0; - transform: translateY(-100%); - border-left: 8px solid transparent; - border-right: 8px solid transparent; -} + /* TODO: move outside of table as soon as tds and ths get their own class */ + th.sortable { + position: relative; + } -table th.sortable::before { - top: 21px; - border-top: 8px solid rgba(0, 0, 0, 0.1); -} -table th.sortable::after { - top: 9px; - border-bottom: 8px solid rgba(0, 0, 0, 0.1); -} -table th.sorted-asc::before { - border-top: 8px solid var(--color-light); -} + th.sortable::after, + th.sortable::before { + content: ''; + position: absolute; + right: 0; + width: 0; + height: 0; + left: 50%; + transform: translate(-50%, -100%); + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-bottom: 8px solid rgba(255, 255, 255, 0.4); + } -table th.sorted-desc::after { - border-bottom: 8px solid var(--color-light); + th.sortable::before { + /* magic numbers to move arrow back in the right position after flipping it. + this allows us to use the same border for the up and the down arrow */ + bottom: -3px; + transform: translateX(-8px) scale(1, -1); + transform-origin: top; + } + + th.sortable::after { + top: 15px; + } + + th.sortable:hover::before, + th.sorted-asc:hover::after, + th.sorted-asc::before, + th.sorted-desc:hover::after, + th.sorted-desc::after { + border-bottom-color: white; + } } From a1b6599a29beb713dc283d60deafa9cef265b400 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 10 Jun 2018 20:19:00 +0200 Subject: [PATCH 050/135] fixed deprecated alerts in backend. we need a template for alerts --- src/Handler/Course.hs | 9 +++++---- src/Handler/Sheet.hs | 19 ++++++++++--------- src/Handler/Term.hs | 9 +++++---- templates/default-layout.hamlet | 4 ++-- templates/home.hamlet | 3 ++- templates/standalone/alerts.julius | 7 ++++++- templates/standalone/alerts.lucius | 1 + 7 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 776d4e03b..a597a504a 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -324,10 +324,11 @@ newCourseForm template = identForm FIDcourse $ \html -> do (FormFailure errorMsgs, [whamlet|
    -

    Fehler: -
      - $forall errmsg <- errorMsgs -
    • #{errmsg} +
      +

      Fehler: +
        + $forall errmsg <- errorMsgs +
      • #{errmsg} ^{widget} |] ) diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index 57e1caa16..997703a1e 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -12,7 +12,7 @@ module Handler.Sheet where -import Import +import Import import System.FilePath (takeFileName) import Handler.Utils @@ -21,10 +21,10 @@ import Handler.Utils.Zip -- import Data.Time import qualified Data.Text as T -- import Data.Function ((&)) --- +-- import Colonnade hiding (fromMaybe, singleton) import Yesod.Colonnade --- +-- import qualified Data.UUID.Cryptographic as UUID import qualified Data.Conduit.List as C @@ -44,7 +44,7 @@ instance Eq (Unique Sheet) where {- * Implement Handlers - * Implement Breadcrumbs in Foundation + * Implement Breadcrumbs in Foundation * Implement Access in Foundation -} @@ -76,7 +76,7 @@ makeSheetForm msId template = identForm FIDsheet $ \html -> do E.&&. sheetFile E.^. SheetFileType E.==. E.val fType return (file E.^. FileId) | otherwise = return Set.empty - + (result, widget) <- flip (renderAForm FormStandard) html $ SheetForm <$> areq textField (fsb "Name") (sfName <$> template) <*> aopt htmlField (fsb "Hinweise für Teilnehmer") (sfDescription <$> template) @@ -100,10 +100,11 @@ makeSheetForm msId template = identForm FIDsheet $ \html -> do (FormFailure errorMsgs, [whamlet|
        -

        Fehler: -
          - $forall errmsg <- errorMsgs -
        • #{errmsg} +
          +

          Fehler: +
            + $forall errmsg <- errorMsgs +
          • #{errmsg} ^{widget} |] ) diff --git a/src/Handler/Term.hs b/src/Handler/Term.hs index a6942d85f..bc8938ef3 100644 --- a/src/Handler/Term.hs +++ b/src/Handler/Term.hs @@ -149,10 +149,11 @@ newTermForm template html = do (FormFailure errorMsgs, [whamlet|
            -

            Fehler: -
              - $forall errmsg <- errorMsgs -
            • #{errmsg} +
              +

              Fehler: +
                + $forall errmsg <- errorMsgs +
              • #{errmsg} ^{widget} |] ) diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index 39586cb46..5f81f4e07 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -23,8 +23,8 @@ $forall (status, msg) <- mmsgs $with status2 <- bool status "info" (status == "")
                -
                #{msg} -
                _{MsgCloseAlert} +
                + #{msg} diff --git a/templates/home.hamlet b/templates/home.hamlet index 69435db5c..f57e6d570 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -6,7 +6,8 @@ Die Reimplementierung von UniWorX ist noch nicht abgeschlossen. -

                Das System ist noch nicht produktiv einsetzbar +

                +
                Das System ist noch nicht produktiv einsetzbar
                diff --git a/templates/standalone/alerts.julius b/templates/standalone/alerts.julius index 253db2674..f32962cb7 100644 --- a/templates/standalone/alerts.julius +++ b/templates/standalone/alerts.julius @@ -4,9 +4,14 @@ window.utils = window.utils || {}; window.utils.alert = function(alertEl) { - alertEl.querySelector('.alert__close').addEventListener('click', function(event) { + var closeEl = document.createElement('DIV'); + closeEl.classList.add('alert__close'); + // TODO: fix this. How to request translation in *.julius .files? + closeEl.innerText = "_{MsgCloseAlert}"; + closeEl.addEventListener('click', function(event) { alertEl.classList.add('alert--invisible'); }); + alertEl.appendChild(closeEl); } })(); diff --git a/templates/standalone/alerts.lucius b/templates/standalone/alerts.lucius index e5ddc7b1f..69869d997 100644 --- a/templates/standalone/alerts.lucius +++ b/templates/standalone/alerts.lucius @@ -56,6 +56,7 @@ } } +.alert-danger, .alert-error { border-color: var(--color-error); background-color: #fff5f7; From 0188673e1f16f15e37f97e197a3c5eee3cd93b0c Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 10 Jun 2018 20:51:41 +0200 Subject: [PATCH 051/135] added datepicker globally --- src/Foundation.hs | 1 + templates/home.hamlet | 10 +++---- templates/home.julius | 19 -------------- templates/standalone/datepicker.hamlet | 1 + templates/standalone/datepicker.julius | 36 ++++++++++++++++++++++++++ templates/widgets/form.hamlet | 1 + 6 files changed, 44 insertions(+), 24 deletions(-) delete mode 100644 templates/home.julius create mode 100644 templates/standalone/datepicker.hamlet create mode 100644 templates/standalone/datepicker.julius diff --git a/src/Foundation.hs b/src/Foundation.hs index be28d2245..ad8f9b5b8 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -482,6 +482,7 @@ instance Yesod UniWorX where $(widgetFile "standalone/inputs") $(widgetFile "standalone/tabber") $(widgetFile "standalone/alerts") + $(widgetFile "standalone/datepicker") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") -- The page to be redirected to when authentication is required. diff --git a/templates/home.hamlet b/templates/home.hamlet index f57e6d570..b827a56dd 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -30,11 +30,11 @@

                Date picker - - - - - + + + + +
                diff --git a/templates/home.julius b/templates/home.julius deleted file mode 100644 index c62129e2c..000000000 --- a/templates/home.julius +++ /dev/null @@ -1,19 +0,0 @@ -document.addEventListener('DOMContentLoaded', function() { - 'use strict'; - - var config = { - enableTime: true, - altInput: true, - altFormat: "j. F Y, H:i", - dateFormat: "Y-m-d H:i", - time_24hr: true - }; - - flatpickr('#datetime-form1 [type="date"]', { - altFormat: "j. F Y", dateFormat: "Y-m-d", altInput: true - }); - flatpickr('#datetime-form1 [type="time"]', { - enableTime: true, noCalendar: true, altFormat: "H:i", dateFormat: "H:i", altInput: true, time_24hr: true - }); - flatpickr('#datetime-form2 input', config); -}); diff --git a/templates/standalone/datepicker.hamlet b/templates/standalone/datepicker.hamlet new file mode 100644 index 000000000..4ec550e09 --- /dev/null +++ b/templates/standalone/datepicker.hamlet @@ -0,0 +1 @@ + diff --git a/templates/standalone/datepicker.julius b/templates/standalone/datepicker.julius new file mode 100644 index 000000000..f056b5062 --- /dev/null +++ b/templates/standalone/datepicker.julius @@ -0,0 +1,36 @@ +document.addEventListener('DOMContentLoaded', function() { + "use strict"; + + var config = { + dtLocal: { + enableTime: true, + altInput: true, + altFormat: "j. F Y, H:i", + dateFormat: "Y-m-d H:i", + time_24hr: true + }, + d: { + altFormat: "j. F Y", + dateFormat: "Y-m-d", + altInput: true + }, + t: { + enableTime: true, + noCalendar: true, + altFormat: "H:i", + dateFormat: "H:i", + altInput: true, + time_24hr: true + } + }; + + Array.from(document.querySelectorAll('input[type="date"]')).forEach(function(el) { + flatpickr(el, config.d); + }); + Array.from(document.querySelectorAll('input[type="time"]')).forEach(function(el) { + flatpickr(el, config.t); + }); + Array.from(document.querySelectorAll('input[type="datetime-local"]')).forEach(function(el) { + flatpickr(el, config.dtLocal); + }); +}); diff --git a/templates/widgets/form.hamlet b/templates/widgets/form.hamlet index 91c015dd9..fdc9d5fb2 100644 --- a/templates/widgets/form.hamlet +++ b/templates/widgets/form.hamlet @@ -6,4 +6,5 @@ $case formLayout
                $if not (Blaze.null $ fvLabel view)