Sha256: 12e66890d1d18128371db70808b3137d49ad583d8c15729f009047d258c04c78

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

= effective_form_with model: [:admin, user] do |f|
  = f.hidden_field :id

  %p The default values are displayed as placeholders.

  %table.table
    %thead
      %th= cpd_cycle_label
      %th Target or Required #{cpd_credits_label}

    %tbody
      = f.fields_for :cpd_targets, f.object.build_cpd_targets do |ctf|
        = ctf.hidden_field :id
        = ctf.hidden_field :cpd_cycle_id
        = ctf.hidden_field :user_type
        = ctf.hidden_field :user_id

        - collection = Effective::CpdTarget::REQUIRED_TO_SUBMIT
        - cpd_cycle = ctf.object.cpd_cycle
        - target = f.object.cpd_target_score(cpd_cycle: cpd_cycle)
        - target_placeholder = f.object.default_cpd_target_score(cpd_cycle: cpd_cycle)
        - required_to_submit = f.object.cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle)
        - required_to_submit_placeholder = collection.find { |label, value| value == required_to_submit }.first

        %tr
          %td= link_to(cpd_cycle, effective_cpd.edit_admin_cpd_cycle_path(cpd_cycle), target: '_blank')
          %td
            .row
              .col
                = ctf.number_field :score, label: false, required: false, placeholder: target_placeholder.to_s
              .col
                = ctf.select :required_to_submit, Effective::CpdTarget::REQUIRED_TO_SUBMIT, label: false, required: false, placeholder: required_to_submit_placeholder.to_s

  = f.save "Save #{cpd_targets_label}", 'data-confirm': "Really Save #{cpd_targets_label} for #{user}?"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_cpd-1.4.5 app/views/admin/users/_form_cpd_targets.html.haml