mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
feat(settings/share): add title to section
This commit is contained in:
parent
bdd6395a76
commit
16b16927ef
@ -6,6 +6,8 @@ import searchService from "../../../../services/search.js";
|
|||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="options-section">
|
<div class="options-section">
|
||||||
|
<h4>${t("share.title")}</h4>
|
||||||
|
|
||||||
<p>${t("share.redirect_bare_domain_description")}</p>
|
<p>${t("share.redirect_bare_domain_description")}</p>
|
||||||
<label class="tn-checkbox">
|
<label class="tn-checkbox">
|
||||||
<input type="checkbox" name="redirectBareDomain">
|
<input type="checkbox" name="redirectBareDomain">
|
||||||
@ -37,7 +39,7 @@ export default class ShareSettingsOptions extends OptionsWidget {
|
|||||||
// Add change handlers for both checkboxes
|
// Add change handlers for both checkboxes
|
||||||
this.$widget.find('input[type="checkbox"]').on("change", (e: JQuery.ChangeEvent) => {
|
this.$widget.find('input[type="checkbox"]').on("change", (e: JQuery.ChangeEvent) => {
|
||||||
this.save();
|
this.save();
|
||||||
|
|
||||||
// Show/hide share root status section based on redirectBareDomain checkbox
|
// Show/hide share root status section based on redirectBareDomain checkbox
|
||||||
const target = e.target as HTMLInputElement;
|
const target = e.target as HTMLInputElement;
|
||||||
if (target.name === 'redirectBareDomain') {
|
if (target.name === 'redirectBareDomain') {
|
||||||
@ -66,7 +68,7 @@ export default class ShareSettingsOptions extends OptionsWidget {
|
|||||||
async checkShareRoot() {
|
async checkShareRoot() {
|
||||||
const $button = this.$widget.find('.check-share-root');
|
const $button = this.$widget.find('.check-share-root');
|
||||||
$button.prop('disabled', true);
|
$button.prop('disabled', true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const shareRootNotes = await searchService.searchForNotes("#shareRoot");
|
const shareRootNotes = await searchService.searchForNotes("#shareRoot");
|
||||||
const sharedShareRootNote = shareRootNotes.find(note => note.isShared());
|
const sharedShareRootNote = shareRootNotes.find(note => note.isShared());
|
||||||
@ -80,7 +82,7 @@ export default class ShareSettingsOptions extends OptionsWidget {
|
|||||||
this.$shareRootStatus
|
this.$shareRootStatus
|
||||||
.removeClass('text-success')
|
.removeClass('text-success')
|
||||||
.addClass('text-danger')
|
.addClass('text-danger')
|
||||||
.text(shareRootNotes.length > 0
|
.text(shareRootNotes.length > 0
|
||||||
? t("share.share_root_not_shared", {noteTitle: shareRootNotes[0].title})
|
? t("share.share_root_not_shared", {noteTitle: shareRootNotes[0].title})
|
||||||
: t("share.share_root_not_found"));
|
: t("share.share_root_not_found"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user