Refactors most controllers and directives into classes for more organized and maintainable code
This commit is contained in:
20
app/assets/javascripts/models/noteHistoryEntry.js
Normal file
20
app/assets/javascripts/models/noteHistoryEntry.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { SFItemHistoryEntry } from 'snjs';
|
||||
|
||||
export class NoteHistoryEntry extends SFItemHistoryEntry {
|
||||
|
||||
previewTitle() {
|
||||
return this.item.updated_at.toLocaleString();
|
||||
}
|
||||
|
||||
previewSubTitle() {
|
||||
if(!this.hasPreviousEntry) {
|
||||
return `${this.textCharDiffLength} characters loaded`
|
||||
} else if(this.textCharDiffLength < 0) {
|
||||
return `${this.textCharDiffLength * -1} characters removed`
|
||||
} else if(this.textCharDiffLength > 0) {
|
||||
return `${this.textCharDiffLength} characters added`
|
||||
} else {
|
||||
return "Title or metadata changed"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user