Some UX improvements
This commit is contained in:
parent
48c0067076
commit
8c81237501
81 changed files with 791 additions and 151 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue