Commit 761c005

mo <mo@mokhan.ca>
2017-11-24 21:28:18
convert spinner layout to partial.
1 parent 6a0fd0e
Changed files (6)
airport/app/assets/stylesheets/application.css
@@ -14,3 +14,19 @@
  *= require_tree .
  *= require_self
  */
+@keyframes spinner {
+  0% { transform: rotate(0deg) }
+  100% { transform: rotate(360deg) }
+}
+
+.spinner {
+  margin: auto;
+  width: 48px;
+  height: 48px;
+  animation: spinner 0.65s infinite steps(12);
+}
+
+.spinner svg {
+  width: 48px;
+  height: 48px;
+}
airport/app/controllers/sessions_controller.rb
@@ -11,14 +11,12 @@ class SessionsController < ApplicationController
       post_binding = idp.single_sign_on_service_for(binding: :http_post)
       @post_uri, @saml_params = post_binding.serialize(builder_for(:login), relay_state: relay_state)
     end
-    render layout: "spinner"
   end
 
   def destroy
     binding = :http_redirect == params[:binding].to_sym ? :http_redirect : :http_post
     saml_binding = idp.single_logout_service_for(binding: binding)
     @url, @saml_params = saml_binding.serialize(builder_for(:logout))
-    render layout: "spinner"
   end
 
   private
airport/app/views/application/_spinner.html.erb
@@ -0,0 +1,1 @@
+<div class="spinner"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 25 25"><defs><style>line{fill:none;stroke:#1a1a1a;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px;}.o25{opacity:0.25;}.o85{opacity:0.85;}.o7{opacity:0.7;}.o55{opacity:0.55;}.o35{opacity:0.35;}</style></defs><line x1="12.5" y1="2" x2="12.5" y2="7.05463"/><line class="o25" x1="12.5" y1="23" x2="12.5" y2="17.94537"/><line class="o85" x1="7.25" y1="3.40674" x2="9.77942" y2="7.78778"/><line class="o25" x1="17.75" y1="21.59326" x2="15.22058" y2="17.21222"/><line class="o25" x1="17.21222" y1="15.22058" x2="21.59326" y2="17.75"/><line class="o7" x1="7.78778" y1="9.77942" x2="3.40674" y2="7.25"/><line class="o25" x1="23" y1="12.5" x2="17.94537" y2="12.5"/><line class="o55" x1="7.05463" y1="12.5" x2="2" y2="12.5"/><line class="o35" x1="7.78778" y1="15.22058" x2="3.40674" y2="17.75"/><line class="o25" x1="21.59326" y1="7.25" x2="17.21222" y2="9.77942"/><line class="o25" x1="9.77942" y1="17.21222" x2="7.25" y2="21.59326"/><line class="o25" x1="17.75" y1="3.40674" x2="15.22058" y2="7.78778"/></svg></div>
airport/app/views/layouts/spinner.html.erb
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-    <style type="text/css" media="all">
-      html,
-      body {
-        width: 100%;
-        height: 100%;
-      }
-
-      body {
-        display: -ms-flexbox;
-        display: flex;
-        -ms-flex-align: center;
-        align-items: center;
-        -ms-flex-pack: center;
-        justify-content: center;
-      }
-
-      @keyframes spinner {
-        0% { transform: rotate(0deg) }
-        100% { transform: rotate(360deg) }
-      }
-
-      .spinner {
-        width: 48px;
-        height: 48px;
-        animation: spinner 0.65s infinite steps(12);
-      }
-
-      .spinner svg {
-        width: 48px;
-        height: 48px;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="spinner"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 25 25"><defs><style>line{fill:none;stroke:#1a1a1a;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px;}.o25{opacity:0.25;}.o85{opacity:0.85;}.o7{opacity:0.7;}.o55{opacity:0.55;}.o35{opacity:0.35;}</style></defs><line x1="12.5" y1="2" x2="12.5" y2="7.05463"/><line class="o25" x1="12.5" y1="23" x2="12.5" y2="17.94537"/><line class="o85" x1="7.25" y1="3.40674" x2="9.77942" y2="7.78778"/><line class="o25" x1="17.75" y1="21.59326" x2="15.22058" y2="17.21222"/><line class="o25" x1="17.21222" y1="15.22058" x2="21.59326" y2="17.75"/><line class="o7" x1="7.78778" y1="9.77942" x2="3.40674" y2="7.25"/><line class="o25" x1="23" y1="12.5" x2="17.94537" y2="12.5"/><line class="o55" x1="7.05463" y1="12.5" x2="2" y2="12.5"/><line class="o35" x1="7.78778" y1="15.22058" x2="3.40674" y2="17.75"/><line class="o25" x1="21.59326" y1="7.25" x2="17.21222" y2="9.77942"/><line class="o25" x1="9.77942" y1="17.21222" x2="7.25" y2="21.59326"/><line class="o25" x1="17.75" y1="3.40674" x2="15.22058" y2="7.78778"/></svg></div>
-    <%= yield %>
-  </body>
-</html>
airport/app/views/sessions/create.html.erb
@@ -3,11 +3,19 @@
     window.location.href = '<%= @redirect_uri %>';
   <% end  %>
 <% else %>
-  <%= form_tag(@post_uri, style: "position: absolute; left: -10000px; top: -10000px;") do %>
-    <%= @saml_params.each do |(key, value)| %>
-      <%= hidden_field_tag key, value %>
-    <% end %>
-  <% end %>
+  <div class="container">
+    <div class="row">
+      <div class="col">
+        <h1>Sending Post to IDP</h1>
+        <%= render partial: 'spinner' %>
+        <%= form_tag(@post_uri, style: "position: absolute; left: -10000px; top: -10000px;") do %>
+          <%= @saml_params.each do |(key, value)| %>
+            <%= hidden_field_tag key, value %>
+          <% end %>
+        <% end %>
+      </div>
+    </div>
+  </div>
 
   <%= javascript_tag do %>
     window.onload = function() {
airport/app/views/sessions/destroy.html.erb
@@ -1,12 +1,17 @@
-<h1>Loggout out of SP</h1>
-<%= form_tag(@url, style: "position: absolute; left: -10000px; top: -10000px;") do %>
-  <%= @saml_params.each do |(key, value)| %>
-    <%= hidden_field_tag key, value %>
-  <% end %>
-<% end %>
+<div class="container">
+  <div class="row">
+    <div class="col">
+      <h1>Loggout out of SP</h1>
+      <%= render partial: 'spinner' %>
+      <%= form_tag(@url, style: "position: absolute; left: -10000px; top: -10000px;") do %>
+        <%= @saml_params.each do |(key, value)| %>
+          <%= hidden_field_tag key, value %>
+        <% end %>
+      <% end %>
+    </div>
+  </div>
+</div>
 
 <%= javascript_tag do %>
-  window.onload = function() {
-    document.forms[0].submit();
-  };
+  window.onload = function() { document.forms[0].submit(); };
 <% end %>