Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Javascript on Ruby on rails and editing the code
    primarykey
    data
    text
    <p>I am trying to modify a code in Javascript. My application is written is Ruby rails and Javascript. It is run in Heroku. I have been modifiying everything in Notepadd++, then I saved it, push it into heroku and then I see the results. </p> <p>The problem comes when I want to change something in Javascript. I have been making changes in a file called quote.js but when I change something, nothing happens. Below you can see the code I am trying to change. I this case I am just trying to take out a column called items from the labour summary table, I removed it from the variable dest and I put it in comments in labour summary. </p> <p>It seems that the changes I make here have not any effect on the whole application. Am I modifying the wrong file?</p> <p>Is this the right way to modify the javascript code in Ruby rails?</p> <p>Thanks.</p> <pre><code>var labour_summary = $(labour_line_items).inject({}, function(sum){ var key = this.pieceIdentifier(); var added = this.pieceSummary(); if(typeof sum[key] == 'undefined') { // New material in summary sum[key] = added; } else { // Add quantity to summary sum[key].hours += added.hours; sum[key].cost += added.cost; //sum[key].item += ", " + added.item; } return sum; }); var dest = this.labour_summary_table; $("tr:gt(0)", dest).remove(); $.each(labour_summary, function() { dest.append("&lt;tr&gt;&lt;td&gt;" + [$.round_two(this.hours), $.dollars(this.hourly_rate), $.dollars(this.cost)].join("&lt;/td&gt;&lt;td&gt;") + "&lt;/td&gt;&lt;/tr&gt;"); }); }, updateCustomSummary: function(e) { var custom_line_items = this.activeQuoteItems().inject([], function(is) { return $.merge(is, $(this).obj().activeCustomLineItems().get()); // grab this quote items labour line items }).collect( function() { return $(this).obj(); // extend the array and collect the labour line item objects }); var custom_summary = $(custom_line_items).inject({}, function(sum){ var key = this.pieceIdentifier(); var added = this.pieceSummary(); if(typeof sum[key] == 'undefined') { // New material in summary sum[key] = added; } else { // Add quantity to summary sum[key].quantity += added.quantity; sum[key].cost += added.cost; //sum[key].item += ", " + added.item; } return sum; }); var dest = this.custom_summary_table; $("tr:gt(0)", dest).remove(); $.each(custom_summary, function() { dest.append("&lt;tr&gt;&lt;td&gt;" + [this.customName, this.quantity, $.dollars(this.costPerPiece), $.dollars(this.cost), this.item].join("&lt;/td&gt;&lt;td&gt;") + "&lt;/td&gt;&lt;/tr&gt;"); }); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload