2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

UX: Widget options to disable FAQ and About

This commit is contained in:
Robin Ward 2017-11-10 10:53:57 -05:00
parent 6cd69529a8
commit 32be3f98c9

View file

@ -35,7 +35,9 @@ export default createWidget('hamburger-menu', {
settings: { settings: {
showCategories: true, showCategories: true,
maxWidth: 300 maxWidth: 300,
showFAQ: true,
showAbout: true
}, },
adminLinks() { adminLinks() {
@ -141,9 +143,11 @@ export default createWidget('hamburger-menu', {
footerLinks(prioritizeFaq, faqUrl) { footerLinks(prioritizeFaq, faqUrl) {
const links = []; const links = [];
if (this.settings.showAbout) {
links.push({ route: 'about', className: 'about-link', label: 'about.simple_title' }); links.push({ route: 'about', className: 'about-link', label: 'about.simple_title' });
}
if (!prioritizeFaq) { if (this.settings.showFAQ && !prioritizeFaq) {
links.push({ href: faqUrl, className: 'faq-link', label: 'faq' }); links.push({ href: faqUrl, className: 'faq-link', label: 'faq' });
} }
@ -171,7 +175,10 @@ export default createWidget('hamburger-menu', {
faqUrl = Discourse.getURL('/faq'); faqUrl = Discourse.getURL('/faq');
} }
const prioritizeFaq = this.currentUser && !this.currentUser.read_faq; const prioritizeFaq = this.settings.showFAQ &&
this.currentUser &&
!this.currentUser.read_faq;
if (prioritizeFaq) { if (prioritizeFaq) {
results.push(this.attach('menu-links', { name: 'faq-link', heading: true, contents: () => { results.push(this.attach('menu-links', { name: 'faq-link', heading: true, contents: () => {
return this.attach('priority-faq-link', { href: faqUrl }); return this.attach('priority-faq-link', { href: faqUrl });