diff --git a/app/assets/javascripts/admin/addon/templates/user-badges.hbs b/app/assets/javascripts/admin/addon/templates/user-badges.hbs index 64d419ca2a8..1c6bb0071dc 100644 --- a/app/assets/javascripts/admin/addon/templates/user-badges.hbs +++ b/app/assets/javascripts/admin/addon/templates/user-badges.hbs @@ -21,6 +21,7 @@ @outletArgs={{hash availableBadges=this.availableBadges userBadges=this.userBadges + user=this.user }} >
diff --git a/app/assets/javascripts/discourse/app/components/categories-boxes.hbs b/app/assets/javascripts/discourse/app/components/categories-boxes.hbs index d2a295d35ca..e45cc6f9fb2 100644 --- a/app/assets/javascripts/discourse/app/components/categories-boxes.hbs +++ b/app/assets/javascripts/discourse/app/components/categories-boxes.hbs @@ -1,100 +1,110 @@ -{{#each this.categories as |c|}} - - -
-
- {{#unless c.isMuted}} - - {{/unless}} - -
- + + {{#each this.categories as |c|}} + +
+
{{#unless c.isMuted}} -
- {{html-safe c.description_excerpt}} + + {{/unless}} + +
+ - {{#if c.isGrandParent}} - {{#each c.subcategories as |subcategory|}} -
-
- - {{#if subcategory.subcategories}} -
- {{#each subcategory.subcategories as |subsubcategory|}} - {{#unless subsubcategory.isMuted}} - - - {{category-link subsubcategory hideParent="true"}} - - {{/unless}} - {{/each}} -
- {{/if}} -
-
- {{/each}} - {{else if c.subcategories}} -
- {{#each c.subcategories as |sc|}} - - - {{#if sc.uploaded_logo.url}} - - {{/if}} - - - {{category-link sc hideParent="true"}} - - {{/each}} + {{#unless c.isMuted}} +
+ {{html-safe c.description_excerpt}}
- {{/if}} - {{/unless}} + + {{#if c.isGrandParent}} + {{#each c.subcategories as |subcategory|}} +
+
+ + {{#if subcategory.subcategories}} +
+ {{#each subcategory.subcategories as |subsubcategory|}} + {{#unless subsubcategory.isMuted}} + + + {{category-link subsubcategory hideParent="true"}} + + {{/unless}} + {{/each}} +
+ {{/if}} +
+
+ {{/each}} + {{else if c.subcategories}} + + {{/if}} + {{/unless}} +
+ +
- -
-
- -{{/each}} + + {{/each}} + u.username === this.currentUser.username) ) { - users = users.concat(this.smallUserAtts(this.currentUser)); + users = users.concat(smallUserAttrs(this.currentUser)); } return users; } @@ -38,38 +29,45 @@ export default class SmallUserList extends Component { } } diff --git a/app/assets/javascripts/discourse/app/components/user-card-contents.hbs b/app/assets/javascripts/discourse/app/components/user-card-contents.hbs index 94241a9f52e..a74515e8b3b 100644 --- a/app/assets/javascripts/discourse/app/components/user-card-contents.hbs +++ b/app/assets/javascripts/discourse/app/components/user-card-contents.hbs @@ -27,54 +27,48 @@
{{else}}
-
- {{#if this.contentHidden}} - {{bound-avatar - this.user - "huge" - }} - {{else}} - {{bound-avatar this.user "huge"}} - {{/if}} - - - -
- -
-
-
-
+ +
{{#if this.contentHidden}} - - {{if - this.nameFirst - this.user.name - (format-username this.user.username) - }} - + {{bound-avatar + this.user + "huge" + }} {{else}} + {{/if}} + + + +
+ +
+
+
+
+ {{#if this.contentHidden}} - {{user-status this.user currentUser=this.currentUser}} - - {{/if}} -
- - {{#if this.nameFirst}} -
{{this.user.username}}
- {{else}} - {{#if this.user.name}} -
{{this.user.name}}
- {{/if}} - {{/if}} - {{#if this.user.title}} -
{{this.user.title}}
- {{/if}} - {{#if this.user.staged}} -
{{i18n "user.staged"}}
- {{/if}} - {{#if this.hasStatus}} -
- {{html-safe this.userStatusEmoji}} - - {{this.user.status.description}} - - {{format-date this.user.status.ends_at format="tiny"}} + {{else}} + + {{/if}}
- {{/if}} -
+ {{#if this.nameFirst}} +
{{this.user.username}}
+ {{else}} + {{#if this.user.name}} +
{{this.user.name}}
+ {{/if}} + {{/if}} + {{#if this.user.title}} +
{{this.user.title}}
+ {{/if}} + {{#if this.user.staged}} +
{{i18n "user.staged"}}
+ {{/if}} + {{#if this.hasStatus}} +
+ {{html-safe this.userStatusEmoji}} + + {{this.user.status.description}} + + {{format-date this.user.status.ends_at format="tiny"}} +
+ {{/if}} +
+ +
-
+
    {{#if this.user.can_send_private_message_to_user}}
  • @@ -379,20 +396,25 @@ {{#if this.showBadges}}
    - {{#if this.user.featured_user_badges}} -
    - {{#each this.user.featured_user_badges as |ub|}} - - {{/each}} - {{#if this.showMoreBadges}} - - - {{i18n "badges.more_badges" count=this.moreBadgesCount}} - - - {{/if}} -
    - {{/if}} + + {{#if this.user.featured_user_badges}} +
    + {{#each this.user.featured_user_badges as |ub|}} + + {{/each}} + {{#if this.showMoreBadges}} + + + {{i18n "badges.more_badges" count=this.moreBadgesCount}} + + + {{/if}} +
    + {{/if}} +
    {{/if}} {{/if}} diff --git a/app/assets/javascripts/discourse/app/lib/transformer/registry.js b/app/assets/javascripts/discourse/app/lib/transformer/registry.js index 985246e89e1..33bc05e79d3 100644 --- a/app/assets/javascripts/discourse/app/lib/transformer/registry.js +++ b/app/assets/javascripts/discourse/app/lib/transformer/registry.js @@ -2,4 +2,5 @@ export const VALUE_TRANSFORMERS = Object.freeze([ // use only lowercase names "header-notifications-avatar-size", "home-logo-href", + "small-user-attrs", ]); diff --git a/app/assets/javascripts/discourse/app/lib/user-list-attrs.js b/app/assets/javascripts/discourse/app/lib/user-list-attrs.js new file mode 100644 index 00000000000..dd03989ec00 --- /dev/null +++ b/app/assets/javascripts/discourse/app/lib/user-list-attrs.js @@ -0,0 +1,16 @@ +import { applyValueTransformer } from "discourse/lib/transformer"; +import { userPath } from "discourse/lib/url"; + +export function smallUserAttrs(user) { + const defaultAttrs = { + template: user.avatar_template, + username: user.username, + post_url: user.post_url, + url: userPath(user.username_lower), + unknown: user.unknown, + }; + + return applyValueTransformer("small-user-attrs", defaultAttrs, { + user, + }); +} diff --git a/app/assets/javascripts/discourse/app/templates/user/badges.hbs b/app/assets/javascripts/discourse/app/templates/user/badges.hbs index 4419f262f56..65ba2aaeb71 100644 --- a/app/assets/javascripts/discourse/app/templates/user/badges.hbs +++ b/app/assets/javascripts/discourse/app/templates/user/badges.hbs @@ -1,30 +1,40 @@ {{body-class "user-badges-page"}}
    -

    - {{i18n - "badges.favorite_count" - count=this.favoriteBadges.length - max=this.siteSettings.max_favorite_badges + - -

    - {{#each this.sortedBadges as |ub|}} - +

    + {{i18n + "badges.favorite_count" + count=this.favoriteBadges.length + max=this.siteSettings.max_favorite_badges + }} +

    +
    + {{#each this.sortedBadges as |ub|}} + + {{/each}} + - {{/each}} - -
    +
    +
    \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/widgets/post-menu.js b/app/assets/javascripts/discourse/app/widgets/post-menu.js index 54795d9e253..7fedbc7fbf4 100644 --- a/app/assets/javascripts/discourse/app/widgets/post-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/post-menu.js @@ -6,7 +6,7 @@ import AdminPostMenu from "discourse/components/admin-post-menu"; import DeleteTopicDisallowedModal from "discourse/components/modal/delete-topic-disallowed"; import { formattedReminderTime } from "discourse/lib/bookmark"; import { recentlyCopied, showAlert } from "discourse/lib/post-action-feedback"; -import { userPath } from "discourse/lib/url"; +import { smallUserAttrs } from "discourse/lib/user-list-attrs"; import { NO_REMINDER_ICON, WITH_REMINDER_ICON, @@ -53,16 +53,6 @@ function registerButton(name, builder) { _builders[name] = builder; } -function smallUserAtts(user) { - return { - template: user.avatar_template, - username: user.username, - post_url: user.post_url, - url: userPath(user.username_lower), - unknown: user.unknown, - }; -} - export function buildButton(name, widget) { let { attrs, state, siteSettings, settings, currentUser } = widget; @@ -904,14 +894,13 @@ export default createWidget("post-menu", { getWhoLiked() { const { attrs, state } = this; - return this.store .find("post-action-user", { id: attrs.id, post_action_type_id: LIKE_ACTION, }) .then((users) => { - state.likedUsers = users.map(smallUserAtts); + state.likedUsers = users.map(smallUserAttrs); state.total = users.totalRows; }); }, @@ -920,7 +909,7 @@ export default createWidget("post-menu", { const { attrs, state } = this; return this.store.find("post-reader", { id: attrs.id }).then((users) => { - state.readers = users.map(smallUserAtts); + state.readers = users.map(smallUserAttrs); state.totalReaders = users.totalRows; }); },