Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/public/app/widgets/dialogs/add_link.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from "../../services/i18n.js";
import treeService from '../../services/tree.js';
import noteAutocompleteService from "../../services/note_autocomplete.js";
import utils from "../../services/utils.js";
Expand All @@ -8,50 +9,50 @@ const TPL = `
<div class="modal-dialog modal-lg" style="max-width: 1000px" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mr-auto">Add link</h5>
<h5 class="modal-title mr-auto">${t('add_link.add_link')}</h5>

<button type="button" class="help-button" title="Help on links" data-help-page="Links">?</button>
<button type="button" class="help-button" title="${t('add_link.help_on_links')}" data-help-page="Links">?</button>

<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<button type="button" class="close" data-dismiss="modal" aria-label="${t('add_link.close')}" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form class="add-link-form">
<div class="modal-body">
<div class="form-group">
<label for="add-link-note-autocomplete">Note</label>
<label for="add-link-note-autocomplete">${t('add_link.note')}</label>

<div class="input-group">
<input class="add-link-note-autocomplete form-control" placeholder="search for note by its name">
<input class="add-link-note-autocomplete form-control" placeholder="${t('add_link.search_note')}">
</div>
</div>

<div class="add-link-title-settings">
<div class="add-link-title-radios form-check">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="link-type" value="reference-link" checked>
link title mirrors the note's current title
${t('add_link.link_title_mirrors')}
</label>
</div>
<div class="add-link-title-radios form-check">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="link-type" value="hyper-link">
link title can be changed arbitrarily
${t('add_link.link_title_arbitrary')}
</label>
</div>

<div class="add-link-title-form-group form-group">
<br/>
<label>
Link title
${t('add_link.link_title')}

<input class="link-title form-control" style="width: 100%;">
</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Add link <kbd>enter</kbd></button>
<button type="submit" class="btn btn-primary">${t('add_link.add_link')} <kbd>enter</kbd></button>
</div>
</form>
</div>
Expand Down
13 changes: 7 additions & 6 deletions src/public/app/widgets/dialogs/branch_prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import toastService from "../../services/toast.js";
import utils from "../../services/utils.js";
import BasicWidget from "../basic_widget.js";
import appContext from "../../components/app_context.js";
import { t } from "../../services/i18n.js";

let branchId;

Expand All @@ -13,17 +14,17 @@ const TPL = `<div class="branch-prefix-dialog modal fade mx-auto" tabindex="-1"
<form class="branch-prefix-form">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mr-auto">Edit branch prefix</h5>
<h5 class="modal-title mr-auto">${t('branch_prefix.edit_branch_prefix')}</h5>

<button class="help-button" type="button" data-help-page="Tree-concepts#prefix" title="Help on Tree prefix">?</button>
<button class="help-button" type="button" data-help-page="Tree-concepts#prefix" title="${t('branch_prefix.help_on_tree_prefix')}">?</button>

<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0;">
<button type="button" class="close" data-dismiss="modal" aria-label="${t('branch_prefix.close')}" style="margin-left: 0;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="branch-prefix-input">Prefix: </label> &nbsp;
<label for="branch-prefix-input">${t('branch_prefix.prefix')}</label> &nbsp;

<div class="input-group">
<input class="branch-prefix-input form-control">
Expand All @@ -35,7 +36,7 @@ const TPL = `<div class="branch-prefix-dialog modal fade mx-auto" tabindex="-1"
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary btn-sm">Save</button>
<button class="btn btn-primary btn-sm">${t('branch_prefix.save')}</button>
</div>
</div>
</form>
Expand Down Expand Up @@ -100,6 +101,6 @@ export default class BranchPrefixDialog extends BasicWidget {

this.$widget.modal('hide');

toastService.showMessage("Branch prefix has been saved.");
toastService.showMessage(t('branch_prefix.branch_prefix_saved'));
}
}
19 changes: 10 additions & 9 deletions src/public/app/widgets/dialogs/bulk_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import bulkActionService from "../../services/bulk_action.js";
import utils from "../../services/utils.js";
import server from "../../services/server.js";
import toastService from "../../services/toast.js";
import { t } from "../../services/i18n.js";

const TPL = `
<div class="bulk-actions-dialog modal mx-auto" tabindex="-1" role="dialog">
Expand Down Expand Up @@ -37,32 +38,32 @@ const TPL = `
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mr-auto">Bulk actions</h5>
<h5 class="modal-title mr-auto">${t('bulk_actions.bulk_actions')}</h5>

<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<button type="button" class="close" data-dismiss="modal" aria-label="${t('bulk_actions.close')}">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<h4>Affected notes: <span class="affected-note-count">0</span></h4>
<h4>${t('bulk_actions.affected_notes')}: <span class="affected-note-count">0</span></h4>

<div class="form-check">
<label class="form-check-label">
<input class="include-descendants form-check-input" type="checkbox" value="">
Include descendants of the selected notes
${t('bulk_actions.include_descendants')}
</label>
</div>

<h4>Available actions</h4>
<h4>${t('bulk_actions.available_actions')}</h4>

<table class="bulk-available-action-list"></table>

<h4>Chosen actions</h4>
<h4>${t('bulk_actions.chosen_actions')}</h4>

<table class="bulk-existing-action-list"></table>
</div>
<div class="modal-footer">
<button type="submit" class="execute-bulk-actions btn btn-primary">Execute bulk actions</button>
<button type="submit" class="execute-bulk-actions btn btn-primary">${t('bulk_actions.execute_bulk_actions')}</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -95,7 +96,7 @@ export default class BulkActionsDialog extends BasicWidget {
includeDescendants: this.$includeDescendants.is(":checked")
});

toastService.showMessage("Bulk actions have been executed successfully.", 3000);
toastService.showMessage(t('bulk_actions.bulk_actions_executed'), 3000);

utils.closeActiveDialog();
});
Expand All @@ -120,7 +121,7 @@ export default class BulkActionsDialog extends BasicWidget {
if (actions.length > 0) {
this.$existingActionList.append(...actions.map(action => action.render()));
} else {
this.$existingActionList.append($("<p>None yet ... add an action by clicking one of the available ones above.</p>"))
this.$existingActionList.append($("<p>").text(t('bulk_actions.none_yet')))
}
}

Expand Down
21 changes: 11 additions & 10 deletions src/public/app/widgets/dialogs/clone_to.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,45 @@ import froca from "../../services/froca.js";
import branchService from "../../services/branches.js";
import appContext from "../../components/app_context.js";
import BasicWidget from "../basic_widget.js";
import { t } from "../../services/i18n.js";

const TPL = `
<div class="clone-to-dialog modal mx-auto" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" style="max-width: 1000px" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mr-auto">Clone notes to ...</h5>
<h5 class="modal-title mr-auto">${t('clone_to.clone_notes_to')}</h5>

<button type="button" class="help-button" title="Help on links" data-help-page="Cloning-notes">?</button>
<button type="button" class="help-button" title="${t('clone_to.help_on_links')}" data-help-page="Cloning-notes">?</button>

<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form class="clone-to-form">
<div class="modal-body">
<h5>Notes to clone</h5>
<h5>${t('clone_to.notes_to_clone')}</h5>

<ul class="clone-to-note-list" style="max-height: 200px; overflow: auto;"></ul>

<div class="form-group">
<label style="width: 100%">
Target parent note
${t('clone_to.target_parent_note')}
<div class="input-group">
<input class="clone-to-note-autocomplete form-control" placeholder="search for note by its name">
<input class="clone-to-note-autocomplete form-control" placeholder="${t('clone_to.search_for_note_by_its_name')}">
</div>
</label>
</div>

<div class="form-group" title="Cloned note will be shown in note tree with given prefix">
<div class="form-group" title="${t('clone_to.cloned_note_prefix_title')}">
<label style="width: 100%">
Prefix (optional)
${t('clone_to.prefix_optional')}
<input class="clone-prefix form-control" style="width: 100%;">
</label>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Clone to selected note <kbd>enter</kbd></button>
<button type="submit" class="btn btn-primary">${t('clone_to.clone_to_selected_note')} <kbd>enter</kbd></button>
</div>
</form>
</div>
Expand Down Expand Up @@ -73,7 +74,7 @@ export default class CloneToDialog extends BasicWidget {
this.cloneNotesTo(notePath);
}
else {
logError("No path to clone to.");
logError(t('clone_to.no_path_to_clone_to'));
}

return false;
Expand Down Expand Up @@ -119,7 +120,7 @@ export default class CloneToDialog extends BasicWidget {
const clonedNote = await froca.getNote(cloneNoteId);
const targetNote = await froca.getBranch(targetBranchId).getNote();

toastService.showMessage(`Note "${clonedNote.title}" has been cloned into ${targetNote.title}`);
toastService.showMessage(t('clone_to.note_cloned', {clonedTitle: clonedNote.title, targetTitle: targetNote.title}));
}
}
}
13 changes: 7 additions & 6 deletions src/public/app/widgets/dialogs/confirm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BasicWidget from "../basic_widget.js";
import { t } from "../../services/i18n.js";

const DELETE_NOTE_BUTTON_CLASS = "confirm-dialog-delete-note";

Expand All @@ -7,7 +8,7 @@ const TPL = `
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mr-auto">Confirmation</h5>
<h5 class="modal-title mr-auto">${t('confirm.confirmation')}</h5>

<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
Expand All @@ -19,11 +20,11 @@ const TPL = `
<div class="confirm-dialog-custom"></div>
</div>
<div class="modal-footer">
<button class="confirm-dialog-cancel-button btn btn-sm">Cancel</button>
<button class="confirm-dialog-cancel-button btn btn-sm">${t('confirm.cancel')}</button>

