Merge branch 'amadilsons-issue881' into devel

Confirm popup appears before Checklist Delete.
Thanks to amadilsons ! Closes #881
This commit is contained in:
Lauri Ojansivu 2017-09-30 16:55:10 +03:00
commit 8680d7727b
39 changed files with 164 additions and 27 deletions

View file

@ -1,10 +1,14 @@
# Upcoming Wekan release
This release fixes the following bugs:
This release adds the following new features:
* [Confirm popup appears before Checklist Delete](https://github.com/wekan/wekan/pull/1257).
and fixes the following bugs:
* [Fix errors when importing from Trello](https://github.com/wekan/wekan/pull/1259).
Thanks to GitHub user GhassenRjab for contributions.
Thanks to GitHub users amadilsons and GhassenRjab for contributions.
# v0.43 2017-09-25 Wekan release

View file

@ -1,8 +1,14 @@
template(name="checklists")
h2 {{_ 'checklists'}}
if toggleDeleteDialog.get
.board-overlay#card-details-overlay
+checklistDeleteDialog(checklist = checklistToDelete)
.card-checklist-items
each checklist in currentCard.checklists
+checklistDetail(checklist = checklist)
if canModifyCard
+inlinedForm(autoclose=false classNames="js-add-checklist" cardId = cardId)
+addChecklistItemForm
@ -18,7 +24,8 @@ template(name="checklistDetail")
.checklist-title
.checkbox.fa.fa-check-square-o
if canModifyCard
a.js-delete-checklist {{_ "delete"}}...
a.js-delete-checklist.toggle-delete-checklist-dialog {{_ "delete"}}...
span.checklist-stat(class="{{#if checklist.isFinished}}is-finished{{/if}}") {{checklist.finishedCount}}/{{checklist.itemCount}}
if canModifyCard
h2.title.js-open-inlined-form.is-editable {{checklist.title}}
@ -26,6 +33,18 @@ template(name="checklistDetail")
h2.title {{checklist.title}}
+checklistItems(checklist = checklist)
template(name="checklistDeleteDialog")
.js-confirm-checklist-delete
p
i(class="fa fa-exclamation-triangle" aria-hidden="true")
p
| {{_ 'confirm-checklist-delete-dialog'}}
span {{checklist.title}}
| ?
.js-checklist-delete-buttons
button.confirm-checklist-delete(type="button") {{_ 'delete'}}
button.toggle-delete-checklist-dialog(type="button") {{_ 'cancel'}}
template(name="addChecklistItemForm")
textarea.js-add-checklist-item(rows='1' autofocus)
.edit-controls.clearfix

View file

@ -66,6 +66,7 @@ Template.checklists.onRendered(function () {
});
BlazeComponent.extendComponent({
addChecklist(event) {
event.preventDefault();
const textarea = this.find('textarea.js-add-checklist-item');
@ -101,6 +102,26 @@ BlazeComponent.extendComponent({
textarea.focus();
},
canModifyCard() {
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
},
deleteChecklist() {
const checklist = this.currentData().checklist;
if (checklist && checklist._id) {
Checklists.remove(checklist._id);
this.toggleDeleteDialog.set(false);
}
},
deleteItem() {
const checklist = this.currentData().checklist;
const item = this.currentData().item;
if (checklist && item && item._id) {
checklist.removeItem(item._id);
}
},
editChecklist(event) {
event.preventDefault();
const textarea = this.find('textarea.js-edit-checklist-item');
@ -109,10 +130,6 @@ BlazeComponent.extendComponent({
checklist.setTitle(title);
},
canModifyCard() {
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
},
editChecklistItem(event) {
event.preventDefault();
@ -123,19 +140,9 @@ BlazeComponent.extendComponent({
checklist.editItem(itemId, title);
},
deleteItem() {
const checklist = this.currentData().checklist;
const item = this.currentData().item;
if (checklist && item && item._id) {
checklist.removeItem(item._id);
}
},
deleteChecklist() {
const checklist = this.currentData().checklist;
if (checklist && checklist._id) {
Checklists.remove(checklist._id);
}
onCreated() {
this.toggleDeleteDialog = new ReactiveVar(false);
this.checklistToDelete = null; //Store data context to pass to checklistDeleteDialog template
},
pressKey(event) {
@ -148,18 +155,50 @@ BlazeComponent.extendComponent({
},
events() {
const events = {
'click .toggle-delete-checklist-dialog'(event) {
if($(event.target).hasClass('js-delete-checklist')){
this.checklistToDelete = this.currentData().checklist; //Store data context
}
this.toggleDeleteDialog.set(!this.toggleDeleteDialog.get());
},
};
return [{
...events,
'submit .js-add-checklist': this.addChecklist,
'submit .js-edit-checklist-title': this.editChecklist,
'submit .js-add-checklist-item': this.addChecklistItem,
'submit .js-edit-checklist-item': this.editChecklistItem,
'click .js-delete-checklist-item': this.deleteItem,
'click .js-delete-checklist': this.deleteChecklist,
'click .confirm-checklist-delete': this.deleteChecklist,
keydown: this.pressKey,
}];
},
}).register('checklists');
Template.checklistDeleteDialog.onCreated(() => {
const $cardDetails = this.$('.card-details');
this.scrollState = { position: $cardDetails.scrollTop(), //save current scroll position
top: false, //required for smooth scroll animation
};
//Callback's purpose is to only prevent scrolling after animation is complete
$cardDetails.animate({ scrollTop: 0 }, 500, () => { this.scrollState.top = true; });
//Prevent scrolling while dialog is open
$cardDetails.on('scroll', () => {
if(this.scrollState.top) { //If it's already in position, keep it there. Otherwise let animation scroll
$cardDetails.scrollTop(0);
}
});
});
Template.checklistDeleteDialog.onDestroyed(() => {
const $cardDetails = this.$('.card-details');
$cardDetails.off('scroll'); //Reactivate scrolling
$cardDetails.animate( { scrollTop: this.scrollState.position });
});
Template.itemDetail.helpers({
canModifyCard() {
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();

View file

@ -38,6 +38,46 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item
.js-delete-checklist
@extends .delete-text
.js-confirm-checklist-delete
background-color: darken(white, 3%)
position: absolute
float: left;
width: 60%
margin-top: 0
margin-left: 13%
padding-bottom: 2%
padding-left: 3%
padding-right: 3%
z-index: 17
border-radius: 3px
p
position: relative
margin-top: 3%
width: 100%
text-align: center
span
font-weight: bold
i
font-size: 2em
.js-checklist-delete-buttons
position: relative
padding: left 2% right 2%
.confirm-checklist-delete
margin-left: 12%
float: left
.toggle-delete-checklist-dialog
margin-right: 12%
float: right
#card-details-overlay
top: 0
bottom: -600px
right: 0
.checklist-items
margin: 0 0 0.5em 1.33em

View file

@ -146,6 +146,7 @@
"comment-only": "التعليق فقط",
"comment-only-desc": "يمكن التعليق على بطاقات فقط.",
"computer": "حاسوب",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "إنشاء",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Krouiñ",

View file

@ -146,6 +146,7 @@
"comment-only": "Només comentaris",
"comment-only-desc": "Només pots fer comentaris a les fitxes",
"computer": "Ordinador",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copia l'enllaç de la ftixa al porta-retalls",
"copyCardPopup-title": "Copia la fitxa",
"create": "Crea",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Počítač",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Kopírovat adresu karty do mezipaměti",
"copyCardPopup-title": "Kopírovat kartu",
"create": "Vytvořit",

View file

@ -146,6 +146,7 @@
"comment-only": "Nur kommentierbar",
"comment-only-desc": "Kann Karten nur Kommentieren",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Kopiere die Karte in die Zwischenablage",
"copyCardPopup-title": "Karte kopieren",
"create": "Erstellen",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Komputilo",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Krei",

View file

@ -146,6 +146,7 @@
"comment-only": "Sólo comentario",
"comment-only-desc": "Solo se puede comentar en tarjetas.",
"computer": "Ordenador",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copiar enlace a la tarjeta al portapapeles",
"copyCardPopup-title": "Copy Card",
"create": "Crear",

View file

@ -146,6 +146,7 @@
"comment-only": "Iruzkinak besterik ez",
"comment-only-desc": "Iruzkinak txarteletan soilik egin ditzake",
"computer": "Ordenagailua",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Kopiatu txartela arbelera",
"copyCardPopup-title": "Copy Card",
"create": "Sortu",

View file

@ -146,6 +146,7 @@
"comment-only": "صرفا یادداشت",
"comment-only-desc": "صرفا یادداشت برروی کارت ها",
"computer": "رایانه",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "ایجاد",

View file

@ -146,6 +146,7 @@
"comment-only": "Vain kommentointi",
"comment-only-desc": "Voi vain kommentoida kortteja",
"computer": "Tietokone",
"confirm-checklist-delete-dialog": "Haluatko varmasti poistaa tarkistuslistan",
"copy-card-link-to-clipboard": "Kopioi kortin linkki leikepöydälle",
"copyCardPopup-title": "Kopioi kortti",
"create": "Luo",

View file

@ -2,8 +2,8 @@
"accept": "Accepter",
"act-activity-notify": "[Wekan] Notification d'activité",
"act-addAttachment": "a joint __attachment__ à __card__",
"act-addChecklist": "added checklist __checklist__ to __card__",
"act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
"act-addChecklist": "a ajouté la checklist __checklist__ à __card__",
"act-addChecklistItem": "a ajouté l'élément __checklistItem__ à la checklist __checklist__ de __card__",
"act-addComment": "a commenté __card__ : __comment__",
"act-createBoard": "a créé __board__",
"act-createCard": "a ajouté __card__ à __list__",
@ -146,6 +146,7 @@
"comment-only": "Commentaire uniquement",
"comment-only-desc": "Ne peut que commenter des cartes.",
"computer": "Ordinateur",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copier le lien vers la carte dans le presse-papier",
"copyCardPopup-title": "Copier la carte",
"create": "Créer",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computador",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Crear",

View file

@ -2,8 +2,8 @@
"accept": "אישור",
"act-activity-notify": "[Wekan] הודעת פעילות",
"act-addAttachment": " __attachment__ צורף לכרטיס __card__",
"act-addChecklist": "added checklist __checklist__ to __card__",
"act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
"act-addChecklist": "רשימת משימות __checklist__ נוספה ל __card__",
"act-addChecklistItem": " __checklistItem__ נוסף לרשימת משימות __checklist__ בכרטיס __card__",
"act-addComment": "התקבלה תגובה על הכרטיס __card__: __comment__",
"act-createBoard": "הלוח __board__ נוצר",
"act-createCard": "הכרטיס __card__ התווסף לרשימה __list__",
@ -146,6 +146,7 @@
"comment-only": "הערה בלבד",
"comment-only-desc": "ניתן להעיר על כרטיסים בלבד.",
"computer": "מחשב",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "העתק כרטיס",
"create": "יצירה",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Számítógép",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Létrehoz",

View file

@ -146,6 +146,7 @@
"comment-only": "Hanya komentar",
"comment-only-desc": "Bisa komen hanya di kartu",
"computer": "Komputer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Buat",

View file

@ -146,6 +146,7 @@
"comment-only": "Solo commenti",
"comment-only-desc": "Puoi commentare solo le schede.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copia link della scheda sulla clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Crea",

View file

@ -146,6 +146,7 @@
"comment-only": "コメントのみ",
"comment-only-desc": "カードにのみコメント可能",
"computer": "コンピューター",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "カードへのリンクをクリップボードにコピー",
"copyCardPopup-title": "Copy Card",
"create": "作成",

View file

@ -146,6 +146,7 @@
"comment-only": "댓글만 입력 가능",
"comment-only-desc": "카드에 댓글만 달수 있습니다.",
"computer": "내 컴퓨터",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "생성",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "Alleen reageren",
"comment-only-desc": "Kan alleen op kaarten reageren.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Kopieer kaart link naar klembord",
"copyCardPopup-title": "Copy Card",
"create": "Aanmaken",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Komputer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Utwórz",

View file

@ -146,6 +146,7 @@
"comment-only": "Somente comentários",
"comment-only-desc": "Pode comentar apenas em cartões.",
"computer": "Computador",
"confirm-checklist-delete-dialog": "Tem a certeza de que pretende eliminar lista de verificação",
"copy-card-link-to-clipboard": "Copiar link do cartão para a área de transferência",
"copyCardPopup-title": "Copy Card",
"create": "Criar",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "Только комментирование",
"comment-only-desc": "Может комментировать только карточки.",
"computer": "Загрузить с компьютера",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Создать",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -2,8 +2,8 @@
"accept": "Acceptera",
"act-activity-notify": "[Wekan] Aktivitetsavisering",
"act-addAttachment": "bifogade __attachment__ to __card__",
"act-addChecklist": "added checklist __checklist__ to __card__",
"act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
"act-addChecklist": "lade till checklist __checklist__ till __card__",
"act-addChecklistItem": "lade till __checklistItem__ till checklistan __checklist__ on __card__",
"act-addComment": "kommenterade __card__: __comment__",
"act-createBoard": "skapade __board__",
"act-createCard": "lade till __card__ to __list__",
@ -146,6 +146,7 @@
"comment-only": "Kommentera endast",
"comment-only-desc": "Kan endast kommentera kort.",
"computer": "Dator",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Kopiera kortlänk till urklipp",
"copyCardPopup-title": "Kopiera kort",
"create": "Skapa",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "คอมพิวเตอร์",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "สร้าง",

View file

@ -146,6 +146,7 @@
"comment-only": "Sadece yorum",
"comment-only-desc": "Sadece kartlara yorum yazabilir.",
"computer": "Bilgisayar",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Kartın linkini kopyala",
"copyCardPopup-title": "Kartı Kopyala",
"create": "Oluştur",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "Comment only",
"comment-only-desc": "Can comment on cards only.",
"computer": "Computer",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "Copy card link to clipboard",
"copyCardPopup-title": "Copy Card",
"create": "Create",

View file

@ -146,6 +146,7 @@
"comment-only": "仅能评论",
"comment-only-desc": "只能在卡片上评论。",
"computer": "从本机上传",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "复制卡片链接到剪贴板",
"copyCardPopup-title": "复制卡片",
"create": "创建",

View file

@ -146,6 +146,7 @@
"comment-only": "只可以發表評論",
"comment-only-desc": "只可以對卡片發表評論",
"computer": "從本機上傳",
"confirm-checklist-delete-dialog": "Are you sure you want to delete checklist",
"copy-card-link-to-clipboard": "將卡片連結複製到剪貼板",
"copyCardPopup-title": "Copy Card",
"create": "建立",