extinctionrebellion/RebelsManager

View on GitHub
app/views/calls/index.html.slim

Summary

Maintainability
Test Coverage
- content_for :page_header do
  = render 'layouts/components/page_header',
           title: 'Calls'

table
  thead
    tr
      th Phone number
      th Language
      th Local group
      th Status
      th Notes
      th  
  tbody
    - @rebels.each do |rebel|
      - if rebel.phone.present?
        javascript:
          $(document).on("turbolinks:load", function() {
            $("#edit_rebel_#{rebel.id}").on("ajax:success", function (event) {
              $('#rebel-#{rebel.id}-save-button').removeClass('hollow');
            });
          });
        = simple_form_for rebel, url: rebel_path(rebel), remote: true do |f|
          tr.form-line.inline
            td
              = f.input :phone,
                        label: "",
                        input_html: { id: "rebel_#{f.object.id}_phone", autocomplete: "off" }
            td
              = f.input :language,
                        label: "",
                        collection: [["FR", "fr"], ["NL", "nl"], ["EN", "en"]],
                        input_html: { id: "rebel_#{f.object.id}_language", autocomplete: "off" }
            td
              = f.input :local_group_id,
                        as: :select,
                        label: "",
                        collection: LocalGroup.all.order(:name),
                        include_blank: "None",
                        input_html: { id: "rebel_#{f.object.id}_local_group_id", autocomplete: "off" }
            td
              = f.input :phone_campaign_status,
                        as: :select,
                        label: "",
                        collection: [["Pending", "pending"], ["Not responding", "not_responding"], ["Called", "called"], ["Don't call again", "do-not-call-again"]],
                        input_html: { id: "rebel_#{f.object.id}_phone_campaign_status", autocomplete: "off" }
            td
              = f.input :phone_campaign_notes,
                        as: :text,
                        label: "",
                        input_html: { id: "rebel_#{f.object.id}_phone_campaign_notes", rows: 1, autocomplete: "off" }
            td.text-right
              = f.button :submit,
                         'Save',
                         id: "rebel-#{rebel.id}-save-button",
                         class: 'small hollow button no-margin-bottom',
                         data: { "disable-with": "..." }