Noosfero/noosfero

View on GitHub
plugins/admin_notifications/views/shared/show_notification.html.erb

Summary

Maintainability
Test Coverage
<% if current_user && current_user.person.is_admin? %>
  <% active_notifications = AdminNotificationsPlugin::Notification.active(environment) %>
  <% unless active_notifications.blank? %>
    <div class="notification-plugin-notification-bar">
      <div class="adminnotification notification">
        <div class="notification-message">
          <p>
            <%= _("There are active notifications in this environment!") %>
            <%= link_to _("Manage all notifications here."), AdminNotificationsPlugin.admin_url %>
          </p>
        </div>
      </div>
    </div>
  <% end %>
<% end %>

<% target = profile.present? ? profile : environment %>

<% @notifications = AdminNotificationsPlugin::Notification.visibles(target, current_user, controller_path).where("id NOT IN (?)", hide_notifications) %>

<div class="notification-plugin-notification-bar">
  <% @notifications.each do |notification| %>
    <div class="<%= notification.type.gsub("AdminNotificationsPlugin::", "").downcase %> notification" data-notification="<%=notification.id%>" notification-display-popup="<%=notification.display_popup?%>">
      <div>
        <% unless notification.title.blank? %>
          <div class='notification-title'><%= notification.title %></div>
        <% end %>
        <div class="notification-message">
          <%= AdminNotificationsPlugin::NotificationHelper.substitute_variables(notification.message, current_user).html_safe %>
        </div>
      </div>
      <% if logged_in? %>
        <div class='notifications-actions'>
          <a class="notification-close" title="<%= _('Do not show anymore') %>"><%= font_awesome(:remove) %></a>
          <a class="notification-hide" title="<%= _('Hide for now') %>"><%= font_awesome('eye-slash') %></a>
        </div>
      <% end %>
    </div>
  <% end %>
</div>