JavaScript Javascript executing despite ruby conditional statement

I'm having a small issue with javascript code being executed with no regards for ruby conditional statements.

Despite both pieces of JS being executed, only the right HTML balises are shown. (if notice, I'll only see <div role="notice"> and if it's the error, I'll only see <div role="alert"> but the javascript inside is definitely executed no matter what)

- if notice
  .row
    %div{role: 'notice'}
      :javascript
        toastr.success('#{notice}','Success')
      })
- if alert
  .row
    %div{role: 'alert'}
      :javascript
      $(function () {
        toastr.error('#{alert}','Error')
      })

I must be missing something obvious, but I can't seem to find what it is.

Thanks a lot for the help

Answer:1

I'm trying to color rows based on "Status" which can be Red/Green. Using dynatable to generate table rows based from JSON data. The problem is that whenever I call the following code from dynatable, ...

I'm trying to color rows based on "Status" which can be Red/Green. Using dynatable to generate table rows based from JSON data. The problem is that whenever I call the following code from dynatable, ...

  1. shade rows based on cell value in excel
  2. shade rows based on value
  3. excel coloring rows based on cell value

I work with Rails 4. I have a User model and a Record model and I want to send to the create method of the controller two javascript variables. To do this I implemented an AJAX call : var funds = $(...

I work with Rails 4. I have a User model and a Record model and I want to send to the create method of the controller two javascript variables. To do this I implemented an AJAX call : var funds = $(...

Does anyone know why this happens? Placing an image and then setting a setInterval function to animate it. Then adding HTML to the parent div breaks the animation. document.getElementById('whiteboard'...

Does anyone know why this happens? Placing an image and then setting a setInterval function to animate it. Then adding HTML to the parent div breaks the animation. document.getElementById('whiteboard'...

I'm trying to code an exercise in html page with javascript, to calculate the mean of a random array of 6 numbers that generated from randomArray() function. After the first loading of the page and ...

I'm trying to code an exercise in html page with javascript, to calculate the mean of a random array of 6 numbers that generated from randomArray() function. After the first loading of the page and ...

  1. pass values from child to parent react
  2. pass values from view to controller mvc
  3. pass values from powerapps to flow
  4. pass values from html to javascript
  5. pass values from view to controller
  6. pass values from parent to child angular
  7. pass values from javascript to php
  8. pass values from lightning component to flow
  9. pass values from html to php
  10. pass values from activity to fragment
  11. pass values from aura to lwc
  12. pass values from html to html
  13. pass values from servlet to jsp
  14. pass values from jsp to java class
  15. pass values from js to html
  16. pass values from fragment to fragment android