use Rails 4 turbolinks

This commit is contained in:
Lee Lawlor 2014-07-23 13:45:15 -04:00
parent 7a132477d0
commit 937d2eea47
25 changed files with 49 additions and 55 deletions

View File

@ -34,6 +34,7 @@ gem 'non-stupid-digest-assets'
gem 'em-http-request' gem 'em-http-request'
gem 'tzinfo' gem 'tzinfo'
gem 'tzinfo-data' gem 'tzinfo-data'
gem 'turbolinks'
# to use debugger # to use debugger
# gem 'ruby-debug' # gem 'ruby-debug'

View File

@ -310,6 +310,8 @@ GEM
treetop (1.4.15) treetop (1.4.15)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
turbolinks (2.2.2)
coffee-rails
tweetstream (2.6.0) tweetstream (2.6.0)
daemons (~> 1.1) daemons (~> 1.1)
em-http-request (>= 1.1.1) em-http-request (>= 1.1.1)
@ -383,6 +385,7 @@ DEPENDENCIES
spork spork
sqlite3-ruby (= 1.3.3) sqlite3-ruby (= 1.3.3)
therubyracer therubyracer
turbolinks
tweetstream tweetstream
twitter_oauth! twitter_oauth!
tzinfo tzinfo

View File

@ -2,6 +2,7 @@
// This file is automatically included by javascript_include_tag :defaults // This file is automatically included by javascript_include_tag :defaults
//= require jquery_ujs //= require jquery_ujs
//= require turbolinks
//= require ./jquery.cookie.js //= require ./jquery.cookie.js
//= require ./updateChart.js //= require ./updateChart.js
//= require ./timeago.min.js //= require ./timeago.min.js

View File

@ -1,5 +1,5 @@
// when the dom is ready // when the dom is ready
$(document).ready(function() { $(document).on('page:load ready', function() {
// if the cheerlights row exists // if the cheerlights row exists
if ($('#cheerlights_row').length > 0) { if ($('#cheerlights_row').length > 0) {

View File

@ -1,5 +1,5 @@
// when the document is ready // when the document is ready
$(document).ready(function() { $(document).on('page:load ready', function() {
// allow flash notices to be dismissed // allow flash notices to be dismissed
if ($(".flash").length > 0) { if ($(".flash").length > 0) {

View File

@ -1,4 +1,4 @@
$(document).ready(function() { $(document).on('page:load ready', function() {
// when a response is clicked // when a response is clicked
$('.response').click(function() { $('.response').click(function() {

View File

@ -26,7 +26,7 @@
$.restSetup = { methodParam: '_method' }; $.restSetup = { methodParam: '_method' };
// collects the csrf-param and csrf-token from meta tags // collects the csrf-param and csrf-token from meta tags
$(document).ready(function(){ $(document).on('page:load ready', function(){
$.extend($.restSetup, { $.extend($.restSetup, {
csrfParam: $('meta[name=csrf-param]').attr('content'), csrfParam: $('meta[name=csrf-param]').attr('content'),
csrfToken: $('meta[name=csrf-token]').attr('content') csrfToken: $('meta[name=csrf-token]').attr('content')
@ -135,3 +135,4 @@
}); });
})(jQuery); })(jQuery);

View File

@ -1,5 +1,5 @@
// execute on window load (and not document.ready), so that the sidebar is positioned correctly // execute on window load (and not document.ready), so that the sidebar is positioned correctly
$(window).load(function() { $(window).on('page:load load', function() {
// if affix function exists // if affix function exists
if ($.fn.affix) { if ($.fn.affix) {

View File

@ -71,14 +71,6 @@ class WindowsController < ApplicationController
def index def index
channel = Channel.find(params[:channel_id]) channel = Channel.find(params[:channel_id])
#channel.update_status_portlet false if (channel.windows.select { |w| w.window_type == 'status' && w.private_flag == false } )
#channel.update_status_portlet true if (channel.windows.select { |w| w.window_type == 'status' && w.private_flag == true } )
#channel.update_video_portlet false if (channel.windows.select { |w| w.window_type == 'video' && w.private_flag == false } )
#channel.update_video_portlet true if (channel.windows.select { |w| w.window_type == 'video' && w.private_flag == true } )
#channel.update_location_portlet false if (channel.windows.select { |w| w.window_type == 'location' && w.private_flag == false } )
#channel.update_location_portlet true if (channel.windows.select { |w| w.window_type == 'location' && w.private_flag == true } )
#channel.update_chart_portlets if (channel.windows.select { |w| w.window_type == 'chart' } )
windows = channel.public_windows(true).order(:position) unless params[:channel_id].nil? windows = channel.public_windows(true).order(:position) unless params[:channel_id].nil?
if channel.recent_statuses.nil? || channel.recent_statuses.size <= 0 if channel.recent_statuses.nil? || channel.recent_statuses.size <= 0
@ -141,15 +133,6 @@ class WindowsController < ApplicationController
def private_windows def private_windows
channel = Channel.find(params[:channel_id]) channel = Channel.find(params[:channel_id])
#channel.update_status_portlet false if (channel.windows.select { |w| w.window_type == 'status' && w.private_flag == false } )
#channel.update_status_portlet true if (channel.windows.select { |w| w.window_type == 'status' && w.private_flag == true } )
#channel.update_video_portlet false if (channel.windows.select { |w| w.window_type == 'video' && w.private_flag == false } )
#channel.update_video_portlet true if (channel.windows.select { |w| w.window_type == 'video' && w.private_flag == true } )
#channel.update_location_portlet false if (channel.windows.select { |w| w.window_type == 'location' && w.private_flag == false } )
#channel.update_location_portlet true if (channel.windows.select { |w| w.window_type == 'location' && w.private_flag == true } )
#channel.update_chart_portlets if (channel.windows.select { |w| w.window_type == 'chart' } )
windows = channel.private_windows(true).order(:position) unless params[:channel_id].nil? windows = channel.private_windows(true).order(:position) unless params[:channel_id].nil?
if channel.recent_statuses.nil? || channel.recent_statuses.size <= 0 if channel.recent_statuses.nil? || channel.recent_statuses.size <= 0

View File

@ -3,7 +3,7 @@
<h4 class="breadcrumb"><%= t(:channels_my) %></h4> <h4 class="breadcrumb"><%= t(:channels_my) %></h4>
<div class="col-pad"> <div class="col-pad" data-no-turbolink>
<% if @channels.length > 0 %> <% if @channels.length > 0 %>
@ -73,7 +73,7 @@
</div> </div>
<script> <script>
$(document).ready(function() { $(document).on('page:load ready', function() {
$('.tablesorter').tablesorter(); $('.tablesorter').tablesorter();
}); });
</script> </script>

View File

@ -36,7 +36,7 @@
<script> <script>
// when the document is ready // when the document is ready
$(document).ready(function() { $(document).on('page:load ready', function() {
// when search tag is clicked // when search tag is clicked
$('#search_tag').on('click', function() { $('#search_tag').on('click', function() {

View File

@ -11,7 +11,7 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).on('page:load ready', function() {
var html = ''; var html = '';
var field1, field2, field3, field4, field5, field6, field7, field8; var field1, field2, field3, field4, field5, field6, field7, field8;
@ -91,3 +91,4 @@
<div id="feed-container"></div> <div id="feed-container"></div>
</body> </body>
</html> </html>

View File

@ -174,7 +174,7 @@
var options = '<%= options.gsub(/'/, "%27") if options %>'; var options = '<%= options.gsub(/'/, "%27") if options %>';
$(document).ready(function() { $(document).on('page:load ready', function() {
// set initial saved values // set initial saved values
$.each((options.split('&amp;')), setupChartForm(<%= index %> )); $.each((options.split('&amp;')), setupChartForm(<%= index %> ));
// draw initial chart with saved options // draw initial chart with saved options

View File

@ -56,7 +56,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).on('page:load ready', function() {
// if chrome/safari error occurs, reload page // if chrome/safari error occurs, reload page
if ($('#title0').val() == '60' && $('#color0').val() == '10') { if ($('#title0').val() == '60' && $('#color0').val() == '10') {
window.location.reload(); window.location.reload();

View File

@ -20,7 +20,7 @@
return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000); return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000);
} }
$(document).ready(function() { $(document).on('page:load ready', function() {
// blank array for holding chart data // blank array for holding chart data
var chartData = []; var chartData = [];
// variable for the local date in milliseconds // variable for the local date in milliseconds

View File

@ -6,12 +6,12 @@
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/cerulean/bootstrap.min.css" /> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/cerulean/bootstrap.min.css" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" media="screen" rel="stylesheet" /> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" media="screen" rel="stylesheet" />
<%= stylesheet_link_tag 'application' %> <%= stylesheet_link_tag 'application', "data-turbolinks-track" => true %>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type='text/javascript' src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script type='text/javascript' src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<%= javascript_include_tag 'application' %> <%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<% if Rails.env == 'production' %> <% if Rails.env == 'production' %>

View File

@ -15,7 +15,7 @@
return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000); return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000);
} }
$(document).ready(function() { $(document).on('page:load ready', function() {
// blank array for holding chart data // blank array for holding chart data
var chartData = []; var chartData = [];
// variable for the date string // variable for the date string

View File

@ -1,6 +1,6 @@
<div class="col-sm-8 col-xs-8"> <div class="col-sm-8 col-xs-8">
<ol class="breadcrumb"> <ol class="breadcrumb" data-no-turbolink>
<li><%= link_to t(:plugins), plugins_path %></li> <li><%= link_to t(:plugins), plugins_path %></li>
<li><%= link_to plugin_path(@plugin.id) do %> <%= t(:plugin) %> <%= @plugin.id %><% end %></li> <li><%= link_to plugin_path(@plugin.id) do %> <%= t(:plugin) %> <%= @plugin.id %><% end %></li>
<li class="active"><%= t(:edit) %></li> <li class="active"><%= t(:edit) %></li>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long