diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-04 22:19:32 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-04 22:19:32 -0500 |
commit | b24b1e7e4e5ee0551ee56aa0f21c4425b479db2e (patch) | |
tree | 5fffaeb461707dada9f2909101d51c9da3c77a50 /assets | |
parent | 2d070627d751bf5728ec98a5efaf163532594cd9 (diff) |
Add subtasks restrictions and time tracking
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/app.js | 16 | ||||
-rw-r--r-- | assets/js/src/base.js | 2 | ||||
-rw-r--r-- | assets/js/src/board.js | 8 |
3 files changed, 17 insertions, 9 deletions
diff --git a/assets/js/app.js b/assets/js/app.js index 9e21e7c3..d040b3be 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -135,16 +135,16 @@ var Kanboard=function(){return{Exists:function(a){return document.getElementById $(".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(){$("#board-selector").chosen({width:180});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});window.setInterval(Kanboard.CheckSession,6E4);Mousetrap.bind("ctrl+enter",function(){$("form").submit()});Kanboard.InitAfterAjax()},InitAfterAjax:function(){$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#markdown-preview").click(Kanboard.MarkdownPreview); -$("#markdown-write").click(Kanboard.MarkdownWriter);$(".auto-select").focus(function(){$(this).select()});$(".dropit-submenu").hide();$(".dropdown").not(".dropit").dropit()}}}(); +$("body").data("login-url")}}})},Init:function(){$("#board-selector").chosen({width:180});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});window.setInterval(Kanboard.CheckSession,6E4);Mousetrap.bind("ctrl+enter",function(){$("form").submit()});$(".popover-subtask-restriction").click(Kanboard.Popover);Kanboard.InitAfterAjax()},InitAfterAjax:function(){$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd", +constrainInput:!1});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);$(".auto-select").focus(function(){$(this).select()});$(".dropit-submenu").hide();$(".dropdown").not(".dropit").dropit()}}}(); Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.InitAfterAjax)}function d(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.InitAfterAjax)})}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(a); $(".category-popover").click(a);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".column-tooltip").tooltip({content:function(a){return $(this).attr("title")}});$(".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);Kanboard.InitAfterAjax();c();g()}})}function b(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();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(){c();l();d()}}}(); +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();$(this).hasClass("popover-subtask-restriction")?(Kanboard.OpenPopover($(this).attr("href")),$(b).tooltip("close")):$.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);Kanboard.InitAfterAjax();c();g()}})}function b(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove(); +$("#main").append(a);Kanboard.InitAfterAjax();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(){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)}}}(); diff --git a/assets/js/src/base.js b/assets/js/src/base.js index 956064fb..a10f5cce 100644 --- a/assets/js/src/base.js +++ b/assets/js/src/base.js @@ -178,6 +178,8 @@ var Kanboard = (function() { $("form").submit(); }); + $(".popover-subtask-restriction").click(Kanboard.Popover); + Kanboard.InitAfterAjax(); }, diff --git a/assets/js/src/board.js b/assets/js/src/board.js index 6bc52326..e86d8018 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -107,7 +107,13 @@ Kanboard.Board = (function() { e.preventDefault(); e.stopPropagation(); - $.get($(this).attr('href'), setTooltipContent); + if ($(this).hasClass("popover-subtask-restriction")) { + Kanboard.OpenPopover($(this).attr('href')); + $(_this).tooltip('close'); + } + else { + $.get($(this).attr('href'), setTooltipContent); + } }); }); |