mirror of https://github.com/TriliumNext/Notes
Merge branch 'sort-by'
commit
2c958eaacb
@ -0,0 +1,24 @@
|
||||
import server from "../services/server.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
const $dialog = $("#sort-child-notes-dialog");
|
||||
const $form = $("#sort-child-notes-form");
|
||||
|
||||
let parentNoteId = null;
|
||||
|
||||
$form.on('submit', async () => {
|
||||
const sortBy = $form.find("input[name='sort-by']:checked").val();
|
||||
const sortDirection = $form.find("input[name='sort-direction']:checked").val();
|
||||
|
||||
await server.put(`notes/${parentNoteId}/sort-children`, {sortBy, sortDirection});
|
||||
|
||||
utils.closeActiveDialog();
|
||||
});
|
||||
|
||||
export async function showDialog(noteId) {
|
||||
parentNoteId = noteId;
|
||||
|
||||
utils.openDialog($dialog);
|
||||
|
||||
$form.find('input:first').focus();
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
<div id="sort-child-notes-dialog" class="modal mx-auto" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg" style="max-width: 500px" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title mr-auto">Sort children by ...</h5>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="sort-child-notes-form">
|
||||
<div class="modal-body">
|
||||
<h5>Sorting criteria</h5>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sort-by" value="title" id="sort-by-title" checked>
|
||||
<label class="form-check-label" for="sort-by-title">
|
||||
title
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sort-by" value="dateCreated" id="sort-by-date-created">
|
||||
<label class="form-check-label" for="sort-by-date-created">
|
||||
date created
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sort-by" value="dateModified" id="sort-by-date-modified">
|
||||
<label class="form-check-label" for="sort-by-date-modified">
|
||||
date modified
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<h5>Sorting direction</h5>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sort-direction" value="asc" id="sort-direction-asc" checked>
|
||||
<label class="form-check-label" for="sort-direction-asc">
|
||||
ascending
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sort-direction" value="desc" id="sort-direction-desc">
|
||||
<label class="form-check-label" for="sort-direction-desc">
|
||||
descending
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Sort <kbd>enter</kbd></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue