diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/css/app.css | 1 | ||||
-rw-r--r-- | assets/css/src/task.css | 1 | ||||
-rw-r--r-- | assets/js/app.js | 24 | ||||
-rw-r--r-- | assets/js/src/base.js | 2 | ||||
-rw-r--r-- | assets/js/src/board.js | 2 | ||||
-rw-r--r-- | assets/js/vendor/mousetrap-global-bind.min.js | 1 |
6 files changed, 16 insertions, 15 deletions
diff --git a/assets/css/app.css b/assets/css/app.css index c29824fc..3b2ff459 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -939,7 +939,6 @@ span.task-board-date-overdue { position: absolute; right: 5px; top: 5px; - text-align: right; opacity: 0.5; font-size: 0.8em; } diff --git a/assets/css/src/task.css b/assets/css/src/task.css index 1b7a4233..7942d8d3 100644 --- a/assets/css/src/task.css +++ b/assets/css/src/task.css @@ -138,7 +138,6 @@ span.task-board-date-overdue { position: absolute; right: 5px; top: 5px; - text-align: right; opacity: 0.5; font-size: 0.8em; } diff --git a/assets/js/app.js b/assets/js/app.js index f9120460..558b3e0c 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -135,21 +135,23 @@ 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); +Mousetrap=function(a){var d={},e=a.stopCallback;a.stopCallback=function(b,c,a){return d[a]?!1:e(b,c,a)};a.bindGlobal=function(b,c,e){a.bind(b,c,e);if(b instanceof Array)for(c=0;c<b.length;c++)d[b[c]]=!0;else d[b]=!0};return a}(Mousetrap); var Kanboard=function(){jQuery(document).ready(function(){Kanboard.Init()});return{Exists:function(a){return document.getElementById(a)?!0:!1},Popover:function(a,c){a.preventDefault();a.stopPropagation();var b=a.target.getAttribute("href");b||(b=a.target.getAttribute("data-href"));b&&Kanboard.OpenPopover(b,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),b=$(this).closest("ul"),d=$(".write-area"),e=$(".preview-area"),f=$("textarea");$.ajax({url:"?controller=app&action=preview",contentType:"application/json",type:"POST",processData:!1,dataType:"html",data:JSON.stringify({text:f.val()})}).done(function(a){b.find("li").removeClass("form-tab-selected"); 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});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});window.setInterval(Kanboard.CheckSession,6E4);Mousetrap.bind("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>"}});$.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()}}}(); -Kanboard.Board=function(){function a(a){a.preventDefault();a.stopPropagation();Kanboard.Popover(a,Kanboard.InitAfterAjax)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.InitAfterAjax)});Mousetrap.bind("s",function(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?(e(),Kanboard.SetStorageItem(d(),"collapsed")):(f(),Kanboard.SetStorageItem(d(),"expanded"))})}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")});h()}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 h(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?f():e()}function k(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){m(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, -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 n(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"),n)})});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)});var b=parseInt($("#board").attr("data-check-interval"));0<b&&(l=window.setInterval(p,1E3*b))}function m(a,b,c,d){clearInterval(l);$.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:c}),success:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();k();g(); -h()}})}function p(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();clearInterval(l);k();g();h()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#board").data("project-id");$("[data-task-id]").each(function(d,e){var h=e.getAttribute("data-owner-id"),f=e.getAttribute("data-due-date"),k=e.getAttribute("data-category-id"); -e.style.opacity=h!=a&&-1!=a?"0.2":"1.0";!c||""!=f&&"0"!=f||(e.style.opacity="0.2");k!=b&&-1!=b&&(e.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+d+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+d+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+d+"_filter-due-date",~~c)}function q(){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 l=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(k(),q(),b(),c())})}(); +$("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.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>"}});$.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()}}}(); +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"))})}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")});h()}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 h(){"expanded"=== +(Kanboard.GetStorageItem(d())||"expanded")?f():e()}function k(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){m(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,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 n(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"),n)})});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)});var b=parseInt($("#board").attr("data-check-interval"));0<b&&(l=window.setInterval(p,1E3*b))}function m(a,b,c,d){clearInterval(l);$.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:c}),success:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();k();g();h()}})}function p(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"), +statusCode:{200:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();clearInterval(l);k();g();h()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#board").data("project-id");$("[data-task-id]").each(function(d,e){var h=e.getAttribute("data-owner-id"),f=e.getAttribute("data-due-date"),k=e.getAttribute("data-category-id");e.style.opacity=h!=a&&-1!=a?"0.2":"1.0";!c||""!=f&&"0"!=f||(e.style.opacity= +"0.2");k!=b&&-1!=b&&(e.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+d+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+d+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+d+"_filter-due-date",~~c)}function q(){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 l=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(k(),q(),b(),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(){var a=$("#user-calendar"),b=a.data("check-url"),c={start:a.fullCalendar("getView").start.format(),end:a.fullCalendar("getView").end.format(),user_id:a.data("user-id")},d;for(d in c)b+="&"+d+"="+c[d];$.getJSON(b,function(b){a.fullCalendar("removeEvents");a.fullCalendar("addEventSource", b);a.fullCalendar("rerenderEvents")})}function b(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 e in d)c+="&"+e+"="+d[e];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource",a);b.fullCalendar("rerenderEvents")})}function d(){var a=Kanboard.GetStorageItem(f);if(""!==a){var a=JSON.parse(a),c;for(c in a)$("select[name="+c+"]").val(a[c])}b(a||{});$(".calendar-filter").change(e)} function e(){var a={};$(".calendar-filter").each(function(){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(f,JSON.stringify(a));b(a)}var f="";jQuery(document).ready(function(){Kanboard.Exists("calendar")?(f="calendar_filters_"+$("#calendar").data("project-id"),$("#calendar").fullCalendar({lang:$("body").data("js-lang"),editable:!0,eventLimit:!0,defaultView:"month",header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"},viewRender:d,eventDrop:a}),d()):Kanboard.Exists("user-calendar")&& diff --git a/assets/js/src/base.js b/assets/js/src/base.js index d918e54a..75e04b3a 100644 --- a/assets/js/src/base.js +++ b/assets/js/src/base.js @@ -179,7 +179,7 @@ var Kanboard = (function() { window.setInterval(Kanboard.CheckSession, 60000); // Keyboard shortcuts - Mousetrap.bind("mod+enter", function() { + Mousetrap.bindGlobal("mod+enter", function() { $("form").submit(); }); diff --git a/assets/js/src/board.js b/assets/js/src/board.js index 74965b40..8e086c93 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -15,7 +15,7 @@ Kanboard.Board = (function() { Mousetrap.bind("n", function() { Kanboard.OpenPopover( - $(".task-creation-popover").attr('href'), + $("#board").data("task-creation-url"), Kanboard.InitAfterAjax ); }); diff --git a/assets/js/vendor/mousetrap-global-bind.min.js b/assets/js/vendor/mousetrap-global-bind.min.js new file mode 100644 index 00000000..636b25e0 --- /dev/null +++ b/assets/js/vendor/mousetrap-global-bind.min.js @@ -0,0 +1 @@ +Mousetrap=function(a){var d={},e=a.stopCallback;a.stopCallback=function(b,c,a){return d[a]?!1:e(b,c,a)};a.bindGlobal=function(b,c,e){a.bind(b,c,e);if(b instanceof Array)for(c=0;c<b.length;c++)d[b[c]]=!0;else d[b]=!0};return a}(Mousetrap); |