infusionvlc/infusion

View on GitHub
app/views/layouts/application.html.erb

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <title>INFUSIÓN</title>
    <%= csrf_meta_tags %>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    <%= render 'application/favicon' %>
  </head>

  <body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      <a class="navbar-brand" href="/">
        <img src="<%= root_url %>/logo_base.svg" alt="INFUSIÓN">
      </a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>

      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item">
            <%= link_to meetups_path, {class: "nav-link"} do %><%= icon('fas', 'calendar') %> Meetups<% end %>
          </li>
          <li class="nav-item">
            <%= link_to ranking_path, {class: "nav-link"} do %><%= icon('fas', 'arrow-up') %> Ranking<% end %>
          </li>
          <li class="nav-item">
            <%= link_to proposals_path, {class: "nav-link"} do %><%= icon('fas', 'lightbulb') %> <%= I18n.t 'activerecord.model.proposal', count: 2 %><% end %>
          </li>
          <li class="nav-item">
            <%= link_to archive_path, {class: "nav-link"} do %><%= icon('fas', 'history') %> <%= I18n.t 'main.archive' %><% end %>
          </li>
          <li class="nav-item">
            <%= link_to users_path, {class: "nav-link"} do %><%= icon('fas', 'users') %> <%= I18n.t 'main.collaborators' %><% end %>
          </li>
          <% if user_signed_in? %>
            <li class="nav-item">
              <%= link_to activities_path, {class: "nav-link"} do %><%= icon('fas', 'bars') %> Feed<% end %>
            </li>
            <% if current_user.admin? %>
              <li class="nav-item">
                <%= link_to reports_path, {class: "nav-link"} do %><%= icon('fas', 'gavel') %> <%= I18n.t 'main.admin_panel' %><% end %>
              </li>
            <% end %>
          <% end %>
          <li class="nav-item">
            <%= link_to '/about', {class: "nav-link"} do %><%= icon('fas', 'info-circle') %> About<% end %>
          </li>
          <li class="nav-item"><%= link_to "", {class: "nav-link ul"} do %> 🌍 <%= I18n.t("nav.language") %><% end %>
              <ul>
                <% if user_signed_in? %>
                   <li><%= link_to save_locale_path({locale: :es}), method: :post  do %> <img src="/flags/ES_flag.png" class="flag"> Castellano<% end %></li>
                  <li><%= link_to save_locale_path({locale: :en}), method: :post do %> <img src="/flags/GB_flag.png" class="flag"> English<% end %></li>
                  <li><%= link_to save_locale_path({locale: :ca}), method: :post do %> <img src="/flags/CA_flag.png" class="flag"> Valencià<% end %></li>
                <% else %>
                   <li><%= link_to url_for(locale: :es), {class: "nav-link ul"} do %> <img src="/flags/ES_flag.png" class="flag"> Castellano<% end %></li>
                   <li><%= link_to url_for(locale: :en), {class: "nav-link ul"} do %> <img src="/flags/GB_flag.png" class="flag"> English<% end %></li>
                   <li><%= link_to url_for(locale: :ca), {class: "nav-link ul"} do %> <img src="/flags/CA_flag.png" class="flag"> Valencià<% end %></li>
                <% end %>
              </ul>
          </li>
        </ul>
        <ul class="navbar-nav navbar-right">
          <% if user_signed_in? %>
            <li class="nav-item">
              <%= link_to "/logout", {class: "nav-link"} do %><%= icon('fas', 'sign-out') %> <%= I18n.t 'user.logout' %><% end %>
            </li>
            <li class="nav-item">
              <%= link_to "/#{current_user.username}", {class: "nav-link"} do %><%= icon('fas', 'user') %> <%= I18n.t 'user.my_profile' %><% end %>
            </li>
            <li class="nav-item">
              <span id="notifications-modal-trigger" class="nav-link" tabindex="0" role="button"
                data-container="body" data-toggle="popover" data-html ="true" data-trigger="click"
                data-placement="bottom" data-content="<%= "#{render 'activities/index'}" %>">
                <% if @notifications.count > 0 %>
                  <%= icon('fas', 'bell') %> <span class="badge badge-pill badge-info"><%= @notifications.count %></span>
                <% else %>
                  <%= icon('fas', 'bell') %>
                <% end %>
              </span>
            </li>
          <% else %>
            <li class="nav-item">
              <%= link_to new_user_session_path, {class: "nav-link"} do %><%= icon('fas', 'sign-in') %> <%= I18n.t 'user.login' %><% end %>
            </li>
            <li class="nav-item">
              <%= link_to new_user_registration_path, {class: "nav-link"} do %><%= icon('fas', 'user-plus') %> <%= I18n.t 'user.signup' %><% end %>
            </li>
          <% end %>
      </div>
    </nav>
    <% flash.each do |key, value| %>
      <div class="alert alert-<%= flash_class(key) %>" role="alert">
        <a href="#" data-dismiss="alert" class="close">×</a>
        <%= value %>
      </div>
    <% end %>
    <div class="container body-padding">
      <%= yield %>
      <br/>
      <p class="center">2018 ❤️ INFUSIÓN</p>
      <p class="center"><%= rules %></p>
      <p class="center">
        <a href="https://twitter.com/infusionvlc"><img class="mini" alt="Twitter" src="/twitter.png"/></a>
        <a href="https://instagram.com/infusion_vlc"><img class="mini" alt="Instagram" src="/instagram.png"/></a>
        <a href="https://www.youtube.com/channel/UCP5URDPxiT1Nd8LDVmShN5Q"><img class="mini" alt="YouTube" src="/youtube.png"/></a>
        <a href="https://t.me/infusionvlc"><img class="mini" alt="Telegram" src="/telegram.png"/></a>
        <a href="https://medium.com/infusión"><img class="mini" alt="Medium" src="/medium.png"/></a>
      </p>
    </div>
  </body>
</html>