Sha256: 162dd5157651e3f085d7a04488d8ca2a96137f43497f5288524771a4a821599d

Contents?: true

Size: 1.68 KB

Versions: 12

Compression:

Stored size: 1.68 KB

Contents

decko.slot.ready (slot)->
  slot.find('._setting-filter').each () ->
    decko.filterRulesByCategory $(this).closest(".card-slot"), $(this).find('input._setting-category:checked').attr("id")

$.extend decko,
  filterRulesByCategory: (container, category) ->
    $(container).find('._setting-list ._setting-group').each (_i) ->
      $list = $(this)
      items = $list.find('._rule-item')
      hiddenCount = 0
      items.each () ->
        $item = $(this)
        wrapper = if $item.parent().is("li") then $item.parent() else $item
        if $item.hasClass("_category-#{category}")
          wrapper.show()
        else
          wrapper.hide()
          hiddenCount += 1

      if (hiddenCount == items.length)
        $list.hide()
      else
        $list.show()
        $list.find('._count').html(items.length - hiddenCount)

$(window).ready ->
  # permissions mod
  $('body').on 'click', '.perm-vals input', ->
    $(this).slot().find('#inherit').attr('checked',false)

  $('body').on 'click', '.perm-editor #inherit', ->
    slot = $(this).slot()
    slot.find('.perm-group input:checked').attr('checked', false)
    slot.find('.perm-indiv input').val('')

  # rstar mod
  $('body').on 'click', '._rule-submit-button', ->
    f = $(this).closest('form')
    checked = f.find('._set-editor input:checked')
    if checked.val()
      if checked.attr('warning')
        confirm checked.attr('warning')
      else
        true
    else
      f.find('._set-editor').addClass('warning')
      $(this).notify 'To what Set does this Rule apply?'
      false

  $('body').on 'click', 'input._setting-category', ->
    category = $(this).attr("id")
    decko.filterRulesByCategory($(this).closest('.card-slot'), category)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-rules-0.18.1 assets/script/rules.js.coffee
card-mod-rules-0.18.0 assets/script/rules.js.coffee
card-mod-rules-0.17.0 assets/script/rules.js.coffee
card-mod-rules-0.16.0 assets/script/rules.js.coffee
card-mod-rules-0.15.6 assets/script/rules.js.coffee
card-mod-rules-0.15.5 assets/script/rules.js.coffee
card-mod-rules-0.15.4 assets/script/rules.js.coffee
card-mod-rules-0.15.3 assets/script/rules.js.coffee
card-mod-rules-0.15.2.pre1 assets/script/rules.js.coffee
card-mod-rules-0.15.1.1 assets/script/rules.js.coffee
card-mod-rules-0.15.1 assets/script/rules.js.coffee
card-mod-rules-0.15.0 assets/script/rules.js.coffee