Files
discourse/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings-view.hbs
Jarek Radosz 1c87bb7fe9 DEV: Update DButton uses (#23333)
1. Use `this.` instead of `{{action}}` where applicable
2. Use `{{fn}}` instead of `@actionParam` where applicable
3. Use non-`@` versions of class/type/tabindex/aria-controls/aria-expanded
4. Remove `btn` class (it's added automatically to all DButtons)
5. Remove `type="button"` (it's the default)
6. Use `concat-class` helper
2023-08-31 11:49:35 +02:00

199 lines
6.3 KiB
Handlebars

<div class="chat-form__section">
<div class="chat-form__field -mute">
<label class="chat-form__label">
<span>{{i18n "chat.settings.mute"}}</span>
<ChatChannelSettingsSavedIndicator
@property={{@channel.currentUserMembership.muted}}
/>
</label>
<div class="chat-form__control">
<ComboBox
@content={{this.mutedOptions}}
@value={{@channel.currentUserMembership.muted}}
@valueProperty="value"
@class="channel-settings-view__selector"
@onChange={{fn this.saveNotificationSettings "muted" "muted"}}
/>
</div>
</div>
{{#unless @channel.currentUserMembership.muted}}
<div class="chat-form__field -desktop-notification-level">
<label class="chat-form__label">
<span>{{i18n "chat.settings.desktop_notification_level"}}</span>
<ChatChannelSettingsSavedIndicator
@property={{@channel.currentUserMembership.desktopNotificationLevel}}
/>
</label>
<div class="chat-form__control">
<ComboBox
@content={{this.notificationLevels}}
@value={{@channel.currentUserMembership.desktopNotificationLevel}}
@valueProperty="value"
@class="channel-settings-view__selector"
@onChange={{fn
this.saveNotificationSettings
"desktopNotificationLevel"
"desktop_notification_level"
}}
/>
</div>
</div>
<div class="chat-form__field -mobile-notification-level">
<label class="chat-form__label">
<span>{{i18n "chat.settings.mobile_notification_level"}}</span>
<ChatChannelSettingsSavedIndicator
@property={{@channel.currentUserMembership.mobileNotificationLevel}}
/>
</label>
<div class="chat-form__control">
<ComboBox
@content={{this.notificationLevels}}
@value={{@channel.currentUserMembership.mobileNotificationLevel}}
@valueProperty="value"
@class="channel-settings-view__selector"
@onChange={{fn
this.saveNotificationSettings
"mobileNotificationLevel"
"mobile_notification_level"
}}
/>
</div>
</div>
{{/unless}}
<div class="chat-retention-info">
{{d-icon "info-circle"}}
<ChatRetentionReminderText @channel={{@channel}} />
</div>
</div>
{{#if this.adminSectionAvailable}}
<h3 class="chat-form__section-admin-title">
{{i18n "chat.settings.admin_title"}}
</h3>
{{#if this.autoJoinAvailable}}
<div class="chat-form__section -autojoin">
<div class="chat-form__field">
<label class="chat-form__label">
<span>{{i18n "chat.settings.auto_join_users_label"}}</span>
<ChatChannelSettingsSavedIndicator
@property={{@channel.autoJoinUsers}}
/>
</label>
<ComboBox
@content={{this.autoAddUsersOptions}}
@value={{@channel.autoJoinUsers}}
@valueProperty="value"
@class="channel-settings-view__selector"
@onChange={{action
(fn this.onToggleAutoJoinUsers @channel.autoJoinUsers)
}}
/>
<p class="chat-form__description">
{{i18n
"chat.settings.auto_join_users_info"
category=@channel.chatable.name
}}
</p>
</div>
</div>
{{/if}}
{{#if this.togglingChannelWideMentionsAvailable}}
<div class="chat-form__section -channel-wide-mentions">
<div class="chat-form__field">
<label class="chat-form__label">
<span>{{i18n "chat.settings.channel_wide_mentions_label"}}</span>
<ChatChannelSettingsSavedIndicator
@property={{@channel.allowChannelWideMentions}}
/>
</label>
<ComboBox
@content={{this.channelWideMentionsOptions}}
@value={{@channel.allowChannelWideMentions}}
@valueProperty="value"
@class="channel-settings-view__selector"
@onChange={{this.onToggleChannelWideMentions}}
/>
<p class="chat-form__description">
{{i18n
"chat.settings.channel_wide_mentions_description"
channel=@channel.title
}}
</p>
</div>
</div>
{{/if}}
<div class="chat-form__section -threading">
<div class="chat-form__field">
<label class="chat-form__label">
<span>{{i18n "chat.settings.channel_threading_label"}}</span>
<span class="channel-settings-view__channel-threading-tooltip">
{{d-icon "info-circle"}}
<DTooltip>
{{i18n "chat.settings.channel_threading_description"}}
</DTooltip>
</span>
<ChatChannelSettingsSavedIndicator
@property={{@channel.threadingEnabled}}
/>
</label>
<ComboBox
@content={{this.threadingEnabledOptions}}
@value={{@channel.threadingEnabled}}
@valueProperty="value"
@class="channel-settings-view__selector"
@onChange={{this.onToggleThreadingEnabled}}
/>
</div>
</div>
{{/if}}
{{#unless @channel.isDirectMessageChannel}}
<div class="chat-form__section">
{{#if (chat-guardian "can-edit-chat-channel")}}
{{#if (chat-guardian "can-archive-channel" @channel)}}
<div class="chat-form__field">
<DButton
@action={{this.onArchiveChannel}}
@label="chat.channel_settings.archive_channel"
@icon="archive"
class="archive-btn chat-form__btn btn-flat"
/>
</div>
{{/if}}
{{#if @channel.isClosed}}
<div class="chat-form__field">
<DButton
@action={{this.onToggleChannelState}}
@label="chat.channel_settings.open_channel"
@icon="unlock"
class="open-btn chat-form__btn btn-flat"
/>
</div>
{{else}}
<div class="chat-form__field">
<DButton
@action={{this.onToggleChannelState}}
@label="chat.channel_settings.close_channel"
@icon="lock"
class="close-btn chat-form__btn btn-flat"
/>
</div>
{{/if}}
<div class="chat-form__field">
<DButton
@action={{this.onDeleteChannel}}
@label="chat.channel_settings.delete_channel"
@icon="trash-alt"
class="delete-btn chat-form__btn btn-flat"
/>
</div>
{{/if}}
</div>
{{/unless}}