Show parent in card (no links, yet)

This commit is contained in:
Nicu Tofan 2018-06-26 02:13:31 +03:00
parent 94a52080cf
commit c0ffd6c20f
No known key found for this signature in database
GPG key ID: 7EE66E95E64FD0B7
10 changed files with 193 additions and 8 deletions

View file

@ -199,9 +199,30 @@ template(name="boardChangeColorPopup")
template(name="boardSubtaskSettingsPopup") template(name="boardSubtaskSettingsPopup")
form.board-subtask-settings form.board-subtask-settings
a.flex.js-field-has-subtasks(class="{{#if allowsSubtasks}}is-checked{{/if}}") h3 {{_ 'show-parent-in-minicard'}}
.materialCheckBox(class="{{#if allowsSubtasks}}is-checked{{/if}}") a#prefix-with-full-path.flex.js-field-show-parent-in-minicard(class="{{#if $eq presentParentTask 'prefix-with-full-path'}}is-checked{{/if}}")
span {{_ 'show-subtasks-field'}} .materialCheckBox(class="{{#if $eq presentParentTask 'prefix-with-full-path'}}is-checked{{/if}}")
span {{_ 'prefix-with-full-path'}}
a#prefix-with-parent.flex.js-field-show-parent-in-minicard(class="{{#if $eq presentParentTask 'prefix-with-parent'}}is-checked{{/if}}")
.materialCheckBox(class="{{#if $eq presentParentTask 'prefix-with-parent'}}is-checked{{/if}}")
span {{_ 'prefix-with-parent'}}
a#subtext-with-full-path.flex.js-field-show-parent-in-minicard(class="{{#if $eq presentParentTask 'subtext-with-full-path'}}is-checked{{/if}}")
.materialCheckBox(class="{{#if $eq presentParentTask 'subtext-with-full-path'}}is-checked{{/if}}")
span {{_ 'subtext-with-full-path'}}
a#subtext-with-parent.flex.js-field-show-parent-in-minicard(class="{{#if $eq presentParentTask 'subtext-with-parent'}}is-checked{{/if}}")
.materialCheckBox(class="{{#if $eq presentParentTask 'subtext-with-parent'}}is-checked{{/if}}")
span {{_ 'subtext-with-parent'}}
a#no-parent.flex.js-field-show-parent-in-minicard(class="{{#if $eq presentParentTask 'no-parent'}}is-checked{{/if}}")
.materialCheckBox(class="{{#if $eq presentParentTask 'no-parent'}}is-checked{{/if}}")
span {{_ 'no-parent'}}
div
hr
div.check-div
a.flex.js-field-has-subtasks(class="{{#if allowsSubtasks}}is-checked{{/if}}")
.materialCheckBox(class="{{#if allowsSubtasks}}is-checked{{/if}}")
span {{_ 'show-subtasks-field'}}
label label
| {{_ 'deposit-subtasks-board'}} | {{_ 'deposit-subtasks-board'}}
select.js-field-deposit-board(disabled="{{#unless allowsSubtasks}}disabled{{/unless}}") select.js-field-deposit-board(disabled="{{#unless allowsSubtasks}}disabled{{/unless}}")
@ -214,7 +235,9 @@ template(name="boardSubtaskSettingsPopup")
option(value='null' selected="selected") {{_ 'custom-field-dropdown-none'}} option(value='null' selected="selected") {{_ 'custom-field-dropdown-none'}}
else else
option(value='null') {{_ 'custom-field-dropdown-none'}} option(value='null') {{_ 'custom-field-dropdown-none'}}
hr div
hr
label label
| {{_ 'deposit-subtasks-list'}} | {{_ 'deposit-subtasks-list'}}
select.js-field-deposit-list(disabled="{{#unless hasLists}}disabled{{/unless}}") select.js-field-deposit-list(disabled="{{#unless hasLists}}disabled{{/unless}}")

