Sha256: ebffc455bb4ff241aecf65fa843bc012d9365941f45d84d6d105d9add8fd0569

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

$(document).on 'click', '.gallery .item:not(.item-uploader)', ->
  gallery = $(this).parents('.gallery')

  if gallery.data('multiselect') != undefined
    $(this).toggleClass('selected')
    checkbox = $(this).find('input:checkbox')
    checkbox.prop("checked", !checkbox.prop("checked"))
    $form = $(this).closest('form')
    count = $form.find('.item.selected').size()
    if count > 0
      $form.find('.gallery-select-counter').text("(#{count})")
    else
      $form.find('.gallery-select-counter').text("")
  else
    gallery.find('.item').removeClass('selected')
    gallery.find('.item input').prop('checked', false)
    $(this).toggleClass('selected')
    $(this).find('input').prop('checked', true)
    $(this).closest('form').submit()

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spina-template-0.3.3 app/assets/javascripts/spina/galleryselect.coffee
spina-template-0.3.2 app/assets/javascripts/spina/galleryselect.coffee
spina-template-0.3.1 app/assets/javascripts/spina/galleryselect.coffee