mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Merge commit 'f1a6f4333a75f5bc186334f7f43a26e969cd712d' into glitch-soc/merge-upstream
This commit is contained in:
@@ -7,7 +7,7 @@ module Admin
|
||||
def index
|
||||
authorize :rule, :index?
|
||||
|
||||
@rules = Rule.ordered
|
||||
@rules = Rule.ordered.includes(:translations)
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -27,7 +27,6 @@ module Admin
|
||||
if @rule.save
|
||||
redirect_to admin_rules_path
|
||||
else
|
||||
@rules = Rule.ordered
|
||||
render :new
|
||||
end
|
||||
end
|
||||
@@ -50,6 +49,22 @@ module Admin
|
||||
redirect_to admin_rules_path
|
||||
end
|
||||
|
||||
def move_up
|
||||
authorize @rule, :update?
|
||||
|
||||
@rule.move!(-1)
|
||||
|
||||
redirect_to admin_rules_path
|
||||
end
|
||||
|
||||
def move_down
|
||||
authorize @rule, :update?
|
||||
|
||||
@rule.move!(+1)
|
||||
|
||||
redirect_to admin_rules_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_rule
|
||||
@@ -58,7 +73,7 @@ module Admin
|
||||
|
||||
def resource_params
|
||||
params
|
||||
.expect(rule: [:text, :hint, :priority])
|
||||
.expect(rule: [:text, :hint, :priority, translations_attributes: [[:id, :language, :text, :hint, :_destroy]]])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user