diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-03-12 21:21:24 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-03-12 21:21:24 -0400 |
commit | 925ede9b48bef67739d26f0d0a394342f2d8edf0 (patch) | |
tree | d2ce47cb3793f8e64831ff7e04b3cddb35dcc498 /assets/js | |
parent | ac19e36b55b566f61d750e801134396fd4d3fada (diff) | |
parent | b747b9750b697b863fcadbbbeb0ed94220e57961 (diff) |
Merge and improve pull-request #704
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/app.js | 4 | ||||
-rw-r--r-- | assets/js/src/base.js | 15 | ||||
-rw-r--r-- | assets/js/src/task.js | 22 |
3 files changed, 17 insertions, 24 deletions
diff --git a/assets/js/app.js b/assets/js/app.js index 7a3a6c96..d5733ed9 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -142,7 +142,8 @@ return""!=a?"visible"==document[a]:!0},SetStorageItem:function(a,c){"undefined"! c.parent().addClass("form-tab-selected");e.find(".markdown").html(a);e.css("height",f.css("height"));e.css("width",f.css("width"));d.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(){window.location= $("body").data("login-url")}}})},Init:function(){$("#board-selector").chosen({width:180,no_results_text:$("#board-selector").data("notfound")});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});window.setInterval(Kanboard.CheckSession,6E4);Mousetrap.bindGlobal("mod+enter",function(){$("form").submit()});Mousetrap.bind("b",function(a){a.preventDefault();$("#board-selector").trigger("chosen:open")});$(".column-tooltip").tooltip({content:function(){return'<div class="markdown">'+ $(this).attr("title")+"</div>"},position:{my:"left-20 top",at:"center bottom+9",using:function(a,c){$(this).css(a);var b=c.target.left+c.target.width/2-c.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(c.vertical).addClass(0==b?"align-left":"align-right").appendTo(this)}}});$.datepicker.setDefaults($.datepicker.regional[$("body").data("js-lang")]);Kanboard.InitAfterAjax()},InitAfterAjax:function(){$(document).on("click",".popover",Kanboard.Popover);$(".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({triggerParentEl:"span"})}}}(); +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({triggerParentEl:"span"});$(".task-autocomplete").length&&($(".task-autocomplete").parent().find("input[type=submit]").attr("disabled","disabled"),$(".task-autocomplete").autocomplete({source:$(".task-autocomplete").data("search-url"), +minLength:2,select:function(a,c){var b=$(".task-autocomplete").data("dst-field");$("input[name="+b+"]").val(c.item.id);$(".task-autocomplete").parent().find("input[type=submit]").removeAttr("disabled")}}))}}}(); Kanboard.Board=function(){function a(a){a.preventDefault();a.stopPropagation();Kanboard.Popover(a,Kanboard.InitAfterAjax)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($("#board").data("task-creation-url"),Kanboard.InitAfterAjax)});Mousetrap.bind("s",function(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?(e(),Kanboard.SetStorageItem(d(),"collapsed")):(f(),Kanboard.SetStorageItem(d(),"expanded"))});Mousetrap.bind("c",function(){p()})}function b(){$(".filter-expand-link").click(function(a){a.preventDefault(); f();Kanboard.SetStorageItem(d(),"expanded")});$(".filter-collapse-link").click(function(a){a.preventDefault();e();Kanboard.SetStorageItem(d(),"collapsed")});g()}function d(){return"board_stacking_"+$("#board").data("project-id")}function e(){$(".filter-collapse").hide();$(".task-board-collapsed").show();$(".filter-expand").show();$(".task-board-expanded").hide()}function f(){$(".filter-collapse").show();$(".task-board-collapsed").hide();$(".filter-expand").hide();$(".task-board-expanded").show()} function g(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?f():e()}function k(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){q(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$("#board").on("click",".task-board-popover",a);$("#board").on("click",".task-board",function(){window.location=$(this).data("task-url")});$(".task-board-tooltip").tooltip({track:!1, @@ -163,7 +164,6 @@ Kanboard.Analytic=function(){jQuery(document).ready(function(){Kanboard.Exists(" Kanboard.Analytic.CFD=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var c=a.labels,b=a.columns,d=a.metrics;a=[];for(var e=0;e<d.length;e++){var f={};f[c.column]=d[e].column_title;f[c.day]=d[e].day;f[c.total]=d[e].total;a.push(f)}d=dimple.newSvg("#chart","100%",380);a=new dimple.chart(d,a);a.addCategoryAxis("x",c.day).addOrderRule("Date");a.addMeasureAxis("y",c.total);a.addSeries(c.column,dimple.plot.area).addOrderRule(b.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,b=a.metrics;a=[];for(var d=0;d<b.length;d++){var e={};e[c.nb_tasks]=b[d].nb_tasks;e[c.column_title]=b[d].column_title;a.push(e)}b=dimple.newSvg("#chart","100%",350);a=new dimple.chart(b,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,b=a.metrics;a=[];for(var d=0;d<b.length;d++){var e={};e[c.nb_tasks]=b[d].nb_tasks;e[c.user]=b[d].user;a.push(e)}b=dimple.newSvg("#chart","100%",350);a=new dimple.chart(b,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()})}}}(); -Kanboard.Task=function(){jQuery(document).ready(function(){$(".task-autocomplete").length&&($("input[type=submit]").attr("disabled","disabled"),$(".task-autocomplete").autocomplete({source:$(".task-autocomplete").data("search-url"),minLength:2,select:function(a,c){var b=$(".task-autocomplete").data("dst-field");$("input[name="+b+"]").val(c.item.id);$("input[type=submit]").removeAttr("disabled")}}))})}(); 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 c(){var a="hidden_swimlanes_"+$("#board").data("project-id");return JSON.parse(Kanboard.GetStorageItem(a))||[]}jQuery(document).ajaxComplete(function(){c().map(function(b){a(b)})});jQuery(document).ready(function(){c().map(function(b){a(b)})});jQuery(document).on("click",".board-swimlane-toggle",function(b){b.preventDefault(); b=$(this).data("swimlane-id");if(-1<c().indexOf(b)){var d="hidden_swimlanes_"+$("#board").data("project-id"),e=JSON.parse(Kanboard.GetStorageItem(d))||[],f=e.indexOf(b);-1<f&&e.splice(f,1);Kanboard.SetStorageItem(d,JSON.stringify(e));$(".swimlane-row-"+b).css("display","table-row");$(".show-icon-swimlane-"+b).css("display","none");$(".hide-icon-swimlane-"+b).css("display","inline")}else d="hidden_swimlanes_"+$("#board").data("project-id"),e=JSON.parse(Kanboard.GetStorageItem(d))||[],e.push(b),Kanboard.SetStorageItem(d, JSON.stringify(e)),a(b)})}(); diff --git a/assets/js/src/base.js b/assets/js/src/base.js index 6e92eb31..05846ab8 100644 --- a/assets/js/src/base.js +++ b/assets/js/src/base.js @@ -242,6 +242,21 @@ var Kanboard = (function() { // Dropdown $(".dropit-submenu").hide(); $('.dropdown').not(".dropit").dropit({ triggerParentEl : "span" }); + + if ($(".task-autocomplete").length) { + $(".task-autocomplete").parent().find("input[type=submit]").attr('disabled','disabled'); + + $(".task-autocomplete").autocomplete({ + source: $(".task-autocomplete").data("search-url"), + minLength: 2, + select: function(event, ui) { + var field = $(".task-autocomplete").data("dst-field"); + $("input[name=" + field + "]").val(ui.item.id); + + $(".task-autocomplete").parent().find("input[type=submit]").removeAttr('disabled'); + } + }); + } } }; diff --git a/assets/js/src/task.js b/assets/js/src/task.js deleted file mode 100644 index 2caf81cc..00000000 --- a/assets/js/src/task.js +++ /dev/null @@ -1,22 +0,0 @@ -Kanboard.Task = (function() { - - jQuery(document).ready(function() { - - if ($(".task-autocomplete").length) { - - $("input[type=submit]").attr('disabled','disabled'); - - $(".task-autocomplete").autocomplete({ - source: $(".task-autocomplete").data("search-url"), - minLength: 2, - select: function(event, ui) { - var field = $(".task-autocomplete").data("dst-field"); - $("input[name=" + field + "]").val(ui.item.id); - - $("input[type=submit]").removeAttr('disabled'); - } - }); - } - }); - -})(); |