diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-16 23:28:02 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-16 23:28:02 -0500 |
commit | 2c68efac3ae754c0d8162bf59eb1be30e1188902 (patch) | |
tree | 0c9a40d74e36eee98bf732667a2d4cf83cbd27da | |
parent | 0db66953a78b704e3710b970ab11b87058bb3859 (diff) |
Add chosen multiple select for due date and recent filters
-rw-r--r-- | app/Locale/da_DK/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/de_DE/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/es_ES/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/fi_FI/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/fr_FR/translations.php | 5 | ||||
-rw-r--r-- | app/Locale/hu_HU/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/it_IT/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/ja_JP/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/pl_PL/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/pt_BR/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/ru_RU/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/sv_SE/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/th_TH/translations.php | 1 | ||||
-rw-r--r-- | app/Locale/zh_CN/translations.php | 1 | ||||
-rw-r--r-- | app/Template/board/filters.php | 13 | ||||
-rw-r--r-- | assets/js/app.js | 12 | ||||
-rw-r--r-- | assets/js/src/board.js | 32 |
17 files changed, 38 insertions, 37 deletions
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index ef4a8f7e..75f27a7c 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index b5a7bcf7..cb05e2f7 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 91a1df15..3981f12d 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index f0a28cdb..06b21953 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 16ef8272..d04005c3 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -278,7 +278,7 @@ return array( 'Remember Me' => 'Connexion automatique', 'Creation date' => 'Date de création', 'Filter by user' => 'Filtrer par utilisateur', - 'Filter by due date' => 'Filtrer par date d\'échéance', + 'Filter by due date' => 'Avec une date d\'échéance', 'Everybody' => 'Tout le monde', 'Open' => 'Ouvert', 'Closed' => 'Fermé', @@ -733,6 +733,7 @@ return array( 'Keyboard shortcuts' => 'Raccourcis clavier', 'Open board switcher' => 'Ouvrir le sélecteur de tableau', 'Application' => 'Application', - 'Filter recently updated' => 'Filtrer récents', + 'Filter recently updated' => 'Récemment modifié', 'since %B %e, %Y at %k:%M %p' => 'depuis le %d/%m/%Y à %H:%M', + 'More filters' => 'Plus de filtres', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index e08154fb..1780505f 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 34b65c9d..525c828b 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 532c5605..90af6a02 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 38b83e04..c6becf4c 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 38ea9c42..5e579c4e 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 0b020cc1..02a66b56 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 29ddf9cc..2fcc3ce5 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 1a8d8191..1945f043 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 63f2b05f..cd1e2ebe 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -733,4 +733,5 @@ return array( // 'Application' => '', // 'Filter recently updated' => '', // 'since %B %e, %Y at %k:%M %p' => '', + // 'More filters' => '', ); diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php index fee8176c..31d647f6 100644 --- a/app/Template/board/filters.php +++ b/app/Template/board/filters.php @@ -49,16 +49,17 @@ </ul> </li> <li> - <?= $this->formSelect('user_id', $users, array(), array(), array('data-placeholder="'.t('Filter by user').'"')) ?> + <?= $this->formSelect('user_id', $users, array(), array(), array('data-placeholder="'.t('Filter by user').'"'), 'apply-filters chosen-select') ?> </li> <li> - <?= $this->formSelect('category_id', $categories, array(), array(), array('data-placeholder="'.t('Filter by category').'"')) ?> + <?= $this->formSelect('category_id', $categories, array(), array(), array('data-placeholder="'.t('Filter by category').'"'), 'apply-filters chosen-select') ?> </li> <li> - <a href="#" id="filter-due-date"><?= t('Filter by due date') ?></a> - </li> - <li> - <a href="#" id="filter-recent"><?= t('Filter recently updated') ?></a> + <select id="more-filters" multiple data-placeholder="<?= t('More filters') ?>" class="apply-filters chosen-select"> + <option value=""></option> + <option value="filter-due-date"><?= t('Filter by due date') ?></option> + <option value="filter-recent"><?= t('Filter recently updated') ?></option> + </select> </li> </ul> </div>
\ No newline at end of file diff --git a/assets/js/app.js b/assets/js/app.js index 8067e16c..1a743b64 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -145,14 +145,14 @@ $(this).attr("title")+"</div>"}});$.datepicker.setDefaults($.datepicker.regional $(".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")});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){n(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", +(Kanboard.GetStorageItem(d())||"expanded")?f():e()}function h(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){n(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 p(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"),p)})});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(m,1E3*b))}function n(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();h();g()}})}function m(){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();h();g()}}})}function h(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#filter-recent").hasClass("filter-on"),e=$("#board").data("project-id");$("[data-task-id]").each(function(e,g){var f=g.getAttribute("data-owner-id"),k=g.getAttribute("data-due-date"),h=g.getAttribute("data-category-id"),m=g.matches(".task-board-recent"); -g.style.display=f!=a&&-1!=a?"none":"block";!c||""!=k&&"0"!=k||(g.style.display="none");h!=b&&-1!=b&&(g.style.display="none");d&&!m&&(g.style.display="none")});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);Kanboard.SetStorageItem("board_filter_"+e+"_filter-recent",~~d)}function q(){var a=$("#board").data("project-id");$("#form-user_id").chosen({width:"180px"}); -$("#form-user_id").change(function(a){h()});$("#form-category_id").chosen({width:"200px"});$("#form-category_id").change(function(a){h()});$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");h();a.preventDefault()});$("#filter-recent").click(function(a){$(this).toggleClass("filter-on");h();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-user_id").trigger("chosen:updated");$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+ -a+"_form-category_id")||-1);$("#form-category_id").trigger("chosen:updated");+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");+Kanboard.GetStorageItem("board_filter_"+a+"_filter-recent")?$("#filter-recent").addClass("filter-on"):$("#filter-recent").removeClass("filter-on");h()}var l=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(k(),q(),b(),c())})}(); +$(b).tooltip("close")},100)});var b=parseInt($("#board").attr("data-check-interval"));0<b&&(l=window.setInterval(m,1E3*b))}function n(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();h();k();g()}})}function m(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"), +statusCode:{200:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();clearInterval(l);h();k();g()}}})}function k(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#more-filters option[value=filter-due-date]").is(":selected"),d=$("#more-filters option[value=filter-recent]").is(":selected"),e=$("#board").data("project-id");$("[data-task-id]").each(function(e,g){var f=g.getAttribute("data-owner-id"),h=g.getAttribute("data-due-date"),m=g.getAttribute("data-category-id"), +k=g.matches(".task-board-recent");g.style.display=f!=a&&-1!=a?"none":"block";!c||""!=h&&"0"!=h||(g.style.display="none");m!=b&&-1!=b&&(g.style.display="none");d&&!k&&(g.style.display="none")});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);Kanboard.SetStorageItem("board_filter_"+e+"_filter-recent",~~d)}function q(){var a=$("#board").data("project-id");$("#form-user_id").chosen({width:"180px"}); +$("#form-category_id").chosen({width:"200px"});$("#more-filters").chosen({width:"30%"});$(".apply-filters").change(function(a){k()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-user_id").trigger("chosen:updated");$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-category_id")||-1);$("#form-category_id").trigger("chosen:updated");+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")&&$("#more-filters option[value=filter-due-date]").attr("selected", +!0);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-recent")&&$("#more-filters option[value=filter-recent]").attr("selected",!0);$("#more-filters").trigger("chosen:updated");k()}var l=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(h(),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/board.js b/assets/js/src/board.js index cd1e0361..cd83fea3 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -272,8 +272,8 @@ Kanboard.Board = (function() { { var selectedUserId = $("#form-user_id").val(); var selectedCategoryId = $("#form-category_id").val(); - var filterDueDate = $("#filter-due-date").hasClass("filter-on"); - var filterRecent = $("#filter-recent").hasClass("filter-on"); + var filterDueDate = $("#more-filters option[value=filter-due-date]").is(":selected") + var filterRecent = $("#more-filters option[value=filter-recent]").is(":selected") var projectId = $('#board').data('project-id'); $("[data-task-id]").each(function(index, item) { @@ -319,28 +319,16 @@ Kanboard.Board = (function() { width: "180px" }); - $("#form-user_id").change(function(e) { - filter_apply(); - }); - $("#form-category_id").chosen({ width: "200px" }); - $("#form-category_id").change(function(e) { - filter_apply(); - }); - - $("#filter-due-date").click(function(e) { - $(this).toggleClass("filter-on"); - filter_apply(); - e.preventDefault(); + $("#more-filters").chosen({ + width: "30%" }); - $("#filter-recent").click(function(e) { - $(this).toggleClass("filter-on"); + $(".apply-filters").change(function(e) { filter_apply(); - e.preventDefault(); }); // Get and set filters from localStorage @@ -351,17 +339,15 @@ Kanboard.Board = (function() { $("#form-category_id").trigger("chosen:updated"); if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) { - $("#filter-due-date").addClass("filter-on"); - } else { - $("#filter-due-date").removeClass("filter-on"); + $("#more-filters option[value=filter-due-date]").attr("selected", true); } if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-recent")) { - $("#filter-recent").addClass("filter-on"); - } else { - $("#filter-recent").removeClass("filter-on"); + $("#more-filters option[value=filter-recent]").attr("selected", true); } + $("#more-filters").trigger("chosen:updated"); + filter_apply(); } |