turbolinks fixes

This commit is contained in:
Lee Lawlor 2014-08-01 15:57:02 -04:00
parent acd42142dc
commit 0c758f6e40
18 changed files with 91 additions and 88 deletions

View File

@ -1,11 +1,7 @@
$(function () {
$("div.progressbar").each (
function () {
var element = this;
$(element).progressbar(
{
value: parseInt($(element).attr("rel"))
});
});
$(document).on('page:load ready', function() {
$("div.progressbar").each(function() {
var element = this;
$(element).progressbar({ value: parseInt($(element).attr("rel")) });
});
});

View File

@ -111,8 +111,8 @@
</div>
<script language="javascript">
$(function() {
$("#sidebar a").attr("target", "_blank");
$(document).on('page:load ready', function() {
$("#sidebar a").attr("target", "_blank");
});
</script>

View File

@ -141,7 +141,7 @@
// remember default field label
var default_label = '<%= t(:channel_default_field) %>';
// when document is ready
$(function() {
$(document).on('page:load ready', function() {
// iterate through each field textbox
$('.field').each(function() {
// if a value is present, show the 'remove' checkbox

View File

@ -12,15 +12,15 @@
<div id="private_dialog1" class="column" > </div>
</div>
<script>
$(function() {
$(document).on('page:load ready', function() {
$("#devInfoLink_private").click(
function(e) {
function(e) {
var element = $("#devInfo");
openDialogCenter(element);
});
$("#portletAddLink_private").click(
function(e) {
$("#addPortlets").load('/channels/<%=@channel.id %>/hidden_windows?visibility_flag=private',
function(e) {
$("#addPortlets").load('/channels/<%=@channel.id %>/hidden_windows?visibility_flag=private',
function(e) {
var element = $("#addPortlets");
openDialogCenter(element);
@ -29,3 +29,4 @@ $(function() {
});
</script>

View File

@ -3,7 +3,7 @@
<%= link_to t(:channels), channels_path %> &raquo;
<%= t(:social_channel_new) %>
</h2>
<%= form_for @channel, :url => { :action => 'social_create' } do |c| %>
<%= error_messages_for 'channel', :header_message => t(:try_again), :message => t(:channel_error) %>
<input name='userlogin' class='userlogin' />
@ -18,49 +18,49 @@
</tr>
<tr>
<td class="left"><%= t(:channel_directions) %></td>
<td><%= c.text_area :description, :cols => 30, :rows => 4 %></td>
<td><%= c.text_area :description, :cols => 30, :rows => 4 %></td>
</tr>
<%= fields_for :tags do |t| %>
<tr>
<td class="left"><%= t(:tags) %></td>
<td><%= t.text_area :name, :cols => 30, :rows => 2, :value => @channel.list_tags %></td>
<td><%= t.text_area :name, :cols => 30, :rows => 2, :value => @channel.list_tags %></td>
</tr>
<% end %>
<tr>
<td class="left"><%= t(:field) %> 1</td>
<td><%= c.text_field :field1 %></td>
<td><%= c.text_field :field1 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 2</td>
<td><%= c.text_field :field2 %></td>
<td><%= c.text_field :field2 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 3</td>
<td><%= c.text_field :field3 %></td>
<td><%= c.text_field :field3 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 4</td>
<td><%= c.text_field :field4 %></td>
<td><%= c.text_field :field4 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 5</td>
<td><%= c.text_field :field5 %></td>
<td><%= c.text_field :field5 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 6</td>
<td><%= c.text_field :field6 %></td>
<td><%= c.text_field :field6 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 7</td>
<td><%= c.text_field :field7 %></td>
<td><%= c.text_field :field7 %></td>
</tr>
<tr>
<td class="left"><%= t(:field) %> 8</td>
<td><%= c.text_field :field8 %></td>
<td><%= c.text_field :field8 %></td>
</tr>
<tr>
<td class="left"><%= t(:message_field) %></td>
<td><%= c.text_field :status %></td>
<td><%= c.text_field :status %></td>
</tr>
<tr>
<td class="left"></td>
@ -68,7 +68,7 @@
</tr>
</table>
<% end %>
</div>
<div id="sidebar" class="ML60 medium">
@ -92,7 +92,7 @@
}
// when document is ready
$(function() {
$(document).on('page:load ready', function() {
// events to automatically create slug field
$('#channel_name').keyup(function() {
@ -104,4 +104,5 @@
});
</script>
</script>

View File

@ -26,11 +26,11 @@
text-align: left;
color: #656fad;
border: 1px solid #535353;
}
#content {
margin: 0 auto;
text-align: left;
text-align: left;
width: 980px;
}
#social {
@ -51,19 +51,19 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22749436-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<body>
<div id="content">
<div id="social">
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitter.com/share?via=socialsensors" class="twitter-share-button">Tweet</a>
@ -76,26 +76,26 @@
<%= link_to 'XML', "#{@api_domain}channels/#{@channel.id}/feed.xml?results=100&location=true&offset=0&round=2&status=true" %>
<%= link_to 'CSV', "#{@api_domain}channels/#{@channel.id}/feed.csv?results=100&location=true&offset=0&round=2&status=true" %>
</div>
<div style="clear:both;"></div>
<div style="float:left; padding-right: 40px;">
<a href="http://www.socialsensornetwork.com">
<img src='<%= "#{@api_domain}images/social_sensor_network_logo.png "%>' width='120' height='120' border='0' />
</a>
</div>
<div style="display: block; padding-top: 25px;">
<h2><%= @channel.name %></h2>
</div>
<br class="CB" />
<% if !@channel.description.blank? %>
<div class="default_text"><%= t(:channel_directions) %>: <%= @channel.description %></div>
<br>
<% end %>
<%= form_tag "#{@post_url}" do %>
<table>
<% @fields.each do |f| %>
@ -110,7 +110,7 @@
<td><%= text_area_tag :status %></td>
</tr>
<% end %>
<tr>
<td></td>
<td>
@ -118,38 +118,38 @@
<span id="msg" />
</td>
</tr>
</table>
<% end %>
<br><br>
<div style="float: left; width: 600px;">
<iframe width="600" height="300" frameborder="0" scrolling="no" style="border: 1px solid #cccccc;" src="<%= @api_domain %>channels/<%= @channel.id %>/maps/default?width=600&height=300&results=100&round=2&status=true&dynamic=true"></iframe>
<% @fields.each do |f| %>
<br><br>
<iframe width="600" height="300" frameborder="0" style="border: 1px solid #cccccc;" src="<%= @api_domain %>channels/<%= @channel.id %>/charts/<%= f[-1] %>?width=600&height=300&results=100&round=2&color=C46353&location=true&dynamic=true&push=false&max=20000&min=-20000"></iframe>
<% end %>
<div id="footer">
<br><br>
&copy;2011 Social Sensor Network - Powered by <a href="https://www.thingspeak.com/">ThingSpeak</a>
</div>
</div>
<div style="float: right; width: 300px;">
<iframe width="300" height="1100" frameborder="0" scrolling="no" allowTransparency="true" style="border: 0;" src="<%= @api_domain %>channels/<%= @channel.id %>/social_feed"></iframe>
</div>
</div>
<script type="text/javascript" src="<%= @api_domain %>javascripts/rest.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
// keep track of whether user entered something in the form
@ -208,7 +208,7 @@
handleNoGeolocation();
}
}
// use maxmind's geoip service
function handleNoGeolocation() {
var latitude = geoip_latitude();
@ -227,7 +227,7 @@
$.create(
// url to post to
'<%= @post_url %>',
// data to send
{
<% @fields.each do |f| %>
@ -238,14 +238,14 @@
location: location<%= ',' if !@channel.status.blank? %>
<% if !@channel.status.blank? %>status: $('#status').val()<% end %>
},
// if post was successful
function (response) {
var msg = (response == '0') ? '<%= t(:saved_error) %>' : '<%= t(:social_saved) %>';
$('#msg').html(msg);
clearMsg();
},
// if post failed
function (response) {
$('#msg').html('<%= t(:saved_error) %>');
@ -261,12 +261,12 @@
// clears message
function clearMsg() {
setTimeout(function() {
$('#msg').html('');
$('#msg').html('');
}, 3000);
}
// when document is ready
$(function() {
$(document).on('page:load ready', function() {
// event to make sure user types something into form
<% @fields.each do |f| %>
@ -306,3 +306,4 @@
</body>
</html>

View File

@ -2,11 +2,11 @@
<html>
<head>
<script type="text/javascript" src="http<%= 's' if @ssl %>://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="<%= @map_domain %>/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="<%= @map_domain %>/maps/api/js?sensor=false"></script>
<script type="text/javascript">
// when document is ready
$(function() {
$(document).on('page:load ready', function() {
// google maps options
var myOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP
@ -30,7 +30,7 @@
title: data.channel.name
});
marker.setMap(map);
marker.setMap(map);
map.setCenter(latlng);
map.setZoom(4);
@ -41,4 +41,5 @@
<body style="padding: 0; margin: 0;">
<div id="map_canvas" style="width: <%= params[:width] ? params[:width].to_i : @width.to_i %>px; height: <%= params[:height] ? params[:height].to_i : @height.to_i %>px;"></div>
</body>
</html>
</html>

View File

@ -2,11 +2,11 @@
<html>
<head>
<script type="text/javascript" src="<%= @map_domain %>/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="<%= @map_domain %>/maps/api/js?sensor=false"></script>
<script type="text/javascript">
// when document is ready
$(function() {
$(document).on('page:load ready', function() {
// google maps options
var myOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP
@ -21,7 +21,7 @@
if (data == '-1') {
$('#chart-container').append('<%= t(:chart_no_access) %>');
}
// set channel field names
if (data.channel.field1) { field1 = data.channel.field1; }
if (data.channel.field2) { field2 = data.channel.field2; }
@ -55,8 +55,8 @@
title: title
});
marker.setMap(map);
bounds.extend(latlng);
marker.setMap(map);
bounds.extend(latlng);
}
});
@ -79,12 +79,12 @@
setInterval(function() {
// get the data with a webservice call
$.getJSON('<%= "#{@domain}channels/#{params[:channel_id]}/feed/last.json?callback=?&location=true&offset=0#{@qs}" %>', function(data) {
$.getJSON('<%= "#{@domain}channels/#{params[:channel_id]}/feed/last.json?callback=?&location=true&offset=0#{@qs}" %>', function(data) {
// if there is data to add
if (data) {
lat = parseFloat(data.latitude);
lng = parseFloat(data.longitude);
if (lat && lng) {
latlng = new google.maps.LatLng(lat, lng);
title = '';
@ -101,8 +101,8 @@
position: latlng,
title: title
});
marker.setMap(map);
marker.setMap(map);
}
}
});
@ -117,3 +117,4 @@
<div id="map_canvas" style="width: <%= params[:width] ? params[:width].to_i : @width.to_i %>px; height: <%= params[:height] ? params[:height].to_i : @height.to_i %>px;"></div>
</body>
</html>

View File

@ -57,7 +57,7 @@
<script type="text/javascript">
// when document is ready
$(function() {
$(document).on('page:load ready', function() {
// allow tabs to work in textareas
$("textarea").tabby();

View File

@ -13,12 +13,12 @@
<% end %>
<div>
<script>
$(function () {
$(document).on('page:load ready', function() {
$(".timeago").timeago();
var refreshInterval = setInterval(refreshStatus, 1 * 60 * 1000);
});
});
function refreshStatus() {
$.getJSON("/channels/<%= @channel_id %>/status/recent", function(data){
//look for most recent status and only append if the new status has a greater entry_id
@ -28,14 +28,14 @@ function refreshStatus() {
for(var i in data) {
if (data[i].entry_id > firstId) {
$(".recent_status").prepend("<div><span class=\"status_messages\" id=\"" +
data[i].entry_id + "\">"+
$(".recent_status").prepend("<div><span class=\"status_messages\" id=\"" +
data[i].entry_id + "\">"+
data[i].status +
"</span><br><abbr class=\"timeago\" title=\"" +
data[i].created_at + "\">" +
"</span><br><abbr class=\"timeago\" title=\"" +
data[i].created_at + "\">" +
data[i].created_at + "</abbr></div></br>");
}
}
$(".timeago").timeago();
});
@ -44,3 +44,4 @@ function refreshStatus() {
</script>
</body>
</html>

View File

@ -1,7 +1,6 @@
<script>
$(function() {
$(document).on('page:load ready', function() {
$("#tabs").tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {

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

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