summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-01-31 11:48:43 +0000
committerPhil Hughes <me@iamphill.com>2017-02-03 18:03:40 +0000
commit4652b08f19fb1dcdea5f062cb3be017518192a34 (patch)
treef6d49eb07e573ac62719ba6b26b149a9c9f07ec8 /app/assets
parent9e4335363c9e7d2ea758c9c601314b88534dc9ae (diff)
downloadgitlab-ce-4652b08f19fb1dcdea5f062cb3be017518192a34.tar.gz
Hardcoded author, assignee & milestone dropdowns
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/boards/components/modal/filters.js.es699
-rw-r--r--app/assets/javascripts/boards/components/modal/index.js.es613
-rw-r--r--app/assets/javascripts/boards/stores/modal_store.js.es65
-rw-r--r--app/assets/javascripts/milestone_select.js4
-rw-r--r--app/assets/javascripts/users_select.js4
5 files changed, 118 insertions, 7 deletions
diff --git a/app/assets/javascripts/boards/components/modal/filters.js.es6 b/app/assets/javascripts/boards/components/modal/filters.js.es6
index f36d3c9ffe6..3a4d2675acb 100644
--- a/app/assets/javascripts/boards/components/modal/filters.js.es6
+++ b/app/assets/javascripts/boards/components/modal/filters.js.es6
@@ -1,36 +1,129 @@
/* global Vue */
+/* global UsersSelect */
+/* global MilestoneSelect */
(() => {
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalFilters = Vue.extend({
+ computed: {
+ currentUsername() {
+ return gon.current_username;
+ },
+ },
+ mounted() {
+ new UsersSelect();
+ new MilestoneSelect();
+ },
template: `
<div class="modal-filters">
<div class="dropdown">
<button
class="dropdown-menu-toggle js-user-search js-author-search"
type="button"
- data-toggle="dropdown">
+ data-toggle="dropdown"
+ data-any-user="Any Author"
+ data-current-user="true"
+ data-field-name="author_id"
+ :data-project-id="12"
+ :data-first-user="currentUsername">
Author
<i class="fa fa-chevron-down"></i>
</button>
+ <div class="dropdown-menu dropdown-select dropdown-menu-user dropdown-menu-selectable dropdown-menu-author">
+ <div class="dropdown-title">
+ <span>Filter by author</span>
+ <button
+ class="dropdown-title-button dropdown-menu-close"
+ aria-label="Close"
+ type="button">
+ <i class="fa fa-times dropdown-menu-close-icon"></i>
+ </button>
+ </div>
+ <div class="dropdown-input">
+ <input
+ type="search"
+ class="dropdown-input-field"
+ placeholder="Search authors"
+ autocomplete="off" />
+ <i class="fa fa-search dropdown-input-search"></i>
+ <i role="button" class="fa fa-times dropdown-input-clear js-dropdown-input-clear"></i>
+ </div>
+ <div class="dropdown-content"></div>
+ <div class="dropdown-loading"><i class="fa fa-spinner fa-spin"></i></div>
+ </div>
</div>
<div class="dropdown">
<button
class="dropdown-menu-toggle js-user-search js-assignee-search"
type="button"
- data-toggle="dropdown">
+ data-toggle="dropdown"
+ data-any-user="Any Assignee"
+ data-null-user="true"
+ data-current-user="true"
+ data-field-name="assignee_id"
+ :data-project-id="12"
+ :data-first-user="currentUsername">
Assignee
<i class="fa fa-chevron-down"></i>
</button>
+ <div class="dropdown-menu dropdown-select dropdown-menu-user dropdown-menu-selectable dropdown-menu-author">
+ <div class="dropdown-title">
+ <span>Filter by assignee</span>
+ <button
+ class="dropdown-title-button dropdown-menu-close"
+ aria-label="Close"
+ type="button">
+ <i class="fa fa-times dropdown-menu-close-icon"></i>
+ </button>
+ </div>
+ <div class="dropdown-input">
+ <input
+ type="search"
+ class="dropdown-input-field"
+ placeholder="Search assignee"
+ autocomplete="off" />
+ <i class="fa fa-search dropdown-input-search"></i>
+ <i role="button" class="fa fa-times dropdown-input-clear js-dropdown-input-clear"></i>
+ </div>
+ <div class="dropdown-content"></div>
+ <div class="dropdown-loading"><i class="fa fa-spinner fa-spin"></i></div>
+ </div>
</div>
<div class="dropdown">
<button
class="dropdown-menu-toggle js-milestone-select"
type="button"
- data-toggle="dropdown">
+ data-toggle="dropdown"
+ data-show-any="true"
+ data-show-upcoming="true"
+ data-field-name="milestone_title"
+ :data-project-id="12"
+ :data-milestones="'/root/test/milestones.json'">
Milestone
<i class="fa fa-chevron-down"></i>
</button>
+ <div class="dropdown-menu dropdown-select dropdown-menu-selectable dropdown-menu-milestone">
+ <div class="dropdown-title">
+ <span>Filter by milestone</span>
+ <button
+ class="dropdown-title-button dropdown-menu-close"
+ aria-label="Close"
+ type="button">
+ <i class="fa fa-times dropdown-menu-close-icon"></i>
+ </button>
+ </div>
+ <div class="dropdown-input">
+ <input
+ type="search"
+ class="dropdown-input-field"
+ placeholder="Search milestones"
+ autocomplete="off" />
+ <i class="fa fa-search dropdown-input-search"></i>
+ <i role="button" class="fa fa-times dropdown-input-clear js-dropdown-input-clear"></i>
+ </div>
+ <div class="dropdown-content"></div>
+ <div class="dropdown-loading"><i class="fa fa-spinner fa-spin"></i></div>
+ </div>
</div>
<div class="dropdown">
<button
diff --git a/app/assets/javascripts/boards/components/modal/index.js.es6 b/app/assets/javascripts/boards/components/modal/index.js.es6
index 666f4e16793..5bcbd2668af 100644
--- a/app/assets/javascripts/boards/components/modal/index.js.es6
+++ b/app/assets/javascripts/boards/components/modal/index.js.es6
@@ -50,17 +50,26 @@
this.issuesCount = false;
}
},
+ filter: {
+ handler() {
+ this.issues = [];
+ this.loadIssues();
+ },
+ deep: true,
+ }
},
methods: {
searchOperation: _.debounce(function searchOperationDebounce() {
this.loadIssues(true);
}, 500),
loadIssues(clearIssues = false) {
- return gl.boardService.getBacklog({
+ const data = Object.assign({}, this.filter, {
search: this.searchTerm,
page: this.page,
per: this.perPage,
- }).then((res) => {
+ });
+
+ return gl.boardService.getBacklog(data).then((res) => {
const data = res.json();
if (clearIssues) {
diff --git a/app/assets/javascripts/boards/stores/modal_store.js.es6 b/app/assets/javascripts/boards/stores/modal_store.js.es6
index 73518b42b84..95b0b3f9484 100644
--- a/app/assets/javascripts/boards/stores/modal_store.js.es6
+++ b/app/assets/javascripts/boards/stores/modal_store.js.es6
@@ -17,6 +17,11 @@
loadingNewPage: false,
page: 1,
perPage: 50,
+ filter: {
+ author_id: '',
+ assignee_id: '',
+ milestone_title: '',
+ },
};
}
diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js
index 7ab39ffbd05..f7e1f4a0816 100644
--- a/app/assets/javascripts/milestone_select.js
+++ b/app/assets/javascripts/milestone_select.js
@@ -116,7 +116,9 @@
e.preventDefault();
return;
}
- if ($('html').hasClass('issue-boards-page') && !$dropdown.hasClass('js-issue-board-sidebar')) {
+ if ($el.closest('.add-issues-modal').length) {
+ gl.issueBoards.ModalStore.store.filter[$dropdown.data('field-name')] = selected.name;
+ } else if ($('html').hasClass('issue-boards-page') && !$dropdown.hasClass('js-issue-board-sidebar')) {
gl.issueBoards.BoardsStore.state.filters[$dropdown.data('field-name')] = selected.name;
gl.issueBoards.BoardsStore.updateFiltersUrl();
e.preventDefault();
diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js
index 77d2764cdf0..8ad0aa7aee8 100644
--- a/app/assets/javascripts/users_select.js
+++ b/app/assets/javascripts/users_select.js
@@ -193,7 +193,9 @@
selectedId = user.id;
return;
}
- if ($('html').hasClass('issue-boards-page') && !$dropdown.hasClass('js-issue-board-sidebar')) {
+ if ($el.closest('.add-issues-modal').length) {
+ gl.issueBoards.ModalStore.store.filter[$dropdown.data('field-name')] = user.id;
+ } else if ($('html').hasClass('issue-boards-page') && !$dropdown.hasClass('js-issue-board-sidebar')) {
selectedId = user.id;
gl.issueBoards.BoardsStore.state.filters[$dropdown.data('field-name')] = user.id;
gl.issueBoards.BoardsStore.updateFiltersUrl();