Sha256: 57a99c4137825f6ad18446bdad5a66971f52be2180693a2bba97f88198a135fa

Contents?: true

Size: 896 Bytes

Versions: 31

Compression:

Stored size: 896 Bytes

Contents

module Effective
  class CpdStatementActivitiesController < ApplicationController
    before_action(:authenticate_user!) if defined?(Devise)

    include Effective::CrudController

    resource_scope -> { CpdStatement.find(params[:cpd_statement_id]).cpd_statement_activities }

    # Score all statements when we change any activity
    after_save do
      CpdScorer.new(user: resource.cpd_statement.user, from: resource.cpd_statement).score!
    end

    # Redirect the remote form back to the activities page
    on :save, redirect: -> {
      statement = resource.cpd_statement
      effective_cpd.cpd_cycle_cpd_statement_build_path(statement.cpd_cycle, statement, :activities)
    }

    def permitted_params
      params.require(:effective_cpd_statement_activity).permit(
        :id, :cpd_category_id, :cpd_activity_id, :amount, :amount2, :description, files: []
      )
    end

  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
effective_cpd-0.4.3 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.4.2 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.4.1 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.4.0 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.3.3 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.3.2 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.3.1 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.3.0 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.2.1 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.2.0 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.19 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.18 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.17 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.16 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.15 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.14 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.13 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.12 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.11 app/controllers/effective/cpd_statement_activities_controller.rb
effective_cpd-0.1.10 app/controllers/effective/cpd_statement_activities_controller.rb