Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
240d8c8d
Commit
240d8c8d
authored
Jan 25, 2017
by
Phil Hughes
Committed by
Fatih Acet
Feb 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created a modal store
parent
acd86c12
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
98 additions
and
73 deletions
+98
-73
app/assets/javascripts/boards/components/modal/dismiss.js.es6
...assets/javascripts/boards/components/modal/dismiss.js.es6
+2
-2
app/assets/javascripts/boards/components/modal/footer.js.es6
app/assets/javascripts/boards/components/modal/footer.js.es6
+8
-10
app/assets/javascripts/boards/components/modal/header.js.es6
app/assets/javascripts/boards/components/modal/header.js.es6
+2
-2
app/assets/javascripts/boards/components/modal/list.js.es6
app/assets/javascripts/boards/components/modal/list.js.es6
+12
-30
app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6
...javascripts/boards/components/modal/lists_dropdown.js.es6
+1
-1
app/assets/javascripts/boards/components/modal/modal.es6
app/assets/javascripts/boards/components/modal/modal.es6
+3
-4
app/assets/javascripts/boards/components/modal/search.js.es6
app/assets/javascripts/boards/components/modal/search.js.es6
+4
-21
app/assets/javascripts/boards/components/modal/tabs.js.es6
app/assets/javascripts/boards/components/modal/tabs.js.es6
+3
-3
app/assets/javascripts/boards/stores/modal_store.js.es6
app/assets/javascripts/boards/stores/modal_store.js.es6
+63
-0
No files found.
app/assets/javascripts/boards/components/modal/dismiss.js.es6
View file @
240d8c8d
/* global Vue */
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.DismissModal = Vue.extend({
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
methods: {
toggleModal(toggle) {
...
...
app/assets/javascripts/boards/components/modal/footer.js.es6
View file @
240d8c8d
//= require ./lists_dropdown
/* global Vue */
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalFooter = Vue.extend({
data() {
return {
store: Store.modal,
};
return ModalStore.globalStore;
},
computed: {
submitDisabled() {
return !
Store.modalS
electedCount();
return !
ModalStore.s
electedCount();
},
submitText() {
const count =
Store.modalS
electedCount();
const count =
ModalStore.s
electedCount();
return `Add ${count} issue${count > 1 || !count ? 's' : ''}`;
},
},
methods: {
hideModal() {
this.s
tore.s
howAddIssuesModal = false;
this.showAddIssuesModal = false;
},
addIssues() {
const list = this.s
tore.s
electedList;
const issueIds = this.s
tore.s
electedIssues.map(issue => issue.id);
const list = this.selectedList;
const issueIds = this.selectedIssues.map(issue => issue.id);
// Post the data to the backend
gl.boardService.addMultipleIssues(list, issueIds);
// Add the issues on the frontend
issueIds.forEach((id) => {
const issue = this.
store.issues.filter(issue => issue.id
== id)[0];
const issue = this.
issues.filter(fIssue => fIssue.id =
== id)[0];
list.addIssue(issue);
list.issuesSize += 1;
});
...
...
app/assets/javascripts/boards/components/modal/header.js.es6
View file @
240d8c8d
...
...
@@ -3,14 +3,14 @@
//= require ./search
/* global Vue */
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.IssuesModalHeader = Vue.extend({
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
components: {
'modal-dismiss': gl.issueBoards.DismissModal,
...
...
app/assets/javascripts/boards/components/modal/list.js.es6
View file @
240d8c8d
...
...
@@ -3,38 +3,27 @@
/* global Masonry */
(() => {
let listMasonry;
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalList = Vue.extend({
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
watch: {
activeTab() {
this.$nextTick(() => {
this.destroyMasonry();
this.initMasonry();
});
this.initMasonry();
},
issues: {
handler() {
this.$nextTick(() => {
listMasonry.layout();
});
this.initMasonry();
},
deep: true,
}
}
,
},
computed: {
loading() {
return this.issues.length === 0;
},
selectedCount() {
return Store.modalSelectedCount();
},
loopIssues() {
if (this.activeTab === 'all') {
return this.issues;
...
...
@@ -44,31 +33,24 @@
},
},
methods: {
toggleIssue(issueObj) {
const issue = issueObj;
issue.selected = !issue.selected;
if (issue.selected) {
this.selectedIssues.push(issue);
} else {
// Remove this issue
const index = this.selectedIssues.indexOf(issue);
this.selectedIssues.splice(index, 1);
}
},
toggleIssue: ModalStore.toggleIssue.bind(ModalStore),
showIssue(issue) {
if (this.activeTab === 'all') return true;
return issue.selected;
},
initMasonry() {
listMasonry = new Masonry(this.$refs.list, {
transitionDuration: 0,
this.$nextTick(() => {
this.destroyMasonry();
listMasonry = new Masonry(this.$refs.list, {
transitionDuration: 0,
});
});
},
destroyMasonry() {
if (listMasonry) {
listMasonry.destroy();
listMasonry = undefined;
}
},
},
...
...
app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6
View file @
240d8c8d
...
...
@@ -10,7 +10,7 @@
return {
modal: Store.modal,
state: Store.state,
}
}
;
},
computed: {
selected() {
...
...
app/assets/javascripts/boards/components/modal/modal.es6
View file @
240d8c8d
...
...
@@ -3,14 +3,14 @@
//= require ./footer
/* global Vue */
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.IssuesModal = Vue.extend({
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
watch: {
searchTerm() {
...
...
@@ -38,8 +38,7 @@
this.issues = [];
data.forEach((issueObj) => {
const issue = new ListIssue(issueObj);
const foundSelectedIssue = this.selectedIssues
.filter(filteredIssue => filteredIssue.id === issue.id)[0];
const foundSelectedIssue = ModalStore.findSelectedIssue(issue);
issue.selected = foundSelectedIssue !== undefined;
this.issues.push(issue);
...
...
app/assets/javascripts/boards/components/modal/search.js.es6
View file @
240d8c8d
/* global Vue */
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalSearch = Vue.extend({
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
computed: {
selectAllText() {
if (
Store.modalS
electedCount() !== this.issues.length || this.issues.length === 0) {
if (
ModalStore.s
electedCount() !== this.issues.length || this.issues.length === 0) {
return 'Select all';
}
...
...
@@ -19,24 +19,7 @@
},
},
methods: {
toggleAll() {
const select = Store.modalSelectedCount() !== this.issues.length;
this.issues.forEach((issue) => {
const issueUpdate = issue;
if (issueUpdate.selected !== select) {
issueUpdate.selected = select;
if (select) {
this.selectedIssues.push(issueUpdate);
} else {
const index = this.selectedIssues.indexOf(issue);
this.selectedIssues.splice(index, 1);
}
}
});
},
toggleAll: ModalStore.toggleAll.bind(ModalStore),
},
template: `
<div
...
...
app/assets/javascripts/boards/components/modal/tabs.js.es6
View file @
240d8c8d
/* global Vue */
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalTabs = Vue.extend({
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
methods: {
changeTab(tab) {
...
...
@@ -16,7 +16,7 @@
},
computed: {
selectedCount() {
return
Store.modalS
electedCount();
return
ModalStore.s
electedCount();
},
},
destroyed() {
...
...
app/assets/javascripts/boards/stores/modal_store.js.es6
0 → 100644
View file @
240d8c8d
(() => {
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
class ModalStore {
constructor() {
this.globalStore = gl.issueBoards.BoardsStore.modal;
}
selectedCount() {
return this.globalStore.selectedIssues.length;
}
toggleIssue(issueObj) {
const issue = issueObj;
issue.selected = !issue.selected;
if (issue.selected) {
this.addSelectedIssue(issue);
} else {
this.removeSelectedIssue(issue);
}
}
toggleAll() {
const select = this.selectedCount() !== this.globalStore.issues.length;
this.globalStore.issues.forEach((issue) => {
const issueUpdate = issue;
if (issueUpdate.selected !== select) {
issueUpdate.selected = select;
if (select) {
this.addSelectedIssue(issue);
} else {
this.removeSelectedIssue(issue);
}
}
});
}
addSelectedIssue(issue) {
this.globalStore.selectedIssues.push(issue);
}
removeSelectedIssue(issue) {
const index = this.selectedIssueIndex(issue);
this.globalStore.selectedIssues.splice(index, 1);
}
selectedIssueIndex(issue) {
return this.globalStore.selectedIssues.indexOf(issue);
}
findSelectedIssue(issue) {
return this.globalStore.selectedIssues
.filter(filteredIssue => filteredIssue.id === issue.id)[0];
}
}
gl.issueBoards.ModalStore = new ModalStore();
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment