gitcoinco/code_fund_ads

View on GitHub
app/views/devise/invitations/new.html.erb

Summary

Maintainability
Test Coverage
<%= render(PageComponent.new(subject: @user)) do |component| %>
  <%= component.with(:header) { render(Page::HeaderComponent.new(title: "Invite User", subtitle: "Fill out the form below")) } %>
  <% component.with(:body) do %>
    <%= simple_form_for resource, as: resource_name, url: invitation_path(resource_name), html: {method: :post}, wrapper: :front_form do |f| %>
      <%= render(Form::ErrorMessageComponent.new(object: resource)) %>
      <%= render CardComponent.new do %>
        <%= render Card::BodyComponent.new do %>
        <%= render(Card::TitleComponent.new(classes: "mb-4")) { "User Details" } %>
          <div class="row">
            <%= tag.div f.input(:first_name, required: true, input_html: {class: "form-control"}), class: "col-md-6 mb-3" %>
            <%= tag.div f.input(:last_name, required: true, input_html: {class: "form-control"}), class: "col-md-6 mb-3" %>
            <%= tag.div f.input(:email, required: true, input_html: {class: "form-control"}), class: "col-md-6 mb-3" %>
            <%= tag.div f.input(:organization_id, label: "Team", collection: organizations_for_select, include_blank: "None",
                                input_html: {class: "form-control", data: {controller: "select"}}), class: "col-md-6 mb-3" %>
            <%= tag.div f.input(:roles, collection: ENUMS::USER_ROLES.values.map { |role| [role.capitalize, role] },
                                required: true, input_html: {multiple: true, data: {controller: "select"}}), class: "col-12" %>
          </div>
        <% end %>
        <%= render Card::FooterComponent.new do |component| %>
          <% component.with(:actions) do %>
            <%= f.button :submit, t("devise.invitations.new.submit_button"), class: "btn btn-primary" %>
          <% end %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>