Sha256: 570dd81efc896acb037a82f29028e916903b0bec0f5155deee849881dbde1d4a

Contents?: true

Size: 973 Bytes

Versions: 5

Compression:

Stored size: 973 Bytes

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, as: :date, label: 'Submitted'

    col :score, label: cpd_credits_label do |cpd_statement|
      cpd_score(cpd_statement.score, cpd_statement.target_score)
    end

    col :carry_forward do |cpd_statement|
      cpd_score(cpd_statement.carry_forward)
    end

    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
    EffectiveCpd.CpdStatement.completed.where(user: attributes[:user] || current_user).includes(:cpd_cycle)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
effective_cpd-1.7.2 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.7.1 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.7.0 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.6.5 app/datatables/effective_cpd_completed_statements_datatable.rb
effective_cpd-1.6.4 app/datatables/effective_cpd_completed_statements_datatable.rb