ikuseiGmbH/smart-village-app-cms

View on GitHub
app/views/dashboard/index.html.erb

Summary

Maintainability
Test Coverage
<!-- Page Heading -->
<div class="text-center">
  <h1 class="h3 mb-0 font-weight-bold">Dashboard</h1>
</div>

<!-- Content Row -->
<div class="row px-4 px-lg-0 justify-content-center">
  <% if visible_in_role?("role_news_item") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-newspaper"></i> Nachrichten
        </h4>
        <h5>
          <%= @news_items.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/news_items", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_news_item_path, class: "btn btn-sm btn-secondary shadow-sm" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_event_record") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-calendar-alt"></i> Veranstaltungen
        </h4>
        <h5>
          <%= @events.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/events", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_event_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_point_of_interest") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-map-pin"></i> Orte
        </h4>
        <h5>
          <%= @points_of_interest.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/point_of_interests", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_point_of_interest_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_tour") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-walking"></i> Touren
        </h4>
        <h5>
          <%= @tours.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/tours", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_tour_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_job") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-briefcase"></i> Stellenanzeigen
        </h4>
        <h5>
          <%= @jobs.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/jobs", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_job_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_offer") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-building"></i> Werbliche Anzeigen
        </h4>
        <h5>
          <%= @offers.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/offers", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_offer_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_construction_site") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-tools"></i> Baustellen
        </h4>
        <h5>
          <%= @constructions.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/constructions", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_construction_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_waste_calendar") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-trash-alt"></i> Abfallkalender
        </h4>
      </div>

      <div class="button-banner">
        <%= link_to "/waste_calendar", class: "btn btn-sm btn-primary shadow-sm" do %>
          Für <%= @waste_locations.count %> Straßen anzeigen
        <% end %>

        <%= link_to new_waste_calendar_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neue Daten importieren
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_survey") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-chart-bar"></i> Umfragen
        </h4>
        <h5>
          <%= @surveys.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/surveys", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_survey_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_push_notification") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-bullhorn"></i> Push-Notifications
        </h4>
        <h5>
        </h5>
      </div>

      <div class="button-banner">
        <span></span>

        <%= link_to new_push_notification_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Push-Notification erstellen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_encounter_support") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-handshake"></i> Begegnungen
        </h4>
        <h5>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/encounters_supports", class: "btn btn-sm btn-primary shadow-sm" do %>
          Nutzer und Begegnungen einsehen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_static_contents") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-file-alt"></i> Statische Inhalte
        </h4>
        <h5>
          <%= @static_contents.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/static_contents", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_static_content_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_deadlines") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-file-signature"></i> Fristen- und Aktionsmelder
        </h4>
        <h5>
          <%= @deadlines.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/deadlines", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>

        <%= link_to new_deadline_path, class: "btn btn-sm btn-secondary shadow-sm ml-3" do %>
          Neu anlegen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_noticeboard") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-clipboard-list"></i> Schwarzes Brett
        </h4>
        <h5>
          <%= @noticeboards.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/noticeboards", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>
      </div>
    </div>
  <% end %>

  <% if visible_in_role?("role_defect_report") %>
    <div
      class="d-flex flex-column col-12 col-lg-5 justify-content-between jumbotron p-0 bg-white shadow mr-lg-4"
    >
      <div class="d-flex justify-content-between align-items-center py-5 px-4">
        <h4>
          <i class="fas fa-fw fa-exclamation-triangle"></i> Mängelmelder
        </h4>
        <h5>
          <%= @defect_reports.count %>
        </h5>
      </div>

      <div class="button-banner">
        <%= link_to "/defect_reports", class: "btn btn-sm btn-primary shadow-sm" do %>
          Alle anzeigen
        <% end %>
      </div>
    </div>
  <% end %>
</div>