discourse/app/assets/javascripts/admin/addon/templates/users-list-show.hbs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

114 lines
4.7 KiB
Handlebars
Raw Normal View History

<div class="admin-title">
<h2>{{title}}</h2>
{{#if canCheckEmails}}
{{#if showEmails}}
{{d-button
action=(action "toggleEmailVisibility")
class="hide-emails btn-default"
label="admin.users.hide_emails"}}
{{else}}
{{d-button
action=(action "toggleEmailVisibility")
class="show-emails btn-default"
label="admin.users.show_emails"}}
{{/if}}
{{/if}}
</div>
2018-07-02 23:14:53 -04:00
<div class="username controls">
{{text-field value=listFilter placeholder=searchHint title=searchHint}}
2018-07-02 23:14:53 -04:00
</div>
{{#load-more class="users-list-container" selector=".users-list tr" action=(action "loadMore")}}
{{#if model}}
2018-07-02 23:14:53 -04:00
<table class="table users-list grid">
<thead>
{{table-header-toggle field="username" labelKey="username" order=order asc=asc automatic=true}}
{{table-header-toggle class=(if showEmails "" "hidden") field="email" labelKey="email" order=order asc=asc automatic=true}}
{{table-header-toggle field="last_emailed" labelKey="admin.users.last_emailed" order=order asc=asc automatic=true}}
{{table-header-toggle field="seen" labelKey="last_seen" order=order asc=asc automatic=true}}
{{table-header-toggle field="topics_viewed" labelKey="admin.user.topics_entered" order=order asc=asc automatic=true}}
{{table-header-toggle field="posts_read" labelKey="admin.user.posts_read_count" order=order asc=asc automatic=true}}
{{table-header-toggle field="read_time" labelKey="admin.user.time_read" order=order asc=asc automatic=true}}
{{table-header-toggle field="created" labelKey="created" order=order asc=asc automatic=true}}
{{#if siteSettings.must_approve_users}}
<th>{{i18n "admin.users.approved"}}</th>
{{/if}}
<th>&nbsp;</th>
</thead>
<tbody>
{{#each model as |user|}}
<tr class="user {{user.selected}} {{unless user.active "not-activated"}}">
2018-07-02 23:14:53 -04:00
<td class="username">
<a href={{user.path}} data-user-card={{user.username}}>
{{avatar user imageSize="small"}}
</a>
{{#link-to "adminUser" user}}{{user.username}}{{/link-to}}
{{#if user.staged}}
2019-01-22 14:42:00 -05:00
{{d-icon "far-envelope" title="user.staged" }}
{{/if}}
</td>
<td class="email {{if showEmails "" "hidden"}}">
{{~user.email~}}
</td>
{{#if user.last_emailed_at}}
<td class="last-emailed" title={{raw-date user.last_emailed_at}}>
<div class="label">{{i18n "admin.users.last_emailed"}}</div>
<div>{{format-duration user.last_emailed_age}}</div>
</td>
{{else}}
<td class="last-emailed">
<div class="label">{{i18n "admin.users.last_emailed"}}</div>
<div>{{format-duration user.last_emailed_age}}</div>
</td>
{{/if}}
<td class="last-seen" title={{raw-date user.last_seen_at}}>
2018-07-02 23:14:53 -04:00
<div class="label">{{i18n "last_seen"}}</div>
<div>{{format-duration user.last_seen_age}}</div>
</td>
2018-07-02 23:14:53 -04:00
<td class="topics-entered">
<div class="label">{{i18n "admin.user.topics_entered"}}</div>
<div>{{number user.topics_entered}}</div>
</td>
2018-07-02 23:14:53 -04:00
<td class="posts-read">
<div class="label">{{i18n "admin.user.posts_read_count"}}</div>
<div>{{number user.posts_read_count}}</div>
</td>
2018-07-02 23:14:53 -04:00
<td class="time-read">
<div class="label">{{i18n "admin.user.time_read"}}</div>
<div>{{format-duration user.time_read}}</div>
</td>
<td class="created" title={{raw-date user.created_at}}>
2018-07-02 23:14:53 -04:00
<div class="label">{{i18n "created"}}</div>
<div>{{format-duration user.created_at_age}}</div>
</td>
{{#if siteSettings.must_approve_users}}
<td>{{i18n-yes-no user.approved}}</td>
{{/if}}
2018-07-02 23:14:53 -04:00
<td class="user-status">
{{#if user.admin}}
{{d-icon "shield-alt" title="admin.title" }}
{{/if}}
{{#if user.moderator}}
{{d-icon "shield-alt" title="admin.moderator" }}
{{/if}}
{{#if user.second_factor_enabled}}
{{d-icon "lock" title="admin.user.second_factor_enabled" }}
{{/if}}
DEV: Update default tagName and connectorTagName for plugin outlets (#13685) This commit should be a no-op for all existing core outlets. Outlets which are introduced by themes/plugins may see a change in behavior, and should follow the steps below if they want to maintain their previous behavior. `tagName="" connectorTagName=""` is almost always the correct choice for plugin outlets. 40eba8cd introduced a `noTags=true` shortcut which achieved this, and left a comment saying it should be the future default. This commit does exactly that. To avoid any breaking changes for plugins, all existing plugin outlets have been reviewed and adjusted by following this logic: 1) If `noTags=true`, remove the `noTags` parameter, and do not complete any further steps 2) If `tagName` is not specified, set `tagName="span"` (the previous default) 3) If `connectorTagName` is not specified, set `selectorTagName="div"` (the previous default) 4) If `tagName=""`, remove it 5) If `connectorTagName=""`, remove it The updates were accomplished with the help of a ruby script: ```ruby def removeAttr(tag, attribute) tag = tag.sub /\s#{attribute}="?\w*"? /, " " tag = tag.sub /\s#{attribute}="?\w*"?}}/, "}}" tag = tag.sub /^\s*#{attribute}="?\w*"?\n/, "" tag end files = Dir.glob("app/assets/javascripts/**/*.hbs") puts "Checking #{files.count} files..." files.each do |f| content = File.read(f) count = 0 edits = 0 content.gsub!(/{{\s*plugin-outlet.*?}}/m) do |match| count += 1 result = match noTags = result.include?("noTags=true") tagName = result[/tagName="(\w*)"/, 1] connectorTagName = result[/connectorTagName="(\w*)"/, 1] if noTags result = removeAttr(result, "noTags") else if connectorTagName == "" result = removeAttr(result, "connectorTagName") elsif connectorTagName.nil? result = result.sub(/name="[\w-]+"/) { |m| "#{m} connectorTagName=\"div\"" } end if tagName == "" result = removeAttr(result, "tagName") elsif tagName.nil? result = result.sub(/name="[\w-]+"/) { |m| "#{m} tagName=\"span\"" } end end edits += 1 if match != result result end puts "#{count} outlets, #{edits} edited -> #{f}" File.write(f, content) end ```
2022-01-06 15:38:17 -05:00
{{plugin-outlet name="admin-users-list-icon" connectorTagName="div" args=(hash user=user query=query)}}
</td>
</tr>
{{/each}}
</tbody>
</table>
{{conditional-loading-spinner condition=refreshing}}
{{else}}
<p>{{i18n "search.no_results"}}</p>
{{/if}}
{{/load-more}}