app/views/meetups/_card.html.erb
<div class="card">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-md-4">
<% if meetup.video_url %>
<%= link_to image_tag("https://img.youtube.com/vi/#{video(meetup)}/hqdefault.jpg", class: 'huge-logo'),
meetup %>
<% end %>
</div>
<div class="col-sm-12 col-md-8">
<div class="card-body">
<h3 class="card-title">
<% if defined? context %>
<% if context == 'popular' || context == 'recent' %>
<span class="badge badge-info badge-pill">
<%= I18n.t 'meetup.assistants', count: meetup.assistances.count %>
</span>
<% elsif context == 'vote'%>
<span class="badge badge-info badge-pill">
<%= I18n.t 'votable.votes', count: meetup.assistances.count %>
</span>
<% end %>
<% else %>
<% meetup.categories.each do |cat| %>
<span class="badge badge-info badge-pill">
<%= cat.display_name %>
</span>
<% end %>
<% end %>
<%= link_to meetup.title, meetup %>
</h3>
<p><%= truncate(strip_tags(@markdown.render(meetup.description)), length: 256) %></p>
<% if defined? context and context == 'vote' and policy(meetup).vote? %>
<%= link_to vote_meetup_session_path(meetup.id, meetup.sessions.last), method: :post, class:'btn btn-primary right' do %>
<%= I18n.t 'main.vote' %>
<% end %>
<% end %>
</div>
<div class="card-footer text-muted">
<% if meetup.took_place? %>
<%= link_to meetup.holdings.first.user.username, "/#{meetup.holdings.first.user.username}" %> | <%= time_ago_in_words(meetup.date) %>
<% else %>
<%= link_to meetup.holdings.first.user.username, "/#{meetup.holdings.first.user.username}" %> | <%= time_ago_in_words(meetup.created_at) %>
<% end %>
</div>
</div>
</div>
</div>
</div>