YaleSTC/shifts

View on GitHub
app/views/notices/_announcement.html.erb

Summary

Maintainability
Test Coverage
<div class="alert alert-info notice announcement" title="<%= "Posted on #{announcement.start.to_date} at #{announcement.start.to_s(:am_pm)}" %>">
  <% if current_user.is_admin_of?(current_department) || announcement.author == current_user%>
    <% if announcement.active? %>
      <%= link_to '&times;'.html_safe, notice_path(announcement),
      confirm: 'Are you sure you want to remove this announcement?',
      method: :delete, class: 'close', title: 'Delete Announcement', data: {
      toggle: 'tooltip', placement: 'bottom' } %>
    <% end %>
    <%= link_to edit_announcement_path(announcement),
    title: 'Edit Announcement', id: 'edit', data: {
     toggle: "modal", target: "#modal", placement: 'bottom',
     remote: edit_announcement_path(announcement, layout: "false")} do %>
      <i class="fa fa-pencil-square-o"></i>
    <% end %>
  <% end %>

  <div class="<%= html_class %>">
    <%= announcement.content_with_formatting %>
  </div>
  <div class="notice-author">
    By <%= link_to announcement.author.name, user_profile_path(announcement.author.login) %>
  </div>
</div>