I am aware of this post here:
Ruby Slim - How do you define an element's class with a rails helper or variable?
and I have tried all three solutions. For me unfortunately not one of them is working.
forum.rb
.panel
.panel-heading
.span = @forum.name
.panel-body
.row
.col-md-7 #{t('global.topic')}
.col-md-3.value.title
.col-md-1.value.topic
.col-md-1.value.date
forum_feed.js.coffee
window.ForumFeedUI = flight.component ->
@defaultAttrs
titleSelector: '.value.volume'
topicSelector: '.value.topic'
dateSelector: '.value.date'
@refresh = (event, data) ->
@update @select('volumSelector'), data.volume
@update @select('topicSelector'), data.topic
@update @select('dateSelector'), data.date
It all works as expected when I want to print the variables as text on the website. However I need the divs containing as well the variable for the title. Whatever I try I am unable to get the divs class with the variable of the title.
I believe I need to create a helper something along these lines and a content_tag:
content_tag(:div, content_tag(:p, "Hello world!"), class: "strong")
div = t(".#{forum_title title}")
def forum_title(title, &block)
content_tag :div, class: "col-md-3-#{title}" do
capture(&block)
end
end