This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/templates/modal/feature-topic.hbs
Joffrey JAFFEUX 0431942f3d
DEV: select-kit 2 (#7998)
This new iteration of select-kit focuses on following best principales and disallowing mutations inside select-kit components. A best effort has been made to avoid breaking changes, however if you content was a flat array, eg: ["foo", "bar"] You will need to set valueProperty=null and nameProperty=null on the component.

Also almost every component should have an `onChange` handler now to decide what to do with the updated data. **select-kit will not mutate your data by itself anymore**
2020-02-03 14:22:14 +01:00

158 lines
5.5 KiB
Handlebars

{{#d-modal-body class="feature-topic"}}
{{#if model.pinned_at}}
<div class="feature-section">
<div class="desc">
{{#if model.pinned_globally}}
<p>
{{#conditional-loading-spinner size="small" condition=loading}}
{{#if pinnedGloballyCount}}
{{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}}
{{else}}
{{{i18n "topic.feature_topic.not_pinned_globally"}}}
{{/if}}
{{/conditional-loading-spinner}}
</p>
<p>{{i18n "topic.feature_topic.global_pin_note"}}</p>
{{else}}
<p>
{{#conditional-loading-spinner size="small" condition=loading}}
{{{alreadyPinnedMessage}}}
{{/conditional-loading-spinner}}
</p>
<p>{{i18n "topic.feature_topic.pin_note"}}</p>
{{/if}}
<p>{{{unPinMessage}}}</p>
<p>{{d-button action=(action "unpin") icon="thumbtack" label="topic.feature.unpin" class="btn-primary"}}</p>
</div>
</div>
{{else}}
<div class="feature-section">
<div class="desc">
<p>
{{#conditional-loading-spinner size="small" condition=loading}}
{{{alreadyPinnedMessage}}}
{{/conditional-loading-spinner}}
</p>
<p>
{{i18n "topic.feature_topic.pin_note"}}
</p>
{{#if site.isMobileDevice}}
<p>
{{{pinMessage}}}
</p>
<p class="with-validation">
{{future-date-input
class="pin-until"
includeFarFuture=true
clearable=true
input=model.pinnedInCategoryUntil
onChangeInput=(action (mut model.pinnedInCategoryUntil))
}}
{{popup-input-tip validation=pinInCategoryValidation shownAt=pinInCategoryTipShownAt}}
</p>
{{else}}
<p class="with-validation">
{{{pinMessage}}}
{{d-icon "far-clock"}}
{{future-date-input
class="pin-until"
includeFarFuture=true
clearable=true
input=model.pinnedInCategoryUntil
onChangeInput=(action (mut model.pinnedInCategoryUntil))
}}
{{popup-input-tip validation=pinInCategoryValidation shownAt=pinInCategoryTipShownAt}}
</p>
{{/if}}
<p>
{{d-button action=(action "pin") icon="thumbtack" label="topic.feature.pin" class="btn-primary"}}
</p>
</div>
</div>
<hr>
<div class="feature-section">
<div class="desc">
<p>
{{#conditional-loading-spinner size="small" condition=loading}}
{{#if pinnedGloballyCount}}
{{{i18n "topic.feature_topic.already_pinned_globally" count=pinnedGloballyCount}}}
{{else}}
{{{i18n "topic.feature_topic.not_pinned_globally"}}}
{{/if}}
{{/conditional-loading-spinner}}
</p>
<p>
{{i18n "topic.feature_topic.global_pin_note"}}
</p>
{{#if site.isMobileDevice}}
<p>
{{i18n "topic.feature_topic.pin_globally"}}
</p>
<p class="with-validation">
{{future-date-input
class="pin-until"
includeFarFuture=true
clearable=true
input=model.pinnedGloballyUntil
onChangeInput=(action (mut model.pinnedGloballyUntil))
}}
{{popup-input-tip validation=pinGloballyValidation shownAt=pinGloballyTipShownAt}}
</p>
{{else}}
<p class="with-validation">
{{i18n "topic.feature_topic.pin_globally"}}
{{d-icon "far-clock"}}
{{future-date-input
class="pin-until"
includeFarFuture=true
clearable=true
input=model.pinnedGloballyUntil
onChangeInput=(action (mut model.pinnedGloballyUntil))
}}
{{popup-input-tip validation=pinGloballyValidation shownAt=pinGloballyTipShownAt}}
</p>
{{/if}}
<p>
{{d-button action=(action "pinGlobally") icon="thumbtack" label="topic.feature.pin_globally" class="btn-primary"}}
</p>
</div>
</div>
{{/if}}
{{#if currentUser.staff}}
<hr>
<div class="feature-section">
<div class="desc">
<p>
{{#conditional-loading-spinner size="small" condition=loading}}
{{#if bannerCount}}
{{{i18n "topic.feature_topic.banner_exists"}}}
{{else}}
{{{i18n "topic.feature_topic.no_banner_exists"}}}
{{/if}}
{{/conditional-loading-spinner}}
</p>
<p>
{{i18n "topic.feature_topic.banner_note"}}
</p>
<p>
{{#if model.isBanner}}
{{i18n "topic.feature_topic.remove_banner"}}
{{else}}
{{i18n "topic.feature_topic.make_banner"}}
{{/if}}
</p>
<p>
{{#if model.isBanner}}
{{d-button action=(action "removeBanner") icon="thumbtack" label="topic.feature.remove_banner" class="btn-primary"}}
{{else}}
{{d-button action=(action "makeBanner") icon="thumbtack" label="topic.feature.make_banner" class="btn-primary"}}
{{/if}}
</p>
</div>
</div>
{{/if}}
{{/d-modal-body}}
<div class="modal-footer">
{{d-modal-cancel close=(route-action "closeModal")}}
</div>