Updated journal page to Polymer 1

This commit is contained in:
Stefan Zermatten
2017-01-31 11:09:57 +02:00
parent 9c61493a12
commit a869772238
10 changed files with 239 additions and 240 deletions

View File

@@ -11,21 +11,36 @@ Template.noteDialog.events({
"tap #deleteButton": function(event, instance){
Notes.softRemove(instance.data.noteId);
GlobalUI.deletedToast(instance.data.noteId, "Notes", "Note");
GlobalUI.closeDetail();
popDialogStack();
},
});
Template.noteDialogEdit.onRendered(function(){
updatePolymerInputs(this);
});
const debounce = (f) => _.debounce(f, 300);
Template.noteDialogEdit.events({
"change #noteNameInput, input #noteNameInput": function(event){
"change #noteNameInput, input #noteNameInput": debounce(function(event){
const input = event.currentTarget;
var name = input.value;
if (!name){
input.invalid = true;
input.errorMessage = "Name is required";
} else {
input.invalid = false;
Notes.update(this._id, {
$set: {name: name}
}, {
removeEmptyStrings: false,
trimStrings: false,
});
}
}),
"input #noteDescriptionInput": debounce(function(event){
var value = event.currentTarget.value;
Notes.update(this._id, {$set: {name: value}});
},
"change #noteDescriptionInput": function(event){
var value = event.currentTarget.value;
Notes.update(this._id, {$set: {description: value}});
},
Notes.update(this._id, {
$set: {description: value}
}, {
removeEmptyStrings: false,
trimStrings: false,
});
}),
});