View file

@ -195,6 +195,14 @@ BlazeComponent.extendComponent({
return this.currentBoard.subtasksDefaultBoardId === this.currentData()._id; return this.currentBoard.subtasksDefaultBoardId === this.currentData()._id;
}, },
presentParentTask() {
let result = this.currentBoard.presentParentTask;
if ((result === null) || (result === undefined)) {
result = 'no-parent';
}
return result;
},
events() { events() {
return [{ return [{
'click .js-field-has-subtasks'(evt) { 'click .js-field-has-subtasks'(evt) {
@ -217,6 +225,25 @@ BlazeComponent.extendComponent({
this.currentBoard.setSubtasksDefaultListId(evt.target.value); this.currentBoard.setSubtasksDefaultListId(evt.target.value);
evt.preventDefault(); evt.preventDefault();
}, },
'click .js-field-show-parent-in-minicard'(evt) {
const value = evt.target.id || $(evt.target).parent()[0].id || $(evt.target).parent()[0].parent()[0].id;
const options = [
'prefix-with-full-path',
'prefix-with-parent',
'subtext-with-full-path',
'subtext-with-parent',
'no-parent'];
options.forEach(function(element) {
if (element !== value) {
$(`#${element} .materialCheckBox`).toggleClass('is-checked', false);
$(`#${element}`).toggleClass('is-checked', false);
}
});
$(`#${value} .materialCheckBox`).toggleClass('is-checked', true);
$(`#${value}`).toggleClass('is-checked', true);
this.currentBoard.setPresentParentTask(value);
evt.preventDefault();
},
}]; }];
}, },
}).register('boardSubtaskSettingsPopup'); }).register('boardSubtaskSettingsPopup');

View file

@ -1,3 +1,22 @@
.integration-form .integration-form
padding: 5px padding: 5px
border-bottom: 1px solid #ccc border-bottom: 1px solid #ccc
.flex
display: -webkit-box
display: -moz-box
display: -webkit-flex
display: -moz-flex
display: -ms-flexbox
display: flex
.option
@extends .flex
-webkit-border-radius: 3px;
border-radius: 3px;
background: #fff;
text-decoration: none;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.2);
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
margin-top: 5px;
padding: 5px;

View file

@ -13,6 +13,12 @@ template(name="cardDetails")
= title = title
if isWatching if isWatching
i.fa.fa-eye.card-details-watch i.fa.fa-eye.card-details-watch
.card-details-path
each parentList
|   >  
a.js-parent-card {{title}}
// else
{{_ 'top-level-card'}}
if archived if archived
p.warning {{_ 'card-archived'}} p.warning {{_ 'card-archived'}}

View file

@ -70,6 +70,14 @@ BlazeComponent.extendComponent({
} }
}, },
presentParentTask() {
let result = this.currentBoard.presentParentTask;
if ((result === null) || (result === undefined)) {
result = 'no-parent';
}
return result;
},
onRendered() { onRendered() {
if (!Utils.isMiniScreen()) this.scrollParentContainer(); if (!Utils.isMiniScreen()) this.scrollParentContainer();
const $checklistsDom = this.$('.card-checklist-items'); const $checklistsDom = this.$('.card-checklist-items');

View file

@ -8,7 +8,21 @@ template(name="minicard")
.minicard-label(class="card-label-{{color}}" title="{{name}}") .minicard-label(class="card-label-{{color}}" title="{{name}}")
.minicard-title .minicard-title
+viewer +viewer
= title if isTopLevel
= title
else
if $eq 'prefix-with-full-path' currentBoard.presentParentTask
[{{ parentString ' > ' }}] {{ title }}
else
if $eq 'prefix-with-parent' currentBoard.presentParentTask
[{{ parentCardName }}] {{ title }}
else
= title
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
.small {{ parentString ' > ' }}
if $eq 'subtext-with-parent' currentBoard.presentParentTask
.small {{ parentCardName }}
.dates .dates
if receivedAt if receivedAt
unless startAt unless startAt

View file

@ -485,7 +485,14 @@
"queue": "Queue", "queue": "Queue",
"subtask-settings": "Subtasks Settings", "subtask-settings": "Subtasks Settings",
"boardSubtaskSettingsPopup-title": "Board Subtasks Settings", "boardSubtaskSettingsPopup-title": "Board Subtasks Settings",
"show-subtasks-field": "Cards can have subtasks:", "show-subtasks-field": "Cards can have subtasks",
"deposit-subtasks-board": "Deposit subtasks to this board:", "deposit-subtasks-board": "Deposit subtasks to this board:",
"deposit-subtasks-list": "Landing list for subtasks deposited here:" "deposit-subtasks-list": "Landing list for subtasks deposited here:",
"show-parent-in-minicard": "Show parent in minicard:",
"prefix-with-full-path": "Prefix with full path",
"prefix-with-parent": "Prefix with parent",
"subtext-with-full-path": "Subtext with full path",
"subtext-with-parent": "Subtext with full parent",
"no-parent": "Don't show parent"
} }

View file

@ -165,6 +165,18 @@ Boards.attachSchema(new SimpleSchema({
type: Boolean, type: Boolean,
defaultValue: true, defaultValue: true,
}, },
presentParentTask: {
type: String,
allowedValues: [
'prefix-with-full-path',
'prefix-with-parent',
'subtext-with-full-path',
'subtext-with-parent',
'no-parent',
],
optional: true,
defaultValue: 'no-parent',
},
})); }));
@ -489,6 +501,10 @@ Boards.mutations({
setSubtasksDefaultListId(subtasksDefaultListId) { setSubtasksDefaultListId(subtasksDefaultListId) {
return { $set: { subtasksDefaultListId } }; return { $set: { subtasksDefaultListId } };
}, },
setPresentParentTask(presentParentTask) {
return { $set: { presentParentTask } };
},
}); });
if (Meteor.isServer) { if (Meteor.isServer) {

View file

@ -326,6 +326,59 @@ Cards.helpers({
return Cards.findOne(this.parentId); return Cards.findOne(this.parentId);
}, },
parentCardName() {
if (this.parentId === '') {
return '';
}
return Cards.findOne(this.parentId).title;
},
parentListId() {
const result = [];
let crtParentId = this.parentId;
while (crtParentId !== '') {
const crt = Cards.findOne(crtParentId);
if ((crt === null) || (crt === undefined)) {
// maybe it has been deleted
break;
}
if (crtParentId in result) {
// circular reference
break;
}
result.unshift(crtParentId);
crtParentId = crt.parentId;
}
return result;
},
parentList() {
const resultId = [];
const result = [];
let crtParentId = this.parentId;
while (crtParentId !== '') {
const crt = Cards.findOne(crtParentId);
if ((crt === null) || (crt === undefined)) {
// maybe it has been deleted
break;
}
if (crtParentId in resultId) {
// circular reference
break;
}
resultId.unshift(crtParentId);
result.unshift(crt);
crtParentId = crt.parentId;
}
return result;
},
parentString(sep) {
return this.parentList().map(function(elem){
return elem.title;
}).join(sep);
},
isTopLevel() { isTopLevel() {
return this.parentId === ''; return this.parentId === '';
}, },

View file

@ -294,7 +294,19 @@ Migrations.add('add-subtasks-allowed', () => {
}, },
}, { }, {
$set: { $set: {
allowsSubtasks: -1, allowsSubtasks: true,
},
}, noValidateMulti);
});
Migrations.add('add-subtasks-allowed', () => {
Boards.update({
presentParentTask: {
$exists: false,
},
}, {
$set: {
presentParentTask: 'no-parent',
}, },
}, noValidateMulti); }, noValidateMulti);
}); });