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
1
Merge Requests
1
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
nexedi
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
Show 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 */
/* global Vue */
(() => {
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.DismissModal = Vue.extend({
gl.issueBoards.DismissModal = Vue.extend({
data() {
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
},
methods: {
methods: {
toggleModal(toggle) {
toggleModal(toggle) {
...
...
app/assets/javascripts/boards/components/modal/footer.js.es6
View file @
240d8c8d
//= require ./lists_dropdown
//= require ./lists_dropdown
/* global Vue */
/* global Vue */
(() => {
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalFooter = Vue.extend({
gl.issueBoards.ModalFooter = Vue.extend({
data() {
data() {
return {
return ModalStore.globalStore;
store: Store.modal,
};
},
},
computed: {
computed: {
submitDisabled() {
submitDisabled() {
return !
Store.modalS
electedCount();
return !
ModalStore.s
electedCount();
},
},
submitText() {
submitText() {
const count =
Store.modalS
electedCount();
const count =
ModalStore.s
electedCount();
return `Add ${count} issue${count > 1 || !count ? 's' : ''}`;
return `Add ${count} issue${count > 1 || !count ? 's' : ''}`;
},
},
},
},
methods: {
methods: {
hideModal() {
hideModal() {
this.s
tore.s
howAddIssuesModal = false;
this.showAddIssuesModal = false;
},
},
addIssues() {
addIssues() {
const list = this.s
tore.s
electedList;
const list = this.selectedList;
const issueIds = this.s
tore.s
electedIssues.map(issue => issue.id);
const issueIds = this.selectedIssues.map(issue => issue.id);
// Post the data to the backend
// Post the data to the backend
gl.boardService.addMultipleIssues(list, issueIds);
gl.boardService.addMultipleIssues(list, issueIds);
// Add the issues on the frontend
// Add the issues on the frontend
issueIds.forEach((id) => {
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.addIssue(issue);
list.issuesSize += 1;
list.issuesSize += 1;
});
});
...
...
app/assets/javascripts/boards/components/modal/header.js.es6
View file @
240d8c8d
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
//= require ./search
//= require ./search
/* global Vue */
/* global Vue */
(() => {
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.IssuesModalHeader = Vue.extend({
gl.issueBoards.IssuesModalHeader = Vue.extend({
data() {
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
},
components: {
components: {
'modal-dismiss': gl.issueBoards.DismissModal,
'modal-dismiss': gl.issueBoards.DismissModal,
...
...
app/assets/javascripts/boards/components/modal/list.js.es6
View file @
240d8c8d
...
@@ -3,38 +3,27 @@
...
@@ -3,38 +3,27 @@
/* global Masonry */
/* global Masonry */
(() => {
(() => {
let listMasonry;
let listMasonry;
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalList = Vue.extend({
gl.issueBoards.ModalList = Vue.extend({
data() {
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
},
watch: {
watch: {
activeTab() {
activeTab() {
this.$nextTick(() => {
this.destroyMasonry();
this.initMasonry();
this.initMasonry();
});
},
},
issues: {
issues: {
handler() {
handler() {
this.$nextTick(() => {
this.initMasonry();
listMasonry.layout();
});
},
},
deep: true,
deep: true,
}
},
computed: {
loading() {
return this.issues.length === 0;
},
},
selectedCount() {
return Store.modalSelectedCount();
},
},
computed: {
loopIssues() {
loopIssues() {
if (this.activeTab === 'all') {
if (this.activeTab === 'all') {
return this.issues;
return this.issues;
...
@@ -44,31 +33,24 @@
...
@@ -44,31 +33,24 @@
},
},
},
},
methods: {
methods: {
toggleIssue(issueObj) {
toggleIssue: ModalStore.toggleIssue.bind(ModalStore),
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);
}
},
showIssue(issue) {
showIssue(issue) {
if (this.activeTab === 'all') return true;
if (this.activeTab === 'all') return true;
return issue.selected;
return issue.selected;
},
},
initMasonry() {
initMasonry() {
this.$nextTick(() => {
this.destroyMasonry();
listMasonry = new Masonry(this.$refs.list, {
listMasonry = new Masonry(this.$refs.list, {
transitionDuration: 0,
transitionDuration: 0,
});
});
});
},
},
destroyMasonry() {
destroyMasonry() {
if (listMasonry) {
if (listMasonry) {
listMasonry.destroy();
listMasonry.destroy();
listMasonry = undefined;
}
}
},
},
},
},
...
...
app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6
View file @
240d8c8d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
return {
return {
modal: Store.modal,
modal: Store.modal,
state: Store.state,
state: Store.state,
}
}
;
},
},
computed: {
computed: {
selected() {
selected() {
...
...
app/assets/javascripts/boards/components/modal/modal.es6
View file @
240d8c8d
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
//= require ./footer
//= require ./footer
/* global Vue */
/* global Vue */
(() => {
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.IssuesModal = Vue.extend({
gl.issueBoards.IssuesModal = Vue.extend({
data() {
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
},
watch: {
watch: {
searchTerm() {
searchTerm() {
...
@@ -38,8 +38,7 @@
...
@@ -38,8 +38,7 @@
this.issues = [];
this.issues = [];
data.forEach((issueObj) => {
data.forEach((issueObj) => {
const issue = new ListIssue(issueObj);
const issue = new ListIssue(issueObj);
const foundSelectedIssue = this.selectedIssues
const foundSelectedIssue = ModalStore.findSelectedIssue(issue);
.filter(filteredIssue => filteredIssue.id === issue.id)[0];
issue.selected = foundSelectedIssue !== undefined;
issue.selected = foundSelectedIssue !== undefined;
this.issues.push(issue);
this.issues.push(issue);
...
...
app/assets/javascripts/boards/components/modal/search.js.es6
View file @
240d8c8d
/* global Vue */
/* global Vue */
(() => {
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalSearch = Vue.extend({
gl.issueBoards.ModalSearch = Vue.extend({
data() {
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
},
computed: {
computed: {
selectAllText() {
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';
return 'Select all';
}
}
...
@@ -19,24 +19,7 @@
...
@@ -19,24 +19,7 @@
},
},
},
},
methods: {
methods: {
toggleAll() {
toggleAll: ModalStore.toggleAll.bind(ModalStore),
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);
}
}
});
},
},
},
template: `
template: `
<div
<div
...
...
app/assets/javascripts/boards/components/modal/tabs.js.es6
View file @
240d8c8d
/* global Vue */
/* global Vue */
(() => {
(() => {
const
Store = gl.issueBoards.Boards
Store;
const
ModalStore = gl.issueBoards.Modal
Store;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.ModalTabs = Vue.extend({
gl.issueBoards.ModalTabs = Vue.extend({
data() {
data() {
return
Store.modal
;
return
ModalStore.globalStore
;
},
},
methods: {
methods: {
changeTab(tab) {
changeTab(tab) {
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
},
},
computed: {
computed: {
selectedCount() {
selectedCount() {
return
Store.modalS
electedCount();
return
ModalStore.s
electedCount();
},
},
},
},
destroyed() {
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