mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Add new tag group and add rule to tag group
This commit is contained in:
@@ -50,6 +50,10 @@ module Admin
|
||||
@object.build_custom_tab if @object.custom_tab.nil?
|
||||
|
||||
load_tag_rule_types
|
||||
# TODO translation
|
||||
@visibility_options = [
|
||||
[t('js.tag_rules.visible'), "visible"], [t('js.tag_rules.not_visible'), "hidden"]
|
||||
]
|
||||
|
||||
return unless params[:stimulus]
|
||||
|
||||
@@ -147,6 +151,17 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
def new_tag_rule_group
|
||||
load_tag_rule_types
|
||||
|
||||
@index = params[:index]
|
||||
@group = { tags: [], rules: [] }
|
||||
|
||||
respond_to do |format|
|
||||
format.turbo_stream
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def delete_custom_tab
|
||||
|
||||
@@ -6,9 +6,15 @@ module Admin
|
||||
|
||||
def new
|
||||
@index = params[:index]
|
||||
@div_id = params[:div_id]
|
||||
is_default = params[:is_default]
|
||||
@customer_tags = params[:customer_tags]
|
||||
# TODO translation
|
||||
@visibility_options = [[t('js.tag_rules.visible'), "visible"],
|
||||
[t('js.tag_rules.not_visible'), "hidden"]]
|
||||
status = :ok
|
||||
if permitted_tag_rule_type.include?(params[:rule_type])
|
||||
@default_rule = "TagRule::#{params[:rule_type]}".constantize.new(is_default: true)
|
||||
@default_rule = "TagRule::#{params[:rule_type]}".constantize.new(is_default:)
|
||||
else
|
||||
flash.now[:error] = t(".not_supported_type")
|
||||
status = :internal_server_error
|
||||
|
||||
Reference in New Issue
Block a user