Basic feature implemented, very basic poc
This commit is contained in:
parent
216089a3e7
commit
48c0067076
118 changed files with 2113 additions and 20 deletions
63
app/controllers/reports_controller.rb
Normal file
63
app/controllers/reports_controller.rb
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
class ReportsController < ApplicationController
|
||||
before_action :set_report, only: %i[show edit update destroy work]
|
||||
|
||||
# GET /reports
|
||||
def index
|
||||
@reports = Report.all
|
||||
end
|
||||
|
||||
# GET /reports/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /reports/new
|
||||
def new
|
||||
@report = Report.new
|
||||
end
|
||||
|
||||
# GET /reports/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /reports
|
||||
def create
|
||||
@report = Report.new(report_params)
|
||||
|
||||
if @report.save
|
||||
redirect_to @report, notice: 'Report was successfully created.'
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /reports/1
|
||||
def update
|
||||
if @report.update(report_params)
|
||||
redirect_to @report, notice: 'Report was successfully updated.', status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /reports/1
|
||||
def destroy
|
||||
@report.destroy!
|
||||
redirect_to reports_url, notice: 'Report was successfully destroyed.', status: :see_other
|
||||
end
|
||||
|
||||
def work
|
||||
@report
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_report
|
||||
@report = Report.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def report_params
|
||||
params.require(:report).permit(:name, :comment)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue