gitcoinco/code_fund_ads

View on GitHub
app/views/organizations/_form.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for organization, wrapper: :front_form do |f| %>
  <%= render(Form::ErrorMessageComponent.new(object: organization)) %>
  <%= render CardComponent.new do %>
    <%= render Card::HeaderComponent.new do %>
      <%= render(Card::TitleComponent.new) { "Team Details" } %>
      <%= render(Card::SubtitleComponent.new) { "Tell us about your team" } %>
    <% end %>
    <%= render Card::BodyComponent.new do %>
      <div class="row">
        <%= tag.div f.input(:name, as: :string, required: true, input_html: {class: "form-control"}), class: "col-md-6 mb-3" %>
        <%= tag.div f.input(:account_manager_user_id,
                            label: "Account Manager <span class='badge badge-secondary'><em>Optional</em></span>".html_safe,
                            collection: account_managers_for_select,
                            input_html: {
                              class: "form-control", data: {controller: "select"}
                            }), class: "col-md-6 mb-3" %>
      </div>
      <div class="row d-flex justify-content-between align-items-center">
        <%= tag.div f.input(:url,
                            as: :url,
                            placeholder: "https://",
                            label: "URL <span class='badge badge-secondary'><em>Optional</em></span>".html_safe,
                            input_html: {
                              class: "form-control", data: {msg: "Please enter a valid website URL", rule_url: true}
                            }), class: "col-md-6 mb-3" %>
        <div class="col-md-6">
          <div class="media d-flex justify-content-between align-items-center mb-3 mt-4 w-full">
            <%= f.label :creative_approval_needed, class: "switcher-control mb-0 mr-3" do %>
              <%= f.check_box :creative_approval_needed, class: "switcher-input" %>
              <span class="switcher-indicator"></span>
            <% end %>
            <label class="media-body text-muted mb-0">
              <span class="d-block text-dark">Approval needed for creatives?</span>
            </label>
          </div>
        </div>
      </div>
    <% end %>
    <%= render Card::FooterComponent.new do |component| %>
      <% component.with(:actions) do %>
        <%= cancel_button(organizations_path) %>
        <%= f.submit "Save Team", class: "btn btn-primary" %>
      <% end %>
    <% end %>
  <% end %>
<% end %>