Some UX improvements
This commit is contained in:
parent
48c0067076
commit
8c81237501
81 changed files with 791 additions and 151 deletions
|
|
@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
|
|||
{ label: 'Dashboard', icon: :speedometer2, path: :root },
|
||||
{ label: Report.model_name.human(count: 2), icon: :'journal-text', path: :reports },
|
||||
{ label: Checklist.model_name.human(count: 2), icon: :'list-check', path: :checklists },
|
||||
{ label: Check.model_name.human(count: 2), icon: :check, path: :checks }
|
||||
{ label: Check.model_name.human(count: 2), icon: :check2, path: :checks }
|
||||
]
|
||||
@search_url = nil # root_url
|
||||
end
|
||||
|
|
|
|||
59
app/controllers/checklist_entries_controller.rb
Normal file
59
app/controllers/checklist_entries_controller.rb
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
class ChecklistEntriesController < ApplicationController
|
||||
before_action :set_checklist_entry, only: %i[show edit update destroy]
|
||||
|
||||
# GET /checklist_entries
|
||||
def index
|
||||
@checklist_entries = ChecklistEntry.all
|
||||
end
|
||||
|
||||
# GET /checklist_entries/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /checklist_entries/new
|
||||
def new
|
||||
@checklist_entry = ChecklistEntry.new(checklist_id: params[:checklist_id])
|
||||
end
|
||||
|
||||
# GET /checklist_entries/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /checklist_entries
|
||||
def create
|
||||
@checklist_entry = ChecklistEntry.new(checklist_entry_params)
|
||||
|
||||
if @checklist_entry.save
|
||||
redirect_to @checklist_entry, notice: 'Checklist entry was successfully created.'
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /checklist_entries/1
|
||||
def update
|
||||
if @checklist_entry.update(checklist_entry_params)
|
||||
redirect_to @checklist_entry, notice: 'Checklist entry was successfully updated.', status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /checklist_entries/1
|
||||
def destroy
|
||||
@checklist_entry.destroy!
|
||||
redirect_to checklist_entries_url, notice: 'Checklist entry was successfully destroyed.', status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_checklist_entry
|
||||
@checklist_entry = ChecklistEntry.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def checklist_entry_params
|
||||
params.require(:checklist_entry).permit(:checklist_id, :check_id, :position)
|
||||
end
|
||||
end
|
||||
|
|
@ -17,7 +17,6 @@ class ChecklistsController < ApplicationController
|
|||
|
||||
# GET /checklists/1/edit
|
||||
def edit
|
||||
@checklist.checklist_entries.build
|
||||
end
|
||||
|
||||
# POST /checklists
|
||||
|
|
@ -55,7 +54,7 @@ class ChecklistsController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def checklist_params
|
||||
params.require(:checklist).permit(:code, :name, :description,
|
||||
params.require(:checklist).permit(:code, :name, :description, :description_html,
|
||||
checklist_entries_attributes: %i[id check_id position _destroy])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -75,6 +75,6 @@ class ChecksController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def check_params
|
||||
params.require(:check).permit(:position, :name, :success_criterion, :level)
|
||||
params.require(:check).permit(:position, :name, :success_criterion, :success_criterion_html, :level)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ElementsController < ApplicationController
|
|||
|
||||
# GET /elements/new
|
||||
def new
|
||||
@element = Element.new
|
||||
@element = Element.new(report_id: params[:report_id])
|
||||
end
|
||||
|
||||
# GET /elements/1/edit
|
||||
|
|
@ -23,13 +23,15 @@ class ElementsController < ApplicationController
|
|||
def create
|
||||
checklist_id = element_params.delete(:checklist_id)
|
||||
checklist = Checklist.find(checklist_id)
|
||||
@element = Element.new(element_params.merge(title: checklist.name))
|
||||
@element = Element.new(element_params)
|
||||
@element.title = checklist.name if @element.title.blank?
|
||||
|
||||
if @element.save
|
||||
checklist.checks.each do |check|
|
||||
@element.success_criteria.create!(title: check.name, description: check.success_criterion, level: check.level)
|
||||
@element.success_criteria.create!(title: check.name, description_html: check.success_criterion_html,
|
||||
level: check.level)
|
||||
end
|
||||
redirect_to [:work, @element.report], notice: 'Element was successfully created.'
|
||||
redirect_to @element.report, notice: 'Element was successfully created.'
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -59,6 +61,6 @@ class ElementsController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def element_params
|
||||
params.require(:element).permit(:report_id, :path, :title, :description, :checklist_id)
|
||||
params.require(:element).permit(:report_id, :path, :title, :description_html, :checklist_id)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -58,6 +58,6 @@ class ReportsController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def report_params
|
||||
params.require(:report).permit(:name, :comment)
|
||||
params.require(:report).permit(:name, :comment_html)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class SuccessCriteriaController < ApplicationController
|
||||
before_action :set_success_criterion, only: %i[ show edit update destroy ]
|
||||
before_action :set_success_criterion, only: %i[show edit update destroy]
|
||||
|
||||
# GET /success_criteria
|
||||
def index
|
||||
|
|
@ -24,7 +24,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
@success_criterion = SuccessCriterion.new(success_criterion_params)
|
||||
|
||||
if @success_criterion.save
|
||||
redirect_to @success_criterion, notice: "Success criterion was successfully created."
|
||||
redirect_to @success_criterion, notice: 'Success criterion was successfully created.'
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
# PATCH/PUT /success_criteria/1
|
||||
def update
|
||||
if @success_criterion.update(success_criterion_params)
|
||||
redirect_to @success_criterion, notice: "Success criterion was successfully updated.", status: :see_other
|
||||
redirect_to @success_criterion, notice: 'Success criterion was successfully updated.', status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -42,17 +42,18 @@ class SuccessCriteriaController < ApplicationController
|
|||
# DELETE /success_criteria/1
|
||||
def destroy
|
||||
@success_criterion.destroy!
|
||||
redirect_to success_criteria_url, notice: "Success criterion was successfully destroyed.", status: :see_other
|
||||
redirect_to success_criteria_url, notice: 'Success criterion was successfully destroyed.', status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_success_criterion
|
||||
@success_criterion = SuccessCriterion.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def success_criterion_params
|
||||
params.require(:success_criterion).permit(:element_id, :title, :description, :level, :result, :comment)
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_success_criterion
|
||||
@success_criterion = SuccessCriterion.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def success_criterion_params
|
||||
params.require(:success_criterion).permit(:element_id, :title, :description_html, :level, :result, :comment_html)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue