mirror of
https://github.com/discourse/discourse-user-card-directory.git
synced 2025-06-28 01:12:15 +00:00
DEV: Update linting config and run gjs-codemod (#57)
This commit is contained in:
parent
4d90ffa942
commit
ae6fe4858c
@ -1,3 +1,4 @@
|
|||||||
|
< 3.5.0.beta5-dev: 4d90ffa942d58b7e5d727d92e98b40fdf3c6905a
|
||||||
< 3.5.0.beta1-dev: 72af869d92500fd4971817fc31a57593416ef832
|
< 3.5.0.beta1-dev: 72af869d92500fd4971817fc31a57593416ef832
|
||||||
< 3.4.0.beta2-dev: 533c97fc4fbf65310bdd7d3d13eebefddc4d5ffd
|
< 3.4.0.beta2-dev: 533c97fc4fbf65310bdd7d3d13eebefddc4d5ffd
|
||||||
< 3.4.0.beta1-dev: 195e853216558cdc16db598656619aa08abf8927
|
< 3.4.0.beta1-dev: 195e853216558cdc16db598656619aa08abf8927
|
||||||
|
44
Gemfile.lock
44
Gemfile.lock
@ -14,30 +14,31 @@ GEM
|
|||||||
securerandom (>= 0.3)
|
securerandom (>= 0.3)
|
||||||
tzinfo (~> 2.0, >= 2.0.5)
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
uri (>= 0.13.1)
|
uri (>= 0.13.1)
|
||||||
ast (2.4.2)
|
ast (2.4.3)
|
||||||
base64 (0.2.0)
|
base64 (0.3.0)
|
||||||
benchmark (0.4.0)
|
benchmark (0.4.1)
|
||||||
bigdecimal (3.1.9)
|
bigdecimal (3.2.2)
|
||||||
concurrent-ruby (1.3.5)
|
concurrent-ruby (1.3.5)
|
||||||
connection_pool (2.5.0)
|
connection_pool (2.5.3)
|
||||||
drb (2.2.1)
|
drb (2.2.3)
|
||||||
i18n (1.14.7)
|
i18n (1.14.7)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
json (2.10.2)
|
json (2.12.2)
|
||||||
language_server-protocol (3.17.0.4)
|
language_server-protocol (3.17.0.5)
|
||||||
lint_roller (1.1.0)
|
lint_roller (1.1.0)
|
||||||
logger (1.6.6)
|
logger (1.7.0)
|
||||||
minitest (5.25.5)
|
minitest (5.25.5)
|
||||||
parallel (1.26.3)
|
parallel (1.27.0)
|
||||||
parser (3.3.7.1)
|
parser (3.3.8.0)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
racc
|
racc
|
||||||
prettier_print (1.2.1)
|
prettier_print (1.2.1)
|
||||||
|
prism (1.4.0)
|
||||||
racc (1.8.1)
|
racc (1.8.1)
|
||||||
rack (3.1.12)
|
rack (3.1.15)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
regexp_parser (2.10.0)
|
regexp_parser (2.10.0)
|
||||||
rubocop (1.74.0)
|
rubocop (1.76.0)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
language_server-protocol (~> 3.17.0.2)
|
language_server-protocol (~> 3.17.0.2)
|
||||||
lint_roller (~> 1.1.0)
|
lint_roller (~> 1.1.0)
|
||||||
@ -45,11 +46,12 @@ GEM
|
|||||||
parser (>= 3.3.0.2)
|
parser (>= 3.3.0.2)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 2.9.3, < 3.0)
|
regexp_parser (>= 2.9.3, < 3.0)
|
||||||
rubocop-ast (>= 1.38.0, < 2.0)
|
rubocop-ast (>= 1.45.0, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 2.4.0, < 4.0)
|
unicode-display_width (>= 2.4.0, < 4.0)
|
||||||
rubocop-ast (1.39.0)
|
rubocop-ast (1.45.0)
|
||||||
parser (>= 3.3.1.0)
|
parser (>= 3.3.7.2)
|
||||||
|
prism (~> 1.4)
|
||||||
rubocop-capybara (2.22.1)
|
rubocop-capybara (2.22.1)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rubocop (~> 1.72, >= 1.72.1)
|
rubocop (~> 1.72, >= 1.72.1)
|
||||||
@ -65,13 +67,13 @@ GEM
|
|||||||
rubocop-factory_bot (2.27.1)
|
rubocop-factory_bot (2.27.1)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rubocop (~> 1.72, >= 1.72.1)
|
rubocop (~> 1.72, >= 1.72.1)
|
||||||
rubocop-rails (2.30.3)
|
rubocop-rails (2.32.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.72.1, < 2.0)
|
rubocop (>= 1.75.0, < 2.0)
|
||||||
rubocop-ast (>= 1.38.0, < 2.0)
|
rubocop-ast (>= 1.44.0, < 2.0)
|
||||||
rubocop-rspec (3.5.0)
|
rubocop-rspec (3.6.0)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rubocop (~> 1.72, >= 1.72.1)
|
rubocop (~> 1.72, >= 1.72.1)
|
||||||
rubocop-rspec_rails (2.31.0)
|
rubocop-rspec_rails (2.31.0)
|
||||||
@ -98,4 +100,4 @@ DEPENDENCIES
|
|||||||
syntax_tree
|
syntax_tree
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.6.6
|
2.6.9
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
grid-gap: 100px 20px;
|
grid-gap: 100px 20px;
|
||||||
margin-top: 60px;
|
margin-top: 60px;
|
||||||
|
|
||||||
@media only screen and (min-width: 500px) {
|
@media only screen and (width >= 500px) {
|
||||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
import Component from "@ember/component";
|
||||||
|
import { tagName } from "@ember-decorators/component";
|
||||||
|
import UserCardDirectoryToggle from "../../components/user-card-directory-toggle";
|
||||||
|
|
||||||
|
@tagName("")
|
||||||
|
export default class UserCardDirectoryToggleConnector extends Component {
|
||||||
|
<template><UserCardDirectoryToggle /></template>
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
<UserCardDirectoryToggle />
|
|
186
javascripts/discourse/templates/users-as-card-directory.gjs
Normal file
186
javascripts/discourse/templates/users-as-card-directory.gjs
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
import { Input } from "@ember/component";
|
||||||
|
import { fn, hash } from "@ember/helper";
|
||||||
|
import { on } from "@ember/modifier";
|
||||||
|
import RouteTemplate from "ember-route-template";
|
||||||
|
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
|
||||||
|
import DButton from "discourse/components/d-button";
|
||||||
|
import DirectoryItemUserFieldValue from "discourse/components/directory-item-user-field-value";
|
||||||
|
import LoadMore from "discourse/components/load-more";
|
||||||
|
import PluginOutlet from "discourse/components/plugin-outlet";
|
||||||
|
import TableHeaderToggle from "discourse/components/table-header-toggle";
|
||||||
|
import basePath from "discourse/helpers/base-path";
|
||||||
|
import bodyClass from "discourse/helpers/body-class";
|
||||||
|
import dasherize from "discourse/helpers/dasherize";
|
||||||
|
import directoryColumnIsAutomatic from "discourse/helpers/directory-column-is-automatic";
|
||||||
|
import directoryColumnIsUserField from "discourse/helpers/directory-column-is-user-field";
|
||||||
|
import directoryItemValue from "discourse/helpers/directory-item-value";
|
||||||
|
import hideApplicationFooter from "discourse/helpers/hide-application-footer";
|
||||||
|
import htmlSafe from "discourse/helpers/html-safe";
|
||||||
|
import lazyHash from "discourse/helpers/lazy-hash";
|
||||||
|
import withEventValue from "discourse/helpers/with-event-value";
|
||||||
|
import { i18n } from "discourse-i18n";
|
||||||
|
import ComboBox from "select-kit/components/combo-box";
|
||||||
|
import PeriodChooser from "select-kit/components/period-chooser";
|
||||||
|
import UserCardStatic from "../components/user-card-static";
|
||||||
|
|
||||||
|
export default RouteTemplate(
|
||||||
|
<template>
|
||||||
|
{{#if @controller.model.canLoadMore}}
|
||||||
|
{{hideApplicationFooter}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{bodyClass "users-page"}}
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<LoadMore
|
||||||
|
@selector=".user-card-directory .user-card-container"
|
||||||
|
@action={{@controller.loadMore}}
|
||||||
|
>
|
||||||
|
<div class="container">
|
||||||
|
<div class="users-directory directory">
|
||||||
|
<PluginOutlet
|
||||||
|
@name="users-top"
|
||||||
|
@connectorTagName="div"
|
||||||
|
@outletArgs={{lazyHash model=@controller.model}}
|
||||||
|
/>
|
||||||
|
<div class="directory-controls">
|
||||||
|
<div class="period-controls">
|
||||||
|
<PeriodChooser
|
||||||
|
@period={{@controller.period}}
|
||||||
|
@onChange={{fn (mut @controller.period)}}
|
||||||
|
@fullDay={{false}}
|
||||||
|
/>
|
||||||
|
{{#if @controller.lastUpdatedAt}}
|
||||||
|
<div class="directory-last-updated">
|
||||||
|
{{i18n "directory.last_updated"}}
|
||||||
|
{{@controller.lastUpdatedAt}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="inline-form">
|
||||||
|
<label class="total-rows">
|
||||||
|
{{#if @controller.model.totalRows}}
|
||||||
|
{{i18n
|
||||||
|
"directory.total_rows"
|
||||||
|
count=@controller.model.totalRows
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
{{on
|
||||||
|
"input"
|
||||||
|
(withEventValue @controller.onUsernameFilterChanged)
|
||||||
|
}}
|
||||||
|
@value={{readonly @controller.emailInput}}
|
||||||
|
placeholder={{i18n "directory.filter_name"}}
|
||||||
|
class="filter-name no-blur"
|
||||||
|
/>
|
||||||
|
{{#if @controller.showGroupFilter}}
|
||||||
|
<ComboBox
|
||||||
|
@value={{@controller.group}}
|
||||||
|
@content={{@controller.groupOptions}}
|
||||||
|
@onChange={{@controller.groupChanged}}
|
||||||
|
@options={{hash none="directory.group.all"}}
|
||||||
|
class="directory-group-selector"
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
{{#if @controller.currentUser.staff}}
|
||||||
|
<DButton
|
||||||
|
@icon="wrench"
|
||||||
|
@action={{@controller.showEditColumnsModal}}
|
||||||
|
class="btn-default open-edit-columns-btn"
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
<PluginOutlet
|
||||||
|
@name="users-directory-controls"
|
||||||
|
@outletArgs={{lazyHash model=@controller.model}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ConditionalLoadingSpinner @condition={{@controller.isLoading}}>
|
||||||
|
{{#if @controller.userCards.length}}
|
||||||
|
<div class="user-card-directory">
|
||||||
|
{{#each @controller.userCards as |userCard|}}
|
||||||
|
<div class="user-card-container">
|
||||||
|
<UserCardStatic
|
||||||
|
@user={{userCard.user}}
|
||||||
|
@visible={{true}}
|
||||||
|
@loading={{userCard.loading}}
|
||||||
|
@username={{userCard.user.username}}
|
||||||
|
@showUser={{@controller.userCardShowUser}}
|
||||||
|
/>
|
||||||
|
{{#if settings.show_stats}}
|
||||||
|
<div class="user-card-directory-footer">
|
||||||
|
{{#each @controller.columns as |column|}}
|
||||||
|
<span
|
||||||
|
class="stat stat-{{dasherize column.name}}
|
||||||
|
stat-type-{{column.type}}"
|
||||||
|
>
|
||||||
|
<span class="value">
|
||||||
|
{{#if
|
||||||
|
(directoryColumnIsUserField column=column)
|
||||||
|
}}
|
||||||
|
<DirectoryItemUserFieldValue
|
||||||
|
@item={{userCard.directoryItem}}
|
||||||
|
@column={{column}}
|
||||||
|
/>
|
||||||
|
{{else}}
|
||||||
|
{{directoryItemValue
|
||||||
|
item=userCard.directoryItem
|
||||||
|
column=column
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
<span class="label">
|
||||||
|
<TableHeaderToggle
|
||||||
|
@onToggle={{@controller.updateOrder}}
|
||||||
|
@field={{column.name}}
|
||||||
|
@icon={{column.icon}}
|
||||||
|
@order={{@controller.order}}
|
||||||
|
@asc={{@controller.asc}}
|
||||||
|
@automatic={{directoryColumnIsAutomatic
|
||||||
|
column=column
|
||||||
|
}}
|
||||||
|
@translated={{column.user_field_id}}
|
||||||
|
@onActiveRender={{@controller.setActiveHeader}}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
<ConditionalLoadingSpinner
|
||||||
|
@condition={{@controller.model.loadingMore}}
|
||||||
|
/>
|
||||||
|
{{else}}
|
||||||
|
<div class="empty-state">
|
||||||
|
<div class="empty-state-body">
|
||||||
|
<p>
|
||||||
|
{{#if @controller.name}}
|
||||||
|
{{i18n "directory.no_results_with_search"}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n "directory.no_results.body"}}
|
||||||
|
{{#if @controller.currentUser.staff}}
|
||||||
|
{{htmlSafe
|
||||||
|
(i18n
|
||||||
|
"directory.no_results.extra_body"
|
||||||
|
basePath=(basePath)
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</ConditionalLoadingSpinner>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</LoadMore>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
);
|
@ -1,147 +0,0 @@
|
|||||||
{{#if this.model.canLoadMore}}
|
|
||||||
{{hide-application-footer}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{body-class "users-page"}}
|
|
||||||
<section>
|
|
||||||
<LoadMore
|
|
||||||
@selector=".user-card-directory .user-card-container"
|
|
||||||
@action={{action "loadMore"}}
|
|
||||||
>
|
|
||||||
<div class="container">
|
|
||||||
<div class="users-directory directory">
|
|
||||||
<PluginOutlet
|
|
||||||
@name="users-top"
|
|
||||||
@connectorTagName="div"
|
|
||||||
@outletArgs={{hash model=this.model}}
|
|
||||||
/>
|
|
||||||
<div class="directory-controls">
|
|
||||||
<div class="period-controls">
|
|
||||||
<PeriodChooser
|
|
||||||
@period={{this.period}}
|
|
||||||
@onChange={{fn (mut this.period)}}
|
|
||||||
@fullDay={{false}}
|
|
||||||
/>
|
|
||||||
{{#if this.lastUpdatedAt}}
|
|
||||||
<div class="directory-last-updated">
|
|
||||||
{{i18n "directory.last_updated"}}
|
|
||||||
{{this.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}}
|
|
||||||
</label>
|
|
||||||
<Input
|
|
||||||
@value={{readonly this.emailInput}}
|
|
||||||
placeholder={{i18n "directory.filter_name"}}
|
|
||||||
class="filter-name no-blur"
|
|
||||||
{{on "input" (with-event-value this.onUsernameFilterChanged)}}
|
|
||||||
/>
|
|
||||||
{{#if this.showGroupFilter}}
|
|
||||||
<ComboBox
|
|
||||||
@value={{this.group}}
|
|
||||||
@content={{this.groupOptions}}
|
|
||||||
@onChange={{this.groupChanged}}
|
|
||||||
@options={{hash none="directory.group.all"}}
|
|
||||||
class="directory-group-selector"
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
{{#if this.currentUser.staff}}
|
|
||||||
<DButton
|
|
||||||
@icon="wrench"
|
|
||||||
@action={{this.showEditColumnsModal}}
|
|
||||||
class="btn-default open-edit-columns-btn"
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
<PluginOutlet
|
|
||||||
@name="users-directory-controls"
|
|
||||||
@outletArgs={{hash model=this.model}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ConditionalLoadingSpinner @condition={{this.isLoading}}>
|
|
||||||
{{#if this.userCards.length}}
|
|
||||||
<div class="user-card-directory">
|
|
||||||
{{#each this.userCards as |userCard|}}
|
|
||||||
<div class="user-card-container">
|
|
||||||
<UserCardStatic
|
|
||||||
@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|}}
|
|
||||||
<span
|
|
||||||
class="stat stat-{{dasherize column.name}}
|
|
||||||
stat-type-{{column.type}}"
|
|
||||||
>
|
|
||||||
<span class="value">
|
|
||||||
{{#if
|
|
||||||
(directory-column-is-user-field column=column)
|
|
||||||
}}
|
|
||||||
{{directory-item-user-field-value
|
|
||||||
item=userCard.directoryItem
|
|
||||||
column=column
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{directory-item-value
|
|
||||||
item=userCard.directoryItem
|
|
||||||
column=column
|
|
||||||
}}
|
|
||||||
{{/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
|
|
||||||
column=column
|
|
||||||
}}
|
|
||||||
@translated={{column.user_field_id}}
|
|
||||||
@onActiveRender={{this.setActiveHeader}}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
<ConditionalLoadingSpinner @condition={{this.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>
|
|
||||||
{{/if}}
|
|
||||||
</ConditionalLoadingSpinner>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</LoadMore>
|
|
||||||
</section>
|
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discourse/lint-configs": "2.11.1",
|
"@discourse/lint-configs": "2.25.0",
|
||||||
"ember-template-lint": "7.0.1",
|
"ember-template-lint": "7.8.1",
|
||||||
"eslint": "9.22.0",
|
"eslint": "9.28.0",
|
||||||
"prettier": "3.5.3",
|
"prettier": "3.5.3",
|
||||||
"stylelint": "16.16.0"
|
"stylelint": "16.20.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 22",
|
"node": ">= 22",
|
||||||
|
1371
pnpm-lock.yaml
generated
1371
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user