osunyorg/admin

View on GitHub
app/views/server/emergency_messages/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @emergency_message %>

<div class="row">
  <div class="col-lg-8">
    <h2><%= t('server_admin.emergency_messages.content') %></h2>
    <div class="row">
      <div class="col-lg-6">
        <%= osuny_label EmergencyMessage.human_attribute_name(:subject_fr) %>
        <p><%= sanitize @emergency_message.subject_fr %></p>
        <%= osuny_label EmergencyMessage.human_attribute_name(:content_fr) %>
        <div><%= sanitize @emergency_message.content_fr %></div>
      </div>
      <div class="col-lg-6">
        <%= osuny_label EmergencyMessage.human_attribute_name(:subject_en) %>
        <p><%= sanitize @emergency_message.subject_en %></p>
        <%= osuny_label EmergencyMessage.human_attribute_name(:content_en) %>
        <div><%= sanitize @emergency_message.content_en %></div>
      </div>
    </div>
  </div>
  <div class="col-lg-4">
    <h2><%= t('server_admin.emergency_messages.filters') %></h2>
    <%= osuny_label EmergencyMessage.human_attribute_name(:university) %>
    <p><%= @emergency_message.university.present? ? link_to(@emergency_message.university, server_university_path(@emergency_message.university)) : t('server_admin.emergency_messages.all_universities') %></p>
    <%= osuny_label EmergencyMessage.human_attribute_name(:role) %>
    <p><%= @emergency_message.role.present? ? t("activerecord.attributes.user.roles.#{@emergency_message.role}") : t('server_admin.emergency_messages.all_roles') %></p>
    <%= osuny_label t('server_admin.emergency_messages.target') %>
    <% count = @emergency_message.delivered? ? @emergency_message.delivered_count : @emergency_message.target.size %>
    <p><%= t('server_admin.emergency_messages.users', count: count) %></p>
  </div>
</div>

<% content_for :action_bar_right do %>
  <% unless @emergency_message.delivered? %>
    <%= link_to t('edit'), [:edit, :server, @emergency_message], class: button_classes %>
    <%= link_to t('server_admin.emergency_messages.deliver'), 
                 [:deliver, :server, @emergency_message], 
                method: :post,
                data: { confirm: t('please_confirm') },
                class: button_classes %>
  <% end %>
<% end %>