summaryrefslogtreecommitdiffstats
path: root/client/components
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-01-25 19:05:44 +0200
committerGitHub <noreply@github.com>2019-01-25 19:05:44 +0200
commit5d6203f5f99d02fc508015c0889977da55eff2f1 (patch)
tree3663d29721ea91df9546bef35cd3896d0fecb1cb /client/components
parent4a2576fbc200d397bcf7cede45316d9fb7e520dd (diff)
parent97d95b4bcbcab86629e368ea41bb9f00450b21f6 (diff)
downloadwekan-5d6203f5f99d02fc508015c0889977da55eff2f1.tar.gz
wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.tar.bz2
wekan-5d6203f5f99d02fc508015c0889977da55eff2f1.zip
Merge pull request #2128 from bentiss/color-lists
Color lists
Diffstat (limited to 'client/components')
-rw-r--r--client/components/boards/boardBody.js31
-rw-r--r--client/components/cards/cardDetails.js1
-rw-r--r--client/components/cards/minicard.js4
-rw-r--r--client/components/lists/list.styl95
-rw-r--r--client/components/lists/listHeader.jade16
-rw-r--r--client/components/lists/listHeader.js37
-rw-r--r--client/components/swimlanes/swimlaneHeader.jade23
-rw-r--r--client/components/swimlanes/swimlaneHeader.js74
-rw-r--r--client/components/swimlanes/swimlanes.jade48
-rw-r--r--client/components/swimlanes/swimlanes.js42
-rw-r--r--client/components/swimlanes/swimlanes.styl103
11 files changed, 373 insertions, 101 deletions
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js
index ccbd0f23..ae5b67fd 100644
--- a/client/components/boards/boardBody.js
+++ b/client/components/boards/boardBody.js
@@ -35,6 +35,37 @@ BlazeComponent.extendComponent({
this._isDragging = false;
// Used to set the overlay
this.mouseHasEnterCardDetails = false;
+
+ // fix swimlanes sort field if there are null values
+ const currentBoardData = Boards.findOne(Session.get('currentBoard'));
+ const nullSortSwimlanes = currentBoardData.nullSortSwimlanes();
+ if (nullSortSwimlanes.count() > 0) {
+ const swimlanes = currentBoardData.swimlanes();
+ let count = 0;
+ swimlanes.forEach((s) => {
+ Swimlanes.update(s._id, {
+ $set: {
+ sort: count,
+ },
+ });
+ count += 1;
+ });
+ }
+
+ // fix lists sort field if there are null values
+ const nullSortLists = currentBoardData.nullSortLists();
+ if (nullSortLists.count() > 0) {
+ const lists = currentBoardData.lists();
+ let count = 0;
+ lists.forEach((l) => {
+ Lists.update(l._id, {
+ $set: {
+ sort: count,
+ },
+ });
+ count += 1;
+ });
+ }
},
onRendered() {
const boardComponent = this;
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 04620084..79a686a7 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -27,7 +27,6 @@ BlazeComponent.extendComponent({
onCreated() {
this.currentBoard = Boards.findOne(Session.get('currentBoard'));
this.isLoaded = new ReactiveVar(false);
- this.currentColor = new ReactiveVar(this.data().color);
const boardBody = this.parentComponent().parentComponent();
//in Miniview parent is Board, not BoardBody.
if (boardBody !== null) {
diff --git a/client/components/cards/minicard.js b/client/components/cards/minicard.js
index e468ec56..da7f9e01 100644
--- a/client/components/cards/minicard.js
+++ b/client/components/cards/minicard.js
@@ -3,10 +3,6 @@
// });
BlazeComponent.extendComponent({
- onCreated() {
- this.currentColor = new ReactiveVar(this.data().color);
- },
-
template() {
return 'minicard';
},
diff --git a/client/components/lists/list.styl b/client/components/lists/list.styl
index 72cb19f4..c12a2c73 100644
--- a/client/components/lists/list.styl
+++ b/client/components/lists/list.styl
@@ -10,7 +10,6 @@
// transparent, because that won't work during a list drag.
background: darken(white, 13%)
border-left: 1px solid darken(white, 20%)
- border-bottom: 1px solid #CCC
padding: 0
float: left
@@ -44,12 +43,16 @@
background: white
margin: -3px 0 8px
+.list-header-card-count
+ height: 35px
+
.list-header
flex: 0 0 auto
- margin: 20px 12px 4px
+ padding: 20px 12px 4px
position: relative
min-height: 20px
+
&.ui-sortable-handle
cursor: grab
@@ -68,16 +71,17 @@
text-overflow: ellipsis
word-wrap: break-word
+
.list-header-watch-icon
padding-left: 10px
color: #a6a6a6
.list-header-menu
position: absolute
- padding: 7px
+ padding: 27px 19px
margin-top: 1px
- top: -@padding
- right: -@padding
+ top: -7px
+ right: -7px
.list-header-plus-icon
color: #a6a6a6
@@ -198,3 +202,84 @@
.search-card-results
max-height: 250px
overflow: hidden
+
+list-header-color(background, color...)
+ background: background !important
+ if color
+ color: color !important //overwrite text for better visibility
+
+.list-header-white
+ list-header-color(#ffffff, #4d4d4d) //Black text for better visibility
+ border: 1px solid #eee
+
+.list-header-green
+ list-header-color(#3cb500, #ffffff) //White text for better visibility
+
+.list-header-yellow
+ list-header-color(#fad900, #4d4d4d) //Black text for better visibility
+
+.list-header-orange
+ list-header-color(#ff9f19, #4d4d4d) //Black text for better visibility
+
+.list-header-red
+ list-header-color(#eb4646, #ffffff) //White text for better visibility
+
+.list-header-purple
+ list-header-color(#a632db, #ffffff) //White text for better visibility
+
+.list-header-blue
+ list-header-color(#0079bf, #ffffff) //White text for better visibility
+
+.list-header-pink
+ list-header-color(#ff78cb, #4d4d4d) //Black text for better visibility
+
+.list-header-sky
+ list-header-color(#00c2e0, #ffffff) //White text for better visibility
+
+.list-header-black
+ list-header-color(#4d4d4d, #ffffff) //White text for better visibility
+
+.list-header-lime
+ list-header-color(#51e898, #4d4d4d) //Black text for better visibility
+
+.list-header-silver
+ list-header-color(unset, #4d4d4d) //Black text for better visibility
+
+.list-header-peachpuff
+ list-header-color(#ffdab9, #4d4d4d) //Black text for better visibility
+
+.list-header-crimson
+ list-header-color(#dc143c, #ffffff) //White text for better visibility
+
+.list-header-plum
+ list-header-color(#dda0dd, #4d4d4d) //Black text for better visibility
+
+.list-header-darkgreen
+ list-header-color(#006400, #ffffff) //White text for better visibility
+
+.list-header-slateblue
+ list-header-color(#6a5acd, #ffffff) //White text for better visibility
+
+.list-header-magenta
+ list-header-color(#ff00ff, #ffffff) //White text for better visibility
+
+.list-header-gold
+ list-header-color(#ffd700, #4d4d4d) //Black text for better visibility
+
+.list-header-navy
+ list-header-color(#000080, #ffffff) //White text for better visibility
+
+.list-header-gray
+ list-header-color(#808080, #ffffff) //White text for better visibility
+
+.list-header-saddlebrown
+ list-header-color(#8b4513, #ffffff) //White text for better visibility
+
+.list-header-paleturquoise
+ list-header-color(#afeeee, #4d4d4d) //Black text for better visibility
+
+.list-header-mistyrose
+ list-header-color(#ffe4e1, #4d4d4d) //Black text for better visibility
+
+.list-header-indigo
+ list-header-color(#4b0082, #ffffff) //White text for better visibility
diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade
index 25ab8c20..eafcc510 100644
--- a/client/components/lists/listHeader.jade
+++ b/client/components/lists/listHeader.jade
@@ -1,5 +1,7 @@
template(name="listHeader")
- .list-header.js-list-header
+ .list-header.js-list-header(
+ class="{{#if limitToShowCardsCount}}list-header-card-count{{/if}}"
+ class="{{#if colorClass}}list-header-{{colorClass}}{{/if}}")
+inlinedForm
+editListTitleForm
else
@@ -50,6 +52,9 @@ template(name="listActionPopup")
unless currentUser.isCommentOnly
hr
ul.pop-over-list
+ li: a.js-set-color-list {{_ 'set-color-list'}}
+ hr
+ ul.pop-over-list
if cards.count
li: a.js-select-cards {{_ 'list-select-cards'}}
hr
@@ -111,3 +116,12 @@ template(name="wipLimitErrorPopup")
p {{_ 'wipLimitErrorPopup-dialog-pt1'}}
p {{_ 'wipLimitErrorPopup-dialog-pt2'}}
button.full.js-back-view(type="submit") {{_ 'cancel'}}
+
+template(name="setListColorPopup")
+ form.edit-label
+ .palette-colors: each colors
+ span.card-label.palette-color.js-palette-color(class="list-header-{{color}}")
+ if(isSelected color)
+ i.fa.fa-check
+ button.primary.confirm.js-submit {{_ 'save'}}
+ button.js-remove-color.negate.wide.right {{_ 'unset-color'}}
diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js
index abcc4639..25e6cb69 100644
--- a/client/components/lists/listHeader.js
+++ b/client/components/lists/listHeader.js
@@ -1,3 +1,8 @@
+let listsColors;
+Meteor.startup(() => {
+ listsColors = Lists.simpleSchema()._schema.color.allowedValues;
+});
+
BlazeComponent.extendComponent({
canSeeAddCard() {
const list = Template.currentData();
@@ -72,6 +77,7 @@ Template.listActionPopup.helpers({
Template.listActionPopup.events({
'click .js-list-subscribe' () {},
+ 'click .js-set-color-list': Popup.open('setListColor'),
'click .js-select-cards' () {
const cardIds = this.allCards().map((card) => card._id);
MultiSelection.add(cardIds);
@@ -154,3 +160,34 @@ Template.listMorePopup.events({
Utils.goBoardId(this.boardId);
}),
});
+
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.currentList = this.currentData();
+ this.currentColor = new ReactiveVar(this.currentList.color);
+ },
+
+ colors() {
+ return listsColors.map((color) => ({ color, name: '' }));
+ },
+
+ isSelected(color) {
+ return this.currentColor.get() === color;
+ },
+
+ events() {
+ return [{
+ 'click .js-palette-color'() {
+ this.currentColor.set(this.currentData().color);
+ },
+ 'click .js-submit' () {
+ this.currentList.setColor(this.currentColor.get());
+ Popup.close();
+ },
+ 'click .js-remove-color'() {
+ this.currentList.setColor(null);
+ Popup.close();
+ },
+ }];
+ },
+}).register('setListColorPopup');
diff --git a/client/components/swimlanes/swimlaneHeader.jade b/client/components/swimlanes/swimlaneHeader.jade
index 483de06f..33eb5731 100644
--- a/client/components/swimlanes/swimlaneHeader.jade
+++ b/client/components/swimlanes/swimlaneHeader.jade
@@ -1,5 +1,5 @@
template(name="swimlaneHeader")
- .swimlane-header-wrap.js-swimlane-header
+ .swimlane-header-wrap.js-swimlane-header(class='{{#if colorClass}}swimlane-{{colorClass}}{{/if}}')
+inlinedForm
+editSwimlaneTitleForm
else
@@ -8,6 +8,7 @@ template(name="swimlaneHeader")
= title
.swimlane-header-menu
unless currentUser.isCommentOnly
+ a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon
a.fa.fa-navicon.js-open-swimlane-menu
template(name="editSwimlaneTitleForm")
@@ -20,4 +21,24 @@ template(name="editSwimlaneTitleForm")
template(name="swimlaneActionPopup")
unless currentUser.isCommentOnly
ul.pop-over-list
+ li: a.js-set-swimlane-color {{_ 'select-color'}}
+ hr
+ ul.pop-over-list
li: a.js-close-swimlane {{_ 'archive-swimlane'}}
+
+template(name="swimlaneAddPopup")
+ unless currentUser.isCommentOnly
+ form
+ input.swimlane-name-input.full-line(type="text" placeholder="{{_ 'add-swimlane'}}"
+ autocomplete="off" autofocus)
+ .edit-controls.clearfix
+ button.primary.confirm(type="submit") {{_ 'add'}}
+
+template(name="setSwimlaneColorPopup")
+ form.edit-label
+ .palette-colors: each colors
+ span.card-label.palette-color.js-palette-color(class="card-details-{{color}}")
+ if(isSelected color)
+ i.fa.fa-check
+ button.primary.confirm.js-submit {{_ 'save'}}
+ button.js-remove-color.negate.wide.right {{_ 'unset-color'}}
diff --git a/client/components/swimlanes/swimlaneHeader.js b/client/components/swimlanes/swimlaneHeader.js
index 50635f86..1004cb25 100644
--- a/client/components/swimlanes/swimlaneHeader.js
+++ b/client/components/swimlanes/swimlaneHeader.js
@@ -1,3 +1,10 @@
+const { calculateIndexData } = Utils;
+
+let swimlaneColors;
+Meteor.startup(() => {
+ swimlaneColors = Swimlanes.simpleSchema()._schema.color.allowedValues;
+});
+
BlazeComponent.extendComponent({
editTitle(evt) {
evt.preventDefault();
@@ -11,15 +18,82 @@ BlazeComponent.extendComponent({
events() {
return [{
'click .js-open-swimlane-menu': Popup.open('swimlaneAction'),
+ 'click .js-open-add-swimlane-menu': Popup.open('swimlaneAdd'),
submit: this.editTitle,
}];
},
}).register('swimlaneHeader');
Template.swimlaneActionPopup.events({
+ 'click .js-set-swimlane-color': Popup.open('setSwimlaneColor'),
'click .js-close-swimlane' (evt) {
evt.preventDefault();
this.archive();
Popup.close();
},
});
+
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.currentSwimlane = this.currentData();
+ },
+
+ events() {
+ return [{
+ submit(evt) {
+ evt.preventDefault();
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ const nextSwimlane = currentBoard.nextSwimlane(this.currentSwimlane);
+ const titleInput = this.find('.swimlane-name-input');
+ const title = titleInput.value.trim();
+ const sortValue = calculateIndexData(this.currentSwimlane, nextSwimlane, 1);
+
+ if (title) {
+ Swimlanes.insert({
+ title,
+ boardId: Session.get('currentBoard'),
+ sort: sortValue.base,
+ });
+
+ titleInput.value = '';
+ titleInput.focus();
+ }
+ // XXX ideally, we should move the popup to the newly
+ // created swimlane so a user can add more than one swimlane
+ // with a minimum of interactions
+ Popup.close();
+ },
+ }];
+ },
+}).register('swimlaneAddPopup');
+
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.currentSwimlane = this.currentData();
+ this.currentColor = new ReactiveVar(this.currentSwimlane.color);
+ },
+
+ colors() {
+ return swimlaneColors.map((color) => ({ color, name: '' }));
+ },
+
+ isSelected(color) {
+ return this.currentColor.get() === color;
+ },
+
+ events() {
+ return [{
+ 'click .js-palette-color'() {
+ this.currentColor.set(this.currentData().color);
+ },
+ 'click .js-submit' () {
+ this.currentSwimlane.setColor(this.currentColor.get());
+ Popup.close();
+ },
+ 'click .js-remove-color'() {
+ this.currentSwimlane.setColor(null);
+ Popup.close();
+ },
+ }];
+ },
+}).register('setSwimlaneColorPopup');
diff --git a/client/components/swimlanes/swimlanes.jade b/client/components/swimlanes/swimlanes.jade
index 76f54c66..cd864a7c 100644
--- a/client/components/swimlanes/swimlanes.jade
+++ b/client/components/swimlanes/swimlanes.jade
@@ -1,21 +1,22 @@
template(name="swimlane")
.swimlane.js-lists.js-swimlane
+swimlaneHeader
- if isMiniScreen
- if currentList
- +list(currentList)
+ .swimlane.list-group.js-lists
+ if isMiniScreen
+ if currentList
+ +list(currentList)
+ else
+ each currentBoard.lists
+ +miniList(this)
+ if currentUser.isBoardMember
+ +addListForm
else
each currentBoard.lists
- +miniList(this)
+ +list(this)
+ if currentCardIsInThisList _id ../_id
+ +cardDetails(currentCard)
if currentUser.isBoardMember
+addListForm
- else
- each currentBoard.lists
- +list(this)
- if currentCardIsInThisList _id ../_id
- +cardDetails(currentCard)
- if currentUser.isBoardMember
- +addListAndSwimlaneForm
template(name="listsGroup")
.swimlane.list-group.js-lists
@@ -35,31 +36,6 @@ template(name="listsGroup")
if currentUser.isBoardMember
+addListForm
-template(name="addListAndSwimlaneForm")
- .list.list-composer.js-list-composer
- .list-header
- +inlinedForm(autoclose=false)
- input.list-name-input.full-line(type="text" placeholder="{{_ 'add-list'}}"
- autocomplete="off" autofocus)
- .edit-controls.clearfix
- button.primary.confirm(type="submit") {{_ 'save'}}
- a.fa.fa-times-thin.js-close-inlined-form
- else
- a.open-list-composer.js-open-inlined-form
- i.fa.fa-plus
- | {{_ 'add-list'}}
- .list-header
- +inlinedForm(autoclose=false)
- input.swimlane-name-input.full-line(type="text" placeholder="{{_ 'add-swimlane'}}"
- autocomplete="off" autofocus)
- .edit-controls.clearfix
- button.primary.confirm(type="submit") {{_ 'save'}}
- a.fa.fa-times-thin.js-close-inlined-form
- else
- a.open-list-composer.js-open-inlined-form
- i.fa.fa-plus
- | {{_ 'add-swimlane'}}
-
template(name="addListForm")
.list.list-composer.js-list-composer
.list-header
diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js
index 865895a9..71317714 100644
--- a/client/components/swimlanes/swimlanes.js
+++ b/client/components/swimlanes/swimlanes.js
@@ -175,48 +175,6 @@ BlazeComponent.extendComponent({
},
}).register('addListForm');
-BlazeComponent.extendComponent({
- // Proxy
- open() {
- this.childComponents('inlinedForm')[0].open();
- },
-
- events() {
- return [{
- submit(evt) {
- evt.preventDefault();
- let titleInput = this.find('.list-name-input');
- if (titleInput) {
- const title = titleInput.value.trim();
- if (title) {
- Lists.insert({
- title,
- boardId: Session.get('currentBoard'),
- sort: $('.list').length,
- });
-
- titleInput.value = '';
- titleInput.focus();
- }
- } else {
- titleInput = this.find('.swimlane-name-input');
- const title = titleInput.value.trim();
- if (title) {
- Swimlanes.insert({
- title,
- boardId: Session.get('currentBoard'),
- sort: $('.swimlane').length,
- });
-
- titleInput.value = '';
- titleInput.focus();
- }
- }
- },
- }];
- },
-}).register('addListAndSwimlaneForm');
-
Template.swimlane.helpers({
canSeeAddList() {
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
diff --git a/client/components/swimlanes/swimlanes.styl b/client/components/swimlanes/swimlanes.styl
index abcc90d4..e4e2cd3b 100644
--- a/client/components/swimlanes/swimlanes.styl
+++ b/client/components/swimlanes/swimlanes.styl
@@ -5,7 +5,7 @@
// transparent, because that won't work during a swimlane drag.
background: darken(white, 13%)
display: flex
- flex-direction: row
+ flex-direction: column
overflow: 0;
max-height: 100%
@@ -27,20 +27,15 @@
.swimlane-header-wrap
display: flex;
flex-direction: row;
- flex: 0 0 50px;
- padding-bottom: 30px;
- border-bottom: 1px solid #CCC
+ flex: 0 0 24px;
+ background-color: #ccc;
.swimlane-header
- -ms-writing-mode: tb-rl;
- writing-mode: vertical-rl;
- transform: rotate(180deg);
font-size: 14px;
- line-height: 50px;
- margin-top: 50px;
+ padding: 5px 5px
font-weight: bold;
min-height: 9px;
- width: 50px;
+ width: 100%;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
@@ -49,7 +44,93 @@
.swimlane-header-menu
position: absolute
- padding: 20px 20px
+ padding: 5px 5px
+
+ .swimlane-header-plus-icon
+ margin-left: 5px
+ margin-right: 10px
.list-group
+ flex-direction: row
height: 100%
+
+swimlane-color(background, color...)
+ background: background !important
+ if color
+ color: color !important //overwrite text for better visibility
+
+.swimlane-white
+ swimlane-color(#ffffff, #4d4d4d) //Black text for better visibility
+ border: 1px solid #eee
+
+.swimlane-green
+ swimlane-color(#3cb500, #ffffff) //White text for better visibility
+
+.swimlane-yellow
+ swimlane-color(#fad900, #4d4d4d) //Black text for better visibility
+
+.swimlane-orange
+ swimlane-color(#ff9f19, #4d4d4d) //Black text for better visibility
+
+.swimlane-red
+ swimlane-color(#eb4646, #ffffff) //White text for better visibility
+
+.swimlane-purple
+ swimlane-color(#a632db, #ffffff) //White text for better visibility
+
+.swimlane-blue
+ swimlane-color(#0079bf, #ffffff) //White text for better visibility
+
+.swimlane-pink
+ swimlane-color(#ff78cb, #4d4d4d) //Black text for better visibility
+
+.swimlane-sky
+ swimlane-color(#00c2e0, #ffffff) //White text for better visibility
+
+.swimlane-black
+ swimlane-color(#4d4d4d, #ffffff) //White text for better visibility
+
+.swimlane-lime
+ swimlane-color(#51e898, #4d4d4d) //Black text for better visibility
+
+.swimlane-silver
+ swimlane-color(unset, #4d4d4d) //Black text for better visibility
+
+.swimlane-peachpuff
+ swimlane-color(#ffdab9, #4d4d4d) //Black text for better visibility
+
+.swimlane-crimson
+ swimlane-color(#dc143c, #ffffff) //White text for better visibility
+
+.swimlane-plum
+ swimlane-color(#dda0dd, #4d4d4d) //Black text for better visibility
+
+.swimlane-darkgreen
+ swimlane-color(#006400, #ffffff) //White text for better visibility
+
+.swimlane-slateblue
+ swimlane-color(#6a5acd, #ffffff) //White text for better visibility
+
+.swimlane-magenta
+ swimlane-color(#ff00ff, #ffffff) //White text for better visibility
+
+.swimlane-gold
+ swimlane-color(#ffd700, #4d4d4d) //Black text for better visibility
+
+.swimlane-navy
+ swimlane-color(#000080, #ffffff) //White text for better visibility
+
+.swimlane-gray
+ swimlane-color(#808080, #ffffff) //White text for better visibility
+
+.swimlane-saddlebrown
+ swimlane-color(#8b4513, #ffffff) //White text for better visibility
+
+.swimlane-paleturquoise
+ swimlane-color(#afeeee, #4d4d4d) //Black text for better visibility
+
+.swimlane-mistyrose
+ swimlane-color(#ffe4e1, #4d4d4d) //Black text for better visibility
+
+.swimlane-indigo
+ swimlane-color(#4b0082, #ffffff) //White text for better visibility