a11yist/app/controllers/link_categories_controller.rb

62 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2024-09-05 22:54:38 +02:00
# frozen_string_literal: true
2024-07-26 00:59:00 +02:00
class LinkCategoriesController < ApplicationController
2024-09-22 21:57:05 +02:00
include BackofficeMenu
2024-09-05 22:54:38 +02:00
before_action :set_link_category, only: %i[show edit update destroy]
2024-07-26 00:59:00 +02:00
# GET /link_categories
def index
@link_categories = LinkCategory.all
end
# GET /link_categories/1
2024-09-05 22:54:38 +02:00
def show; end
2024-07-26 00:59:00 +02:00
# GET /link_categories/new
def new
@link_category = LinkCategory.new
end
# GET /link_categories/1/edit
2024-09-05 22:54:38 +02:00
def edit; end
2024-07-26 00:59:00 +02:00
# POST /link_categories
def create
@link_category = LinkCategory.new(link_category_params)
if @link_category.save
redirect_to @link_category, notice: "Link category was successfully created."
else
render :new, status: :unprocessable_entity
end
end
# PATCH/PUT /link_categories/1
def update
if @link_category.update(link_category_params)
redirect_to @link_category, notice: "Link category was successfully updated.", status: :see_other
else
render :edit, status: :unprocessable_entity
end
end
# DELETE /link_categories/1
def destroy
@link_category.destroy!
redirect_to link_categories_url, notice: "Link category was successfully destroyed.", status: :see_other
end
private
2024-09-05 22:54:38 +02:00
# Use callbacks to share common setup or constraints between actions.
def set_link_category
@link_category = LinkCategory.find(params[:id])
end
# Only allow a list of trusted parameters through.
def link_category_params
params.require(:link_category).permit(:name, :description, :rich_text)
end
2024-07-26 00:59:00 +02:00
end