infusionvlc/infusion

View on GitHub
app/views/locations/show.html.erb

Summary

Maintainability
Test Coverage
<div class="jumbotron jumbotron-fluid">
  <div class="container">
    <h1><%= @location.name %></h1>
    <p class="lead"><%= @location.meetups.count %> Meetups</p>
  </div>
</div>
<br/>
<% if policy(@location).edit? %>
  <div class="row">
    <div class="col-md-8 col-sm-12">
<%else %>
  <div>
<% end %>
  <h2><%= I18n.t 'activerecord.model.meetup.other' %></h2>
  <% if @location.meetups.count == 0 %>
    <p><%= I18n.t 'location.no_meetups' %></p>
  <% else %>
    <% @location.sessions.each do |session| %>
      <%= render 'meetups/card', meetup: session.meetup %>
    <% end %>
  <% end %>
  <% if policy(@location).edit? %>
    </div>
    <div class="col-md-4 col-sm-12 card">
        <%= link_to edit_location_path(@location), class:'btn btn-primary btn-lg btn-block' do %><%= icon('fas', pencil') %> <%= I18n.t 'main.edit' %><% end %>
        <% if policy(@location).destroy? %>
          <%= link_to location_path(@location), method: :delete, class:'btn btn-danger btn-lg btn-block' do %><%= icon('fas', 'times') %> <%= I18n.t 'main.delete' %><% end %>
        <% end %>
    </div>
  <% end %>
</div>