Sha256: fcc76ece8b348a69cfef2cd6f31968e7effa6ff803f5b1c45ae33ed1b4d18927

Contents?: true

Size: 900 Bytes

Versions: 4

Compression:

Stored size: 900 Bytes

Contents

$ ->

  path = "/#{$('body').data('app-name')}/body.html"
  name = $('body').data('app-name')

  $.ajax "/"+name+"/options.json"
    cache: false
    success: (data) ->
      data.menu = [] unless data.menu
      for m in data.menu
        console.log m
        el = $("<li>"
          class: 'dropdown'
        )
        a = $("<a>"
          href: "#"
          "class":"dropdown-toggle"
          "data-toggle":"dropdown"
          html: m.name
        )
        el.append(a)
        if m.submenu.length
          ul = $("<ul>"
            class: "dropdown-menu"
          )
          for sub in m.submenu
            ul.append("<li><a href='' id='#{sub.id}'>#{sub.name}</a></li>")
          el.append(ul)
        $("ul.nav").append(el)

      $.ajax "/"+name+"/body.html"
        cache: false
        success: (data) ->
          $('body').append(data)
          $(window).trigger("body_loaded")

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daftos-0.4.1 lib/libs/coffee/daftos.coffee
daftos-0.4.0 lib/libs/coffee/daftos.coffee
daftos-0.3.0 lib/libs/coffee/daftos.coffee
daftos-0.2.0 lib/libs/coffee/daftos.coffee