pwnstyles_rails 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0235b18b2dd43aad38103c6d16a3355a6fc143a
4
- data.tar.gz: b97bf048a1cb51197c33f2f51ecf5e87f3d0f9bc
3
+ metadata.gz: 11a2d0a57d389cfb2bd7912c6e45ee8e2ff09183
4
+ data.tar.gz: 81e5d7207360791b6227af565c8a8a1b0ad2fec2
5
5
  SHA512:
6
- metadata.gz: 7cb3097ca8dc9b83cad0d56fdb9d286cb1be6c6ccee6b5a4a43bbf08e91a5d37324ba78b34b37e4f42038714272cc545663066dd2acbfd848037035782134961
7
- data.tar.gz: 990d4be181ca1a1f563b6d575ed627a106f5d09a21705b2bd7c62e331044b82663af007c9ccd81c590fd95e76354a2dd1e80752d6740b690f9c94aab08e0909d
6
+ metadata.gz: e989aadc79ae3965d17b9e3ce558309d8cfd24393ba40bbfb671c186b43fc58e691ceafe90ff5b2d9cc8c2fe9129308a3329d6d967496b496fea1c26d9ea7716
7
+ data.tar.gz: cd90d32ee4a69e19ac4e3d6f7e4fce7ade86147cdd893cdca164bc312e2f00398deec97a8eb0e1db442fd4fbdc5ee41c2507c60333a6e1fa2cc3c46d4222ef52
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
@@ -404,6 +404,51 @@ class PwnFxHide
404
404
  PwnFx.registerEffect 'hide', PwnFxHide
405
405
 
406
406
 
407
+ # Disables / enables elements when an element is clicked or checked / unchecked.
408
+ #
409
+ # Attributes:
410
+ # data-pwnfx-disable: a name for the events caused by this element's triggering
411
+ # data-pwnfx-disable-trigger: "click" means events are triggered when the
412
+ # element is clicked, "checked" means events are triggered when the
413
+ # element is checked; (default: click)
414
+ # data-pwnfx-disable-positive: set to the same value as data-pwnfx-disable on
415
+ # elements that will be disabled when a positive event (click / check) is
416
+ # triggered, and enabled when a negative event (uncheck) is triggered
417
+ # data-pwnfx-disable-negative: set to the same value as data-pwnfx-disable on
418
+ # elements that will be enabled when a positive event (click / check) is
419
+ # triggered, and disabled when a negative event (uncheck) is triggered
420
+ class PwnFxDisable
421
+ constructor: (element, identifier, scopeId) ->
422
+ trigger = element.getAttribute('data-pwnfx-disable-trigger') || 'click'
423
+ positiveSelector = "[data-pwnfx-disable-positive=\"#{identifier}\"]"
424
+ negativeSelector = "[data-pwnfx-disable-negative=\"#{identifier}\"]"
425
+ onChange = (event) ->
426
+ positive = (trigger is 'click') || element.checked
427
+ disableSelector = if positive then positiveSelector else negativeSelector
428
+ enableSelector = if positive then negativeSelector else positiveSelector
429
+
430
+ scope = PwnFx.resolveScope scopeId, element
431
+ for targetElement in PwnFx.queryScope(scope, disableSelector)
432
+ targetElement.disabled = true
433
+ for targetElement in PwnFx.queryScope(scope, enableSelector)
434
+ targetElement.disabled = false
435
+ if trigger is 'click'
436
+ event.preventDefault()
437
+ false
438
+ else
439
+ true
440
+
441
+ if trigger is 'click'
442
+ element.addEventListener 'click', onChange, false
443
+ else if trigger is 'checked'
444
+ element.addEventListener 'change', onChange, false
445
+ onChange()
446
+ else
447
+ throw new Error("Unimplemented pwnfx-disable trigger #{trigger}")
448
+
449
+ PwnFx.registerEffect 'disable', PwnFxDisable
450
+
451
+
407
452
  # Shows / hides elements in a DOM depending on an input's value.
408
453
  #
409
454
  # Attributes:
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: pwnstyles_rails 0.2.6 ruby lib
5
+ # stub: pwnstyles_rails 0.2.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pwnstyles_rails"
9
- s.version = "0.2.6"
9
+ s.version = "0.2.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Victor Costan"]
14
- s.date = "2015-10-23"
14
+ s.date = "2015-10-28"
15
15
  s.description = "Included CSS was designed for reuse across pwnb.us apps."
16
16
  s.email = "victor@costan.us"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwnstyles_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-23 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass-rails