mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 02:30:57 +08:00
98201ecc24
This PR is the first step towards replacing our `{{user-selector}}` and eventually deprecating and removing it from our codebase. Some of `{{user-selector}}` problems are:
1. It's called `{{user-selector}}`, but in reality in can also select groups and emails.
2. It's an Ember component, yet it doesn't have a handlebars template and uses jQuery to render itself and modify the DOM. An example of this problem is when you want to clear the selected users programmatically, see [this](6c155dba77/app/assets/javascripts/discourse/app/components/user-selector.js (L179-L185)
).
3. We now have select kit which does very similar things but a lot better.
This PR introduces `{{email-group-user-chooser}}` which is meant to replace `{{user-selector}}`. It extends select kit and has the same features that `{{user-selector}}` has. `{{user-selector}}` is still used in a few places in core, but they'll all be replaced with the new component in a separate commit.
Once `{{user-selector}}` is not used anywhere in core, it'll be deprecated and then removed after the 2.7 release.
90 lines
3.0 KiB
Handlebars
90 lines
3.0 KiB
Handlebars
{{#link-to "adminApiKeys.index" class="go-back"}}
|
|
{{d-icon "arrow-left"}}
|
|
{{i18n "admin.api.all_api_keys"}}
|
|
{{/link-to}}
|
|
|
|
<div class="api-key api-key-new">
|
|
{{#if model.id}}
|
|
{{#admin-form-row label="admin.api.key"}}
|
|
<div>{{model.key}}</div>
|
|
{{/admin-form-row}}
|
|
{{#admin-form-row}}
|
|
{{i18n "admin.api.not_shown_again"}}
|
|
{{/admin-form-row}}
|
|
{{#admin-form-row}}
|
|
{{d-button icon="angle-right" label="admin.api.continue" action=(action "continue") class="btn-primary"}}
|
|
{{/admin-form-row}}
|
|
{{else}}
|
|
{{#admin-form-row label="admin.api.description"}}
|
|
{{input value=model.description maxlength="255" placeholder=(i18n "admin.api.description_placeholder")}}
|
|
{{/admin-form-row}}
|
|
|
|
{{#admin-form-row label="admin.api.user_mode"}}
|
|
{{combo-box content=userModes value=userMode onChange=(action "changeUserMode")}}
|
|
{{/admin-form-row}}
|
|
|
|
{{#if showUserSelector}}
|
|
{{#admin-form-row label="admin.api.user"}}
|
|
{{email-group-user-chooser
|
|
value=model.username
|
|
onChange=(action "updateUsername")
|
|
options=(hash
|
|
maximum=1
|
|
filterPlaceholder="admin.api.user_placeholder"
|
|
)
|
|
}}
|
|
{{/admin-form-row}}
|
|
{{/if}}
|
|
|
|
{{#admin-form-row label="admin.api.use_global_key"}}
|
|
{{input type="checkbox" checked=useGlobalKey}}
|
|
{{/admin-form-row}}
|
|
|
|
{{#unless useGlobalKey}}
|
|
<div class="scopes-title">{{i18n "admin.api.scopes.title"}}</div>
|
|
<p>{{i18n "admin.api.scopes.description"}}</p>
|
|
<table class="scopes-table grid">
|
|
<thead>
|
|
<tr>
|
|
<td></td>
|
|
<td></td>
|
|
<td>{{i18n "admin.api.scopes.allowed_urls"}}</td>
|
|
<td>{{i18n "admin.api.scopes.optional_allowed_parameters"}}</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#each-in scopes as |resource actions|}}
|
|
<tr class="scope-resource-name">
|
|
<td><b>{{resource}}</b></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
{{#each actions as |act|}}
|
|
<tr>
|
|
<td>{{input type="checkbox" checked=act.selected}}</td>
|
|
<td>
|
|
<div class="scope-name">{{act.name}}</div>
|
|
<span class="scope-tooltip" data-tooltip={{i18n (concat "admin.api.scopes.descriptions." resource "." act.key)}}>
|
|
{{d-icon "question-circle"}}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
{{d-button icon="link" action=(action "showURLs" act.urls) class="btn-info"}}
|
|
</td>
|
|
<td>
|
|
{{#each act.params as |p|}}
|
|
{{input maxlength="255" value=(get act p) placeholder=p}}
|
|
{{/each}}
|
|
</td>
|
|
</tr>
|
|
{{/each}}
|
|
{{/each-in}}
|
|
</tbody>
|
|
</table>
|
|
{{/unless}}
|
|
|
|
{{d-button icon="check" label="admin.api.save" action=(action "save") class="btn-primary" disabled=saveDisabled}}
|
|
{{/if}}
|
|
</div>
|