Sha256: 1b9e6160ab40e96688a132397f604807ebd12ba8cd7f777ecbbc8b95f523579b

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

# Displays past cpd statements that were completed by the user

class EffectiveCpdCompletedStatementsDatatable < Effective::Datatable
  datatable do
    order :cpd_cycle_id

    col(:cpd_cycle_id, label: 'Statement') do |statement|
      statement.cpd_cycle.to_s
    end

    col :submitted_at, as: :date, label: 'Submitted'
    col :score, label: cpd_credits_label.capitalize

    col :required_score, label: 'Required' do |cpd_statement|
      cpd_score(cpd_statement.required_score || cpd_statement.targeted_score)
    end

    col :carry_forward

    unless attributes[:actions] == false
      actions_col(actions: []) do |cpd_statement|
        dropdown_link_to('Show', effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_statement.cpd_cycle, cpd_statement, cpd_statement.last_completed_step))
      end
    end
  end

  collection do
    raise('expected a current_user') unless current_user.present?
    user = (current_user.class.find(attributes[:user_id]) if attributes[:user_id])
    Effective::CpdStatement.completed.where(user: user || current_user).includes(:cpd_cycle)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
effective_cpd-0.5.4 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-0.5.3 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-0.5.2 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-0.5.1 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-0.5.0 app/datatables/effective_cpd_completed_statements_datatable.rb