new logout warning which is easy to see in the background

pull/6827/head
Markus Kahl 9 years ago
parent d8b499fe4f
commit 8d6dd69f38
  1. 5
      app/session/session_controller.rb
  2. 14
      app/views/session/_warn_logout.js.erb
  3. 6
      app/views/session/logout_warning.html.erb
  4. 4
      config/locales/de.yml
  5. 4
      config/locales/en.yml
  6. 2
      config/routes.rb
  7. 3
      lib/open_project/openid_connect/lobby_boy_configuration.rb

@ -0,0 +1,5 @@
class SessionController < ActionController::Base
def logout_warning
end
end

@ -0,0 +1,14 @@
// window.parent == OpenProject window
var $ = window.parent.jQuery
$.ajax({
url: "/session/logout_warning",
cache: false,
success: function(html) {
$("#logout-warning").remove();
$(html).prependTo("body").hide().slideDown();
$('html, body').animate({
scrollTop: $("#logout-warning").offset().top
}, 1000);
}
});

@ -0,0 +1,6 @@
<div id="logout-warning" class="top-shelf icon icon-warning">
<h1><%= t('title.warning') %></h1>
<p>
<%= t('logout_warning') %>
</p>
</div>

@ -0,0 +1,4 @@
de:
logout_warning: >
Sie wurden ausgeloggt. Inhalte von Formularen, die sie abschicken möchten,
können verloren gehen. Bitte loggen Sie sich wieder ein.

@ -0,0 +1,4 @@
en:
logout_warning: >
You have been logged out. The contents of any form you submit may be lost.
Please log in.

@ -2,4 +2,6 @@ require 'lobby_boy'
Rails.application.routes.draw do
mount LobbyBoy::Engine, at: '/'
get '/session/logout_warning', to: 'session#logout_warning'
end

@ -36,7 +36,8 @@ module OpenProject
def update_client!
LobbyBoy.configure_client! host: host,
end_session_endpoint: end_session_endpoint
end_session_endpoint: end_session_endpoint,
on_logout_js_partial: 'session/warn_logout.js'
end
def update_provider!

Loading…
Cancel
Save