intercity/intercity-next

View on GitHub
app/views/servers/_new.html.erb

Summary

Maintainability
Test Coverage
<%= form_for @server, remote: true do |f| %>
  <div class="modal-background"></div>
  <div class="modal-card">
    <header class="modal-card-head">
      <p class="modal-card-title">Add a new server</p>
      <a class="delete" data-behaviour="close-modal"></a>
    </header>
    <section class="modal-card-body">
      <%= f.label :name, class: "label" %>
      <div class="control">
        <%= f.text_field :name, class: "input", placeholder: "Name",
          data: { error: @server.errors[:name].first } %>
      </div>

      <%= f.label :username, class: "label", value: "Username for the root user" %>
      <div class="control">
        <%= f.text_field :username, class: "input", placeholder: "Username",
          data: { error: @server.errors[:username].first } %>
      </div>

      <%= f.label :ip, class: "label", value: "IP Address" %>
      <div class="control">
        <%= f.text_field :ip, class: "input", placeholder: "IP Address",
          data: { error: @server.errors[:ip].first } %>
      </div>
    </section>
    <footer class="modal-card-foot">
      <%= f.submit "Add server", class: "button is-primary" %>
      <%= button_tag "Cancel", type: :reset, class: "button", data: { behaviour: "close-modal" } %>
    </footer>
  </div>
<% end %>