unclesp1d3r/CipherSwarm

View on GitHub
app/views/campaigns/new.html.erb

Summary

Maintainability
Test Coverage
<%= render Railsboot::HeaderComponent.new do |header| %>
  <% header.with_heading do %>
    <%= title "New Campaign" %>
  <% end %>
  <% header.with_breadcrumb.with_items([
       { text: "Dashboard", href: root_path },
       { text: "Activity", href: campaigns_path },
       { text: "New Campaign", active: true }
     ]) %>
<% end %>

<% if @hash_lists.empty? %>

  <%= render Railsboot::BlankSlateComponent.new do |blankslate| %>
    <% blankslate.with_icon do %>
      <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-sticky" viewBox="0 0 16 16">
        <path d="M2.5 1A1.5 1.5 0 0 0 1 2.5v11A1.5 1.5 0 0 0 2.5 15h6.086a1.5 1.5 0 0 0 1.06-.44l4.915-4.914A1.5 1.5 0 0 0 15 8.586V2.5A1.5 1.5 0 0 0 13.5 1zM2 2.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V8H9.5A1.5 1.5 0 0 0 8 9.5V14H2.5a.5.5 0 0 1-.5-.5zm7 11.293V9.5a.5.5 0 0 1 .5-.5h4.293z"/>
      </svg>
    <% end %>
    <% blankslate.with_heading(tag: "h3").with_content("You do not have any hash lists yet.") %>
    <% blankslate.with_description.with_content("Add a hash list before creating a campaign.") %>
    <% blankslate.with_primary_action do %>
      <%= render Railsboot::Button::LinkComponent.new(href: new_hash_list_path, text: "Add Hash List") %>
    <% end %>
  <% end %>

<% else %>
  <%= render "form", campaign: @campaign, hash_lists: @hash_lists %>
<% end %>