diff --git a/package-lock.json b/package-lock.json index d3660ba4..b242bf97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nodebb-theme-harmony", - "version": "2.2.72", + "version": "3.0.0-beta.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nodebb-theme-harmony", - "version": "2.2.72", + "version": "3.0.0-beta.2", "license": "MIT", "dependencies": { "@fontsource/inter": "5.2.8", diff --git a/package.json b/package.json index e9fafd6e..3fe956f3 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "nodebb-theme-harmony", - "version": "2.2.72", + "version": "3.0.0-beta.2", "nbbpm": { - "compatibility": "^4.12.0" + "compatibility": "^4.14.0" }, "description": "Harmony theme for NodeBB", "main": "library.js", diff --git a/public/harmony.js b/public/harmony.js index b414b98b..5681ca8a 100644 --- a/public/harmony.js +++ b/public/harmony.js @@ -141,7 +141,7 @@ $(document).ready(function () { } function setupDrafts() { - require(['composer/drafts', 'bootbox'], function (drafts, bootbox) { + require(['composer/drafts', 'modals', 'api'], function (drafts, modals, api) { const draftsEl = $('[component="sidebar/drafts"]'); const bottomBarDraftsEl = $('[component="bottombar"] [component="sidebar/drafts"]'); function updateBadgeCount() { @@ -159,17 +159,15 @@ $(document).ready(function () { draftListEl.find('.draft-item-container').html(''); return; } - draftItems.reverse().forEach((draft) => { - if (draft) { - if (draft.title) { - draft.title = utils.escapeHTML(String(draft.title)); - } - draft.text = utils.escapeHTML( - draft.text - ).replace(/(?:\r\n|\r|\n)/g, '
'); + draftItems.reverse(); + await Promise.all(draftItems.map(async (item) => { + const cid = String(item.cid); + if (item && item.action === 'topics.post' && cid !== '0') { + const categoryUrl = cid !== '-1' ? + `/api/category/${encodeURIComponent(cid)}` : `/api/world`; + item.category = await api.get(categoryUrl, {}); } - }); - + })); const html = await app.parseAndTranslate('partials/sidebar/drafts', 'drafts', { drafts: draftItems }); draftListEl.find('.no-drafts').addClass('hidden'); draftListEl.find('.placeholder-wave').addClass('hidden'); @@ -185,7 +183,7 @@ $(document).ready(function () { draftsEl.on('click', '[component="drafts/delete"]', function () { const save_id = $(this).attr('data-save-id'); - bootbox.confirm({ + modals.confirm({ title: '[[modules:bootbox.confirm]]', message: '[[modules:composer.discard-draft-confirm]]', callback: function (ok) { diff --git a/scss/groups.scss b/scss/groups.scss deleted file mode 100644 index 1c81dd78..00000000 --- a/scss/groups.scss +++ /dev/null @@ -1,20 +0,0 @@ -.template-groups-details #panel { - margin-top: 0px!important; -} - -.group-hover-bg { - $hover-color: mix($body-bg, $body-color, 90%); - $border-color: mix($body-bg, $body-color, 90%); - border-color: $border-color!important; - &:hover { - background-color: $hover-color; - } -} - -.groups.details { - margin-top: 200px; - - @include media-breakpoint-up(md) { - margin-top: 300px; - } -} diff --git a/scss/harmony.scss b/scss/harmony.scss index 6c55152f..792eee35 100644 --- a/scss/harmony.scss +++ b/scss/harmony.scss @@ -10,7 +10,6 @@ @import "mobilebar"; @import "status"; @import "account"; -@import "groups"; @import "world"; @import "modals"; @@ -19,7 +18,6 @@ @import "modules/user-menu"; @import "modules/topic-navigator"; @import "modules/topics-list"; -@import "modules/cover"; @import "modules/nprogress"; @import "modules/paginator"; @import "modules/filters"; diff --git a/scss/modules/cover.scss b/scss/modules/cover.scss deleted file mode 100644 index 33c65712..00000000 --- a/scss/modules/cover.scss +++ /dev/null @@ -1,104 +0,0 @@ -// used in group and account pages -.cover { - background-size: cover; - background-repeat: no-repeat; - height: 200px; - position: absolute; - background-origin: content-box; - width: 100%; - top: var(--panel-offset)!important; - left: auto; - right: 0px; - - &:hover .controls, .controls:focus-within { - opacity: 1; - } - - .controls { - height: 200px; - line-height: 200px; - opacity: 0; - @include transition(opacity .15s linear); - cursor: pointer; - pointer-events: none; - - > * { - pointer-events: all; - } - } - - &.active { - &:hover { - cursor: move; - } - - .controls { - > * { - display: none; - } - } - - .save { - display: inline-block; - } - } - - &.saving { - .save { - display: none; - } - - .indicator { - display: inline-block; - } - } - - .save, .indicator { - display: inline-block; - position: absolute; - bottom: 1em; - left: 50%; - transform: translateX(-50%); - opacity: 1; - padding: 0.5em; - font-weight: bold; - - &:hover { - cursor: pointer; - } - } - - .save { - display: none; - } - - .indicator { - display: none; - } -} - -.cover > .container { - height: 200px; - position: relative; - pointer-events: none; - .save { - pointer-events: all; - } - .controls { - pointer-events: none; - > * { - pointer-events: all; - } - } -} - -@include media-breakpoint-up(md) { - .cover, .cover > .container { - height: 300px; - - .controls { - height: 300px; - line-height: 300px; - } - } -} \ No newline at end of file diff --git a/templates/account/blocks.tpl b/templates/account/blocks.tpl index fb7a60aa..3827411c 100644 --- a/templates/account/blocks.tpl +++ b/templates/account/blocks.tpl @@ -17,7 +17,7 @@
  • - {buildAvatar(./user, "24px", true)} + {{buildAvatar(./user, "24px", true)}} @@ -151,7 +151,7 @@ {{{ end }}}

    - [[user:info.banned-reason-label]]: {./reason} + [[user:info.banned-reason-label]]: {tx(./reason)}

    {{{ if ./until }}} @@ -192,7 +192,7 @@

  • - {buildAvatar(./user, "24px", true)} + {{buildAvatar(./user, "24px", true)}} @@ -205,7 +205,7 @@ {{{ end }}}

    - [[user:info.banned-reason-label]]: {./reason} + [[user:info.banned-reason-label]]: {tx(./reason)}

    {{{ if ./until }}} @@ -240,7 +240,7 @@

    - {buildAvatar(./user, "24px", true)} + {{buildAvatar(./user, "24px", true)}} diff --git a/templates/account/posts.tpl b/templates/account/posts.tpl index d155ad3f..f212c3e1 100644 --- a/templates/account/posts.tpl +++ b/templates/account/posts.tpl @@ -21,7 +21,7 @@
    {{{ if !posts.length }}} -
    {noItemsFoundKey}
    +
    {tx(noItemsFoundKey)}
    {{{ end }}}
    diff --git a/templates/account/profile.tpl b/templates/account/profile.tpl index 81765a41..405c693c 100644 --- a/templates/account/profile.tpl +++ b/templates/account/profile.tpl @@ -3,21 +3,21 @@ {{{ if widgets.profile-aboutme-before.length }}}
    {{{each widgets.profile-aboutme-before}}} -{./html} +{{./html}} {{{end}}}
    {{{ end }}} {{{ if aboutme }}}
    -{aboutmeParsed} +{{txEscape(aboutmeParsed)}}
    {{{ end }}} {{{ if widgets.profile-aboutme-after.length }}}
    {{{each widgets.profile-aboutme-after}}} -{./html} +{{./html}} {{{end}}}
    {{{ end }}} @@ -76,7 +76,7 @@ {{{ if ./value }}}
    - {./name} + {tx(./name)} {{{ if (./type == "input-link") }}} {./linkValue} {{{ else }}} diff --git a/templates/account/settings.tpl b/templates/account/settings.tpl index b735a19a..e96c9f80 100644 --- a/templates/account/settings.tpl +++ b/templates/account/settings.tpl @@ -10,7 +10,7 @@ @@ -67,7 +67,7 @@
    {{{ each settings.chatAllowListUsers }}}
    - {buildAvatar(@value, "16px", true)} {./username} + {{buildAvatar(@value, "16px", true)}} {./username}
    {{{ end }}} @@ -82,7 +82,7 @@
    {{{ each settings.chatDenyListUsers }}}
    - {buildAvatar(@value, "16px", true)} {./username} + {{buildAvatar(@value, "16px", true)}} {./username}
    {{{ end }}} @@ -177,7 +177,7 @@

    [[user:digest-description]]

    @@ -189,7 +189,7 @@
    {./title}
    - {./content} + {{./content}}
    {{{end}}}
    @@ -271,7 +271,7 @@
    - +
    diff --git a/templates/account/shares.tpl b/templates/account/shares.tpl index 82f471ce..26237d3c 100644 --- a/templates/account/shares.tpl +++ b/templates/account/shares.tpl @@ -7,7 +7,7 @@
    {{{ if !topics.length }}} -
    {noItemsFoundKey}
    +
    {tx(noItemsFoundKey)}
    {{{ end }}}
    diff --git a/templates/account/tags.tpl b/templates/account/tags.tpl index c1007eb8..82b2d2c7 100644 --- a/templates/account/tags.tpl +++ b/templates/account/tags.tpl @@ -2,7 +2,7 @@
    -

    {title}

    +

    {tx(title)}

    diff --git a/templates/account/topics.tpl b/templates/account/topics.tpl index 8de43bba..f490f713 100644 --- a/templates/account/topics.tpl +++ b/templates/account/topics.tpl @@ -32,7 +32,7 @@ {{{ if !topics.length }}} -
    {noItemsFoundKey}
    +
    {tx(noItemsFoundKey)}
    {{{ end }}}
    diff --git a/templates/account/uploads.tpl b/templates/account/uploads.tpl index ac2638e7..64b7312f 100644 --- a/templates/account/uploads.tpl +++ b/templates/account/uploads.tpl @@ -1,6 +1,6 @@ -

    {title}

    +

    {tx(title)}

    {{{ if privateUploads }}}[[uploads:private-uploads-info]]{{{ else }}}[[uploads:public-uploads-info]]{{{ end }}} diff --git a/templates/category.tpl b/templates/category.tpl index a371faba..cc1cdf4d 100644 --- a/templates/category.tpl +++ b/templates/category.tpl @@ -5,9 +5,9 @@
    - {buildCategoryIcon(@value, "60px", "rounded-1 flex-shrink-0")} + {{buildCategoryIcon(@value, "60px", "rounded-1 flex-shrink-0")}}
    -

    {./name}

    +

    {tx(./name)}

    {humanReadableNumber(totalTopicCount)} @@ -18,7 +18,7 @@ [[global:posts]] {{{ if !isNumber(cid) }}} - + View Original @@ -31,12 +31,12 @@
    {{{ if ./descriptionParsed }}}
    - {./descriptionParsed} + {{./descriptionParsed}}
    {{{ end }}} {{{ if ./handleFull }}}

    - [[category:handle.description, {txEscape(handleFull)}]] + [[category:handle.description, {handleFull}]]

    {{{ end }}} diff --git a/templates/groups/details.tpl b/templates/groups/details.tpl deleted file mode 100644 index 2d76a18e..00000000 --- a/templates/groups/details.tpl +++ /dev/null @@ -1,92 +0,0 @@ -
    -
    -
    - {{{ if group.isOwner }}} -
    - - - -
    - [[groups:cover-save]] -
    [[groups:cover-saving]]
    - {{{ end }}} -
    -
    - -
    -
    -
    -

    {generateGroupDisplayName(group)}

    -
    - {{{ if group.private }}}[[groups:details.private]]{{{ end }}} - {{{ if group.hidden }}}[[groups:details.hidden]]{{{ end }}} -
    -
    -
    - {group.descriptionParsed} -
    -
    -
    - {{{ if loggedIn }}} - {membershipBtn(group)} - {{{ end }}} - {{{ if isAdmin }}} - [[user:edit]] - {{{ end }}} -
    -
    - -
    -
    - {{{each widgets.left}}} - {{widgets.left.html}} - {{{end}}} -
    - - -
    -
    -
    -

    [[global:posts]]

    - {{{ if !posts.length }}} -
    [[groups:details.has-no-posts]]
    - {{{ end }}} - -
    -
    -

    [[groups:details.members]]

    - - -
    - {{{ if group.isOwner }}} -
    -

    [[groups:details.pending]]

    - -
    - -
    -

    [[groups:details.invited]]

    - -
    - -
    -
    -

    [[groups:details.owner-options]]

    -
    - - -
    -
    - -
    - {{{ end }}} -
    -
    - -
    - {{{each widgets.right}}} - {{widgets.right.html}} - {{{end}}} -
    -
    -
    diff --git a/templates/groups/list.tpl b/templates/groups/list.tpl deleted file mode 100644 index 6d62e934..00000000 --- a/templates/groups/list.tpl +++ /dev/null @@ -1,58 +0,0 @@ -
    - {{{each widgets.header}}} - {{widgets.header.html}} - {{{end}}} -
    -
    -

    [[pages:groups]]

    -
    - -
    -
    -
    - {{{ if allowGroupCreation }}} - - {{{ end }}} - -
    -
    -
    - - -
    -
    -
    -
    -
    - -
    - -
    - {{{ if groups.length }}} - - {{{ else }}} -
    -
    - [[groups:no-groups-found]] -
    -
    - {{{ end }}} -
    - - -
    diff --git a/templates/groups/members.tpl b/templates/groups/members.tpl deleted file mode 100644 index ffec941a..00000000 --- a/templates/groups/members.tpl +++ /dev/null @@ -1,10 +0,0 @@ - -
    -
    - {{{ each users }}} - - {{{ end }}} -
    - - -
    \ No newline at end of file diff --git a/templates/header.tpl b/templates/header.tpl index df942889..18ec488a 100644 --- a/templates/header.tpl +++ b/templates/header.tpl @@ -2,9 +2,9 @@ {browserTitle} - {{{each metaTags}}}{buildMetaTag(@value)}{{{end}}} + {{{each metaTags}}}{{buildMetaTag(@value)}}{{{end}}} - {{{each linkTags}}}{buildLinkTag(@value)}{{{end}}} + {{{each linkTags}}}{{buildLinkTag(@value)}}{{{end}}} \ No newline at end of file diff --git a/templates/partials/breadcrumbs.tpl b/templates/partials/breadcrumbs.tpl index a44a5145..83680bcc 100644 --- a/templates/partials/breadcrumbs.tpl +++ b/templates/partials/breadcrumbs.tpl @@ -4,7 +4,7 @@ {{{ if ./url }}}{{{ end }}} - {./text} + {tx(./text)} {{{ if ./url }}}{{{ end }}}
  • {{{ end }}} diff --git a/templates/partials/buttons/newTopic.tpl b/templates/partials/buttons/newTopic.tpl index 1da752f6..c7ff3dcd 100644 --- a/templates/partials/buttons/newTopic.tpl +++ b/templates/partials/buttons/newTopic.tpl @@ -10,7 +10,7 @@ {categories.level}
    - {buildCategoryIcon(@value, "24px", "rounded-circle")} + {{buildCategoryIcon(@value, "24px", "rounded-circle")}} {categories.name}
    diff --git a/templates/partials/categories/children.tpl b/templates/partials/categories/children.tpl index 8a521678..dc6f8b3c 100644 --- a/templates/partials/categories/children.tpl +++ b/templates/partials/categories/children.tpl @@ -4,7 +4,7 @@
  • - {./name} + {./name}
  • {{{ end }}} diff --git a/templates/partials/categories/item.tpl b/templates/partials/categories/item.tpl index f2131984..b4f30b66 100644 --- a/templates/partials/categories/item.tpl +++ b/templates/partials/categories/item.tpl @@ -3,7 +3,7 @@
    - {buildCategoryIcon(@value, "40px", "rounded-1")} + {{buildCategoryIcon(@value, "40px", "rounded-1")}}

    @@ -11,7 +11,7 @@

    {{{ if ./descriptionParsed }}}
    - {./descriptionParsed} + {{./descriptionParsed}}
    {{{ end }}} {{{ if !./link }}} diff --git a/templates/partials/categories/lastpost.tpl b/templates/partials/categories/lastpost.tpl index e43fdb13..3fb054e2 100644 --- a/templates/partials/categories/lastpost.tpl +++ b/templates/partials/categories/lastpost.tpl @@ -3,12 +3,12 @@ {{{ if @first }}} {{{ end }}} diff --git a/templates/partials/categories/link.tpl b/templates/partials/categories/link.tpl index 6b358d9d..df442672 100644 --- a/templates/partials/categories/link.tpl +++ b/templates/partials/categories/link.tpl @@ -1,5 +1,5 @@ {{{ if ./isSection }}} -{./name} +{tx(./name)} {{{ else }}} - + {{{ end }}} \ No newline at end of file diff --git a/templates/partials/category/tags.tpl b/templates/partials/category/tags.tpl index 75459fdf..2784b9f2 100644 --- a/templates/partials/category/tags.tpl +++ b/templates/partials/category/tags.tpl @@ -1,3 +1,3 @@ {{{ each tags }}} -{./valueEscaped} +{./value} {{{ end }}} diff --git a/templates/partials/cookie-consent.tpl b/templates/partials/cookie-consent.tpl index 1ec81809..9769ea78 100644 --- a/templates/partials/cookie-consent.tpl +++ b/templates/partials/cookie-consent.tpl @@ -1,6 +1,6 @@
    diff --git a/templates/partials/groups/admin.tpl b/templates/partials/groups/admin.tpl deleted file mode 100644 index 4ef8704b..00000000 --- a/templates/partials/groups/admin.tpl +++ /dev/null @@ -1,90 +0,0 @@ -
    -
    -
    -
    -
    - - -
    -
    - - -
    - -
    - - - {{{ if !allowPrivateGroups }}} -

    - [[groups:details.private-system-help]] -

    - {{{ end }}} -

    - [[groups:details.private-help]] -

    -
    -
    - - -

    - [[groups:details.hidden-help]] -

    -
    - -
    - - -
    -
    - - -
    - -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - - -
    - {{{ if group.userTitle }}}{group.userTitle}{{{ end }}} -
    - - -
    - -
    - - - - -
    -
    -
    - - -
    -
    - - -
    -
    -
    - -
    -
    diff --git a/templates/partials/groups/badge.tpl b/templates/partials/groups/badge.tpl deleted file mode 100644 index 667aaf08..00000000 --- a/templates/partials/groups/badge.tpl +++ /dev/null @@ -1 +0,0 @@ -{{{ if ./userTitle }}}{./userTitle}{{{ end }}} \ No newline at end of file diff --git a/templates/partials/groups/invited.tpl b/templates/partials/groups/invited.tpl deleted file mode 100644 index 5ff2bc76..00000000 --- a/templates/partials/groups/invited.tpl +++ /dev/null @@ -1,33 +0,0 @@ - -
    - - -
    - -
    - - -
    - -
    - -
    - -
    -
    [[groups:invited.none]]
    - - - {{{ each group.invited }}} - - - - {{{ end }}} - -
    - - -
    -
    \ No newline at end of file diff --git a/templates/partials/groups/list.tpl b/templates/partials/groups/list.tpl deleted file mode 100644 index 8dcdca6b..00000000 --- a/templates/partials/groups/list.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{{{ each groups }}} - -{{{ end }}} \ No newline at end of file diff --git a/templates/partials/groups/memberlist.tpl b/templates/partials/groups/memberlist.tpl deleted file mode 100644 index 953019e1..00000000 --- a/templates/partials/groups/memberlist.tpl +++ /dev/null @@ -1,47 +0,0 @@ -
    - {{{ if isAdmin }}} -
    - -
    - {{{ end }}} -
    -
    - - -
    -
    -
    - -
    - - - {{{each group.members}}} - - - - {{{end}}} - -
    -
    - - - {{{ if group.isOwner }}} -
    - - - - - - - -
    - {{{ end }}} -
    -
    -
    \ No newline at end of file diff --git a/templates/partials/groups/pending.tpl b/templates/partials/groups/pending.tpl deleted file mode 100644 index e751c25d..00000000 --- a/templates/partials/groups/pending.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{{ if group.pending.length }}} -
    - - - -
    -{{{ end }}} - -
    -
    [[groups:pending.none]]
    - - - {{{ each group.pending }}} - - - - {{{ end }}} - -
    - -
    -
    -
    -
    diff --git a/templates/partials/groups/sidebar-left.tpl b/templates/partials/groups/sidebar-left.tpl deleted file mode 100644 index 9c7feb10..00000000 --- a/templates/partials/groups/sidebar-left.tpl +++ /dev/null @@ -1,27 +0,0 @@ -
    - -
    diff --git a/templates/partials/mobile-nav.tpl b/templates/partials/mobile-nav.tpl index c6f90702..9ecb42a0 100644 --- a/templates/partials/mobile-nav.tpl +++ b/templates/partials/mobile-nav.tpl @@ -10,14 +10,14 @@