&nbsp;

<button class="confirm-dialog-ok-button btn btn-primary btn-sm">OK</button>
<button class="confirm-dialog-ok-button btn btn-primary btn-sm">${t('confirm.ok')}</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -82,7 +83,7 @@ export default class ConfirmDialog extends BasicWidget {
showConfirmDeleteNoteBoxWithNoteDialogEvent({title, callback}) {
glob.activeDialog = this.$widget;

this.$confirmContent.text(`Are you sure you want to remove the note "${title}" from relation map?`);
this.$confirmContent.text(`${t('confirm.are_you_sure_remove_note', {title: title})}`);

this.$custom.empty()
.append("<br/>")
Expand All @@ -92,13 +93,13 @@ export default class ConfirmDialog extends BasicWidget {
$("<label>")
.addClass("form-check-label")
.attr("style", "text-decoration: underline dotted var(--main-text-color)")
.attr("title", "If you don't check this, the note will be only removed from the relation map.")
.attr("title", `${t('confirm.if_you_dont_check')}`)
.append(
$("<input>")
.attr("type", "checkbox")
.addClass(`form-check-input ${DELETE_NOTE_BUTTON_CLASS}`)
)
.append("Also delete the note")
.append(`${t('confirm.also_delete_note')}`)
));

this.$custom.show();
Expand Down
23 changes: 12 additions & 11 deletions src/public/app/widgets/dialogs/delete_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import froca from "../../services/froca.js";
import linkService from "../../services/link.js";
import utils from "../../services/utils.js";
import BasicWidget from "../basic_widget.js";
import { t } from "../../services/i18n.js";

const TPL = `
<div class="delete-notes-dialog modal mx-auto" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-scrollable modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title mr-auto">Delete notes preview</h4>
<h4 class="modal-title mr-auto">${t('delete_notes.delete_notes_preview')}</h4>

<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
Expand All @@ -20,42 +21,42 @@ const TPL = `
<label>
<input class="delete-all-clones" value="1" type="checkbox">

delete also all clones (can be undone in recent changes)
${t('delete_notes.delete_all_clones_description')}
</label>
</div>

<div class="checkbox">
<label title="Normal (soft) deletion only marks the notes as deleted and they can be undeleted (in recent changes dialog) within a period of time. Checking this option will erase the notes immediately and it won't be possible to undelete the notes.">
<label title="${t('delete_notes.erase_notes_description')}">
<input class="erase-notes" value="1" type="checkbox">

erase notes permanently (can't be undone), including all clones. This will force application reload.
${t('delete_notes.erase_notes_warning')}
</label>
</div>

<div class="delete-notes-list-wrapper">
<h4>Following notes will be deleted (<span class="deleted-notes-count"></span>)</h4>
<h4>${t('delete_notes.notes_to_be_deleted')} (<span class="deleted-notes-count"></span>)</h4>

<ul class="delete-notes-list" style="max-height: 200px; overflow: auto;"></ul>
</div>

<div class="no-note-to-delete-wrapper alert alert-info">
No note will be deleted (only clones).
${t('delete_notes.no_note_to_delete')}
</div>

<div class="broken-relations-wrapper">
<div class="alert alert-danger">
<h4>Following relations will be broken and deleted (<span class="broke-relations-count"></span>)</h4>
<h4>${t('delete_notes.broken_relations_to_be_deleted')} (<span class="broke-relations-count"></span>)</h4>

<ul class="broken-relations-list" style="max-height: 200px; overflow: auto;"></ul>
</div>
</div>
</div>
<div class="modal-footer">
<button class="delete-notes-dialog-cancel-button btn btn-sm">Cancel</button>
<button class="delete-notes-dialog-cancel-button btn btn-sm">${t('delete_notes.cancel')}</button>

&nbsp;

<button class="delete-notes-dialog-ok-button btn btn-primary btn-sm">OK</button>
<button class="delete-notes-dialog-ok-button btn btn-primary btn-sm">${t('delete_notes.ok')}</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -135,9 +136,9 @@ export default class DeleteNotesDialog extends BasicWidget {
for (const attr of response.brokenRelations) {
this.$brokenRelationsList.append(
$("<li>")
.append(`Note `)
.append(`${t('delete_notes.note')} `)
.append(await linkService.createLink(attr.value))
.append(` (to be deleted) is referenced by relation <code>${attr.name}</code> originating from `)
.append(` ${t('delete_notes.to_be_deleted', {attrName: attr.name})} `)
.append(await linkService.createLink(attr.noteId))
);
}
Expand Down
Loading