简体   繁体   中英

Rails helper, concat content_tag

I'm trying to use a helper for render a div inside my view, it's pretty simple.

def render_form_steps_header
    content_tag :div , class: 'col-xs-3 bs-wizard-step complete' do
        content_tag :div, class: 'text-center bs-wizard-stepnum' do
            "Step 1"
        end

        content_tag :div, class: 'progress' do
            content_tag :div, nil, class: 'progress-bar'
        end
        link_to "", "", :class => "bs-wizard-dot"
    end

end

But seems to be just taking the last line "link_to", if I remove that line, it works fine and returns the div's as expected. Any ideas?

Already fixed:

def render_form_steps_header
content_tag :div , class: 'col-xs-3 bs-wizard-step complete' do
  str = content_tag :div, class: 'text-center bs-wizard-stepnum' do
    "Step 1"
  end
  str += content_tag :div, class: 'progress' do
    content_tag :div, nil, class: 'progress-bar'
  end

  str += link_to "", "", :class => "bs-wizard-dot"
end

end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM