1
0
Fork 0

Deal with turbolinks

$document().ready is only called when the DOM completes loading.  Since
turbolinks loads new data into the DOM without completely reloading, the ready
event is never fired.  We can account for this by using the page:load event.
This commit is contained in:
Andrew Tomaka 2014-03-07 02:08:41 -05:00
parent 09b173ca40
commit ae9aecc2ab
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$(document).ready ->
$("pre code").each (i, e) ->
$(document).on 'ready page:load', ->
$(".highlight pre code").each (i, e) ->
hljs.highlightBlock e

View File

@ -1,7 +1,7 @@
<%= form_for @paste do |f| %>
<div class="form-group">
<%= f.label :content %>
<%= f.text_area :content, class: 'form-control' %>
<%= f.text_area :content, class: 'form-control', rows: 15 %>
</div>
<%= f.submit 'Paste it!', class: 'btn btn-primary' %>
<% end %>

View File

@ -1 +1 @@
<pre><code><%= @paste.content %></code></pre>
<div class="highlight"><pre><code><%= @paste.content %></code></pre></div>