How do I convert this haml code to erb?

384 Views Asked by At

Need to convert this HAML code to ERB. Getting errors when I use the HamltoErb converter. Any help will be appreciated.

%header.main{:class => @full_header ? 'full' : 'basic'}
  .inner
    / Primary navigation
    %nav.main
      %ul
        %li= link_to "Home", root_path, :nav_item => :home
        %li
          = link_to "Our catalogue", catalogue_path, :nav_item => :catalogue, :class => 'noborder'
          %ul
            - for category in Shoppe::ProductCategory.ordered
              %li= link_to category.name, products_path(category.permalink)
        %li= link_to "Why shop with us?", page_path(:why), :nav_item => :why
        %li= link_to "FAQs", page_path(:faqs), :nav_item => :faqs
        %li= link_to "Get in touch", page_path(:contact), :nav_item => :contact
      %h1= link_to Shoppe.settings.store_name, root_path

    - if @full_header
      %h2 Welcome to our <em>shoppe</em>.
      %p.intro Check out our lovely products on this page and then you can buy them through the website with just a few clicks using our supremely simple ordering system.

  - if @full_header
    .bar
      .inner
        %p.call Call us today on <b>01202 901 101</b> if you have any questions.
        %p.offer <b>This week only!</b> FREE next day shipping on all orders over &pound;30.
1

There are 1 best solutions below

1
On BEST ANSWER

First google search for converter: https://haml2erb.org/

Converting returns error:

(line 1, column 37):
unexpected "?"
expecting space, "(" or "["

Meaning he doesn't understand ? in that context. First guess is to change first line to:

%header.main{:class => (@full_header ? 'full' : 'basic')}

Ohmygoditworks.

Try to put a little effort into something before posting it here