Koala7
Koala7

Reputation: 1404

Drop down menu inside a Table with Haml

I need to code in haml a drop down menu inside a column of a table, i cant test it yet but i want to make sure if i am doing well with my following snippets code that i paste it down. It's just a css dropdown on hover

 %thead
     %tr
      %th.date.header
        = "#{t :"date"}"
          %a
            ="#{t :"main_link"}"
          %ul
              %li
                 ="#{t :"link1"}"
              %li
                 ="#{t :"link2"}"
              %li
                 ="#{t :"link3"}"

  %th.header 
    = "#{t :"Sports"}"
  %th.header 
    = "#{t :"Event"}"
  %th.header 
    = "#{t :"Media"}"

I write also how the Css would be

.date.header ul { display: none}
.date.header ul:hover {display: block}

Is this a good way? How i can improve it?

Upvotes: 0

Views: 473

Answers (1)

jvnill
jvnill

Reputation: 29599

I'd write your code this way

%thead
  %tr
    %th.date.header
      = t('date')
      %a= t('mail_link')
      %ul
        %li= t('link1')
        %li= t('link2')
        %li= t('link3')

    %th.header= t('Sports')
    %th.header= t('Event')
    %th.header= t('Media')

Upvotes: 1

Related Questions