Compare commits

..

2 Commits

Author SHA1 Message Date
4970071520 experimenting 2024-02-22 08:20:56 -08:00
21879a6b81 Filter user cards based on user_field.3 2024-02-21 20:24:49 -08:00
76 changed files with 3317 additions and 4849 deletions

View File

@ -1,6 +1,2 @@
< 3.5.0.beta1-dev: 72af869d92500fd4971817fc31a57593416ef832
< 3.4.0.beta2-dev: 533c97fc4fbf65310bdd7d3d13eebefddc4d5ffd
< 3.4.0.beta1-dev: 195e853216558cdc16db598656619aa08abf8927
< 3.3.0.beta1-dev: 4d7491226a4eac33f5a57ebd67f292ef91c8c51e
3.1.999: 6942afd56f4cf43e643bbafe1782aa055fadc7bc
2.8.0.beta1: d9ed154f9887dcf48e648d7fa8af76c65caa5006

8
.eslintrc Normal file
View File

@ -0,0 +1,8 @@
{
"extends": "eslint-config-discourse",
"ignorePatterns": ["javascripts/vendor/*"],
"globals": {
"settings": "readonly",
"themePrefix": "readonly"
}
}

2
.npmrc
View File

@ -1,2 +0,0 @@
engine-strict = true
auto-install-peers = false

1
.prettierrc Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -1 +0,0 @@
module.exports = require("@discourse/lint-configs/prettier");

View File

@ -1,2 +0,0 @@
inherit_gem:
rubocop-discourse: stree-compat.yml

View File

@ -1,2 +0,0 @@
--print-width=100
--plugins=plugin/trailing_comma,plugin/disable_auto_ternary

View File

@ -1 +0,0 @@
module.exports = require("@discourse/lint-configs/template-lint");

4
.template-lintrc.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};

View File

@ -1,8 +0,0 @@
# frozen_string_literal: true
source "https://rubygems.org"
group :development do
gem "rubocop-discourse"
gem "syntax_tree"
end

View File

@ -1,101 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (8.0.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.2)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
drb (2.2.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.10.2)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.6.6)
minitest (5.25.5)
parallel (1.26.3)
parser (3.3.7.1)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.8.1)
rack (3.1.12)
rainbow (3.1.1)
regexp_parser (2.10.0)
rubocop (1.74.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.39.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.22.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-discourse (3.12.1)
activesupport (>= 6.1)
lint_roller (>= 1.1.0)
rubocop (>= 1.73.2)
rubocop-capybara (>= 2.22.0)
rubocop-factory_bot (>= 2.27.0)
rubocop-rails (>= 2.30.3)
rubocop-rspec (>= 3.0.1)
rubocop-rspec_rails (>= 2.31.0)
rubocop-factory_bot (2.27.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rails (2.30.3)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (3.5.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec_rails (2.31.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec (~> 3.5)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
PLATFORMS
arm64-darwin-23
ruby
DEPENDENCIES
rubocop-discourse
syntax_tree
BUNDLED WITH
2.6.6

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License
Copyright (c) Civilized Discourse Construction Kit, Inc.
Copyright (c) 2022 Discourse
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -2,15 +2,12 @@
"name": "User Card Directory",
"component": true,
"about_url": "https://meta.discourse.org/t/user-card-directory/144479",
"license_url": "https://github.com/discourse/discourse-user-card-directory/blob/main/LICENSE",
"license_url": null,
"authors": "David Taylor",
"minimum_discourse_version": "2.5.0.beta2",
"assets": {},
"color_schemes": {},
"modifiers": {
"svg_icons": [
"id-card",
"table-list"
]
"svg_icons": ["id-card", "th-list"]
}
}

View File

@ -40,9 +40,8 @@
.user-card-directory {
display: grid;
grid-template-columns: 1fr;
grid-gap: 60px 20px;
margin-top: 60px;
@media only screen and (min-width: 500px) {
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
@ -50,12 +49,19 @@
.user-card-container {
margin: 60px 20px;
margin-bottom: auto;
width: 100%;
background-color: var(--secondary);
box-shadow: var(--shadow-card);
}
@supports (display: grid) {
display: grid;
.user-card-container {
margin: 0;
}
}
grid-gap: 60px 20px;
margin-top: 60px;
.user-card {
z-index: z("base");
position: relative;
@ -72,6 +78,14 @@
display: none;
}
.user-card-container {
width: 100%;
background-color: var(--secondary);
box-shadow: var(--shadow-card);
margin-bottom: auto;
}
.user-card-directory-footer {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(5em, 1fr));
@ -96,7 +110,6 @@
.label {
font-size: var(--font-down-2);
.d-icon {
margin-right: 0.2em;
color: var(--primary-medium);
@ -112,10 +125,8 @@
justify-content: center;
width: 100%;
min-width: 0;
span {
min-width: 0;
@include ellipsis;
}
}

View File

@ -1,3 +0,0 @@
import DiscourseRecommendedTheme from "@discourse/lint-configs/eslint-theme";
export default [...DiscourseRecommendedTheme];

View File

@ -1,32 +0,0 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
export default class UserCardDirectoryToggle extends Component {
@service router;
get showingCards() {
const { cards } = this.router.currentRoute.queryParams;
return (
cards === "yes" ||
(cards === undefined && settings.default_view === "cards")
);
}
@action
toggleCards() {
const newValue = this.showingCards ? "no" : "yes";
this.router.transitionTo({ queryParams: { cards: newValue } });
}
<template>
<DButton
@action={{this.toggleCards}}
@icon={{if this.showingCards "table-list" "id-card"}}
@title={{themePrefix (if this.showingCards "show_table" "show_cards")}}
class="btn-default open-edit-columns-btn toggle-cards-button"
/>
</template>
}

View File

@ -0,0 +1,6 @@
{{d-button
icon=(if showingCards "th-list" "id-card")
action=(action "toggleCards")
title=(theme-prefix (if showingCards "show_table" "show_cards"))
class="btn-default open-edit-columns-btn toggle-cards-button"
}}

View File

@ -0,0 +1,23 @@
import Component from "@ember/component";
import { inject as service } from "@ember/service";
import discourseComputed from "discourse-common/utils/decorators";
export default Component.extend({
router: service("router"),
tagName: "",
@discourseComputed("router.currentRoute.queryParams.cards")
showingCards(cardsParam) {
return (
cardsParam === "yes" ||
(cardsParam === undefined && settings.default_view === "cards")
);
},
actions: {
toggleCards() {
const newValue = this.showingCards ? "no" : "yes";
this.router.transitionTo({ queryParams: { cards: newValue } });
},
},
});

View File

@ -1,21 +1,18 @@
import { action } from "@ember/object";
import UserCardContents from "discourse/components/user-card-contents";
import { action } from "@ember/object";
export default class UserCardStaticContents extends UserCardContents {
layoutName = "components/user-card-contents";
elementId = null;
export default UserCardContents.extend({
layoutName: "components/user-card-contents",
elementId: null,
// Overriding functions which cause the user card to show/hide based on mouse/keyboard events:
cleanUp() {}
didInsertElement() {}
willDestroyElement() {}
keyUp() {}
cleanUp() {},
didInsertElement() {},
willDestroyElement() {},
keyUp() {},
// need to override this to work with the loading slider
@action
handleShowUser() {
return;
}
}
},
});

View File

@ -1 +1 @@
<UserCardDirectoryToggle />
{{user-card-directory-toggle}}

View File

@ -1,7 +1,8 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import discourseComputed from "discourse-common/utils/decorators";
import User from "discourse/models/user";
import EmberObject, { action } from "@ember/object";
import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse/lib/decorators";
import { withPluginApi } from "discourse/lib/plugin-api";
import DiscourseURL, { userPath } from "discourse/lib/url";
export default {
@ -11,11 +12,6 @@ export default {
api.modifyClass("route:users", {
pluginId: "user-card-directory",
init() {
this._super(...arguments);
this.queryParams.cards = { refreshModel: true };
},
get templateName() {
if (this.modelFor("users")?.showAsCards) {
return "users-as-card-directory";
@ -31,6 +27,10 @@ export default {
}
},
queryParams: {
cards: { refreshModel: true },
},
model(params) {
return this._super(params).then((model) => {
model.showAsCards =
@ -42,88 +42,78 @@ export default {
},
});
api.modifyClass(
"controller:users",
(Superclass) =>
class extends Superclass {
init() {
this.set("cachedUserCardInfo", {});
super.init(...arguments);
}
api.modifyClass("controller:users", {
pluginId: "user-card-directory",
cachedUserCardInfo: null,
@discourseComputed("model.content.@each")
userCards(allUsers) {
if (!allUsers) {
return [];
}
const toLoad = [];
if (settings.hide_current_user && this.currentUser) {
allUsers = allUsers.filter((u) => u.id !== this.currentUser.id);
}
const filteredUsers = allUsers.filter(u => u.user.user_fields["3"] === "true");
const userCardInfos = filteredUsers.map((u) => {
if (this.cachedUserCardInfo[u.id]) {
return this.cachedUserCardInfo[u.id];
}
init() {
this.set("cachedUserCardInfo", {});
this._super(...arguments);
},
const userCardInfo = (this.cachedUserCardInfo[u.id] =
EmberObject.create({
user: this.store.createRecord("user", u.user),
directoryItem: u,
loading: true,
}));
toLoad.push(userCardInfo);
return userCardInfo;
});
const loadMax = 50;
while (toLoad.length > 0) {
const thisBatch = toLoad.splice(0, loadMax);
const promise = ajax("/user-cards.json", {
data: {
user_ids: thisBatch.map((uc) => uc.user.id).join(","),
},
});
thisBatch.forEach((uc) => {
// Each user card expects its own promise
// Rather than making a separate AJAX request for each
// We re-use the `user-cards.json` promise, and manipulate the data
const convertedPromise = promise.then((data) => {
// Find the correct user from users, and put it in the user attribute
// Use Object.assign to avoid contaminating the source object
return Object.assign({}, data, {
user: data.users.find((u) => u.id === uc.user.id),
});
});
return uc.user
.findDetails({ existingRequest: convertedPromise })
.finally(() => uc.set("loading", false));
});
}
window.scrollBy(0, 5);
window.scrollBy(0, -5);
return userCardInfos;
}
@action
userCardShowUser(user) {
DiscourseURL.routeTo(userPath(user.username_lower));
}
@action
updateOrder(field, asc) {
this.setProperties({
order: field,
asc,
});
}
@discourseComputed("model.content.@each")
userCards(allUsers) {
if (!allUsers) {
return [];
}
);
const toLoad = [];
if (settings.hide_current_user && this.currentUser) {
allUsers = allUsers.filter((u) => u.id !== this.currentUser.id);
}
const filteredUsers = allUsers.filter(u => u.user.user_fields["3"] === "true");
const userCardInfos = filteredUsers.map((u) => {
if (this.cachedUserCardInfo[u.id]) {
return this.cachedUserCardInfo[u.id];
}
const userCardInfo = (this.cachedUserCardInfo[u.id] =
EmberObject.create({
user: User.create(u.user),
directoryItem: u,
loading: true,
}));
toLoad.push(userCardInfo);
return userCardInfo;
});
const loadMax = 50;
while (toLoad.length > 0) {
const thisBatch = toLoad.splice(0, loadMax);
const promise = ajax("/user-cards.json", {
data: { user_ids: thisBatch.map((uc) => uc.user.id).join(",") },
});
thisBatch.forEach((uc) => {
// Each user card expects its own promise
// Rather than making a separate AJAX request for each
// We re-use the `user-cards.json` promise, and manipulate the data
const convertedPromise = promise.then((data) => {
// Find the correct user from users, and put it in the user attribute
// Use Object.assign to avoid contaminating the source object
return Object.assign({}, data, {
user: data.users.find((u) => u.id === uc.user.id),
});
});
return uc.user
.findDetails({ existingRequest: convertedPromise })
.finally(() => uc.set("loading", false));
});
}
window.scrollBy(0, 5);
window.scrollBy(0, -5);
return userCardInfos;
},
@action
userCardShowUser(user) {
DiscourseURL.routeTo(userPath(user.username_lower));
},
});
});
},
};

View File

@ -1,13 +1,8 @@
{{#if this.model.canLoadMore}}
{{hide-application-footer}}
{{/if}}
{{body-class "users-page"}}
<section>
<LoadMore
@selector=".user-card-directory .user-card-container"
@action={{action "loadMore"}}
>
{{#d-section pageClass="users"}}
{{#load-more
selector=".user-card-directory .user-card-container"
action=(action "loadMore")
}}
<div class="container">
<div class="users-directory directory">
<PluginOutlet
@ -17,45 +12,48 @@
/>
<div class="directory-controls">
<div class="period-controls">
<PeriodChooser
@period={{this.period}}
@onChange={{fn (mut this.period)}}
@fullDay={{false}}
/>
{{#if this.lastUpdatedAt}}
{{period-chooser
period=period
onChange=(action (mut period))
fullDay=false
}}
{{#if lastUpdatedAt}}
<div class="directory-last-updated">
{{i18n "directory.last_updated"}}
{{this.lastUpdatedAt}}
{{lastUpdatedAt}}
</div>
{{/if}}
</div>
<div class="inline-form">
<label class="total-rows">
{{#if this.model.totalRows}}
{{i18n "directory.total_rows" count=this.model.totalRows}}
{{#if model.totalRows}}
{{i18n "directory.total_rows" count=model.totalRows}}
{{/if}}
</label>
<Input
@value={{readonly this.emailInput}}
placeholder={{i18n "directory.filter_name"}}
@value={{readonly emailInput}}
placeholder={{I18n "directory.filter_name"}}
class="filter-name no-blur"
{{on "input" (with-event-value this.onUsernameFilterChanged)}}
{{on
"input"
(action "onUsernameFilterChanged" value="target.value")
}}
/>
{{#if this.showGroupFilter}}
<ComboBox
@value={{this.group}}
@content={{this.groupOptions}}
@onChange={{this.groupChanged}}
@options={{hash none="directory.group.all"}}
{{#if showGroupFilter}}
{{combo-box
class="directory-group-selector"
/>
value=group
content=groupOptions
onChange=(action groupChanged)
options=(hash none="directory.group.all")
}}
{{/if}}
{{#if this.currentUser.staff}}
<DButton
@icon="wrench"
@action={{this.showEditColumnsModal}}
{{#if currentUser.staff}}
{{d-button
icon="wrench"
action=(action "showEditColumnsModal")
class="btn-default open-edit-columns-btn"
/>
}}
{{/if}}
<PluginOutlet
@name="users-directory-controls"
@ -64,21 +62,21 @@
</div>
</div>
<ConditionalLoadingSpinner @condition={{this.isLoading}}>
{{#if this.userCards.length}}
{{#conditional-loading-spinner condition=isLoading}}
{{#if userCards.length}}
<div class="user-card-directory">
{{#each this.userCards as |userCard|}}
{{#each userCards as |userCard|}}
<div class="user-card-container">
<UserCardStatic
@user={{userCard.user}}
@visible={{true}}
@loading={{userCard.loading}}
@username={{userCard.user.username}}
@showUser={{this.userCardShowUser}}
/>
{{user-card-static
user=userCard.user
visible=true
loading=userCard.loading
username=userCard.user.username
showUser=this.userCardShowUser
}}
{{#if (theme-setting "show_stats")}}
<div class="user-card-directory-footer">
{{#each this.columns as |column|}}
{{#each columns as |column|}}
<span
class="stat stat-{{dasherize column.name}}
stat-type-{{column.type}}"
@ -99,18 +97,17 @@
{{/if}}
</span>
<span class="label">
<TableHeaderToggle
@onToggle={{this.updateOrder}}
@field={{column.name}}
@icon={{column.icon}}
@order={{this.order}}
@asc={{this.asc}}
@automatic={{directory-column-is-automatic
{{table-header-toggle
field=column.name
icon=column.icon
order=order
asc=asc
automatic=(directory-column-is-automatic
column=column
}}
@translated={{column.user_field_id}}
@onActiveRender={{this.setActiveHeader}}
/>
)
translated=column.user_field_id
onActiveRender=setActiveHeader
}}
</span>
</span>
{{/each}}
@ -119,29 +116,14 @@
</div>
{{/each}}
</div>
<ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
{{conditional-loading-spinner condition=model.loadingMore}}
{{else}}
<div class="empty-state">
<div class="empty-state-body">
<p>
{{#if this.name}}
{{i18n "directory.no_results_with_search"}}
{{else}}
{{i18n "directory.no_results.body"}}
{{#if this.currentUser.staff}}
{{html-safe
(i18n
"directory.no_results.extra_body" basePath=(base-path)
)
}}
{{/if}}
{{/if}}
</p>
</div>
</div>
<div class="clearfix"></div>
<p>{{i18n "directory.no_results"}}</p>
{{/if}}
</ConditionalLoadingSpinner>
{{/conditional-loading-spinner}}
</div>
</div>
</LoadMore>
</section>
{{/load-more}}
{{/d-section}}

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ar:
theme_metadata:
description: يستبدل دليل المستخدم بشبكة من بطاقات المستخدم
settings:
hide_current_user: إخفاء المستخدم الحالي من الشبكة دائمًا
show_stats: عرض الإحصائيات أسفل كل بطاقة مستخدم
show_cards: العرض في بطاقات
show_table: العرض في جدول

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
be:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
bg:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
bs_BA:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ca:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
cs:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
da:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
de:
theme_metadata:
description: Ersetzt das Benutzerverzeichnis durch ein Raster aus Benutzerkarten
settings:
hide_current_user: Den aktuellen Benutzer immer aus dem Raster ausblenden
show_stats: Statistiken unter jeder Benutzerkarte anzeigen
show_cards: Als Karten anzeigen
show_table: Als Tabelle anzeigen

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
el:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
en_GB:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
es:
theme_metadata:
description: Sustituye el directorio de usuarios por una cuadrícula de tarjetas de usuario
settings:
hide_current_user: Ocultar siempre al usuario actual de la cuadrícula
show_stats: Mostrar estadísticas debajo de cada tarjeta de usuario
show_cards: Mostrar como tarjetas
show_table: Mostrar como tabla

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
et:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
fa_IR:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
fi:
theme_metadata:
description: Korvaa käyttäjähakemiston käyttäjäkorttien ruudukolla
settings:
hide_current_user: Piilota aina nykyinen käyttäjä ruudukosta
show_stats: Näytä tilastot kunkin käyttäjäkortin alla
show_cards: Näytä kortteina
show_table: Näytä taulukkona

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
fr:
theme_metadata:
description: Remplace le répertoire des utilisateurs par une grille de cartes d'utilisateur
settings:
hide_current_user: Toujours masquer l'utilisateur actuel de la grille
show_stats: Afficher les statistiques sous chaque carte d'utilisateur
show_cards: Afficher sous forme de cartes
show_table: Afficher sous forme de tableau

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
gl:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
he:
theme_metadata:
description: החלפת ספריית המשתמשים ברשת של כרטיסים משתמשים
settings:
hide_current_user: תמיד להסתיר את המשתמש הנוכחי מהרשת
show_stats: הצגת סטטיסטיקה תחת כל כרטיס משתמש
show_cards: הצגה ככרטיסים
show_table: הצגה כטבלה

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
hr:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
hu:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
hy:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
id:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
it:
theme_metadata:
description: Sostituisce la directory utente con una griglia di schede utente
settings:
hide_current_user: Nascondi sempre l'utente attuale dalla griglia
show_stats: Mostra le statistiche sotto ogni scheda utente
show_cards: Mostra come schede
show_table: Mostra come tabella

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ja:
theme_metadata:
description: ユーザーディレクトリをユーザーカードのグリッドに置き換えます
settings:
hide_current_user: 現在のユーザーをグリッドから常に非表示にします
show_stats: 各ユーザーカードの下に統計情報を表示する
show_cards: カードとして表示
show_table: テーブルとして表示

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ko:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
lt:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
lv:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
nb_NO:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
nl:
theme_metadata:
description: Vervangt de gebruikerslijst door een raster van gebruikerskaarten
settings:
hide_current_user: Huidige gebruiker altijd verbergen in het raster
show_stats: Statistieken weergeven onder elke gebruikerskaart
show_cards: Weergeven als kaarten
show_table: Weergeven als tabel

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
pl_PL:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
pt:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
pt_BR:
theme_metadata:
description: Substitui o diretório do(a) usuário(a) por uma grade com cartões dos(as) usuários(as)
settings:
hide_current_user: Sempre ocultar o(a) usuário(a) da grade
show_stats: Mostrar estatísticas sob o cartão de cada usuário(a)
show_cards: Mostrar como cartões
show_table: Mostrar como tabela

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ro:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ru:
theme_metadata:
description: Заменяет каталог пользователей таблицей карточек пользователей
settings:
hide_current_user: Всегда скрывать текущего пользователя из таблицы
show_stats: Показывать статистику под каждой карточкой пользователя
show_cards: Показывать в виде карточек
show_table: Показывать в виде таблицы

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
sk:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
sl:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
sq:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
sr:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
sv:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
sw:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
te:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
th:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
tr_TR:
theme_metadata:
description: Kullanıcı dizinini kullanıcı kartlarından oluşan bir ızgarayla değiştirir
settings:
hide_current_user: Mevcut kullanıcıyı her zaman ızgaradan gizle
show_stats: Her kullanıcı kartının altında istatistikleri göster
show_cards: Kart olarak göster
show_table: Tablo olarak göster

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ug:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
uk:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
ur:

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
vi:

View File

@ -1,14 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
zh_CN:
theme_metadata:
description: 使用用户卡片网格替换用户目录
settings:
hide_current_user: 始终在网格中隐藏当前用户
show_stats: 在每个用户卡片下显示统计信息
show_cards: 以卡片形式显示
show_table: 以表形式显示

View File

@ -1,7 +0,0 @@
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
zh_TW:

View File

@ -1,17 +1,10 @@
{
"private": true,
"name": "discourse-user-card-directory",
"version": "1.0.0",
"repository": "https://github.com/discourse/discourse-user-card-directory",
"author": "Discourse",
"license": "MIT",
"devDependencies": {
"@discourse/lint-configs": "2.11.1",
"ember-template-lint": "7.0.1",
"eslint": "9.22.0",
"prettier": "3.5.3",
"stylelint": "16.16.0"
},
"engines": {
"node": ">= 22",
"npm": "please-use-pnpm",
"yarn": "please-use-pnpm",
"pnpm": "9.x"
},
"packageManager": "pnpm@9.15.5"
"eslint-config-discourse": "^3.2.0"
}
}

4022
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
export default {
extends: ["@discourse/lint-configs/stylelint"],
};

View File

@ -1,6 +1,6 @@
import { click, currentURL, visit } from "@ember/test-helpers";
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
acceptance("User Card Directory", function (needs) {
needs.pretender((server, helper) => {
@ -132,41 +132,33 @@ acceptance("User Card Directory", function (needs) {
test("Displays table when cards=no", async function (assert) {
await visit("/u?cards=no");
assert.dom(document.body).hasClass(/users-page/);
assert
.dom(".directory .directory-table__row")
.exists({ count: 2 }, "has a list of users");
assert.ok($("body.users-page").length, "has the body class");
assert.equal(
count(".directory .directory-table__row"),
2,
"has a list of users"
);
});
test("Displays cards when cards=yes", async function (assert) {
await visit("/u?cards=yes");
assert
.dom(".user-card-avatar")
.exists({ count: 2 }, "has two cards showing");
});
test("Updates the order when column is clicked", async function (assert) {
await visit("/u?order=post_count&period=yearly");
await click("#table-header-toggle-post_count");
assert.equal(
currentURL(),
"/u?asc=true&order=post_count&period=yearly",
"sorts by topic count"
);
assert.equal(count(".user-card-avatar"), 2, "has two cards showing");
});
test("Can toggle between views", async function (assert) {
await visit("/u?cards=no");
assert
.dom(".directory .directory-table__row")
.exists({ count: 2 }, "has two table rows");
assert.equal(
count(".directory .directory-table__row"),
2,
"has two table rows"
);
await click(".toggle-cards-button");
assert.dom(".user-card-avatar").exists({ count: 2 }, "has two cards");
assert.equal(count(".user-card-avatar"), 2, "has two cards");
await click(".toggle-cards-button");
assert
.dom(".directory .directory-table__row")
.exists({ count: 2 }, "has two table rows");
assert.equal(
count(".directory .directory-table__row"),
2,
"has two table rows"
);
});
});

View File

@ -1,5 +0,0 @@
# Configuration file for discourse-translator-bot
files:
- source_path: locales/en.yml
destination_path: translations.yml

3077
yarn.lock Normal file

File diff suppressed because it is too large Load Diff