discourse/app/assets/javascripts/admin/addon/templates/site-text-index.hbs
David Taylor a60d7a2bc7
DEV: Modernize admin-site-text route/controller (#23581)
- Switch to `@tracked` and native getters
- Remove queryParam defaults which are awkward to work with. Instead, add `resolvedBlah` getters
- Add 'no results found' text
- Use standard 'model' key instead of a custom `setupController` method
- Remove use of `route-action`
- Remove `{{action` helper

Default queryParams in ember controllers are tricky to work with, especially when combined with the new router service. Instead, we can handle defaults ourselves
2023-09-14 11:27:09 +01:00

76 lines
1.9 KiB
Handlebars

<div class="search-area">
<p>{{i18n "admin.site_text.description"}}</p>
<TextField
@value={{this.q}}
@placeholderKey="admin.site_text.search"
@class="no-blur site-text-search"
@autofocus="true"
@key-up={{this.search}}
/>
<div class="reseed">
<DButton
@action={{this.showReseedModal}}
@label="admin.reseed.action.label"
@title="admin.reseed.action.title"
@icon="sync"
class="btn-default"
/>
</div>
<p class="filter-options">
<div class="locale">
<label>{{i18n "admin.site_text.locale"}}</label>
<ComboBox
@valueProperty="value"
@content={{this.availableLocales}}
@value={{this.locale}}
@onChange={{this.updateLocale}}
@class="locale-search"
@options={{hash filterable=true}}
/>
</div>
<label>
<input
id="toggle-overridden"
type="checkbox"
checked={{this.resolvedOverridden}}
{{on "click" this.toggleOverridden}}
/>
{{i18n "admin.site_text.show_overriden"}}
</label>
<label>
<input
id="toggle-outdated"
type="checkbox"
checked={{this.resolvedOutdated}}
{{on "click" this.toggleOutdated}}
/>
{{i18n "admin.site_text.show_outdated"}}
</label>
</p>
</div>
<ConditionalLoadingSpinner @condition={{this.searching}}>
{{#if this.model.extras.recommended}}
<p><b>{{i18n "admin.site_text.recommended"}}</b></p>
{{/if}}
{{#each this.model as |siteText|}}
<SiteTextSummary
@siteText={{siteText}}
@editAction={{this.edit}}
@term={{this.q}}
@searchRegex={{this.model.extras.regex}}
/>
{{else}}
{{i18n "admin.site_text.no_results"}}
{{/each}}
{{#if this.model.extras.has_more}}
<p class="warning">{{i18n "admin.site_text.more_than_50_results"}}</p>
{{/if}}
</ConditionalLoadingSpinner>