Jake

Joined

1,260 Experience
12 Lessons Completed
0 Questions Solved

Activity

nice way to round out the tutorial! thanks for all your hard work

Great tutorial.

Unfortunately, this breaks the max_nesting from the last episode :/

great catch @Marc Köhlbrugge

Great tutorial.

One thing, if you're using rich_text instead of normal text fields for the comment body, then when rendering you'll want to add the id to the render, or else all of the rich_text editors (event the nested ones) will have the same id, and nothing will save.

for app/views/comments/_form.html.erb

<%= form_with model: [commentable, Comment.new], local: true, html: { class: local_assigns[:class], data: { target: local_assigns[:target] } } do |form| %>
  <div class="form-group">
    <%= form.rich_text_area :body, id: local_assigns[:parent_id] %>
  </div>
  <div class="form-group">
    <%= form.hidden_field :parent_id, value: local_assigns[:parent_id] %>
    <%= form.submit class: "btn btn-primary" %>
  </div>
<% end %>

really great episode, this was everything i needed to install what i was working on, tablesort javascript library.

only thing was, that import didn't work and i had to use require instead. not sure why
var Tablesort = require('tablesort')

the finished code in app/javascript/packs/application.js

var Tablesort = require('tablesort')
document.addEventListener("turbolinks:load", () => {
  document.querySelectorAll('[data-tablesort]').forEach(
    function(table) { new Tablesort(table) }
  )
})

Posted in Stimulus JS Framework Introduction Discussion

always appreciate the little humor, calling the app "stimulating" Lol

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.