publiclab/plots2

View on GitHub
app/views/layouts/_alerts.html.erb

Summary

Maintainability
Test Coverage
<div class="alerts-container">
  <div id="alert-placeholder"></div>

  <% if flash[:notice] %><div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><%= raw flash[:notice] %></div><% end %>

  <% if flash[:error] %>
    <div class="alert alert-danger">
      <button type="button" class="close" data-dismiss="alert">×</button>
      <span class="alert-content">
        <% if flash[:error].is_a? String %>
          <%= raw flash[:error] %>
        <% elsif flash[:error].is_a? Array %>
          <ul>
            <% flash[:error].each do |error| %>
              <li><%= raw error %></li>
            <% end %>
          </ul>
        <% end %>
      </span>
    </div>
  <% end %>

  <% if flash[:warning] %><div class="alert alert-warning"><button type="button" class="close" data-dismiss="alert">×</button><i class="fa fa-exclamation-mark"></i> <%= raw flash[:warning] %></div><% end %>

  <% if current_user && session[:openid_return_to] # for openid login, redirects back to openid auth process %>
    <div class="alert alert-warning"><button type="button" class="close" data-dismiss="alert">×</button><i class="fa fa-exclamation-mark"></i><%= translation('layout._alerts.request_access') %><a href="/openid/resume"><%= translation('layout._alerts.approve_or_deny') %> &raquo;</a></div>
  <% end %>

  <% cache('feature_sitewide-alert', skip_digest: true) do %>
    <%= feature('sitewide-alert') %>
  <% end %>
</div>
<script>
  setTimeout("$('.alerts-container .alert-success').fadeOut('slow')", 7000)
</script>