class ApprovalsController < ApplicationController
  include MedicalReleaseContext

  before_action :set_medical_release
  before_action :set_project

  layout "project"

  def create
    @medical_release.approve_by(current_user)
    if @medical_release.save
      redirect_to [@project, :medical_releases], notice: t('.release_approved')
    end
  end

  private

  def set_project
    @project = @medical_release.project
  end
end
