Sha256: 7524781a8d9252fa9c573deedc849d3b8ee835d7dc13ff0c1e0659a472f122b7

Contents?: true

Size: 958 Bytes

Versions: 2

Compression:

Stored size: 958 Bytes

Contents

window.hancock_cms.gallery.gallery_loader = (target = "[data-hancock-gallery-gallery-loader]")->
  $(document).delegate target, "click", (e)->
    e.preventDefault()

    link = $(e.currentTarget)
    url = link.attr('href')
    url = link.data("url") if !url or url == ""
    if url and url != ""
      $.get url, (data)->
        _target_selector = link.data("target-selector")
        if _target_selector and _target_selector != ""
          _target = $(_target_selector)
          if _target.length > 0
            if link.data("target-replace") == "true"
              _target.replaceWith(data)
            else
              _target.html(data)
            if link.data("loader-remove") == "true"
              link.remove()

        else
          if link.data("loader-insert-data") == "true"
            link.html(data)
          else
            link.replaceWith(data)

        window.hancock_cms.gallery.construct_pages_selector()

    return false

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hancock_cms_gallery-1.0.2 app/assets/javascripts/hancock/gallery/loaders/gallery_loader.coffee
hancock_cms_gallery-1.0.0 app/assets/javascripts/hancock/gallery/loaders/gallery_loader.coffee