Sha256: 08c2e2b40190208ae86119d51dd992ee991f52b68f6625dc9e9b1b24b6e5543b

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 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: cpd_statement_label) do |statement|
      statement.cpd_cycle.to_s
    end

    col :submitted_at
    col :score, label: cpd_credits_label

    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])

    EffectiveCpd.CpdStatement.completed.where(user: user || current_user).includes(:cpd_cycle)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
effective_cpd-1.3.7 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.6 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.5 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.4 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.3 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.2 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.1 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.3.0 app/datatables/effective_cpd_completed_statements_datatable.rb