inesita-rb / inesita

Frontend web application framework in Ruby using Opal.
https://inesita.fazibear.me/
MIT License
259 stars 15 forks source link

Call js with an element after render (external library) #14

Closed olegantonyan closed 8 years ago

olegantonyan commented 8 years ago

Hi! If after_render is bad, how can I use libraries such as datetime pickers (http://bevacqua.github.io/rome/, https://tarruda.github.io/bootstrap-datetimepicker)? It requires you to call function with an element. This crap works:

def after_render
  `elements = document.getElementsByClassName("timepicker"); for(var i = 0; i < elements.length; i++) { rome(elements[i], { date: false, timeInterval: 600 }); }`
end

But it's ugly. What is the best practice to deal with external libraries like these?

fazibear commented 8 years ago

Just like in react. You can write you own timepicker component, or use crap like this.