Skip to content

Commit

Permalink
session modal styling (#3874)
Browse files Browse the repository at this point in the history
* session modal styling

* remove unnecessary span

* consolidate spacing classes
  • Loading branch information
kristinmerbach authored and scaustin34 committed Jun 3, 2024
1 parent 3f62c37 commit d09c31f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/controllers/session_timeout_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def skip_timeout

def check_time_until_logout
@time_left = Devise.timeout_in - (Time.now - (user_session["last_request_at"] || Time.now)).to_i.round
@bs4 = true if params[:bs4] == "true"
if @time_left <= 0
sign_out(current_user)
respond_to do |format|
Expand Down
13 changes: 13 additions & 0 deletions app/javascript/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,16 @@ ul.list-right-section li {
.full-height {
height: 70vh;
}

// modals

.backdrop-modal {
background: hsla(0, 0%, 0%, 0.2);
.modal-header {
border-bottom: 0;
}

.modal-footer {
border-top: 0;
}
}
35 changes: 31 additions & 4 deletions app/views/devise/sessions/_session_expiration_warning.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
<% if @bs4 %>
<div class="modal backdrop-modal" id="sessionExpirationWarningModal" tabindex="-1" role="dialog" role="document" data-backdrop="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<div class="d-flex align-items-center">
<div class="pl-2">
<div class="warning-icon icon" alt="warning" aria-hidden="true">&nbsp;</div>
</div>
<div class="my-1 pl-0 pr-2">
<h4 class="modal-title">Session Ending Soon</h4>
</div>
</div>
</div>
<div class="modal-body">
<p>
Your session will expire in <strong><%= @time_left %></strong>
seconds. If you’d like to continue with your application, select STAY LOGGED IN.
</p>
<ul class="application-warnings"></ul>
</div>
<div class="modal-footer">
<%= link_to l10n(".logout"), destroy_user_session_path, method: "delete", class: "button outline", tabindex: "0" %>
<span tabindex="0", onkeydown="handleButtonKeyDown(event, 'stay-logged-in')", id="stay-logged-in" class="button" data-dismiss="modal"><%= l10n("faa.stay_logged_in") %></span>
</div>
</div>
</div>
</div>
<% else %>
<div class="modal" id="sessionExpirationWarningModal" tabindex="-1" role="dialog" role="document">
<div class="modal-dialog">
<div class="modal-content">
Expand All @@ -6,10 +35,7 @@
</div>
<div class="modal-body">
<p>
Your session will expire in
<strong>
<%= @time_left %>
</strong>
Your session will expire in <strong><%= @time_left %></strong>
seconds. If you’d like to continue with your application, select STAY LOGGED IN.
</p>
<ul class="application-warnings"></ul>
Expand All @@ -21,3 +47,4 @@
</div>
</div>
</div>
<% end %>
1 change: 1 addition & 0 deletions app/views/ui-components/bs4/v1/navs/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
url: "<%= main_app.check_time_until_logout_path(format: :js) %>",
method: 'GET',
dataType: 'script',
data:{bs4: <%= @bs4 %>},
success: function(response){
},
error: function(response){
Expand Down

0 comments on commit d09c31f

Please sign in to comment.