Commit e00b56d0 authored by Phil Hughes's avatar Phil Hughes

Correctly uses search query in backlog

parent ff5fd4eb
(() => { (() => {
const Board = Vue.extend({ const Board = Vue.extend({
props: { props: {
board: Object, list: Object,
disabled: Boolean disabled: Boolean
}, },
data: function () { data: function () {
return { return {
query: '',
filters: BoardsStore.state.filters filters: BoardsStore.state.filters
}; };
}, },
watch: { watch: {
'query': function () { 'query': function () {
if (this.board.canSearch()) { if (this.list.canSearch()) {
this.board.getIssues(true); this.list.filters = this.getFilterData();
this.list.getIssues(true);
} }
}, },
'filters': { 'filters': {
handler: function () { handler: function () {
this.board.getIssues(true); this.list.getIssues(true);
}, },
deep: true deep: true
} }
...@@ -27,14 +29,14 @@ ...@@ -27,14 +29,14 @@
this.query = ''; this.query = '';
}, },
getFilterData: function () { getFilterData: function () {
const queryData = this.board.canSearch() ? { search: this.query } : {}; const queryData = this.list.canSearch() ? { search: this.query } : {};
return _.extend(queryData, this.filters); return _.extend(queryData, this.filters);
} }
}, },
computed: { computed: {
isPreset: function () { isPreset: function () {
return this.board.type === 'backlog' || this.board.type === 'done' || this.board.type === 'blank'; return this.list.type === 'backlog' || this.list.type === 'done' || this.list.type === 'blank';
} }
}, },
ready: function () { ready: function () {
......
...@@ -113,7 +113,9 @@ ...@@ -113,7 +113,9 @@
} }
if (listTo.type === 'done' && listFrom.type !== 'backlog') { if (listTo.type === 'done' && listFrom.type !== 'backlog') {
_.each(issueLists, list.removeIssue.bind(list)); _.each(issueLists, function (list) {
list.removeIssue(issue);
});
issue.removeLabels(listLabels); issue.removeLabels(listLabels);
} else { } else {
listFrom.removeIssue(issue); listFrom.removeIssue(issue);
......
%board-blank-state{ "inline-template" => true, "v-if" => "board.id == 'blank'" } %board-blank-state{ "inline-template" => true,
"v-if" => "list.id == 'blank'" }
.board-blank-state .board-blank-state
%p %p
Add the following default lists to your Issue Board with one click: Add the following default lists to your Issue Board with one click:
......
%board{ "inline-template" => true, %board{ "inline-template" => true,
"v-cloak" => true, "v-cloak" => true,
"v-for" => "board in state.lists | orderBy 'position'", "v-for" => "list in state.lists | orderBy 'position'",
":board" => "board", ":list" => "list",
":disabled" => "#{current_user.nil?}" } ":disabled" => "#{current_user.nil?}" }
.board{ ":class" => "{ 'is-draggable': !isPreset }" } .board{ ":class" => "{ 'is-draggable': !isPreset }" }
.board-inner .board-inner
%header.board-header{ ":class" => "{ 'has-border': board.label }", ":style" => "{ borderTopColor: (board.label ? board.label.color : null) }" } %header.board-header{ ":class" => "{ 'has-border': list.label }", ":style" => "{ borderTopColor: (list.label ? list.label.color : null) }" }
%h3.board-title.js-board-handle{ ":class" => "{ 'user-can-drag': !disabled }" } %h3.board-title.js-board-handle{ ":class" => "{ 'user-can-drag': !disabled }" }
{{ board.title }} {{ list.title }}
%span.pull-right{ "v-if" => "board.type !== 'blank'" } %span.pull-right{ "v-if" => "list.type !== 'blank'" }
{{ board.issues.length }} {{ list.issues.length }}
- if current_user - if current_user
%board-delete{ "inline-template" => true, "v-if" => "!isPreset", ":board-id" => "board.id" } %board-delete{ "inline-template" => true, "v-if" => "!isPreset", ":board-id" => "list.id" }
%button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete list", "aria-label" => "Delete list", data: { placement: "bottom" }, "@click" => "deleteBoard" } %button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete list", "aria-label" => "Delete list", data: { placement: "bottom" }, "@click" => "deleteBoard" }
= icon("trash") = icon("trash")
.board-inner-container.board-search-container{ "v-if" => "board.canSearch()" } .board-inner-container.board-search-container{ "v-if" => "list.canSearch()" }
%input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query", "debounce" => "250" } %input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query", "debounce" => "250" }
= icon("search", class: "board-search-icon", "v-show" => "!query") = icon("search", class: "board-search-icon", "v-show" => "!query")
%button.board-search-clear-btn{ type: "button", role: "button", "aria-label" => "Clear search", "@click" => "clearSearch", "v-show" => "query" } %button.board-search-clear-btn{ type: "button", role: "button", "aria-label" => "Clear search", "@click" => "clearSearch", "v-show" => "query" }
= icon("times", class: "board-search-clear") = icon("times", class: "board-search-clear")
%board-list{ "inline-template" => true, %board-list{ "inline-template" => true,
"v-if" => "board.type !== 'blank'", "v-if" => "list.type !== 'blank'",
":list" => "board", ":list" => "list",
":issues" => "board.issues", ":issues" => "list.issues",
":loading" => "board.loading", ":loading" => "list.loading",
":disabled" => "disabled", ":disabled" => "disabled",
":issue-link-base" => "'#{namespace_project_issues_path(@project.namespace, @project)}'" } ":issue-link-base" => "'#{namespace_project_issues_path(@project.namespace, @project)}'" }
.board-list-loading.text-center{ "v-if" => "loading" } .board-list-loading.text-center{ "v-if" => "loading" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment