mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-29 21:21:15 +02:00
All: Resolves #345: Option to hide completed todos
This commit is contained in:
parent
16635defcd
commit
61dd4cefbc
ElectronClient/app
ReactNativeClient/lib
@ -437,6 +437,14 @@ class Application extends BaseApplication {
|
|||||||
click: () => {
|
click: () => {
|
||||||
Setting.setValue('uncompletedTodosOnTop', !Setting.value('uncompletedTodosOnTop'));
|
Setting.setValue('uncompletedTodosOnTop', !Setting.value('uncompletedTodosOnTop'));
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
label: Setting.settingMetadata('showCompletedTodos').label(),
|
||||||
|
type: 'checkbox',
|
||||||
|
checked: Setting.value('showCompletedTodos'),
|
||||||
|
screens: ['Main'],
|
||||||
|
click: () => {
|
||||||
|
Setting.setValue('showCompletedTodos', !Setting.value('showCompletedTodos'));
|
||||||
|
},
|
||||||
}],
|
}],
|
||||||
}, {
|
}, {
|
||||||
label: _('Tools'),
|
label: _('Tools'),
|
||||||
|
@ -199,6 +199,7 @@ class BaseApplication {
|
|||||||
let options = {
|
let options = {
|
||||||
order: stateUtils.notesOrder(state.settings),
|
order: stateUtils.notesOrder(state.settings),
|
||||||
uncompletedTodosOnTop: Setting.value('uncompletedTodosOnTop'),
|
uncompletedTodosOnTop: Setting.value('uncompletedTodosOnTop'),
|
||||||
|
showCompletedTodos: Setting.value('showCompletedTodos'),
|
||||||
caseInsensitive: true,
|
caseInsensitive: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -283,6 +284,10 @@ class BaseApplication {
|
|||||||
refreshNotes = true;
|
refreshNotes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.hasGui() && ((action.type == 'SETTING_UPDATE_ONE' && action.key == 'showCompletedTodos') || action.type == 'SETTING_UPDATE_ALL')) {
|
||||||
|
refreshNotes = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.hasGui() && ((action.type == 'SETTING_UPDATE_ONE' && action.key.indexOf('notes.sortOrder') === 0) || action.type == 'SETTING_UPDATE_ALL')) {
|
if (this.hasGui() && ((action.type == 'SETTING_UPDATE_ONE' && action.key.indexOf('notes.sortOrder') === 0) || action.type == 'SETTING_UPDATE_ALL')) {
|
||||||
refreshNotes = true;
|
refreshNotes = true;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,11 @@ class NotesScreenComponent extends BaseScreenComponent {
|
|||||||
id: { name: 'uncompletedTodosOnTop', value: !Setting.value('uncompletedTodosOnTop') },
|
id: { name: 'uncompletedTodosOnTop', value: !Setting.value('uncompletedTodosOnTop') },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
buttons.push({
|
||||||
|
text: makeCheckboxText(Setting.value('showCompletedTodos'), 'tick', '[ ' + Setting.settingMetadata('showCompletedTodos').label() + ' ]'),
|
||||||
|
id: { name: 'showCompletedTodos', value: !Setting.value('showCompletedTodos') },
|
||||||
|
});
|
||||||
|
|
||||||
const r = await dialogs.pop(this, Setting.settingMetadata('notes.sortOrder.field').label(), buttons);
|
const r = await dialogs.pop(this, Setting.settingMetadata('notes.sortOrder.field').label(), buttons);
|
||||||
if (!r) return;
|
if (!r) return;
|
||||||
|
|
||||||
@ -79,6 +84,7 @@ class NotesScreenComponent extends BaseScreenComponent {
|
|||||||
let options = {
|
let options = {
|
||||||
order: props.notesOrder,
|
order: props.notesOrder,
|
||||||
uncompletedTodosOnTop: props.uncompletedTodosOnTop,
|
uncompletedTodosOnTop: props.uncompletedTodosOnTop,
|
||||||
|
showCompletedTodos: props.showCompletedTodos,
|
||||||
caseInsensitive: true,
|
caseInsensitive: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -219,6 +225,7 @@ const NotesScreen = connect(
|
|||||||
notes: state.notes,
|
notes: state.notes,
|
||||||
notesSource: state.notesSource,
|
notesSource: state.notesSource,
|
||||||
uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop,
|
uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop,
|
||||||
|
showCompletedTodos: state.settings.showCompletedTodos,
|
||||||
theme: state.settings.theme,
|
theme: state.settings.theme,
|
||||||
noteSelectionEnabled: state.noteSelectionEnabled,
|
noteSelectionEnabled: state.noteSelectionEnabled,
|
||||||
notesOrder: stateUtils.notesOrder(state.settings),
|
notesOrder: stateUtils.notesOrder(state.settings),
|
||||||
|
@ -237,6 +237,7 @@ class Note extends BaseItem {
|
|||||||
if (!options.conditionsParams) options.conditionsParams = [];
|
if (!options.conditionsParams) options.conditionsParams = [];
|
||||||
if (!options.fields) options.fields = this.previewFields();
|
if (!options.fields) options.fields = this.previewFields();
|
||||||
if (!options.uncompletedTodosOnTop) options.uncompletedTodosOnTop = false;
|
if (!options.uncompletedTodosOnTop) options.uncompletedTodosOnTop = false;
|
||||||
|
if (!('showCompletedTodos' in options)) options.showCompletedTodos = true;
|
||||||
|
|
||||||
if (parentId == BaseItem.getClass('Folder').conflictFolderId()) {
|
if (parentId == BaseItem.getClass('Folder').conflictFolderId()) {
|
||||||
options.conditions.push('is_conflict = 1');
|
options.conditions.push('is_conflict = 1');
|
||||||
@ -265,6 +266,10 @@ class Note extends BaseItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!options.showCompletedTodos) {
|
||||||
|
options.conditions.push('todo_completed <= 0');
|
||||||
|
}
|
||||||
|
|
||||||
if (options.uncompletedTodosOnTop && hasTodos) {
|
if (options.uncompletedTodosOnTop && hasTodos) {
|
||||||
let cond = options.conditions.slice();
|
let cond = options.conditions.slice();
|
||||||
cond.push('is_todo = 1');
|
cond.push('is_todo = 1');
|
||||||
|
@ -61,6 +61,7 @@ class Setting extends BaseModel {
|
|||||||
return output;
|
return output;
|
||||||
}},
|
}},
|
||||||
'uncompletedTodosOnTop': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['cli'], label: () => _('Uncompleted to-dos on top') },
|
'uncompletedTodosOnTop': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['cli'], label: () => _('Uncompleted to-dos on top') },
|
||||||
|
'showCompletedTodos': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['cli'], label: () => _('Show completed to-dos') },
|
||||||
'notes.sortOrder.field': { value: 'user_updated_time', type: Setting.TYPE_STRING, isEnum: true, public: true, appTypes: ['cli'], label: () => _('Sort notes by'), options: () => {
|
'notes.sortOrder.field': { value: 'user_updated_time', type: Setting.TYPE_STRING, isEnum: true, public: true, appTypes: ['cli'], label: () => _('Sort notes by'), options: () => {
|
||||||
const Note = require('lib/models/Note');
|
const Note = require('lib/models/Note');
|
||||||
const noteSortFields = ['user_updated_time', 'user_created_time', 'title'];
|
const noteSortFields = ['user_updated_time', 'user_created_time', 'title'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user