I'm having trouble making a jQuery UI indeterminate progressbar work properly in a Rails application. I'm basing my work off the jQuery-UI API demos at http://jqueryui.com/progressbar/#indeterminate and am trying to adapt this for my application.
The key parts of the jQuery example code that I'm trying to emulate are:
$(function() { $( "#progressbar" ).progressbar({value: false});
<style> #progressbar .ui-progressbar-value {background-color: #ccc;}</style>
<div id="progressbar"></div>
The key pieces of code in my Rails app are as follows:
application.js:
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree ./sitewide
page-specific JS (event.js) - included in views/events/new.html.erb:
$(document).ready(function() { $( '#progressbar' ).progressbar();
//$( '#progressbar' ).css({background: '#aa0000'});
$( '#progressbar' ).progressbar( { value: false } );
});
application.css:
@import url(http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css);
events.css.scss:
#progressbar .ui-progressbar-value { background-color: #ccc; }
views/events/new.html.erb:
<div id="progressbar"></div>
<%= javascript_include_tag "events" %>
Resulting HTML in served page:
<div id="progressbar"></div>
<script src="/assets/events.js?body=1" type="text/javascript"></script>
This code produces a blank white bar in the progressbar div, rather than the grey animated bar from the jQuery demo. If I remove the comments in the document.ready function, the bar changes to red (#aa0000), but it's still not animated, just static. I would greatly appreciate any insight anyone has into this behaviour.
Update: I found the following thread - https://forum.jquery.com/topic/progressbar-api-redesign#14737000003912014 - which suggests that the animated overlay GIF file has not been included in the theme packages yet, so I downloaded it and installed it in assets/images/animated-overlay.gif, but it still doesn't work. I found the following lines in the Smoothness theme CSS file:
.ui-progressbar .ui-progressbar-overlay {
background: url("images/animated-overlay.gif");
height: 100%;
filter: alpha(opacity=25);
opacity: 0.25;
}
so I think I'm putting the image in the right place. Any suggestions?