title: using Bootstrap-Progressbar.js to dynamically render progress bars in a Rails project
body: <p>I am attempting to use Bootstrap-Progressbar.js  <a href="https://github.com/minddust/bootstrap-progressbar" rel="nofollow">https://github.com/minddust/bootstrap-progressbar</a>  to dynamically render a progressbar based upon a user's percentage complete (of an event). I calculate the VALUE in the users controller:</p>
  
  <pre><code># Calculate percentage complete
    if @hours_total &lt;= 120
      @hours_total_raw = @hours_total                            
      @hours_total_percentage = (@hours_total).to_f/120.to_f.round(0)
    else @hours_total &gt;= 121
      @hours_total_raw = 120
      @hours_total_percentage = 100
    end
  </code></pre>
  
  <p>In the user's status page, I have the Bootstrap progressbar code (as shown by Minddust, above):</p>
  
  <pre><code>&lt;div class="progress"&gt;
    &lt;div class="progress progress-bar-success" role="progressbar" aria-valuenow = "VALUE"
    aria-valuemin="0" aria-valuemax="100"&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As an aside, Minddust says to replace aria-valuenow with data-transitionsgoal.  Unfortunately, that "bricked" my progressbar (in Chrome on a Mac) to use Minddust's term, so I reverted to aria-valuenow.  </p>
  
  <p>The VALUE is passed TO - not from - the following javascript to render the progressbar:</p>
  
  <pre><code>$(document).ready(function() {
    $(".progress .progress-bar-success").progressbar({
  });
  </code></pre>
  
  <p>This is the basic functionality show in Minddust's demos.  The progressbar correctly renders as a percentage of 100% whatever number I manually make VALUE.  How do I pass a number to VALUE - which is inside the div brackets &lt; div ... aria-valuenow = "VALUE"  >.  "VALUE" is an instance variable that has not been saved to the database; it is calculated on the fly.</p>
  
  <p>The answers I found on Stackoverflow, e.g., the excellent answer to question # 21182058 (passing a pre-defined value from a checkbox), all recommend using javascript; however, they all deal with situations where one is passing in a value from html and not dynamically changing that value.  </p>
  
  <p>I've tried a variety of approaches, even passing the value as "data" attached to the link that re-directs the user to the status page with no luck.  Is what I want to do even feasible?  Is there a gem - or different approach all together - that will accomplish this?  Thank you in advance for your help.</p>