Sha256: 9d430207d546045558b6570822654157183813582a2016929b3ca11e63f42510

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

class @AntsMenu
  constructor: (@title, @apiPath) ->
    @objectStore = new RailsObjectStore
      resource: 'menu'
      path: "#{ @apiPath }"

    @formSchema =
      links:
        type: 'documents'
        newButtonLabel: 'Add a Link'
        sortBy: '_position'
        label: false
        formSchema:
          title:
            type: "string"
            placeholder: "Title"

          url:
            type: "url"
            placeholder: "Path or URL, e.g. /about"
            onInitialize: (input) =>
              @_add_preview_action(input)

    @onViewShow = (view) ->
      view.$el.addClass "view-menu"

  _add_preview_action: (input) ->
    input.$actions =$ "<span class='input-actions'></span>"
    input.$el.append input.$actions

    input.$previewBtn =$ """<a href='#{input.value}' target='_blank'>
                              #{Icons.preview}
                            </a>"""
    input.$actions.append input.$previewBtn

    input.$input.on "change", (e) ->
      link = input.$input.val()
      input.$previewBtn.attr "href", link

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ants-0.3.14 app/assets/javascripts/ants/menu.coffee
ants-0.3.13 app/assets/javascripts/ants/menu.coffee
ants-0.3.12 app/assets/javascripts/ants/menu.coffee
ants-0.3.11 app/assets/javascripts/ants/menu.coffee
ants-0.3.10 app/assets/javascripts/ants/menu.coffee
ants-0.3.9 app/assets/javascripts/ants/menu.coffee