1
0

Preliminary Measurement edit/update

This commit is contained in:
cryptogopher
2019-12-01 20:02:45 +01:00
parent 54040a2764
commit 7cb3ac4134
5 changed files with 55 additions and 16 deletions

View File

@@ -2,7 +2,7 @@ class MeasurementsController < ApplicationController
menu_item :body_trackers
before_action :find_project_by_project_id, only: [:index, :create]
before_action :find_measurement, only: [:destroy, :retake]
before_action :find_measurement, only: [:edit, :update, :destroy, :retake]
before_action :authorize
def index
@@ -25,6 +25,19 @@ class MeasurementsController < ApplicationController
end
end
def edit
prepare_measurements
render :index
end
def update
if @measurement.update(measurement_params)
flash[:notice] = 'Updated measurement'
end
prepare_measurements
render :index
end
def destroy
# FIXME: don't destroy if there are any readout values
if @measurement.destroy