fixed turbolinks/ready issue

This commit is contained in:
Mark Moser 2016-09-28 21:23:01 -05:00
parent 4d89a5ecc3
commit 33f3be1c79
5 changed files with 15 additions and 10 deletions

View File

@ -105,7 +105,7 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.0.2)
jwt (1.5.5)
jwt (1.5.6)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
@ -120,7 +120,7 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.0)
minitest (5.9.1)
minitest-reporters (1.1.11)
ansi
builder
@ -145,7 +145,7 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
parser (2.3.1.3)
parser (2.3.1.4)
ast (~> 2.2)
pkg-config (1.1.7)
powerpack (0.1.1)
@ -188,7 +188,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rake (11.2.2)
rake (11.3.0)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)

View File

@ -15,7 +15,9 @@ function revealPassword($src){
$src.removeClass('fa-lock').addClass('fa-unlock');
}
$(function(){
// Use this instead of typical $().ready
// because turbolinks.
document.addEventListener("turbolinks:load", function() {
$("[data-id=passwd]").on("ajax:success", "a", function(e, data){
getPassword($(e.target).parent(), data.hash);
});

View File

@ -1,6 +1,6 @@
<p id="notice"><%= notice %></p>
<h1>Accounts</h1>
<h1>FTP Accounts</h1>
<table>
<thead>

View File

@ -4,13 +4,16 @@
<title>FtpManager</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track' => 'reload') %>
<%= javascript_include_tag('application', 'data-turbolinks-track' => 'reload') %>
</head>
<body>
<header>
<p>Welcome <%= session[:name] %></p>
<p>
Welcome <%= session[:name] %>
<% #= "(admin)" if session[:admin] == true %>
</p>
</header>
<%= yield %>
</body>

View File

@ -6,7 +6,7 @@ class AuthControllerTest < ActionDispatch::IntegrationTest
test "Should fake login process" do
# This is not a real test of AuthController!
# We are really testing that the monkey path is correct
# We are really testing that the monkey patch is correct
#
# This simply tests to make sure the test suite is
# properly monkey patching the oAuth network call and