A lot :)
This commit is contained in:
parent
aad67af0d1
commit
63fc206c27
153 changed files with 2043 additions and 646 deletions
|
|
@ -1,14 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChecksController < ApplicationController
|
||||
before_action :set_check, only: %i[show edit update destroy]
|
||||
|
||||
# GET /checks or /checks.json
|
||||
def index
|
||||
@pagy, @checks = pagy(Check.search(filter_params[:s]))
|
||||
@pagy, @checks = if filter_params[:s]
|
||||
pagy(Check.search(filter_params[:s]).order(:conformity_level))
|
||||
else
|
||||
pagy(Check.all.order(:conformity_level))
|
||||
end
|
||||
end
|
||||
|
||||
# GET /checks/1 or /checks/1.json
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /checks/new
|
||||
def new
|
||||
|
|
@ -16,8 +21,7 @@ class ChecksController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /checks/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /checks or /checks.json
|
||||
def create
|
||||
|
|
@ -27,11 +31,11 @@ class ChecksController < ApplicationController
|
|||
if @check.save
|
||||
format.html do
|
||||
redirect_to check_url(@check),
|
||||
notice: t('scaffold.model_created_successfully', model: @check.model_name.human)
|
||||
notice: t("scaffold.model_created_successfully", model: @check.model_name.human)
|
||||
end
|
||||
format.json { render :show, status: :created, location: @check }
|
||||
else
|
||||
flash[:alert] = t('there_were_errors', count: @check.errors.size)
|
||||
flash[:alert] = t("there_were_errors", count: @check.errors.size)
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @check.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
|
@ -44,7 +48,7 @@ class ChecksController < ApplicationController
|
|||
if @check.update(check_params)
|
||||
format.html do
|
||||
redirect_to check_url(@check),
|
||||
notice: t('scaffold.model_updated_successfully', model: @check.model_name.human)
|
||||
notice: t("scaffold.model_updated_successfully", model: @check.model_name.human)
|
||||
end
|
||||
format.json { render :show, status: :ok, location: @check }
|
||||
else
|
||||
|
|
@ -60,7 +64,7 @@ class ChecksController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to checks_url, notice: t('scaffold.model_destroyed_successfully', model: @check.model_name.human)
|
||||
redirect_to checks_url, notice: t("scaffold.model_destroyed_successfully", model: @check.model_name.human)
|
||||
end
|
||||
format.json { head :no_content }
|
||||
end
|
||||
|
|
@ -79,6 +83,43 @@ class ChecksController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def check_params
|
||||
params.require(:check).permit(:position, :name, :success_criterion, :success_criterion_html, :level)
|
||||
params.require(:check).permit(:principle_id,
|
||||
:number,
|
||||
:name_de,
|
||||
:name_en,
|
||||
:standard_id,
|
||||
:visual,
|
||||
:auditory,
|
||||
:physical,
|
||||
:cognitive,
|
||||
:applicable_to_app,
|
||||
:applicable_to_web,
|
||||
:external_number,
|
||||
:conformity_level,
|
||||
:conformity_notice_de,
|
||||
:conformity_notice_en,
|
||||
:priority,
|
||||
:quick_criterion_de,
|
||||
:quick_criterion_en,
|
||||
:quick_fail_de,
|
||||
:quick_fail_en,
|
||||
:quick_fix_de,
|
||||
:quick_fix_en,
|
||||
:criterion_de,
|
||||
:criterion_en,
|
||||
:criterion_details_de,
|
||||
:criterion_details_en,
|
||||
:example_de,
|
||||
:example_en,
|
||||
:exemption_details_de,
|
||||
:exemption_details_en,
|
||||
:standard_text_de,
|
||||
:standard_text_en,
|
||||
:test_instructions,
|
||||
:powerpoint_text_de,
|
||||
:powerpoint_text_en,
|
||||
:comment,
|
||||
link_ids: [],
|
||||
standard_ids: [])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue