Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Fix redirection for installations with custom root path, refs #58
Browse files Browse the repository at this point in the history
  • Loading branch information
pencil committed Aug 2, 2014
1 parent 7d74d86 commit daa65df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/assets/javascripts/casino/application.js
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
// Place all the behaviors and hooks related to the matching controller here.
(function(win) {
if(!win.CASino) {
win.CASino = { baseUrl: '/' };
}

win.CASino.url = function(path) {
return win.CASino.baseUrl + path;
}
})(this);
3 changes: 1 addition & 2 deletions app/assets/javascripts/casino/sessions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function(win, doc) {
var url = '/login',
var url = win.CASino.url('login'),
cookie_regex = /(^|;)\s*tgt=/,
ready_bound = false;

Expand All @@ -8,7 +8,6 @@
service = serviceEl ? serviceEl.getAttribute('value') : null;

if(cookie_regex.test(doc.cookie)) {
url = '/login';
if(service) {
url += '?service=' + encodeURIComponent(service);
}
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title><%= CASino.config.frontend[:sso_name] %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_tag "window.CASino = { baseUrl: '#{root_path}' };" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= favicon_link_tag 'favicon.png', type: 'image/png' %>
Expand Down

0 comments on commit daa65df

Please sign in to comment.