Vinoth Kannan 143f06f2c6
FEATURE: Allow watched words to be created as a group (#26632)
At the moment, there is no way to create a group of related watched words together.  If a user needed a set of words to be created together, they'll have to create them individually one at a time.

This change attempts to allow related watched words to be created as a group. The idea here is to have a list of words be tied together via a common `WatchedWordGroup` record.  Given a list of words, a `WatchedWordGroup` record is created and assigned to each `WatchedWord` record. The existing WatchedWord creation behaviour remains largely unchanged.

Co-authored-by: Selase Krakani <skrakani@gmail.com>
Co-authored-by: Martin Brennan <martin@discourse.org>
2024-04-29 15:50:55 +05:30

88 lines
2.3 KiB
Handlebars

<div class="watched-word-input">
<label for="watched-word">{{i18n "admin.watched_words.form.label"}}</label>
<WatchedWords
@id="watched-words"
@value={{this.words}}
@onChange={{action (mut this.words)}}
@options={{hash
filterPlaceholder=this.placeholderKey
disabled=this.formSubmitted
}}
/>
</div>
{{#if this.canReplace}}
<div class="watched-word-input">
<label for="watched-replacement">{{i18n
"admin.watched_words.form.replace_label"
}}</label>
<TextField
@id="watched-replacement"
@value={{this.replacement}}
@disabled={{this.formSubmitted}}
@autocorrect="off"
@autocapitalize="off"
@placeholderKey="admin.watched_words.form.replace_placeholder"
class="watched-word-input-field"
/>
</div>
{{/if}}
{{#if this.canTag}}
<div class="watched-word-input">
<label for="watched-tag">{{i18n
"admin.watched_words.form.tag_label"
}}</label>
<TagChooser
@id="watched-tag"
@tags={{this.selectedTags}}
@onChange={{this.changeSelectedTags}}
@everyTag={{true}}
@options={{hash allowAny=true disabled=this.formSubmitted}}
class="watched-word-input-field"
/>
</div>
{{/if}}
{{#if this.canLink}}
<div class="watched-word-input">
<label for="watched-link">{{i18n
"admin.watched_words.form.link_label"
}}</label>
<TextField
@id="watched-link"
@value={{this.replacement}}
@disabled={{this.formSubmitted}}
@autocorrect="off"
@autocapitalize="off"
@placeholderKey="admin.watched_words.form.link_placeholder"
class="watched-word-input-field"
/>
</div>
{{/if}}
<div class="watched-word-input">
<label for="watched-case-sensitivity">{{i18n
"admin.watched_words.form.case_sensitivity_label"
}}</label>
<label class="case-sensitivity-checkbox checkbox-label">
<Input
@type="checkbox"
@checked={{this.isCaseSensitive}}
disabled={{this.formSubmitted}}
/>
{{i18n "admin.watched_words.form.case_sensitivity_description"}}
</label>
</div>
<DButton
@action={{this.submitForm}}
@disabled={{this.submitDisabled}}
@label="admin.watched_words.form.add"
type="submit"
class="btn-primary"
/>
{{#if this.showMessage}}
<span class="success-message">{{this.message}}</span>
{{/if}}