Sha256: 306876025ab74f247c892ea78eea0017ec27dae555e05d5c2c39eebc4667bcf2

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

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

  %p
    #{cpd_targets_label} set the requirements checked when submitting a #{cpd_statement_label}

  %table.table
    %thead
      %th= cpd_cycle_label
      %th Default Requirements
      %th Requirements for #{f.object}

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

        - default_target = f.object.default_cpd_target_score(cpd_cycle: cpd_cycle) || 0
        - default_required_to_submit = f.object.default_cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle)

        %tr
          %td= link_to(cpd_cycle, effective_cpd.edit_admin_cpd_cycle_path(cpd_cycle), target: '_blank')
          %td
            %p
              = pluralize(default_target, cpd_credit_label.downcase)
              = default_required_to_submit ? 'required' : 'targeted'
              and
              = collection.find { |value| value.last == default_required_to_submit }.first.downcase

          %td
            .row
              .col
                = ctf.number_field :score, required: false, label: false
              .col
                = ctf.select :required_to_submit, Effective::CpdTarget::REQUIRED_TO_SUBMIT, required: false, label: false

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
effective_cpd-1.6.4 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.6.3 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.6.2 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.6.1 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.6.0 app/views/admin/users/_form_cpd_targets.html.haml
effective_cpd-1.5.1 app/views/admin/users/_form_cpd_targets.html.haml