show_notification.html.erb
1.5 KB
<% 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 class="notification-message">
<%= AdminNotificationsPlugin::NotificationHelper.substitute_variables(notification.message, current_user).html_safe %>
</div>
<% if logged_in? %>
<div class="notification-close" title="<%= _('Do not show anymore') %>"></div>
<div class="notification-hide" title="<%= _('Hide for now') %>"></div>
<% end %>
</div>
<% end %>
</div>