extinctionrebellion/RebelsManager

View on GitHub
app/views/public/rebels/edit.html.slim

Summary

Maintainability
Test Coverage
- content_for :page_title, _("My Rebel Profile")

- content_for :header do
  h1 = _("My Rebel Profile")

= simple_form_for @rebel,
                  url: public_rebel_path(@rebel, a: @rebel.created_at.to_i, b: @rebel.email, c: @rebel.token),
                  html: { data: { controller: "registration-form" } } do |f|
  = render "layouts/public/components/form_errors", object: f.object

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

  .grid-x
    .cell.small-8.medium-7.large-6
      = f.input :local_group_id,
                as: :select,
                label: "#{_("Local group")} *",
                collection: LocalGroup.all.order(:name),
                prompt: _("Select a local group"),
                hint: _("No local group (yet) next to you? Please select the one that makes the more sense to you."),
                required: true

  = f.input :email,
            as: :email,
            label: "#{_("Email address")} *",
            placeholder: _("Email address"),
            required: true

  .grid-x
    .cell.small-8.medium-7.large-6
      = f.input :language,
                label: "#{_("Preferred language")} *",
                collection: [["English", "en"], ["Français", "fr"], ["Nederlands", "nl"]],
                required: true,
                prompt: _("Please select a language")

  div(data-target="registration-form.activeRebelFields" class="#{f.object.active? ? nil : "hide"}")
    .card
      .card-section
        = f.input :phone,
                  label: _("Mobile phone"),
                  placeholder: _("Mobile phone"),
                  required: false,
                  hint: _("We may send text messages about public actions.")

        = f.input :dont_call,
                  as: :boolean,
                  wrapper: :foundation_checkbox,
                  label: _("Please don't call me on my mobile phone"),
                  hint: _("We may call once a year to ask your opinion about upcoming actions"),
                  required: false

        .grid-x
          .cell.small-6.medium-4.large-3
            = f.input :postcode,
                      label: _("Postcode"),
                      placeholder: _("Postcode"),
                      required: false

        = f.input :willingness_to_be_arrested,
                  as: :boolean,
                  wrapper: :foundation_checkbox,
                  label: _("Yes, I am willing to be arrested during an action"),
                  hint: _("Of course, your opinion can change over time, depending on the action"),
                  required: false

        = f.input :skill_ids,
                  as: :check_boxes,
                  wrapper: :foundation_radio_buttons,
                  collection: Skill.all.order(:name).collect { |skill| ["#{skill.name}<br><small>#{skill.description}</small>", skill.id] },
                  label: _("In which areas would you like to participate?"),
                  hint: _("We recommend that you select a maximum of 2 answers.")

        = f.input :notes,
                  as: :text,
                  input_html: { rows: 5 },
                  label: _("What specific skills/experience/resources do you have? Do you have any thoughts/questions you would like to share?"),
                  hint: _("Feel free to let us know about anything that can help Extinction Rebellion."),
                  required: false

        = f.input :availability,
                  label: _("My availability for Extinction Rebellion"),
                  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'] \
                  ]

        =  f.input :agree_with_principles,
                   as: :boolean,
                   label: raw(_("I've read and I agree with the principles and values of Extinction Rebellion") + "<br>" + link_to(_("Open principles and values in a new tab"), ENV['XR_BRANCH_AGREEMENT_URL'], target: "_blank").html_safe),
                   wrapper: :foundation_checkbox,
                   required: true

  = f.button :submit,
             _("Update my Rebel Profile"),
             class: "expanded large"