Split mute rule form into seperate partial and replace on create
This commit is contained in:
parent
40d5dc41dd
commit
efef85b7c6
|
@ -12,7 +12,10 @@ class Settings::MutesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.turbo_stream do
|
||||
render turbo_stream: turbo_stream.append("rules", partial: "settings/mutes/rule", locals: { rule: })
|
||||
render turbo_stream: [
|
||||
turbo_stream.replace("form", partial: "settings/mutes/form"),
|
||||
turbo_stream.append("rules", partial: "settings/mutes/rule", locals: { rule: })
|
||||
]
|
||||
end
|
||||
|
||||
format.html { redirect_to settings_muted_path }
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#form.form-group
|
||||
%form{ action: settings_muted_path, method: "post" }
|
||||
.input-group
|
||||
%input.form-control#muted_phrase{ name: :muted_phrase, placeholder: t(".placeholder"), data: { controller: :autofocus } }
|
||||
.input-group-append
|
||||
%button.btn.btn-primary{ type: "submit" }= t("voc.add")
|
|
@ -6,12 +6,7 @@
|
|||
#rules
|
||||
- @rules.each do |rule|
|
||||
= render "settings/mutes/rule", rule: rule
|
||||
.form-group
|
||||
%form{ action: settings_muted_path, method: "post" }
|
||||
.input-group
|
||||
%input.form-control#muted_phrase{ name: :muted_phrase, placeholder: t(".placeholder") }
|
||||
.input-group-append
|
||||
%button.btn.btn-primary{ type: "submit" }= t("voc.add")
|
||||
= render "settings/mutes/form"
|
||||
|
||||
- provide(:title, generate_title(t(".title")))
|
||||
- parent_layout "user/settings"
|
||||
|
|
|
@ -408,6 +408,7 @@ en:
|
|||
heading: "Muted Terms"
|
||||
body: "Muting words (or longer phrases) will prevent questions containing those to appear in your inbox."
|
||||
note: "Note: Filtered questions are discarded completely from your inbox, and won't reappear if you remove a filter later on."
|
||||
form:
|
||||
placeholder: "Add a new muted term…"
|
||||
privacy:
|
||||
edit:
|
||||
|
|
Loading…
Reference in New Issue