Sha256: 95acc9e0774469bad0e1024a656efcbddef8eb56623bbedc4b8e66937a122b4d

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 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)
        - 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.to_s
              .col
                = ctf.select :required_to_submit, Effective::CpdTarget::REQUIRED_TO_SUBMIT, label: 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

5 entries across 5 versions & 1 rubygems

Version Path
effective_cpd-1.4.4 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.4.3 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.4.2 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.4.1 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.4.0 app/views/admin/users/_form_cpd_targets.html.haml