From 5cc488947305eea5b9762997222c84d6007761c8 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 1 Apr 2017 17:04:18 -0400 Subject: Move Gantt charts to external plugin --- assets/js/app.min.js | 5 +- assets/js/components/keyboard-shortcuts.js | 4 - assets/js/src/Gantt.js | 489 ----------------------------- 3 files changed, 2 insertions(+), 496 deletions(-) delete mode 100644 assets/js/src/Gantt.js (limited to 'assets/js') diff --git a/assets/js/app.min.js b/assets/js/app.min.js index 7a814e40..e42460d1 100644 --- a/assets/js/app.min.js +++ b/assets/js/app.min.js @@ -1,3 +1,2 @@ -!function(){function t(t,a,i){if(!n)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var r=i&&i.debug||!1;if(r){var d=document.querySelector("#input-textarea-caret-position-mirror-div");d&&d.parentNode.removeChild(d)}var s=document.createElement("div");s.id="input-textarea-caret-position-mirror-div",document.body.appendChild(s);var l=s.style,c=window.getComputedStyle?getComputedStyle(t):t.currentStyle;l.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(l.wordWrap="break-word"),l.position="absolute",r||(l.visibility="hidden"),e.forEach(function(t){l[t]=c[t]}),o?t.scrollHeight>parseInt(c.height)&&(l.overflowY="scroll"):l.overflow="hidden",s.textContent=t.value.substring(0,a),"INPUT"===t.nodeName&&(s.textContent=s.textContent.replace(/\s/g," "));var u=document.createElement("span");u.textContent=t.value.substring(a)||".",s.appendChild(u);var p={top:u.offsetTop+parseInt(c.borderTopWidth),left:u.offsetLeft+parseInt(c.borderLeftWidth)};return r?u.style.backgroundColor="#aaa":document.body.removeChild(s),p}var e=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],n="undefined"!=typeof window,o=n&&null!=window.mozInnerScreenX;"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=t:n&&(window.getCaretCoordinates=t)}(),function(){function t(){if(!("KeyboardEvent"in window)||"key"in KeyboardEvent.prototype)return!1;var t={get:function(t){var e=n.keys[this.which||this.keyCode];return Array.isArray(e)&&(e=e[+this.shiftKey]),e}};return Object.defineProperty(KeyboardEvent.prototype,"key",t),t}var e,n={polyfill:t,keys:{3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"}};for(e=1;e<25;e++)n.keys[111+e]="F"+e;var o="";for(e=65;e<91;e++)o=String.fromCharCode(e),n.keys[e]=[o.toLowerCase(),o.toUpperCase()];n.polyfill()}(),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;--n>=0&&e.item(n)!==this;);return n>-1});var KB={components:{},utils:{},html:{},http:{},listeners:{clicks:{},changes:{},keys:[],internals:{}}};KB.on=function(t,e){this.listeners.internals.hasOwnProperty(t)||(this.listeners.internals[t]=[]),this.listeners.internals[t].push(e)},KB.trigger=function(t,e){if(this.listeners.internals.hasOwnProperty(t))for(var n=0;n0){for(var i=!0,r=0;r-1)window.location=e.split("#")[0];else if(e)window.location=e;else if(n)window.location=n;else if("application/json"===t.getResponseHeader("Content-Type"))try{return JSON.parse(t.responseText)}catch(t){}return t.responseText}var i=function(){},r=function(){};this.execute=function(){var d=new XMLHttpRequest;d.open(t,e,!0),d.setRequestHeader("X-Requested-With","XMLHttpRequest");for(var s in n)n.hasOwnProperty(s)&&d.setRequestHeader(s,n[s]);return d.onerror=function(){r()},d.onreadystatechange=function(){if(d.readyState===XMLHttpRequest.DONE){var t=a(d);200===d.status?i(t):r(t)}},d.send(o),this},this.success=function(t){return i=t,this},this.error=function(t){return r=t,this}},KB.http.get=function(t){return new KB.http.request("GET",t).execute()},KB.http.postJson=function(t,e){var n={"Content-Type":"application/json",Accept:"application/json"};return new KB.http.request("POST",t,n,JSON.stringify(e)).execute()},KB.http.postForm=function(t,e){var n=new FormData(e);return new KB.http.request("POST",t,{},n).execute()},KB.http.uploadFile=function(t,e,n,o,a,i){var r=new FormData;r.append("files[]",e);var d=new XMLHttpRequest;d.upload.addEventListener("progress",n),d.upload.addEventListener("error",a),d.open("POST",t,!0),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.onreadystatechange=function(){d.readyState===XMLHttpRequest.DONE&&(200===d.status?o():"undefined"!=typeof i&&i(JSON.parse(d.responseText)))},d.send(r)},function(){function t(t){t.target.matches("#modal-overlay")&&(t.stopPropagation(),t.preventDefault(),s())}function e(){KB.trigger("modal.close")}function n(){KB.trigger("modal.loading"),a()}function o(){return document.querySelector("#modal-content form:not(.js-modal-ignore-form)")}function a(){var t=o();if(t){var e=t.getAttribute("action");e&&KB.http.postForm(e,t).success(function(t){KB.trigger("modal.stop"),t?r(t):s()})}}function i(){var t=KB.find("#modal-content form");t&&t.on("submit",n,!1);var e=document.querySelector("#modal-content input[autofocus]");e&&e.focus(),KB.render(),_KB.datePicker(),_KB.autoComplete(),_KB.tagAutoComplete(),_KB.get("Task").onPopoverOpened()}function r(t){var e=KB.find("#modal-content");e&&(e.replace(KB.dom("div").attr("id","modal-content").html(t).build()),i())}function d(n,o,a){var r=KB.dom("a").attr("href","#").attr("id","modal-close-button").html('').click(e).build(),d=KB.dom("div").attr("id","modal-header").add(r).build(),s=KB.dom("div").attr("id","modal-content").html(n).build(),l=KB.dom("div").attr("id","modal-box").style("width",o).add(d).add(s).build(),c=KB.dom("div").attr("id","modal-overlay").add(l).build();a&&c.addEventListener("click",t,!1),document.body.appendChild(c),i()}function s(){c=!1;var t=KB.find("#modal-overlay");t&&t.remove()}function l(t){var e=KB.utils.getViewportSize();if(e.width<700)return"99%";switch(t){case"large":return e.width<1350?"98%":"1350px";case"medium":return e.width<1024?"70%":"1024px"}return e.width<800?"75%":"800px"}var c=!1;KB.on("modal.close",function(){s()}),KB.on("modal.submit",function(){a()}),KB.modal={open:function(t,e,n){_KB.get("Dropdown").close(),s(),"undefined"==typeof n&&(n=!0),KB.http.get(t).success(function(t){c=!0,d(t,l(e),n)})},close:function(){s()},isOpen:function(){return c},replace:function(t){KB.http.get(t).success(function(t){r(t)})},getForm:o,submitForm:a}}(),KB.utils.formatDuration=function(t){return t>=86400?Math.round(t/86400)+"d":t>=3600?Math.round(t/3600)+"h":t>=60?Math.round(t/60)+"m":t+"s"},KB.utils.getSelectionPosition=function(t){var e,n;return e=t.value.length0&&o.push([l]):s>0?(o[s].push(l),"undefined"==typeof o[0][d]&&o[0].push(0),o[0][d]+=l):a.push(r(i.parse(l)))}KB.dom(t).add(KB.dom("div").attr("id","chart").build()),c3.generate({data:{columns:o},axis:{x:{type:"category",categories:a}}})}}),KB.component("chart-project-cumulative-flow",function(t,e){this.render=function(){for(var n=e.metrics,o=[],a=[],i=[],r=d3.time.format("%Y-%m-%d"),d=d3.time.format(e.dateFormat),s=0;s0&&(a.push(c),o.push([c])):l>0?o[l-1].push(c):i.push(d(r.parse(c)))}KB.dom(t).add(KB.dom("div").attr("id","chart").build()),c3.generate({data:{columns:o.reverse(),type:"area-spline",groups:[a],order:null},axis:{x:{type:"category",categories:i}}})}}),KB.component("chart-project-lead-cycle-time",function(t,e){this.render=function(){var n=e.metrics,o=[e.labelCycle],a=[e.labelLead],i=[],r={};r[e.labelCycle]="area",r[e.labelLead]="area-spline";var d={};d[e.labelLead]="#afb42b",d[e.labelCycle]="#4e342e";for(var s=0;s'+e+"")}})}}),KB.component("file-upload",function(t,e){function n(t){if(t.lengthComputable){var e=t.loaded/t.total,n=Math.floor(100*e);KB.find("#file-progress-"+w).attr("value",e),KB.find("#file-percentage-"+w).replaceText("("+n+"%)")}}function o(){var t=KB.dom("div").addClass("file-error").text(e.labelUploadError).build();KB.find("#file-item-"+w).add(t)}function a(t){var e=KB.dom("div").addClass("file-error").text(t.message).build();KB.find("#file-item-"+w).add(e),KB.trigger("modal.stop")}function i(){if(w++,w0&&KB.http.uploadFile(e.url,y[w],n,i,o,a)}function f(){y.length>0?(KB.trigger("modal.enable"),KB.dom(B).empty().add(b())):(KB.trigger("modal.disable"),KB.dom(B).empty().add(h()))}function m(){return KB.dom("input").attr("id","file-input-element").attr("type","file").attr("name","files[]").attr("multiple",!0).on("change",s).hide().build()}function h(){var t=KB.dom("a").attr("href","#").text(e.labelChooseFiles).click(l).build();return KB.dom("div").attr("id","file-dropzone-inner").text(e.labelDropzone+" "+e.labelOr+" ").add(t).build()}function g(){var t=KB.dom("div").attr("id","file-dropzone").add(h()).build();return t.ondragover=c,t.ondrop=u,t.ondragover=c,t}function v(t){var n=!1,o=KB.dom("progress").attr("id","file-progress-"+t).attr("value",0).build(),a=KB.dom("span").attr("id","file-percentage-"+t).text("(0%)").build(),i=KB.dom("li").attr("id","file-item-"+t).add(o).text(" "+y[t].name+" ").add(a);return y[t].size>e.maxSize&&(i.add(KB.dom("div").addClass("file-error").text(e.labelOversize).build()),n=!0),n&&KB.trigger("modal.disable"),i.build()}function b(){for(var t=KB.dom("ul").attr("id","file-list").build(),e=0;e=e.images.length&&(n=0),p=e.images[n];break}d()}function r(){s();for(var t=0;t1&&("INPUT"!==document.activeElement.tagName&&"TEXTAREA"!==document.activeElement.tagName||$(document.activeElement).parents("form").submit())}}KB.onKey("?",function(){KB.modal.isOpen()||KB.modal.open(KB.find("body").data("keyboardShortcutUrl"))}),KB.onKey("Escape",function(){KB.exists("#suggest-menu")||(KB.trigger("modal.close"),_KB.get("Dropdown").close())}),KB.onKey("Enter",e,!0,!0),KB.onKey("Enter",e,!0,!1,!0),KB.onKey("b",function(){KB.modal.isOpen()||KB.trigger("board.selector.open")}),KB.exists("#board")&&(KB.onKey("c",function(){KB.modal.isOpen()||_KB.get("BoardHorizontalScrolling").toggle()}),KB.onKey("s",function(){KB.modal.isOpen()||_KB.get("BoardCollapsedMode").toggle()}),KB.onKey("n",function(){KB.modal.isOpen()||KB.modal.open(KB.find("#board").data("taskCreationUrl"),"large",!1)})),KB.exists("#task-view")&&(KB.onKey("e",function(){KB.modal.isOpen()||KB.modal.open(KB.find("#task-view").data("editUrl"),"large",!1)}),KB.onKey("c",function(){KB.modal.isOpen()||KB.modal.open(KB.find("#task-view").data("commentUrl"),"medium",!1)}),KB.onKey("s",function(){KB.modal.isOpen()||KB.modal.open(KB.find("#task-view").data("subtaskUrl"),"medium",!1)}),KB.onKey("l",function(){KB.modal.isOpen()||KB.modal.open(KB.find("#task-view").data("internalLinkUrl"),"medium",!1)})),KB.onKey("f",function(){KB.modal.isOpen()||KB.focus("#form-search")}),KB.onKey("r",function(){if(!KB.modal.isOpen()){var t=$(".filter-reset").data("filter"),e=$("#form-search");e.val(t),$("form.search").submit()}}),KB.onKey("v+o",function(){t("a.view-overview")}),KB.onKey("v+b",function(){t("a.view-board")}),KB.onKey("v+l",function(){t("a.view-listing")}),KB.onKey("v+g",function(){t("a.view-gantt")})},function(){function t(t){return"I"===t.target.tagName?t.target.parentNode.getAttribute("href"):t.target.getAttribute("href")}KB.onClick(".js-modal-large",function(e){KB.modal.open(t(e),"large",!1)}),KB.onClick(".js-modal-medium",function(e){KB.modal.isOpen()?KB.modal.replace(t(e)):KB.modal.open(t(e),"medium",!1)}),KB.onClick(".js-modal-small",function(e){KB.modal.open(t(e),"small",!1)}),KB.onClick(".js-modal-confirm",function(e){KB.modal.open(t(e),"small")}),KB.onClick(".js-modal-close",function(){KB.modal.close()}),KB.onClick(".js-modal-replace",function(e){var n=t(e);KB.modal.isOpen()?KB.modal.replace(n):window.location.href=n})}(),KB.onChange(".js-project-creation-select-options",function(t){var e=t.value;"0"===e?KB.find(".js-project-creation-options").hide():KB.find(".js-project-creation-options").show()}),KB.component("project-select-role",function(t,e){function n(t){d=!0,e.role=t.value,a(),o()}function o(){KB.http.postJson(e.url,{id:e.id,role:e.role}).success(function(){d=!1,s=!0,a()}).error(function(){d=!1,s=!1,l=!0,a()})}function a(){KB.dom(r).remove(),r=i(),t.appendChild(r)}function i(){var t=[],o=KB.dom("div");for(var a in e.roles)if(e.roles.hasOwnProperty(a)){var i={value:a,text:e.roles[a]};e.role===a&&(i.selected="selected"),t.push(i)}return o.add(KB.dom("select").change(n).for("option",t).build()),d?(o.text(" "),o.add(KB.dom("i").attr("class","fa fa-spinner fa-pulse fa-fw").build())):s?(o.text(" "),o.add(KB.dom("i").attr("class","fa fa-check fa-fw icon-fade-out icon-success").build())):l&&(o.text(" "),o.add(KB.dom("i").attr("class","fa fa-check fa-fw icon-fade-out icon-error").build())),o.build()}var r,d=!1,s=!1,l=!1;this.render=function(){r=i(),t.appendChild(r)}}),KB.component("screenshot",function(t){function e(t){d(t.target.result)}function n(t){if(t.clipboardData&&t.clipboardData.items){var n=t.clipboardData.items;if(n)for(var o=0;o0&&(t.index=t.index-1),KB.dom(t.items[t.index]).addClass("active")}function m(){var t=p();t.indexo?1:0}):n.sort(function(t,e){var n=t["data-label"].toLowerCase(),o=e["data-label"].toLowerCase();return no?1:0}),n}function g(t,n){for(var o=[],a=!1,i=0;i-1){var r=n[i];"undefined"!=typeof e.defaultValue&&String(e.defaultValue)===r["data-value"]&&(r.class+=" active",a=!0),o.push(r)}return!a&&o.length>0&&(o[0].class+=" active"),o}function v(){var t=g(w.value,h(e.items)),n=y.getBoundingClientRect();return 0===t.length?null:KB.dom("ul").attr("id","select-dropdown-menu").style("top",document.body.scrollTop+n.bottom+"px").style("left",n.left+"px").style("width",n.width+"px").style("maxHeight",window.innerHeight-n.bottom-20+"px").mouseover(d).click(s).for("li",t).build()}function b(){var t=KB.find("#select-dropdown-menu");null!==t&&t.remove(),document.removeEventListener("keydown",i,!1),document.removeEventListener("click",l,!1)}function K(){var t=v();null!==t&&document.body.appendChild(t),document.addEventListener("keydown",i,!1),document.addEventListener("click",l,!1)}function B(){return e.defaultValue&&e.defaultValue in e.items?e.items[e.defaultValue]:e.placeholder?e.placeholder:""}var y,w,k,x,C;this.render=function(){KB.on("select.dropdown.loading.start",n),KB.on("select.dropdown.loading.stop",o),KB.on("modal.close",function(){KB.removeListener("select.dropdown.loading.start",n),KB.removeListener("select.dropdown.loading.stop",o)}),x=KB.dom("i").attr("class","fa fa-chevron-down select-dropdown-chevron").click(c).build(),C=KB.dom("span").hide().addClass("select-loading-icon").add(KB.dom("i").attr("class","fa fa-spinner fa-pulse").build()).build(),k=KB.dom("input").attr("type","hidden").attr("name",e.name).attr("value",e.defaultValue||"").build(), -w=KB.dom("input").attr("type","text").attr("placeholder",B()).addClass("select-dropdown-input").style("width",t.offsetWidth-30+"px").on("focus",c).on("input",r,!0).build(),y=KB.dom("div").addClass("select-dropdown-input-container").add(k).add(w).add(x).add(C).build(),t.appendChild(y),e.onFocus&&e.onFocus.forEach(function(t){KB.on(t,function(){w.focus()})}),window.addEventListener("scroll",a,!1)}}),KB.interval(60,function(){var t=KB.find("body").data("statusUrl"),e=KB.find("body").data("loginUrl");null===KB.find(".form-login")&&KB.http.get(t).error(function(){window.location=e})}),KB.component("submit-buttons",function(t,e){function n(){u=!0,c(),KB.trigger("modal.submit")}function o(){KB.trigger("modal.close")}function a(){u=!1,c()}function i(){u=!1,p=!0,c()}function r(){u=!1,p=!1,c()}function d(){KB.dom(m).hide()}function s(t){f=t.submitLabel,c()}function l(){var t=KB.dom("button").attr("type","submit").attr("class","btn btn-"+(e.color||"blue"));return KB.modal.isOpen()&&t.click(n),e.tabindex&&t.attr("tabindex",e.tabindex),u&&t.disable().add(KB.dom("i").attr("class","fa fa-spinner fa-pulse").build()).text(" "),p&&t.disable(),t.text(f).build()}function c(){var t=l();KB.dom(h).replace(t),h=t}var u=!1,p=e.disabled||!1,f=e.submitLabel,m=null,h=null;this.render=function(){KB.on("modal.stop",a),KB.on("modal.disable",i),KB.on("modal.enable",r),KB.on("modal.hide",d),KB.on("modal.submit.label",s),KB.on("modal.close",function(){KB.removeListener("modal.stop",a),KB.removeListener("modal.disable",i),KB.removeListener("modal.enable",r),KB.removeListener("modal.hide",d),KB.removeListener("modal.submit.label",s)}),h=l();var n=KB.dom("div").attr("class","form-actions").add(h);KB.modal.isOpen()&&n.text(" "+e.orLabel+" ").add(KB.dom("a").attr("href","#").click(o).text(e.cancelLabel).build()),m=n.build(),t.appendChild(m)}}),KB.on("dom.ready",function(){function t(t,e){var n=$(".subtasks-table").data("save-position-url");$.ajax({cache:!1,url:n,contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({subtask_id:t,position:e})})}$(".draggable-row-handle").mouseenter(function(){$(this).parent().parent().addClass("draggable-item-hover")}).mouseleave(function(){$(this).parent().parent().removeClass("draggable-item-hover")}),$(".subtasks-table tbody").sortable({forcePlaceholderSize:!0,handle:"td:first i",helper:function(t,e){return e.children().each(function(){$(this).width($(this).width())}),e},stop:function(e,n){var o=n.item;o.removeClass("draggable-item-selected"),t(o.data("subtask-id"),o.index()+1)},start:function(t,e){e.item.addClass("draggable-item-selected")}}).disableSelection()}),KB.on("dom.ready",function(){$(document).on("click",".js-subtask-toggle-status",function(t){var e=$(this),n=e.attr("href");t.preventDefault(),$.ajax({cache:!1,url:n,success:function(t){n.indexOf("fragment=table")!=-1?$(".subtasks-table").replaceWith(t):n.indexOf("fragment=rows")!=-1?$(e).closest(".task-list-subtasks").replaceWith(t):$(e).closest(".subtask-title").replaceWith(t)}})}),$(document).on("click",".js-subtask-toggle-timer",function(t){var e=$(this);t.preventDefault(),$.ajax({cache:!1,url:e.attr("href"),success:function(t){$(e).closest(".subtask-time-tracking").replaceWith(t)}})})}),KB.component("suggest-menu",function(t,e){function n(t){switch(KB.utils.getKey(t)){case"Escape":u();break;case"ArrowUp":t.preventDefault(),t.stopImmediatePropagation(),l();break;case"ArrowDown":t.preventDefault(),t.stopImmediatePropagation(),c();break;case"Enter":t.preventDefault(),t.stopImmediatePropagation(),i()}}function o(){i()}function a(t){KB.dom(t).hasClass("suggest-menu-item")&&(KB.find(".suggest-menu-item.active").removeClass("active"),KB.dom(t).addClass("active"))}function i(){t.focus();var e=KB.find(".suggest-menu-item.active"),n=e.data("value"),o=e.data("trigger"),a=t.value,i=r(t),d=o+n+" ",s=KB.utils.getSelectionPosition(t),l=a.substring(0,s.selectionStart-i.length),c=a.substring(s.selectionEnd),p=l.length+d.length;t.value=l+d+c,t.setSelectionRange(p,p),u()}function r(t){var e=t.value.substring(0,t.selectionEnd).split("\n"),n=e[e.length-1],o=n.split(" ");return o[o.length-1]}function d(){for(var t=["#modal-content form","#modal-content","body"],e=0;e0&&(t.index=t.index-1),KB.dom(t.items[t.index]).addClass("active")}function c(){var t=s();t.index0&&b(v(t,n))}function g(t,e){var n=[];if(0===t.length)return e;for(var o=0;o0&&r.add(KB.html.label(e.positionLabel,"form-position")).add(KB.dom("select").attr("id","form-position").for("option",t).build()).add(KB.html.radio(e.beforeLabel,"positionChoice","before")).add(KB.html.radio(e.afterLabel,"positionChoice","after")),r.build()}this.render=function(){KB.on("modal.submit",c),KB.on("modal.close",function(){KB.removeListener("modal.submit",c)});var n=KB.dom("div").add(KB.dom("div").attr("id","message-container").build()).add(KB.html.label(e.swimlaneLabel,"form-swimlanes")).add(u()).add(KB.html.label(e.columnLabel,"form-columns")).add(p()).add(f()).build();t.appendChild(n)}}),KB.component("text-editor",function(t,e){function n(){var t=KB.dom("div").attr("class","text-editor-toolbar").for("a",[{href:"#",html:' '+e.labelWrite,click:function(){a()}}]).build();return h=KB.dom("div").attr("class","text-editor-preview-area markdown").build(),KB.dom("div").attr("class","text-editor-view-mode").add(t).add(h).hide().build()}function o(){var t=KB.dom("div").attr("class","text-editor-toolbar").for("a",[{href:"#",html:' '+e.labelPreview,click:function(){a()}},{href:"#",html:'',click:function(){d("**")}},{href:"#",html:'',click:function(){d("_")}},{href:"#",html:'',click:function(){d("~~")}},{href:"#",html:'',click:function(){l("> ")}},{href:"#",html:'',click:function(){l("* ")}},{href:"#",html:'',click:function(){s("```")}}]).build(),n=KB.dom("textarea");return n.attr("name",e.name),e.tabindex&&n.attr("tabindex",e.tabindex),e.required&&n.attr("required","required"),n.text(e.text),e.placeholder&&n.attr("placeholder",e.placeholder),p=n.build(),e.suggestOptions&&KB.getComponent("suggest-menu",p,e.suggestOptions).render(),KB.dom("div").attr("class","text-editor-write-mode").add(t).add(p).build()}function a(){KB.dom(h).html(marked(p.value,{sanitize:!0})),KB.dom(f).toggle(),KB.dom(m).toggle()}function i(){return p.value.substring(p.selectionStart,p.selectionEnd)}function r(t,e,n,o){return t.substring(0,e)+o+t.substring(n)}function d(t){var e=i();c(t+e+t),u(t)}function s(t){var e=i();c("\n"+t+"\n"+e+"\n"+t),u(t,2)}function l(t){var e=i();if(e.indexOf("\n")===-1)c("\n"+t+e);else{for(var n=e.split("\n"),o=0;o ')},Kanboard.App.prototype.hideLoadingIcon=function(){$("#app-loading-icon").remove()},Kanboard.BoardCollapsedMode=function(t){this.app=t},Kanboard.BoardCollapsedMode.prototype.toggle=function(){var t=this;this.app.showLoadingIcon(),$.ajax({cache:!1,url:$('.filter-display-mode:not([style="display: none;"]) a').attr("href"),success:function(e){$(".filter-display-mode").toggle(),t.app.get("BoardDragAndDrop").refresh(e)}})},Kanboard.BoardColumnView=function(t){this.app=t},Kanboard.BoardColumnView.prototype.execute=function(){this.app.hasId("board")&&this.render()},Kanboard.BoardColumnView.prototype.listen=function(){var t=this;$(document).on("click",".board-toggle-column-view",function(){t.toggle($(this).data("column-id"))})},Kanboard.BoardColumnView.prototype.onBoardRendered=function(){this.render()},Kanboard.BoardColumnView.prototype.render=function(){var t=this;$(".board-column-header").each(function(){var e=$(this).data("column-id");localStorage.getItem("hidden_column_"+e)&&t.hideColumn(e)})},Kanboard.BoardColumnView.prototype.toggle=function(t){localStorage.getItem("hidden_column_"+t)?this.showColumn(t):this.hideColumn(t),this.app.get("BoardDragAndDrop").dragAndDrop()},Kanboard.BoardColumnView.prototype.hideColumn=function(t){$(".board-column-"+t+" .board-column-expanded").hide(),$(".board-column-"+t+" .board-column-collapsed").show(),$(".board-column-header-"+t+" .board-column-expanded").hide(),$(".board-column-header-"+t+" .board-column-collapsed").show(),$(".board-column-header-"+t).each(function(){$(this).removeClass("board-column-compact"),$(this).addClass("board-column-header-collapsed")}),$(".board-column-"+t).each(function(){$(this).addClass("board-column-task-collapsed")}),$(".board-column-"+t+" .board-rotation").each(function(){$(this).css("width",$(".board-column-"+t).height())}),localStorage.setItem("hidden_column_"+t,1)},Kanboard.BoardColumnView.prototype.showColumn=function(t){$(".board-column-"+t+" .board-column-expanded").show(),$(".board-column-"+t+" .board-column-collapsed").hide(),$(".board-column-header-"+t+" .board-column-expanded").show(),$(".board-column-header-"+t+" .board-column-collapsed").hide(),$(".board-column-header-"+t).removeClass("board-column-header-collapsed"),$(".board-column-"+t).removeClass("board-column-task-collapsed"),0==localStorage.getItem("horizontal_scroll")&&$(".board-column-header-"+t).addClass("board-column-compact"),localStorage.removeItem("hidden_column_"+t)},Kanboard.BoardHorizontalScrolling=function(t){this.app=t},Kanboard.BoardHorizontalScrolling.prototype.execute=function(){this.app.hasId("board")&&this.render()},Kanboard.BoardHorizontalScrolling.prototype.listen=function(){var t=this;$(document).on("click",".filter-toggle-scrolling",function(e){e.preventDefault(),t.toggle()})},Kanboard.BoardHorizontalScrolling.prototype.onBoardRendered=function(){this.render()},Kanboard.BoardHorizontalScrolling.prototype.toggle=function(){var t=localStorage.getItem("horizontal_scroll")||1;localStorage.setItem("horizontal_scroll",0==t?1:0),this.render()},Kanboard.BoardHorizontalScrolling.prototype.render=function(){0==localStorage.getItem("horizontal_scroll")?($(".filter-wide").show(),$(".filter-compact").hide(),$("#board-container").addClass("board-container-compact"),$("#board th:not(.board-column-header-collapsed)").addClass("board-column-compact")):($(".filter-wide").hide(),$(".filter-compact").show(),$("#board-container").removeClass("board-container-compact"),$("#board th").removeClass("board-column-compact"))},Kanboard.BoardPolling=function(t){this.app=t},Kanboard.BoardPolling.prototype.execute=function(){if(this.app.hasId("board")){var t=parseInt($("#board").attr("data-check-interval"));t>0&&window.setInterval(this.check.bind(this),1e3*t)}},Kanboard.BoardPolling.prototype.check=function(){if(KB.utils.isVisible()&&!this.app.get("BoardDragAndDrop").savingInProgress){var t=this;this.app.showLoadingIcon(),$.ajax({cache:!1,url:$("#board").data("check-url"),statusCode:{200:function(e){t.app.get("BoardDragAndDrop").refresh(e)},304:function(){t.app.hideLoadingIcon()}}})}},Kanboard.Column=function(t){this.app=t},Kanboard.Column.prototype.listen=function(){this.dragAndDrop()},Kanboard.Column.prototype.dragAndDrop=function(){var t=this;$(".draggable-row-handle").mouseenter(function(){$(this).parent().parent().addClass("draggable-item-hover")}).mouseleave(function(){$(this).parent().parent().removeClass("draggable-item-hover")}),$(".columns-table tbody").sortable({forcePlaceholderSize:!0,handle:"td:first i",helper:function(t,e){return e.children().each(function(){$(this).width($(this).width())}),e},stop:function(e,n){var o=n.item;o.removeClass("draggable-item-selected"),t.savePosition(o.data("column-id"),o.index()+1)},start:function(t,e){e.item.addClass("draggable-item-selected")}}).disableSelection()},Kanboard.Column.prototype.savePosition=function(t,e){var n=$(".columns-table").data("save-position-url"),o=this;this.app.showLoadingIcon(),$.ajax({cache:!1,url:n,contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({column_id:t,position:e}),complete:function(){o.app.hideLoadingIcon()}})},Kanboard.Dropdown=function(t){this.app=t},Kanboard.Dropdown.prototype.listen=function(){var t=this;$(document).on("click",function(){t.close()}),$(document).on("click",".dropdown-menu",function(e){e.preventDefault(),e.stopImmediatePropagation(),t.close();var n=$(this).next("ul"),o=$(this).offset();$("body").append(jQuery("
",{id:"dropdown"})),n.clone().appendTo("#dropdown");var a=$("#dropdown ul");a.addClass("dropdown-submenu-open");var i=a.outerHeight(),r=a.outerWidth();o.top+i-$(window).scrollTop()<$(window).height()||$(window).scrollTop()+o.top$(window).width()?a.css("left",o.left-r+$(this).outerWidth()):a.css("left",o.left)}),$(document).on("click",".dropdown-submenu-open li",function(t){$(t.target).is("li")&&$(this).find("a:visible")[0].click()})},Kanboard.Dropdown.prototype.close=function(){$("#dropdown").remove()},Kanboard.Gantt=function(t){this.app=t,this.data=[],this.options={container:"#gantt-chart",showWeekends:!0,allowMoves:!0,allowResizes:!0,cellWidth:21,cellHeight:31,slideWidth:1e3,vHeaderWidth:200}},Kanboard.Gantt.prototype.execute=function(){this.app.hasId("gantt-chart")&&this.show()},Kanboard.Gantt.prototype.saveRecord=function(t){this.app.showLoadingIcon(),$.ajax({cache:!1,url:$(this.options.container).data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify(t),complete:this.app.hideLoadingIcon.bind(this)})},Kanboard.Gantt.prototype.show=function(){this.data=this.prepareData($(this.options.container).data("records"));var t=Math.floor(this.options.slideWidth/this.options.cellWidth+5),e=this.getDateRange(t),n=e[0],o=e[1],a=$(this.options.container),i=jQuery("
",{class:"ganttview"});i.append(this.renderVerticalHeader()),i.append(this.renderSlider(n,o)),a.append(i),jQuery("div.ganttview-grid-row div.ganttview-grid-row-cell:last-child",a).addClass("last"),jQuery("div.ganttview-hzheader-days div.ganttview-hzheader-day:last-child",a).addClass("last"),jQuery("div.ganttview-hzheader-months div.ganttview-hzheader-month:last-child",a).addClass("last"),$(this.options.container).data("readonly")?(this.options.allowResizes=!1,this.options.allowMoves=!1):(this.listenForBlockResize(n),this.listenForBlockMove(n))},Kanboard.Gantt.prototype.renderVerticalHeader=function(){for(var t=jQuery("
",{class:"ganttview-vtheader"}),e=jQuery("
",{class:"ganttview-vtheader-item"}),n=jQuery("
",{class:"ganttview-vtheader-series"}),o=0;o").append(jQuery("",{class:"fa fa-info-circle tooltip",title:this.getVerticalHeaderTooltip(this.data[o])})).append(" ");"task"==this.data[o].type?a.append(jQuery("",{href:this.data[o].link,title:this.data[o].title}).text(this.data[o].title)):a.append(jQuery("",{href:this.data[o].board_link,title:$(this.options.container).data("label-board-link")}).append('')).append(" ").append(jQuery("",{href:this.data[o].gantt_link,title:$(this.options.container).data("label-gantt-link")}).append('')).append(" ").append(jQuery("",{href:this.data[o].link}).text(this.data[o].title)),n.append(jQuery("
",{class:"ganttview-vtheader-series-name"}).append(a))}return e.append(n),t.append(e),t},Kanboard.Gantt.prototype.renderSlider=function(t,e){var n=jQuery("
",{class:"ganttview-slide-container"}),o=this.getDates(t,e);return n.append(this.renderHorizontalHeader(o)),n.append(this.renderGrid(o)),n.append(this.addBlockContainers()),this.addBlocks(n,t),n},Kanboard.Gantt.prototype.renderHorizontalHeader=function(t){var e=jQuery("
",{class:"ganttview-hzheader"}),n=jQuery("
",{class:"ganttview-hzheader-months"}),o=jQuery("
",{class:"ganttview-hzheader-days"}),a=0;for(var i in t)for(var r in t[i]){var d=t[i][r].length*this.options.cellWidth;a+=d,n.append(jQuery("
",{class:"ganttview-hzheader-month",css:{width:d-1+"px"}}).append($.datepicker.regional[$("body").data("js-lang")].monthNames[r]+" "+i));for(var s in t[i][r])o.append(jQuery("
",{class:"ganttview-hzheader-day"}).append(t[i][r][s].getDate()))}return n.css("width",a+"px"),o.css("width",a+"px"),e.append(n).append(o),e},Kanboard.Gantt.prototype.renderGrid=function(t){var e=jQuery("
",{class:"ganttview-grid"}),n=jQuery("
",{class:"ganttview-grid-row"});for(var o in t)for(var a in t[o])for(var i in t[o][a]){var r=jQuery("
",{class:"ganttview-grid-row-cell"});this.options.showWeekends&&this.isWeekend(t[o][a][i])&&r.addClass("ganttview-weekend"),n.append(r)}var d=jQuery("div.ganttview-grid-row-cell",n).length*this.options.cellWidth;n.css("width",d+"px"),e.css("width",d+"px");for(var s=0;s",{class:"ganttview-blocks"}),e=0;e",{class:"ganttview-block-container"}));return t},Kanboard.Gantt.prototype.addBlocks=function(t,e){for(var n=jQuery("div.ganttview-blocks div.ganttview-block-container",t),o=0,a=0;a",{class:"ganttview-block-text"}),l=jQuery("
",{class:"ganttview-block tooltip"+(this.options.allowMoves?" ganttview-block-movable":""),title:this.getBarTooltip(i),css:{width:r*this.options.cellWidth-9+"px","margin-left":d*this.options.cellWidth+"px"}}).append(s);r>=2&&s.append(i.progress),l.data("record",i),this.setBarColor(l,i),jQuery(n[o]).append(l),o+=1}},Kanboard.Gantt.prototype.getVerticalHeaderTooltip=function(t){var e="";if("task"==t.type)e=jQuery("").append(jQuery("").text(t.column_title)).append(document.createTextNode(" ("+t.progress+")")).append(jQuery("
")).append(document.createTextNode(t.title)).prop("outerHTML");else{var n=["project-manager","project-member"];for(var o in n){var a=n[o];if(!jQuery.isEmptyObject(t.users[a])){var i=jQuery("