From 1a720c918c009f8a5a074f6d94b7f54206ff145c Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Sun, 26 Jun 2022 04:50:46 +0000 Subject: [PATCH] feat(admin): add pageExtensions field to admin general + more animated icons --- server/db/migrations/3.0.0.js | 1 + server/graph/resolvers/site.js | 13 ++++- server/graph/schemas/site.graphql | 2 + server/models/sites.js | 1 + .../icons/fluent-paint-roller-animated.svg | 55 +++++++++++++++++++ .../_assets/icons/fluent-paint-roller.svg | 25 ++++++++- .../icons/fluent-rest-api-animated.svg | 21 +++++++ .../ultraviolet-sort-by-follow-up-date.svg | 1 + ux/src/i18n/locales/en.json | 5 +- ux/src/pages/AdminApi.vue | 2 +- ux/src/pages/AdminGeneral.vue | 22 ++++++++ ux/src/pages/AdminTheme.vue | 8 +-- 12 files changed, 146 insertions(+), 10 deletions(-) create mode 100644 ux/public/_assets/icons/fluent-paint-roller-animated.svg create mode 100644 ux/public/_assets/icons/fluent-rest-api-animated.svg create mode 100644 ux/public/_assets/icons/ultraviolet-sort-by-follow-up-date.svg diff --git a/server/db/migrations/3.0.0.js b/server/db/migrations/3.0.0.js index d1deeca8..e80ef3b3 100644 --- a/server/db/migrations/3.0.0.js +++ b/server/db/migrations/3.0.0.js @@ -453,6 +453,7 @@ exports.up = async knex => { company: '', contentLicense: '', footerExtra: '', + pageExtensions: ['md', 'html', 'txt'], defaults: { timezone: 'America/New_York', dateFormat: 'YYYY-MM-DD', diff --git a/server/graph/resolvers/site.js b/server/graph/resolvers/site.js index af59af08..5fec0acf 100644 --- a/server/graph/resolvers/site.js +++ b/server/graph/resolvers/site.js @@ -13,7 +13,8 @@ module.exports = { ...s.config, id: s.id, hostname: s.hostname, - isEnabled: s.isEnabled + isEnabled: s.isEnabled, + pageExtensions: s.config.pageExtensions.join(', ') })) }, async siteById (obj, args) { @@ -22,7 +23,8 @@ module.exports = { ...site.config, id: site.id, hostname: site.hostname, - isEnabled: site.isEnabled + isEnabled: site.isEnabled, + pageExtensions: site.config.pageExtensions.join(', ') } : null }, async siteByHostname (obj, args) { @@ -38,7 +40,8 @@ module.exports = { ...site.config, id: site.id, hostname: site.hostname, - isEnabled: site.isEnabled + isEnabled: site.isEnabled, + pageExtensions: site.config.pageExtensions.join(', ') } : null } }, @@ -102,6 +105,10 @@ module.exports = { if (args.patch?.theme?.injectCSS) { args.patch.theme.injectCSS = new CleanCSS({ inline: false }).minify(args.patch.theme.injectCSS).styles } + // -> Format Page Extensions + if (args.patch?.pageExtensions) { + args.patch.pageExtensions = args.patch.pageExtensions.split(',').map(ext => ext.trim().toLowerCase()).filter(ext => ext.length > 0) + } // -> Update site await WIKI.models.sites.updateSite(args.id, { hostname: args.patch.hostname ?? site.hostname, diff --git a/server/graph/schemas/site.graphql b/server/graph/schemas/site.graphql index a5a34ec4..76e9190e 100644 --- a/server/graph/schemas/site.graphql +++ b/server/graph/schemas/site.graphql @@ -54,6 +54,7 @@ type Site { company: String contentLicense: String footerExtra: String + pageExtensions: String logoText: Boolean sitemap: Boolean robots: SiteRobots @@ -132,6 +133,7 @@ input SiteUpdateInput { company: String contentLicense: String footerExtra: String + pageExtensions: String logoText: Boolean sitemap: Boolean robots: SiteRobotsInput diff --git a/server/models/sites.js b/server/models/sites.js index 91a0211a..329c3a5f 100644 --- a/server/models/sites.js +++ b/server/models/sites.js @@ -38,6 +38,7 @@ module.exports = class Site extends Model { company: '', contentLicense: '', footerExtra: '', + pageExtensions: ['md', 'html', 'txt'], defaults: { timezone: 'America/New_York', dateFormat: 'YYYY-MM-DD', diff --git a/ux/public/_assets/icons/fluent-paint-roller-animated.svg b/ux/public/_assets/icons/fluent-paint-roller-animated.svg new file mode 100644 index 00000000..5a937043 --- /dev/null +++ b/ux/public/_assets/icons/fluent-paint-roller-animated.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ux/public/_assets/icons/fluent-paint-roller.svg b/ux/public/_assets/icons/fluent-paint-roller.svg index 82a4ca3c..81b810ac 100644 --- a/ux/public/_assets/icons/fluent-paint-roller.svg +++ b/ux/public/_assets/icons/fluent-paint-roller.svg @@ -1 +1,24 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ux/public/_assets/icons/fluent-rest-api-animated.svg b/ux/public/_assets/icons/fluent-rest-api-animated.svg new file mode 100644 index 00000000..e684aa6a --- /dev/null +++ b/ux/public/_assets/icons/fluent-rest-api-animated.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ux/public/_assets/icons/ultraviolet-sort-by-follow-up-date.svg b/ux/public/_assets/icons/ultraviolet-sort-by-follow-up-date.svg new file mode 100644 index 00000000..2211d081 --- /dev/null +++ b/ux/public/_assets/icons/ultraviolet-sort-by-follow-up-date.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ux/src/i18n/locales/en.json b/ux/src/i18n/locales/en.json index 40202070..adcae309 100644 --- a/ux/src/i18n/locales/en.json +++ b/ux/src/i18n/locales/en.json @@ -1426,5 +1426,8 @@ "admin.mail.smtpName": "Client Identifying Name", "admin.mail.smtpNameHint": "An optional name to send to the SMTP server to identify your mailer. Leave empty to use server hostname. For Google Workspace customers, this should be your main domain name.", "admin.general.footerExtra": "Additional Footer Text", - "admin.general.footerExtraHint": "Optionally add more content to the footer, such as additional copyright terms or mandatory regulatory info." + "admin.general.footerExtraHint": "Optionally add more content to the footer, such as additional copyright terms or mandatory regulatory info.", + "admin.general.urlHandling": "URL Handling", + "admin.general.pageExtensions": "Page Extensions", + "admin.general.pageExtensionsHint": "A comma-separated list of URL extensions that will be treated as pages. For example, adding md will treat /foobar.md the same as /foobar." } diff --git a/ux/src/pages/AdminApi.vue b/ux/src/pages/AdminApi.vue index 078fd705..53975c43 100644 --- a/ux/src/pages/AdminApi.vue +++ b/ux/src/pages/AdminApi.vue @@ -2,7 +2,7 @@ q-page.admin-api .row.q-pa-md.items-center .col-auto - img.admin-icon.animated.fadeInLeft(src='/_assets/icons/fluent-rest-api.svg') + img.admin-icon.animated.fadeInLeft(src='/_assets/icons/fluent-rest-api-animated.svg') .col.q-pl-md .text-h5.text-primary.animated.fadeInLeft {{ t('admin.api.title') }} .text-subtitle1.text-grey.animated.fadeInLeft.wait-p2s {{ t('admin.api.subtitle') }} diff --git a/ux/src/pages/AdminGeneral.vue b/ux/src/pages/AdminGeneral.vue index 57e29d99..f5cf0248 100644 --- a/ux/src/pages/AdminGeneral.vue +++ b/ux/src/pages/AdminGeneral.vue @@ -209,6 +209,25 @@ q-page.admin-general :aria-label='t(`admin.general.allowSearch`)' ) + //- ----------------------- + //- URL Handling + //- ----------------------- + q-card.shadow-1.q-pb-sm.q-mt-md + q-card-section + .text-subtitle1 {{t('admin.general.urlHandling')}} + q-item + blueprint-icon(icon='sort-by-follow-up-date') + q-item-section + q-item-label {{t(`admin.general.pageExtensions`)}} + q-item-label(caption) {{t(`admin.general.pageExtensionsHint`)}} + q-item-section + q-input( + outlined + v-model='state.config.pageExtensions' + dense + :aria-label='t(`admin.general.pageExtensions`)' + ) + .col-12.col-lg-5 //- ----------------------- //- Logo @@ -444,6 +463,7 @@ const state = reactive({ company: '', contentLicense: '', footerExtra: '', + pageExtensions: '', logoText: false, ratings: { index: false, @@ -532,6 +552,7 @@ async function load () { company contentLicense footerExtra + pageExtensions logoText sitemap robots { @@ -594,6 +615,7 @@ async function save () { company: state.config.company ?? '', contentLicense: state.config.contentLicense ?? '', footerExtra: state.config.footerExtra ?? '', + pageExtensions: state.config.pageExtensions ?? '', logoText: state.config.logoText ?? false, sitemap: state.config.sitemap ?? false, robots: { diff --git a/ux/src/pages/AdminTheme.vue b/ux/src/pages/AdminTheme.vue index a1fc09e9..99b83c1d 100644 --- a/ux/src/pages/AdminTheme.vue +++ b/ux/src/pages/AdminTheme.vue @@ -2,7 +2,7 @@ q-page.admin-theme .row.q-pa-md.items-center .col-auto - img.admin-icon.animated.fadeInLeft(src='/_assets/icons/fluent-paint-roller.svg') + img.admin-icon.animated.fadeInLeft(src='/_assets/icons/fluent-paint-roller-animated.svg') .col.q-pl-md .text-h5.text-primary.animated.fadeInLeft {{ t('admin.theme.title') }} .text-subtitle1.text-grey.animated.fadeInLeft.wait-p2s {{ t('admin.theme.subtitle') }} @@ -48,7 +48,7 @@ q-page.admin-theme color='pink' @click='resetColors' ) - q-item(tag='label', v-ripple) + q-item(tag='label') blueprint-icon(icon='light-on') q-item-section q-item-label {{t(`admin.theme.darkMode`)}} @@ -123,7 +123,7 @@ q-page.admin-theme :options='rightLeftOptions' ) q-separator.q-my-sm(inset) - q-item(tag='label', v-ripple) + q-item(tag='label') blueprint-icon(icon='share') q-item-section q-item-label {{t(`admin.theme.showSharingMenu`)}} @@ -137,7 +137,7 @@ q-page.admin-theme :aria-label='t(`admin.theme.showSharingMenu`)' ) q-separator.q-my-sm(inset) - q-item(tag='label', v-ripple) + q-item(tag='label') blueprint-icon(icon='print') q-item-section q-item-label {{t(`admin.theme.showPrintBtn`)}}