agile-alliance-brazil/event_registrations

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

Summary

Maintainability
Test Coverage
<div class="breadcrumb">
  <div class="row">
    <div class="col-xl-12">
      <%= link_to t('events.index.title'), events_path %>
      >

      <%= @event.name %>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-xl-4">
    <p>
      <% if @event.event_image_valid? %>
        <%= image_tag @event.event_image.url, size: '300x300', class: 'card-img-top' %>
      <% else %>
        <%= image_tag 'https://res.cloudinary.com/agile-alliance-brazil/image/upload/v1623597789/img-empty_b8hdek.png', size: '300x300', class: 'card-img-top' %>
      <% end %>
    </p>
  </div>

  <div class="col-xl-8">
    <p><h3><%= @event.name %></h3></p>
    <p>
      <b><%= I18n.t('activerecord.attributes.event.country') %>:</b>
      <% if @event.country.present? && ISO3166::Country[@event.country].present? %>
        <%= ISO3166::Country[@event.country].translations[I18n.locale.to_s] %>
      <% else %>
        <%= I18n.t('general.not_informed') %>
      <% end %>
    </p>
    <p>
      <b><%= I18n.t('activerecord.attributes.event.state') %>:</b>
      <%= @event.state %>
    </p>
    <p>
      <b><%= I18n.t('activerecord.attributes.event.city') %>:</b>
      <%= @event.city %>
    </p>
    <p>
      <b><%= Event.human_attribute_name(:full_price) %>:</b>
      <%= number_to_currency(@event.full_price) %>
    </p>
    <p>
      <b><%= I18n.t('events.show.current_price') %>:</b>
      <%= number_to_currency(@event.registration_price_for(Attendance.new, :gateway)) %>
    </p>
    <p>
      <b><%= I18n.t('events.show.statement_agreement_price') %>:</b>
      <%= number_to_currency(@event.registration_price_for(Attendance.new, 'statement_agreement')) %>
    </p>
    <p>
      <b><%= I18n.t('events.show.student_price') %>:</b>
      <%= number_to_currency(@event.registration_price_for(Attendance.new, 'statement_agreement') / 2) %>
    </p>
    <p>
      <b><%= Event.human_attribute_name(:main_email_contact) %>:</b>
      <%= mail_to(@event.main_email_contact, @event.main_email_contact) %>
    </p>
    <p>
      <% if @event.privacy_policy %>
        <%= link_to Event.human_attribute_name(:privacy_policy), @event.privacy_policy %>
      <% else %>
      <%= I18n.t('events.show.no_policy') %>
      <% end %>
    </p>

    <% if current_user&.organizer_of?(@event) %>
      <p><%= link_to I18n.t('events.edit.title'), edit_event_path(@event), class: 'btn btn-sm btn-success' %></p>
    <% end %>
  </div>
</div>

<% if current_user&.organizer_of?(@event) %>
  <ul class="nav nav-tabs bottom-spaced-component">
    <li class="nav-item">
      <a class="nav-link active" data-toggle="tab" href="#organizers-list"><%= I18n.t('events.show.organizers.tab') %></a>
    </li>
    <li class="nav-item">
      <a class="nav-link" data-toggle="tab" href="#periods-list"><%= I18n.t('events.show.registration_periods.tab') %></a>
    </li>
    <li class="nav-item">
      <a class="nav-link" data-toggle="tab" href="#quotas-list"><%= I18n.t('events.show.registration_quotes.tab') %></a>
    </li>
    <li class="nav-item">
      <a class="nav-link" data-toggle="tab" href="#groups-list"><%= I18n.t('events.show.registration_groups.tab') %></a>
    </li>
  </ul>

  <div class="tab-content">
    <div class="tab-pane active" id="organizers-list">
      <%= render 'users/event_organizers_list', organizers_list: @event.organizers.order(:first_name, :last_name) %>
    </div>

    <div class="tab-pane fade" id="periods-list">
      <%= render 'registration_periods/periods_list', event: @event %>
    </div>
    <div class="tab-pane fade" id="quotas-list">
      <%= render 'registration_quotas/quotas_list', event: @event %>
    </div>
    <div class="tab-pane fade" id="groups-list">
      <%= render 'registration_groups/groups_list', event: @event %>
    </div>
  </div>

<% end %>

<% content_for :javascript do %>
  <%= javascript_include_tag 'registration_groups/index' %>
<% end %>