extinctionrebellion/RebelsManager

View on GitHub
app/views/rebels/_form.html.slim

Summary

Maintainability
Test Coverage
= section_heading heading: "Profile",
                  spacing: false

- if !f.object.new_record?
  p
    | These details can be updated by the rebel. Provide this private link:
    br
    = link_to f.object.profile_url, f.object.profile_url

.grid-x
  .cell.small-12
    .card
      .card-section
        = f.input :email,
                  as: :email,
                  label: "Email address *",
                  placeholder: "Email address",
                  required: true

        - if !current_user.local_group
          = f.input :local_group_id,
                    as: :select,
                    label: "Local Group *",
                    collection: LocalGroup.active.order(:name),
                    prompt: "Select a local group",
                    required: false

        = f.input :language,
                  label: "Preferred language *",
                  collection: [["Français", "fr"], ["Nederlands", "nl"], ["English", "en"]],
                  required: true

    = f.input :name,
              label: "Name or nickname",
              placeholder: "Name or nickname",
              required: false

    = f.input :phone,
              label: "Mobile phone",
              placeholder: "Mobile phone",
              required: false,
              hint: "We may send text messages about public actions"

    - if f.object.dont_call?
      .warning.callout
        span.label.label--warm-yellow DON'T CALL ME
        span  This rebel doesn't want to be called.

    = f.input :postcode,
              label: "Postcode",
              placeholder: "Postcode",
              hint: "A postcode is better than a city name",
              required: false

    = f.input :willingness_to_be_arrested,
              as: :boolean,
              wrapper: :foundation_checkbox,
              label: "Willingness to be arrested during an action",
              required: false

    .grid-x
      .cell.small-6.medium-4.large-3
        = f.input :number_of_arrests,
                  label: "Number of arrests",
                  as: :integer,
                  required: false

    = f.input :skill_ids,
              as: :check_boxes,
              label: "Areas of interest",
              wrapper: :foundation_radio_buttons,
              collection: Skill.all.order(:name)

    = f.input :notes,
              as: :text,
              input_html: { rows: 5 },
              label: "Specific skills/experience/resources OR thoughts/questions",
              required: false

    - if current_user.local_group&.working_groups&.any?
      = section_heading heading: "Working Groups",
                        spacing: :spacer

      = f.input :working_group_ids,
                as: :check_boxes,
                wrapper: :foundation_radio_buttons,
                collection: current_user.local_group.working_groups,
                label: ""

    = section_heading heading: "Management",
                    spacing: :spacer

    p These information are not shared with the rebel.

    = f.input :irl,
      as: :boolean,
      label: "This rebel has attended an XR event",
      hint: "We have met this rebel in real life",
      wrapper: :foundation_checkbox

    = f.input :regular_volunteer,
      as: :boolean,
      label: "This rebel is a regular volunteer",
      hint: "XR International Support Team wants to know how many regular volunteers are involved for each national group",
      wrapper: :foundation_checkbox

    = f.input :tag_list,
              as: :text,
              label: "Tags",
              hint: "Separate tags with a comma (,)",
              input_html: { rows: 2 }

    = f.input :internal_notes,
              as: :text,
              input_html: { rows: 3 },
              label: "Notes about this rebel",
              required: false

    = f.input :interests,
              as: :text,
              input_html: { rows: 5 },
              label: "Working Group interests",
              hint: "Legacy data",
              required: false

    = f.input :status,
              label: "Activity status",
              as: :radio_buttons,
              wrapper: :foundation_radio_buttons,
              collection: [ \
                ["💥  Active rebel", "active"],
                ["⏸  Paused rebel", "paused"],
                ["🛑  Inactive rebel", "inactive"] \
              ]

    = f.input :availability,
              label: "Availability",
              as: :radio_buttons,
              wrapper: :foundation_radio_buttons,
              collection: [ \
                ["A few hours a month", 'few_hours_a_month'],
                ["A couple of hours a week", 'few_hours_a_week'],
                ["More than 10 hours a week", '10_hours_a_week'] \
              ]

    .spacer-2