mirror of
https://github.com/wekan/wekan.git
synced 2026-02-22 16:04:08 +01:00
Merge pull request #4598 from Viehlieb/feature/save_description_on_card_exit
Feature/save description on card exit
This commit is contained in:
commit
5b883f4ea6
6 changed files with 69 additions and 1 deletions
|
|
@ -1714,10 +1714,29 @@ BlazeComponent.extendComponent({
|
||||||
EscapeActions.register(
|
EscapeActions.register(
|
||||||
'detailsPane',
|
'detailsPane',
|
||||||
() => {
|
() => {
|
||||||
|
// if card description diverges from database due to editing
|
||||||
|
// ask user whether changes should be applied
|
||||||
|
if(currentUser.profile.rescueCardDescription== true)
|
||||||
|
{
|
||||||
|
currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
|
||||||
|
if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription()))
|
||||||
|
{
|
||||||
|
if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) {
|
||||||
|
Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value);
|
||||||
|
// Save it!
|
||||||
|
console.log(document.getElementsByClassName("editor js-new-description-input").item(0).value);
|
||||||
|
console.log("current description",Utils.getCurrentCard().getDescription());
|
||||||
|
} else {
|
||||||
|
// Do nothing!
|
||||||
|
console.log('Description changes were not saved to the database.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Session.get('cardDetailsIsDragging')) {
|
if (Session.get('cardDetailsIsDragging')) {
|
||||||
// Reset dragging status as the mouse landed outside the cardDetails template area and this will prevent a mousedown event from firing
|
// Reset dragging status as the mouse landed outside the cardDetails template area and this will prevent a mousedown event from firing
|
||||||
Session.set('cardDetailsIsDragging', false);
|
Session.set('cardDetailsIsDragging', false);
|
||||||
Session.set('cardDetailsIsMouseDown', false);
|
Session.set('cardDetailsIsMouseDown', false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Prevent close card when the user is selecting text and moves the mouse cursor outside the card detail area
|
// Prevent close card when the user is selecting text and moves the mouse cursor outside the card detail area
|
||||||
Utils.goBoardId(Session.get('currentBoard'));
|
Utils.goBoardId(Session.get('currentBoard'));
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,13 @@ template(name="changeSettingsPopup")
|
||||||
option(selected="true", value="#{day.value}") #{day.name}
|
option(selected="true", value="#{day.value}") #{day.name}
|
||||||
else
|
else
|
||||||
option(value="#{day.value}") #{day.name}
|
option(value="#{day.value}") #{day.name}
|
||||||
|
label.bold.clear
|
||||||
|
| {{_ 'card-settings'}}
|
||||||
|
ul#cards.card-description-rescued
|
||||||
|
a.flex.js-rescue-card-description(title="{{_ 'rescue-card-description'}}")
|
||||||
|
b
|
||||||
|
#rescue-card-description.materialCheckBox.left(class="{{#if rescueCardDescription}}is-checked{{/if}}", value=rescueCardDescription)
|
||||||
|
span {{_ 'rescue-card-description'}}
|
||||||
input.js-apply-user-settings.left(type="submit" value="{{_ 'apply'}}")
|
input.js-apply-user-settings.left(type="submit" value="{{_ 'apply'}}")
|
||||||
|
|
||||||
template(name="userDeletePopup")
|
template(name="userDeletePopup")
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,16 @@ Template.changeSettingsPopup.helpers({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
rescueCardDescription() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).rescueCardDescription;
|
||||||
|
} else if (window.localStorage.getItem('rescueCardDescription')) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
showCardsCountAt() {
|
showCardsCountAt() {
|
||||||
currentUser = Meteor.user();
|
currentUser = Meteor.user();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
|
|
@ -356,6 +366,9 @@ Template.changeSettingsPopup.events({
|
||||||
window.localStorage.setItem('hasHiddenSystemMessages', 'true');
|
window.localStorage.setItem('hasHiddenSystemMessages', 'true');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'click .js-rescue-card-description'() {
|
||||||
|
Meteor.call('toggleRescueCardDescription')
|
||||||
|
},
|
||||||
'click .js-apply-user-settings'(event, templateInstance) {
|
'click .js-apply-user-settings'(event, templateInstance) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let minLimit = parseInt(
|
let minLimit = parseInt(
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,9 @@
|
||||||
"rename": "Umbenennen",
|
"rename": "Umbenennen",
|
||||||
"rename-board": "Board umbenennen",
|
"rename-board": "Board umbenennen",
|
||||||
"restore": "Wiederherstellen",
|
"restore": "Wiederherstellen",
|
||||||
|
"rescue-card-description": "Vor dem Schließen Dialog für ungespeicherte Änderungen von Kartenbeschreibungen anzeigen",
|
||||||
|
"rescue-card-description-dialogue": "Aktuelle Kartenbeschreibung mit ihren Änderungen überschreiben?",
|
||||||
|
"card-settings": "Karteneinstellungen",
|
||||||
"save": "Speichern",
|
"save": "Speichern",
|
||||||
"search": "Suchen",
|
"search": "Suchen",
|
||||||
"rules": "Regeln",
|
"rules": "Regeln",
|
||||||
|
|
@ -1178,4 +1181,4 @@
|
||||||
"action": "Aktion",
|
"action": "Aktion",
|
||||||
"board-title": "Board-Titel",
|
"board-title": "Board-Titel",
|
||||||
"attachmentRenamePopup-title": "Umbenennen"
|
"attachmentRenamePopup-title": "Umbenennen"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,9 @@
|
||||||
"rename": "Rename",
|
"rename": "Rename",
|
||||||
"rename-board": "Rename Board",
|
"rename-board": "Rename Board",
|
||||||
"restore": "Restore",
|
"restore": "Restore",
|
||||||
|
"rescue-card-description": "Show rescue dialogue before closing for unsaved card descriptions",
|
||||||
|
"rescue-card-description-dialogue": "Overwrite current card description with your changes?",
|
||||||
|
"card-settings":"Card Settings",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"search": "Search",
|
"search": "Search",
|
||||||
"rules": "Rules",
|
"rules": "Rules",
|
||||||
|
|
|
||||||
|
|
@ -337,6 +337,13 @@ Users.attachSchema(
|
||||||
type: Date,
|
type: Date,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
'profile.rescueCardDescription': {
|
||||||
|
/**
|
||||||
|
* show dialog for saving card description on unintentional card closing
|
||||||
|
*/
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
'profile.showCardsCountAt': {
|
'profile.showCardsCountAt': {
|
||||||
/**
|
/**
|
||||||
* showCardCountAt field of the user
|
* showCardCountAt field of the user
|
||||||
|
|
@ -794,6 +801,11 @@ Users.helpers({
|
||||||
return profile.hiddenMinicardLabelText || false;
|
return profile.hiddenMinicardLabelText || false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hasRescuedCardDescription(){
|
||||||
|
const profile = this.profile || {};
|
||||||
|
return profile.rescueCardDescription || false;
|
||||||
|
},
|
||||||
|
|
||||||
getEmailBuffer() {
|
getEmailBuffer() {
|
||||||
const { emailBuffer = [] } = this.profile || {};
|
const { emailBuffer = [] } = this.profile || {};
|
||||||
return emailBuffer;
|
return emailBuffer;
|
||||||
|
|
@ -1004,6 +1016,13 @@ Users.mutations({
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
toggleRescueCardDescription(value = false) {
|
||||||
|
return {
|
||||||
|
$set: {
|
||||||
|
'profile.rescueCardDescription': !value,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
addNotification(activityId) {
|
addNotification(activityId) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -1103,6 +1122,10 @@ Meteor.methods({
|
||||||
const user = Meteor.user();
|
const user = Meteor.user();
|
||||||
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
||||||
},
|
},
|
||||||
|
toggleRescueCardDescription() {
|
||||||
|
const user = Meteor.user();
|
||||||
|
user.toggleRescueCardDescription(user.hasRescuedCardDescription());
|
||||||
|
},
|
||||||
changeLimitToShowCardsCount(limit) {
|
changeLimitToShowCardsCount(limit) {
|
||||||
check(limit, Number);
|
check(limit, Number);
|
||||||
Meteor.user().setShowCardsCountAt(limit);
|
Meteor.user().setShowCardsCountAt(limit);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue