infusionvlc/infusion

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

Summary

Maintainability
Test Coverage
<% if user_signed_in? %>
  <%= link_to new_meetup_path, class:'btn btn-primary right' do
    I18n.t 'meetup.host_yours'
  end %>
<% else %>
  <%= link_to new_user_registration_path, class:'btn btn-primary right' do
    I18n.t 'meetup.host_yours'
  end %>
<% end %>

<h1>Meetups</h1>
<br/>


<div class="card next-meetup-card">
  <div class="card-header">
    <h2><%= I18n.t 'meetup.next' %></h2>
  </div>
  <% if @next_sessions.nil? || @next_sessions.count == 0 %>
    <div class="card-body" %>
      <h3 class="center">
        <%= I18n.t 'meetup.no_next' %>
      </h3>
    </div>
  <% else %>
    <% @next_sessions.each do |ses| %>
      <div class="card-body">
        <h2>
          <br/>📍 <%= ses.location.name %> | 📅 <%= I18n.l ses.event.date %> | ⏰ <%= ses.start.strftime('%H:%M') %> - <%= ses.end.strftime('%H:%M') %>
        </h2>
        <h2>
          <span class="badge badge-info badge-pill">
            <%= I18n.t 'meetup.assistants', count: ses.meetup.assistances.count %>
          </span>
          <%= link_to ses.meetup.title, ses.meetup %>
        </h2>
        <p><%= truncate(strip_tags(@markdown.render(ses.meetup.description)), length: 200) %></p>
      </div>
      <div class="card-footer text-muted">
        <%= link_to ses.meetup.holdings.first.user.username, "/#{ses.meetup.holdings.first.user.username}" %> | <%= time_ago_in_words(ses.meetup.created_at) %>
      </div>
    <% end %>
  <% end %>
</div>




<br/><br/>
<div class="row">
  <div class="col-md-6 left">
    <h2><%= I18n.t 'meetup.recents' %></h2>
    <% @most_recent.each do |meetup| %>
      <%= render 'meetups/card', meetup: meetup, context: 'recent' %>
    <% end %>
  </div>
  <div class="col-md-6 right">
    <h2><%= I18n.t 'meetup.populars' %></h2>
    <% @most_popular.each do |meetup| %>
      <%= render 'meetups/card', meetup: meetup, context: 'popular' %>
    <% end %>
  </div>
</div>