aboutsummaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2024-03-20 13:59:15 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2024-03-20 13:59:15 +0100
commitccf588845a6e595d1c9b2726a05eddd34bc92488 (patch)
tree80ff56c17f5723ae8fff4f164bd0466df42ca348 /app/controllers
parent37d4967780f5b3dd06bb05337149811d7d7f8788 (diff)
downloadoperum-ccf588845a6e595d1c9b2726a05eddd34bc92488.tar.gz
operum-ccf588845a6e595d1c9b2726a05eddd34bc92488.zip
tags: added a way to update tags
It's useful to just rename tags which have quite some references that you don't want to nuke. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/tags_controller.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 8ae36d7..9d87687 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class TagsController < ApplicationController
- before_action :set_tag, only: %i[destroy]
+ before_action :set_tag, only: %i[edit update destroy]
def index
@tags = Tag.order(:name)
@@ -11,6 +11,8 @@ class TagsController < ApplicationController
@tag = Tag.new
end
+ def edit; end
+
def create
@tag = Tag.new(tag_params)
@@ -21,6 +23,14 @@ class TagsController < ApplicationController
end
end
+ def update
+ if @tag.update(tag_params)
+ redirect_to tags_url, notice: t('tags.update-success')
+ else
+ render :edit, status: :unprocessable_entity
+ end
+ end
+
def destroy
@tag.destroy!