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:
parent
09b173ca40
commit
ae9aecc2ab
3 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -1 +1 @@
|
|||
<pre><code><%= @paste.content %></code></pre>
|
||||
<div class="highlight"><pre><code><%= @paste.content %></code></pre></div>
|
||||
|
|
Loading…
Reference in a new issue