diff --git a/wiki/public/js/render_wiki.js b/wiki/public/js/render_wiki.js index 01f8b1c7..fcd6cfeb 100644 --- a/wiki/public/js/render_wiki.js +++ b/wiki/public/js/render_wiki.js @@ -109,6 +109,7 @@ window.RenderWiki = class RenderWiki extends Wiki { this.set_revisions(); this.add_click_to_copy(); this.setup_feedback(); + this.setup_page_settings(); } }); } @@ -719,4 +720,38 @@ window.RenderWiki = class RenderWiki extends Wiki { }); }); } + + setup_page_settings() { + $(".update-page-settings-button").on("click", function () { + const name = $('[name="wiki-page-name"]').val(); + const hideOnSidebar = $('input[name="pageHideOnSidebar"]').prop( + "checked", + ); + const route = + $(".wiki-space-route-block").text().trim() + + $('input[name="pageRoute"]').val(); + + frappe + .call({ + method: "wiki.wiki.doctype.wiki_page.wiki_page.update_page_settings", + args: { + name, + settings: { + hide_on_sidebar: !!hideOnSidebar, + route, + }, + }, + }) + .then(() => { + frappe.show_alert({ + message: __("Page settings updated successfully"), + indicator: "green", + }); + + setTimeout(() => { + window.location.href = "/" + route; + }, 1000); + }); + }); + } }; diff --git a/wiki/public/scss/wiki.scss b/wiki/public/scss/wiki.scss index b84be465..92828f54 100644 --- a/wiki/public/scss/wiki.scss +++ b/wiki/public/scss/wiki.scss @@ -1233,6 +1233,25 @@ p { padding: 0.25rem 0.5rem; font-size: 13px; line-height: 1.25rem; + + &[type="checkbox"] { + color: #000; + padding: 0%; + border: 1px solid var(--gray-500); + border-radius: 4px; + accent-color: black; + + &:checked { + background-color: var(--primary); + background-image: url("data:image/svg+xml, "), + var(--checkbox-gradient); + background-size: 57%, 100%; + box-shadow: none; + border: none; + background-repeat: no-repeat; + background-position: center; + } + } } input, @@ -1334,3 +1353,11 @@ ins { letter-spacing: 0.02em; font-weight: 400; } + +.wiki-space-route-block { + padding: 0.4rem 0.5rem; + border-radius: 0.375rem; + background-color: var(--gray-300); + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} \ No newline at end of file diff --git a/wiki/wiki/doctype/wiki_group_item/wiki_group_item.json b/wiki/wiki/doctype/wiki_group_item/wiki_group_item.json index 8b60dbc2..b0ec8262 100644 --- a/wiki/wiki/doctype/wiki_group_item/wiki_group_item.json +++ b/wiki/wiki/doctype/wiki_group_item/wiki_group_item.json @@ -8,7 +8,8 @@ "engine": "InnoDB", "field_order": [ "parent_label", - "wiki_page" + "wiki_page", + "hide_on_sidebar" ], "fields": [ { @@ -25,12 +26,18 @@ "label": "Wiki Page", "options": "Wiki Page", "reqd": 1 + }, + { + "default": "0", + "fieldname": "hide_on_sidebar", + "fieldtype": "Check", + "label": "Hide on sidebar" } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2023-04-04 18:17:37.507102", + "modified": "2024-04-16 12:06:18.398870", "modified_by": "Administrator", "module": "Wiki", "name": "Wiki Group Item", diff --git a/wiki/wiki/doctype/wiki_page/templates/page_settings.html b/wiki/wiki/doctype/wiki_page/templates/page_settings.html new file mode 100644 index 00000000..129c7d39 --- /dev/null +++ b/wiki/wiki/doctype/wiki_page/templates/page_settings.html @@ -0,0 +1,43 @@ +
\ No newline at end of file diff --git a/wiki/wiki/doctype/wiki_page/templates/show.html b/wiki/wiki/doctype/wiki_page/templates/show.html index f86f7c83..97c7a835 100644 --- a/wiki/wiki/doctype/wiki_page/templates/show.html +++ b/wiki/wiki/doctype/wiki_page/templates/show.html @@ -15,8 +15,13 @@