discourse/app/assets/javascripts/admin/templates/user-index.hbs

491 lines
16 KiB
Handlebars
Raw Normal View History

<section class="details {{unless model.active 'not-activated'}}">
2013-02-06 03:16:51 +08:00
<div class='user-controls'>
{{#if model.active}}
{{#link-to 'user' model class="btn"}}
{{fa-icon "user"}}
{{i18n 'admin.user.show_public_profile'}}
{{/link-to}}
{{#if model.can_impersonate}}
<button class='btn btn-danger' {{action "impersonate" target="content"}} title="{{i18n 'admin.impersonate.help'}}">
{{fa-icon "crosshairs"}}
{{i18n 'admin.impersonate.title'}}
</button>
{{/if}}
{{#if currentUser.admin}}
<button class='btn' {{action "log_out" target="content"}}>
{{fa-icon "power-off"}}
{{i18n 'admin.user.log_out'}}
</button>
{{/if}}
{{/if}}
</div>
<div class='display-row username'>
<div class='field'>{{i18n 'user.username.title'}}</div>
<div class='value'>{{model.username}}</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#link-to 'preferences.username' model class="btn"}}
{{fa-icon "pencil"}}
{{i18n 'user.change_username.title'}}
2013-09-17 02:08:55 +08:00
{{/link-to}}
2013-02-06 03:16:51 +08:00
</div>
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.name.title'}}</div>
<div class='value'>{{model.name}}</div>
</div>
{{#if canCheckEmails}}
<div class='display-row email'>
<div class='field'>{{i18n 'user.email.title'}}</div>
<div class='value'>
{{#unless model.active}}
<div class='controls'>{{i18n 'admin.users.not_verified'}}</div>
{{/unless}}
{{#if model.email}}
<a href="mailto:{{unbound model.email}}">{{model.email}}</a>
{{else}}
<button class="btn" title="{{i18n 'admin.users.check_email.title'}}" {{action "checkEmail" this}}>{{fa-icon "envelope-o"}} {{i18n 'admin.users.check_email.text'}}</button>
{{/if}}
</div>
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row associations'>
<div class='field'>{{i18n 'user.associated_accounts'}}</div>
<div class='value'>
{{#if model.associated_accounts}}
{{model.associated_accounts}}
{{else}}
<button class="btn" title="{{i18n 'admin.users.check_email.title'}}" {{action "checkEmail" this}}>{{fa-icon "envelope-o"}} {{i18n 'admin.users.check_email.text'}}</button>
{{/if}}
</div>
</div>
{{/if}}
<div class='display-row'>
<div class='field'>{{i18n 'user.avatar.title'}}</div>
2013-02-06 03:16:51 +08:00
<div class='value'>{{avatar content imageSize="large"}}</div>
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.title.title'}}</div>
<div class='value'>
{{#if editingTitle}}
{{text-field value=model.title autofocus="autofocus"}}
{{else}}
<span {{action "toggleTitleEdit"}}>{{model.title}}&nbsp;</span>
{{/if}}
</div>
<div class='controls'>
{{#if editingTitle}}
{{d-button action="saveTitle" label="admin.user.save_title"}}
<a href {{action "toggleTitleEdit"}}>{{i18n 'cancel'}}</a>
{{else}}
{{d-button action="toggleTitleEdit" icon="pencil" label="admin.user.edit_title"}}
{{/if}}
</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'user.ip_address.title'}}</div>
<div class='value'>{{model.ip_address}}</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#if currentUser.staff}}
<button class='btn' {{action "refreshBrowsers" target="content"}}>
{{i18n 'admin.user.refresh_browsers'}}
</button>
{{ip-lookup ip=model.ip_address userId=model.id}}
{{/if}}
2013-02-06 03:16:51 +08:00
</div>
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.registration_ip_address.title'}}</div>
<div class='value'>{{model.registration_ip_address}}</div>
<div class='controls'>
{{#if currentUser.staff}}
{{ip-lookup ip=model.registration_ip_address userId=model.id}}
{{/if}}
</div>
</div>
{{#if showBadges}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.badges.title'}}</div>
<div class='value'>
{{i18n 'badges.badge_count' count=model.badge_count}}
</div>
<div class='controls'>
{{#link-to 'adminUser.badges' model class="btn"}}{{fa-icon "certificate"}}{{i18n 'admin.badges.edit_badges'}}{{/link-to}}
</div>
</div>
{{/if}}
2013-02-06 03:16:51 +08:00
</section>
{{#if userFields}}
<section class='details'>
2014-12-13 02:28:20 +08:00
{{#each uf in userFields}}
<div class='display-row'>
2014-12-13 02:28:20 +08:00
<div class='field'>{{uf.name}}</div>
<div class='value'>
2014-12-13 02:28:20 +08:00
{{#if uf.value}}
{{uf.value}}
{{else}}
&mdash;
{{/if}}
</div>
</div>
{{/each}}
</section>
{{/if}}
2013-02-06 03:16:51 +08:00
<section class='details'>
<h1>{{i18n 'admin.user.permissions'}}</h1>
2013-02-06 03:16:51 +08:00
{{#if showApproval}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.approved'}}</div>
<div class='value'>
{{#if model.approved}}
{{i18n 'admin.user.approved_by'}}
{{#link-to 'adminUser' approvedBy}}{{avatar model.approvedBy imageSize="small"}}{{/link-to}}
{{#link-to 'adminUser' approvedBy}}{{model.approvedBy.username}}{{/link-to}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'>
{{#if model.approved}}
{{i18n 'admin.user.approve_success'}}
{{else}}
{{#if model.can_approve}}
<button class='btn' {{action "approve" target="content"}}>
{{fa-icon "check"}}
{{i18n 'admin.user.approve'}}
</button>
{{/if}}
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
</div>
{{/if}}
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.active'}}</div>
<div class='value'>
{{#if model.active}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'>
{{#if model.active}}
{{#if model.can_deactivate}}
<button class='btn' {{action "deactivate" target="content"}}>{{i18n 'admin.user.deactivate_account'}}</button>
{{i18n 'admin.user.deactivate_explanation'}}
{{/if}}
{{else}}
{{#if model.can_send_activation_email}}
<button class='btn' {{action "sendActivationEmail" target="content"}}>
{{fa-icon "envelope"}}
{{i18n 'admin.user.send_activation_email'}}
</button>
{{/if}}
{{#if model.can_activate}}
<button class='btn' {{action "activate" target="content"}}>
{{fa-icon "check"}}
{{i18n 'admin.user.activate'}}
</button>
{{/if}}
{{/if}}
</div>
</div>
{{#if currentUser.admin}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.api.key'}}</div>
{{#if model.api_key}}
<div class='long-value'>
{{model.api_key.key}}
{{d-button action="regenerateApiKey" icon="undo" label="admin.api.regenerate"}}
{{d-button action="revokeApiKey" icon="times" label="admin.api.revoke"}}
</div>
{{else}}
<div class='value'>
&mdash;
</div>
<div class='controls'>
{{d-button action="generateApiKey" icon="key" label="admin.api.generate"}}
</div>
{{/if}}
</div>
{{/if}}
2013-10-23 03:53:08 +08:00
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.admin'}}</div>
<div class='value'>{{model.admin}}</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#if model.can_revoke_admin}}
<button class='btn' {{action "revokeAdmin" target="content"}}>
{{fa-icon "shield"}}
{{i18n 'admin.user.revoke_admin'}}
2013-02-06 03:16:51 +08:00
</button>
{{/if}}
{{#if model.can_grant_admin}}
<button class='btn' {{action "grantAdmin" target="content"}}>
{{fa-icon "shield"}}
{{i18n 'admin.user.grant_admin'}}
2013-02-06 03:16:51 +08:00
</button>
{{/if}}
2013-02-06 03:16:51 +08:00
</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.moderator'}}</div>
<div class='value'>{{model.moderator}}</div>
<div class='controls'>
{{#if model.can_revoke_moderation}}
<button class='btn' {{action "revokeModeration" target="content"}}>
{{fa-icon "shield"}}
{{i18n 'admin.user.revoke_moderation'}}
</button>
{{/if}}
{{#if model.can_grant_moderation}}
<button class='btn' {{action "grantModeration" target="content"}}>
{{fa-icon "shield"}}
{{i18n 'admin.user.grant_moderation'}}
</button>
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'trust_level'}}</div>
<div class="value">
{{combo-box content=site.trustLevels value=model.trust_level nameProperty="detailedName"}}
{{#if model.dirty}}
<div>
<button class='btn ok no-text' {{action "saveTrustLevel" target="content"}}>{{fa-icon "check"}}</button>
<button class='btn cancel no-text' {{action "restoreTrustLevel" target="content"}}>{{fa-icon "times"}}</button>
</div>
{{/if}}
</div>
<div class="controls">
{{#if model.canLockTrustLevel}}
{{#if model.trust_level_locked}}
<i title='{{i18n 'admin.user.trust_level_locked_tip'}}' {{action "lockTrustLevel" false target="model"}} class='fa fa-lock'></i> <button class="btn" {{action "lockTrustLevel" false target="model"}}>{{i18n 'admin.user.unlock_trust_level'}}</button>
{{else}}
<i title='{{i18n 'admin.user.trust_level_unlocked_tip'}}' class='fa fa-unlock'></i> <button class="btn" {{action "lockTrustLevel" true target="model"}}>{{i18n 'admin.user.lock_trust_level'}}</button>
{{/if}}
{{/if}}
{{#if model.tl3Requirements}}
{{#link-to 'adminUser.tl3Requirements' model class="btn"}}{{i18n 'admin.user.trust_level_3_requirements'}}{{/link-to}}
{{/if}}
</div>
</div>
<div {{bind-attr class=":display-row model.isSuspended:highlight-danger"}}>
<div class='field'>{{i18n 'admin.user.suspended'}}</div>
<div class='value'>{{model.isSuspended}}</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#if model.isSuspended}}
<button class='btn btn-danger' {{action "unsuspend" target="content"}}>
{{fa-icon "ban"}}
{{i18n 'admin.user.unsuspend'}}
</button>
{{suspendDuration}}
{{i18n 'admin.user.suspended_explanation'}}
2013-02-06 03:16:51 +08:00
{{else}}
{{#if model.canSuspend}}
<button class='btn btn-danger' {{action "showSuspendModal" this}}>
{{fa-icon "ban"}}
{{i18n 'admin.user.suspend'}}
2013-02-06 03:16:51 +08:00
</button>
{{i18n 'admin.user.suspended_explanation'}}
2013-02-06 03:16:51 +08:00
{{/if}}
{{/if}}
</div>
</div>
{{#if model.isSuspended}}
<div class='display-row highlight-danger'>
<div class='field'>{{i18n 'admin.user.suspended_by'}}</div>
<div class='value'>
2015-08-14 05:32:12 +08:00
{{#link-to 'adminUser' suspendedBy}}{{avatar model.suspendedBy imageSize="tiny"}}{{/link-to}}
{{#link-to 'adminUser' suspendedBy}}{{model.suspendedBy.username}}{{/link-to}}
</div>
<div class='controls'>
<b>{{i18n 'admin.user.suspend_reason'}}</b>:
2015-08-14 05:32:12 +08:00
{{model.suspend_reason}}
</div>
</div>
{{/if}}
<div {{bind-attr class=":display-row model.blocked:highlight-danger"}}>
<div class='field'>{{i18n 'admin.user.blocked'}}</div>
<div class='value'>{{model.blocked}}</div>
<div class='controls'>
{{#if model.blocked}}
<button class='btn' {{action "unblock" target="content"}}>
{{fa-icon "thumbs-o-up"}}
{{i18n 'admin.user.unblock'}}
</button>
{{i18n 'admin.user.block_explanation'}}
{{/if}}
</div>
</div>
2013-02-06 03:16:51 +08:00
</section>
<section class='details'>
<h1>{{i18n 'admin.groups.title'}}</h1>
{{#if currentUser.admin}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.groups.automatic'}}</div>
<div class='value'>{{automaticGroups}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.groups.custom'}}</div>
<div class='value'>
{{admin-group-selector selected=model.customGroups available=availableGroups}}
</div>
<div class='controls'>
{{#if model.customGroups}}
{{i18n 'admin.groups.primary'}}
{{combo-box content=model.customGroups value=model.primary_group_id nameProperty="name" none="admin.groups.no_primary"}}
{{/if}}
{{#if primaryGroupDirty}}
{{d-button icon="check" class="ok" action="savePrimaryGroup"}}
{{d-button icon="times" class="cancel" action="resetPrimaryGroup"}}
{{/if}}
</div>
</div>
{{/if}}
</section>
2013-02-06 03:16:51 +08:00
<section class='details'>
<h1>{{i18n 'admin.user.activity'}}</h1>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'created'}}</div>
<div class='value'>{{{model.created_at_age}}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.last_emailed'}}</div>
<div class='value'>{{{model.last_emailed_age}}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'last_seen'}}</div>
<div class='value'>{{{model.last_seen_age}}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.like_count'}}</div>
<div class='value'>{{model.like_given_count}} / {{model.like_count}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.topics_entered'}}</div>
<div class='value'>{{model.topics_entered}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.post_count'}}</div>
<div class='value'>{{model.post_count}}</div>
<div class='controls'>
{{#if model.can_delete_all_posts}}
{{#if model.post_count}}
<button class='btn btn-danger' {{action "deleteAllPosts" target="content"}}>
{{fa-icon "trash-o"}}
{{i18n 'admin.user.delete_all_posts'}}
</button>
{{/if}}
{{else}}
{{model.deleteAllPostsExplanation}}
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.posts_read_count'}}</div>
<div class='value'>{{model.posts_read_count}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.warnings_received_count'}}</div>
<div class='value'>{{model.warnings_received_count}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.flags_given_received_count'}}</div>
<div class='value'>{{model.flags_given_count}} / {{model.flags_received_count}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.private_topics_count'}}</div>
<div class='value'>{{model.private_topics_count}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.time_read'}}</div>
<div class='value'>{{{model.time_read}}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.invited.days_visited'}}</div>
<div class='value'>{{{model.days_visited}}}</div>
</div>
2013-02-06 03:16:51 +08:00
</section>
{{#if model.single_sign_on_record}}
2014-08-23 08:34:48 +08:00
<section class='details'>
<h1>{{i18n 'admin.user.sso.title'}}</h1>
2014-08-23 08:34:48 +08:00
{{#with model.single_sign_on_record}}
2014-08-23 08:34:48 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_id'}}</div>
2014-08-23 08:34:48 +08:00
<div class='value'>{{external_id}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_username'}}</div>
2014-08-23 08:34:48 +08:00
<div class='value'>{{external_username}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_name'}}</div>
2014-08-23 08:34:48 +08:00
<div class='value'>{{external_name}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_email'}}</div>
2014-08-23 08:34:48 +08:00
<div class='value'>{{external_email}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_avatar_url'}}</div>
2014-08-23 08:34:48 +08:00
<div class='value'>{{external_avatar_url}}</div>
</div>
{{/with}}
</section>
{{/if}}
<section>
<hr/>
2015-03-11 01:06:08 +08:00
<div class="pull-right">
{{#unless model.anonymizeForbidden}}
2015-03-11 01:06:08 +08:00
{{d-button label="admin.user.anonymize"
icon="exclamation-triangle"
class="btn-danger"
disabled=model.anonymizeForbidden
2015-03-11 01:06:08 +08:00
action="anonymize"}}
{{/unless}}
{{#unless model.deleteForbidden}}
2015-03-11 01:06:08 +08:00
{{d-button label="admin.user.delete"
icon="exclamation-triangle"
class="btn-danger"
disabled=model.deleteForbidden
2015-03-11 01:06:08 +08:00
action="destroy"}}
{{/unless}}
</div>
{{#if model.deleteExplanation}}
<div class="clearfix"></div>
2015-03-11 01:06:08 +08:00
<br/>
<div class="pull-right">
{{fa-icon "exclamation-triangle"}} {{model.deleteExplanation}}
</div>
{{/if}}
</section>
<div class="clearfix"></div>