diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/css/app.css | 8 | ||||
-rw-r--r-- | assets/css/src/board.css | 7 | ||||
-rw-r--r-- | assets/js/app.js | 38 | ||||
-rw-r--r-- | assets/js/src/swimlane.js | 90 |
4 files changed, 117 insertions, 26 deletions
diff --git a/assets/css/app.css b/assets/css/app.css index 70a2cd96..d0f7e01b 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -1411,10 +1411,10 @@ a.filter-on { } /* swimlanes */ -th.board-swimlane-title { - vertical-align: top; - text-align: right; -}/* task inside the board */ +#board th a.board-swimlane-toggle { + font-size: 0.95em; +} +/* task inside the board */ .task-board { position: relative; margin-right: 5px; diff --git a/assets/css/src/board.css b/assets/css/src/board.css index 37dba974..81c2a3a2 100644 --- a/assets/css/src/board.css +++ b/assets/css/src/board.css @@ -62,7 +62,6 @@ a.filter-on { } /* swimlanes */ -th.board-swimlane-title { - vertical-align: top; - text-align: right; -}
\ No newline at end of file +#board th a.board-swimlane-toggle { + font-size: 0.95em; +} diff --git a/assets/js/app.js b/assets/js/app.js index 9eb535b4..625537b0 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -33,25 +33,27 @@ c,a,e),l[d.key][c?"unshift":"push"]({callback:b,modifiers:d.modifiers,action:d.a "@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},G={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p,l={},q={},n={},D,z=!1,I=!1,u=!1;for(f=1;20>f;++f)h[111+f]="f"+f;for(f=0;9>=f;++f)h[f+96]=f;s(r,"keypress",y);s(r,"keydown",y);s(r,"keyup",y);var m={bind:function(a,b,d){a=a instanceof Array?a:[a];for(var c=0;c<a.length;++c)F(a[c],b,d);return this}, unbind:function(a,b){return m.bind(a,function(){},b)},trigger:function(a,b){if(q[a+":"+b])q[a+":"+b]({},a);return this},reset:function(){l={};q={};return this},stopCallback:function(a,b){return-1<(" "+b.className+" ").indexOf(" mousetrap ")?!1:"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable},handleKey:function(a,b,d){var c=C(a,b,d),e;b={};var f=0,g=!1;for(e=0;e<c.length;++e)c[e].seq&&(f=Math.max(f,c[e].level));for(e=0;e<c.length;++e)c[e].seq?c[e].level==f&&(g=!0, b[c[e].seq]=1,x(c[e].callback,d,c[e].combo,c[e].seq)):g||x(c[e].callback,d,c[e].combo);c="keypress"==d.type&&I;d.type!=u||w(a)||c||t(b);I=g&&"keydown"==d.type}};J.Mousetrap=m;"function"===typeof define&&define.amd&&define(m)})(window,document); -var Kanboard=function(){return{Exists:function(a){return document.getElementById(a)?!0:!1},Popover:function(a,c){a.preventDefault();a.stopPropagation();var e=a.target.getAttribute("href");e||(e=a.target.getAttribute("data-href"));e&&Kanboard.OpenPopover(e,c)},OpenPopover:function(a,c){$.get(a,function(a){$("body").append('<div id="popover-container"><div id="popover-content">'+a+"</div></div>");$("#popover-container").click(function(){$(this).remove()});$("#popover-content").click(function(a){a.stopPropagation()}); -$(".close-popover").click(function(a){a.preventDefault();$("#popover-container").remove()});Mousetrap.bind("esc",function(){$("#popover-container").remove()});c&&c()})},IsVisible:function(){var a="";"undefined"!==typeof document.hidden?a="visibilityState":"undefined"!==typeof document.mozHidden?a="mozVisibilityState":"undefined"!==typeof document.msHidden?a="msVisibilityState":"undefined"!==typeof document.webkitHidden&&(a="webkitVisibilityState");return""!=a?"visible"==document[a]:!0},SetStorageItem:function(a, -c){"undefined"!==typeof Storage&&localStorage.setItem(a,c)},GetStorageItem:function(a){return"undefined"!==typeof Storage?localStorage.getItem(a):""},MarkdownPreview:function(a){a.preventDefault();var c=$(this),e=$(this).closest("ul"),f=$(".write-area"),d=$(".preview-area"),b=$("textarea");$.ajax({url:"?controller=app&action=preview",contentType:"application/json",type:"POST",processData:!1,dataType:"html",data:JSON.stringify({text:b.val()})}).done(function(a){e.find("li").removeClass("form-tab-selected"); -c.parent().addClass("form-tab-selected");d.find(".markdown").html(a);d.css("height",b.css("height"));d.css("width",b.css("width"));f.hide();d.show()})},MarkdownWriter:function(a){a.preventDefault();$(this).closest("ul").find("li").removeClass("form-tab-selected");$(this).parent().addClass("form-tab-selected");$(".write-area").show();$(".preview-area").hide()},CheckSession:function(){$(".form-login").length||$.ajax({cache:!1,url:$("body").data("status-url"),statusCode:{401:function(a){window.location= +var Kanboard=function(){return{Exists:function(a){return document.getElementById(a)?!0:!1},Popover:function(a,d){a.preventDefault();a.stopPropagation();var c=a.target.getAttribute("href");c||(c=a.target.getAttribute("data-href"));c&&Kanboard.OpenPopover(c,d)},OpenPopover:function(a,d){$.get(a,function(a){$("body").append('<div id="popover-container"><div id="popover-content">'+a+"</div></div>");$("#popover-container").click(function(){$(this).remove()});$("#popover-content").click(function(a){a.stopPropagation()}); +$(".close-popover").click(function(a){a.preventDefault();$("#popover-container").remove()});Mousetrap.bind("esc",function(){$("#popover-container").remove()});d&&d()})},IsVisible:function(){var a="";"undefined"!==typeof document.hidden?a="visibilityState":"undefined"!==typeof document.mozHidden?a="mozVisibilityState":"undefined"!==typeof document.msHidden?a="msVisibilityState":"undefined"!==typeof document.webkitHidden&&(a="webkitVisibilityState");return""!=a?"visible"==document[a]:!0},SetStorageItem:function(a, +d){"undefined"!==typeof Storage&&localStorage.setItem(a,d)},GetStorageItem:function(a){return"undefined"!==typeof Storage?localStorage.getItem(a):""},MarkdownPreview:function(a){a.preventDefault();var d=$(this),c=$(this).closest("ul"),f=$(".write-area"),e=$(".preview-area"),b=$("textarea");$.ajax({url:"?controller=app&action=preview",contentType:"application/json",type:"POST",processData:!1,dataType:"html",data:JSON.stringify({text:b.val()})}).done(function(a){c.find("li").removeClass("form-tab-selected"); +d.parent().addClass("form-tab-selected");e.find(".markdown").html(a);e.css("height",b.css("height"));e.css("width",b.css("width"));f.hide();e.show()})},MarkdownWriter:function(a){a.preventDefault();$(this).closest("ul").find("li").removeClass("form-tab-selected");$(this).parent().addClass("form-tab-selected");$(".write-area").show();$(".preview-area").hide()},CheckSession:function(){$(".form-login").length||$.ajax({cache:!1,url:$("body").data("status-url"),statusCode:{401:function(a){window.location= $("body").data("login-url")}}})},Init:function(){$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#board-selector").chosen({width:180});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);window.setInterval(Kanboard.CheckSession,6E4);$(".auto-select").focus(function(){$(this).select()}); Mousetrap.bind("ctrl+enter",function(){$("form").submit()})}}}(); -Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.Init)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.Init)})}function e(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){d(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$(".assignee-popover").click(Kanboard.Popover); -$(".category-popover").click(Kanboard.Popover);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var d=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0==d?"align-left":"align-right").appendTo(this)}},content:function(a){if(a=$(this).attr("data-href")){var b= -this;$.get(a,function k(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var d=$(b).tooltip("option","position");d.of=$(b);a.position(d);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$.get($(this).attr("href"),k)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout", -function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var c=parseInt($("#board").attr("data-check-interval"));0<c&&(h=window.setInterval(b,1E3*c))}function f(){$("[data-task-url]").off();clearInterval(h)}function d(a,b,d,c){f();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json", -type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:b,swimlane_id:c,position:d}),success:function(a){$("#board").remove();$("#main").append(a);e();g()}})}function b(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);f();e();g()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),d=$("#filter-due-date").hasClass("filter-on"),c=$("#board").data("project-id"); -$("[data-task-id]").each(function(c,e){var f=e.getAttribute("data-owner-id"),g=e.getAttribute("data-due-date"),h=e.getAttribute("data-category-id");e.style.opacity=f!=a&&-1!=a?"0.2":"1.0";!d||""!=g&&"0"!=g||(e.style.opacity="0.2");h!=b&&-1!=b&&(e.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+c+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+c+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+c+"_filter-due-date",~~d)}function l(){var a=$("#board").data("project-id"); +Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.Init)}function d(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.Init)})}function c(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){e(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$(".assignee-popover").click(Kanboard.Popover); +$(".category-popover").click(Kanboard.Popover);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var c=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0==c?"align-left":"align-right").appendTo(this)}},content:function(a){if(a=$(this).attr("data-href")){var b= +this;$.get(a,function k(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$.get($(this).attr("href"),k)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout", +function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var c=parseInt($("#board").attr("data-check-interval"));0<c&&(h=window.setInterval(b,1E3*c))}function f(){$("[data-task-url]").off();clearInterval(h)}function e(a,b,e,d){f();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json", +type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:b,swimlane_id:d,position:e}),success:function(a){$("#board").remove();$("#main").append(a);c();g()}})}function b(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);f();c();g()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),e=$("#board").data("project-id"); +$("[data-task-id]").each(function(e,d){var f=d.getAttribute("data-owner-id"),g=d.getAttribute("data-due-date"),h=d.getAttribute("data-category-id");d.style.opacity=f!=a&&-1!=a?"0.2":"1.0";!c||""!=g&&"0"!=g||(d.style.opacity="0.2");h!=b&&-1!=b&&(d.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+e+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+e+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+e+"_filter-due-date",~~c)}function l(){var a=$("#board").data("project-id"); $("#form-user_id").change(g);$("#form-category_id").change(g);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");g();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-category_id")||-1);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");g()}var h= -null;return{Init:function(){e();l();c()}}}(); -Kanboard.Calendar=function(){function a(a){$.ajax({cache:!1,url:$("#calendar").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a.id,date_due:a.start.format()})})}function c(a){var b=$("#calendar"),c=b.data("check-url"),e={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format()};jQuery.extend(e,a);for(var f in e)c+="&"+f+"="+e[f];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource", -a);b.fullCalendar("rerenderEvents")})}function e(){var a={};$(".calendar-filter").each(function(b,c){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(f,JSON.stringify(a));c(a)}var f="";return{Init:function(){f="calendar_filters_"+$("#calendar").data("project-id");var d=$("#calendar"),b=d.data("translations");d.fullCalendar({editable:!0,eventLimit:!0,header:{left:"prev,next today",center:"title",right:""},eventDrop:a,monthNames:[b.January,b.February,b.March,b.April,b.May,b.June,b.July, -b.August,b.September,b.October,b.November,b.December],monthNamesShort:[b.Jan,b.Feb,b.Mar,b.Apr,b.May,b.Jun,b.Jul,b.Aug,b.Sep,b.Oct,b.Nov,b.Dec],buttonText:{today:b.Today},dayNames:[b.Sunday,b.Monday,b.Tuesday,b.Wednesday,b.Thursday,b.Friday,b.Saturday],dayNamesShort:[b.Sun,b.Mon,b.Tue,b.Wed,b.Thu,b.Fri,b.Sat]});d=Kanboard.GetStorageItem(f);if("undefined"!==d&&""!==d){var d=JSON.parse(d),g;for(g in d)$("select[name="+g+"]").val(d[g])}c(d||{});$(".calendar-filter").change(e)}}}();Kanboard.Task=function(){return{Init:function(){$(".file-popover").click(Kanboard.Popover)}}}(); +null;return{Init:function(){c();l();d()}}}(); +Kanboard.Calendar=function(){function a(a){$.ajax({cache:!1,url:$("#calendar").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a.id,date_due:a.start.format()})})}function d(a){var b=$("#calendar"),c=b.data("check-url"),d={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format()};jQuery.extend(d,a);for(var f in d)c+="&"+f+"="+d[f];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource", +a);b.fullCalendar("rerenderEvents")})}function c(){var a={};$(".calendar-filter").each(function(b,c){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(f,JSON.stringify(a));d(a)}var f="";return{Init:function(){f="calendar_filters_"+$("#calendar").data("project-id");var e=$("#calendar"),b=e.data("translations");e.fullCalendar({editable:!0,eventLimit:!0,header:{left:"prev,next today",center:"title",right:""},eventDrop:a,monthNames:[b.January,b.February,b.March,b.April,b.May,b.June,b.July, +b.August,b.September,b.October,b.November,b.December],monthNamesShort:[b.Jan,b.Feb,b.Mar,b.Apr,b.May,b.Jun,b.Jul,b.Aug,b.Sep,b.Oct,b.Nov,b.Dec],buttonText:{today:b.Today},dayNames:[b.Sunday,b.Monday,b.Tuesday,b.Wednesday,b.Thursday,b.Friday,b.Saturday],dayNamesShort:[b.Sun,b.Mon,b.Tue,b.Wed,b.Thu,b.Fri,b.Sat]});e=Kanboard.GetStorageItem(f);if("undefined"!==e&&""!==e){var e=JSON.parse(e),g;for(g in e)$("select[name="+g+"]").val(e[g])}d(e||{});$(".calendar-filter").change(c)}}}();Kanboard.Task=function(){return{Init:function(){$(".file-popover").click(Kanboard.Popover)}}}(); Kanboard.Analytic=function(){return{Init:function(){Kanboard.Exists("analytic-task-repartition")?Kanboard.Analytic.TaskRepartition.Init():Kanboard.Exists("analytic-user-repartition")?Kanboard.Analytic.UserRepartition.Init():Kanboard.Exists("analytic-cfd")&&Kanboard.Analytic.CFD.Init()}}}(); -Kanboard.Analytic.CFD=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var c=a.labels,e=a.columns,f=a.metrics;a=[];for(var d=0;d<f.length;d++){var b={};b[c.column]=f[d].column_title;b[c.day]=f[d].day;b[c.total]=f[d].total;a.push(b)}f=dimple.newSvg("#chart","100%",380);a=new dimple.chart(f,a);a.addCategoryAxis("x",c.day).addOrderRule("Date");a.addMeasureAxis("y",c.total);a.addSeries(c.column,dimple.plot.area).addOrderRule(e.reverse());a.addLegend(10,10,500, -30,"left");a.draw()})}}}();Kanboard.Analytic.TaskRepartition=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var c=a.labels,e=a.metrics;a=[];for(var f=0;f<e.length;f++){var d={};d[c.nb_tasks]=e[f].nb_tasks;d[c.column_title]=e[f].column_title;a.push(d)}e=dimple.newSvg("#chart","100%",350);a=new dimple.chart(e,a);a.addMeasureAxis("p",c.nb_tasks);a.addSeries(c.column_title,dimple.plot.pie).innerRadius="50%";a.addLegend(0,0,100,"100%","left");a.draw()})}}}(); -Kanboard.Analytic.UserRepartition=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var c=a.labels,e=a.metrics;a=[];for(var f=0;f<e.length;f++){var d={};d[c.nb_tasks]=e[f].nb_tasks;d[c.user]=e[f].user;a.push(d)}e=dimple.newSvg("#chart","100%",350);a=new dimple.chart(e,a);a.addMeasureAxis("p",c.nb_tasks);a.addSeries(c.user,dimple.plot.pie).innerRadius="50%";a.addLegend(0,0,100,"100%","left");a.draw()})}}}(); -$(function(){Kanboard.Init();Kanboard.Exists("board")?Kanboard.Board.Init():Kanboard.Exists("calendar")?Kanboard.Calendar.Init():Kanboard.Exists("task-section")?Kanboard.Task.Init():Kanboard.Exists("analytic-section")&&Kanboard.Analytic.Init()}); +Kanboard.Analytic.CFD=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var d=a.labels,c=a.columns,f=a.metrics;a=[];for(var e=0;e<f.length;e++){var b={};b[d.column]=f[e].column_title;b[d.day]=f[e].day;b[d.total]=f[e].total;a.push(b)}f=dimple.newSvg("#chart","100%",380);a=new dimple.chart(f,a);a.addCategoryAxis("x",d.day).addOrderRule("Date");a.addMeasureAxis("y",d.total);a.addSeries(d.column,dimple.plot.area).addOrderRule(c.reverse());a.addLegend(10,10,500, +30,"left");a.draw()})}}}();Kanboard.Analytic.TaskRepartition=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var d=a.labels,c=a.metrics;a=[];for(var f=0;f<c.length;f++){var e={};e[d.nb_tasks]=c[f].nb_tasks;e[d.column_title]=c[f].column_title;a.push(e)}c=dimple.newSvg("#chart","100%",350);a=new dimple.chart(c,a);a.addMeasureAxis("p",d.nb_tasks);a.addSeries(d.column_title,dimple.plot.pie).innerRadius="50%";a.addLegend(0,0,100,"100%","left");a.draw()})}}}(); +Kanboard.Analytic.UserRepartition=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var d=a.labels,c=a.metrics;a=[];for(var f=0;f<c.length;f++){var e={};e[d.nb_tasks]=c[f].nb_tasks;e[d.user]=c[f].user;a.push(e)}c=dimple.newSvg("#chart","100%",350);a=new dimple.chart(c,a);a.addMeasureAxis("p",d.nb_tasks);a.addSeries(d.user,dimple.plot.pie).innerRadius="50%";a.addLegend(0,0,100,"100%","left");a.draw()})}}}(); +Kanboard.Swimlane=function(){function a(a){$(".swimlane-row-"+a).css("display","none");$(".show-icon-swimlane-"+a).css("display","inline");$(".hide-icon-swimlane-"+a).css("display","none")}function d(){var a="hidden_swimlanes_"+$("#board").data("project-id");return JSON.parse(Kanboard.GetStorageItem(a))||[]}jQuery(document).ajaxComplete(function(){d().map(function(c){a(c)})});jQuery(document).ready(function(){d().map(function(c){a(c)})});jQuery(document).on("click",".board-swimlane-toggle",function(c){c.preventDefault(); +c=$(this).data("swimlane-id");if(-1<d().indexOf(c)){var f="hidden_swimlanes_"+$("#board").data("project-id"),e=JSON.parse(Kanboard.GetStorageItem(f))||[],b=e.indexOf(c);-1<b&&e.splice(b,1);Kanboard.SetStorageItem(f,JSON.stringify(e));$(".swimlane-row-"+c).css("display","table-row");$(".show-icon-swimlane-"+c).css("display","none");$(".hide-icon-swimlane-"+c).css("display","inline")}else f="hidden_swimlanes_"+$("#board").data("project-id"),e=JSON.parse(Kanboard.GetStorageItem(f))||[],e.push(c),Kanboard.SetStorageItem(f, +JSON.stringify(e)),a(c)})}();$(function(){Kanboard.Init();Kanboard.Exists("board")?Kanboard.Board.Init():Kanboard.Exists("calendar")?Kanboard.Calendar.Init():Kanboard.Exists("task-section")?Kanboard.Task.Init():Kanboard.Exists("analytic-section")&&Kanboard.Analytic.Init()}); diff --git a/assets/js/src/swimlane.js b/assets/js/src/swimlane.js new file mode 100644 index 00000000..77f45907 --- /dev/null +++ b/assets/js/src/swimlane.js @@ -0,0 +1,90 @@ +Kanboard.Swimlane = (function() {
+
+ // Expand a Swimlane via display attributes
+ function expand(swimlaneId)
+ {
+ $('.swimlane-row-' + swimlaneId).css('display', 'table-row');
+ $('.show-icon-swimlane-' + swimlaneId).css('display', 'none');
+ $('.hide-icon-swimlane-' + swimlaneId).css('display', 'inline');
+ }
+
+ // Collapse a Swimlane via display attributes
+ function collapse(swimlaneId)
+ {
+ $('.swimlane-row-' + swimlaneId).css('display', 'none');
+ $('.show-icon-swimlane-' + swimlaneId).css('display', 'inline');
+ $('.hide-icon-swimlane-' + swimlaneId).css('display', 'none');
+ }
+
+ // Add swimlane Id to the hidden list and stores the list to localStorage
+ function hide(id)
+ {
+ var storageKey = "hidden_swimlanes_" + $("#board").data("project-id");
+ var hiddenSwimlaneIds = JSON.parse(Kanboard.GetStorageItem(storageKey)) || [];
+
+ hiddenSwimlaneIds.push(id);
+
+ Kanboard.SetStorageItem(storageKey, JSON.stringify(hiddenSwimlaneIds));
+ }
+
+ // Remove swimlane Id from the hidden list and stores the list to
+ // localStorage
+ function unhide(id)
+ {
+ var storageKey = "hidden_swimlanes_" + $("#board").data("project-id");
+ var hiddenSwimlaneIds = JSON.parse(Kanboard.GetStorageItem(storageKey)) || [];
+ var index = hiddenSwimlaneIds.indexOf(id);
+
+ if (index > -1) {
+ hiddenSwimlaneIds.splice(index, 1);
+ }
+
+ Kanboard.SetStorageItem(storageKey, JSON.stringify(hiddenSwimlaneIds));
+ }
+
+ // Check if swimlane Id is hidden. Anything > -1 means hidden.
+ function isHidden(id)
+ {
+ return getAllHidden().indexOf(id) > -1;
+ }
+
+ // Gets all swimlane Ids that are hidden
+ function getAllHidden()
+ {
+ var storageKey = "hidden_swimlanes_" + $("#board").data("project-id");
+ return JSON.parse(Kanboard.GetStorageItem(storageKey)) || [];
+ }
+
+ // Reload the swimlane states (shown/hidden) after an ajax call
+ jQuery(document).ajaxComplete(function() {
+
+ getAllHidden().map(function(swimlaneId) {
+ collapse(swimlaneId);
+ });
+ });
+
+ // Reload the swimlane states (shown/hidden) after page refresh
+ jQuery(document).ready(function() {
+
+ getAllHidden().map(function(swimlaneId) {
+ collapse(swimlaneId);
+ });
+ });
+
+ // Clicking on Show/Hide icon fires this.
+ jQuery(document).on('click', ".board-swimlane-toggle", function(e) {
+ e.preventDefault();
+
+ var swimlaneId = $(this).data('swimlane-id');
+
+ if (isHidden(swimlaneId)) {
+ unhide(swimlaneId);
+ expand(swimlaneId);
+ }
+ else {
+ hide(swimlaneId);
+ collapse(swimlaneId);
+ }
+ });
+
+})();
|