express_templates 0.11.14 → 0.11.15

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: 37e0aee40d1e423259f8a277828f5972e8f2fcd5
4
- data.tar.gz: d0f88711a06abeb927c608db9eb7f5ab4cf5e0e8
3
+ metadata.gz: 06a22fa8551d60cb0e140fc4d1b05af93a24c7fa
4
+ data.tar.gz: bf5bdbf96e5a3cde426b4934dc36df89dd5be1c6
5
5
  SHA512:
6
- metadata.gz: dfed066435c02c8b1ea55c232d9066e446dc1edbfd1db8734af9dbe130b618ac3f87f0dc96452fe882ae829960922af25aef4b48827e52c2f2cb181922f60f67
7
- data.tar.gz: 5f852c84dfebc6710d721a5273f6c2ed5ea69cfd67219b5da87e9d94b3560e4c3b194a8adbaf0ccaaf6716cd0b537b67239789f3935df4686089da2872685628
6
+ metadata.gz: ff9a03858ffbcb5589ec51571f86231501c3c200f815d0e9a61ae97840706a674c093e7720c940641fb01f6f7a9dcfa714ab8ec60a95d828bf0b763910d51e99
7
+ data.tar.gz: 89ea3234826a6fe0ed4778b4880708504f931c730c6e5eabaaa800e64f09c91a1b2f2256463442816598fee61044db709af3a48f20ab7e7cce59a795165787b0
@@ -0,0 +1,59 @@
1
+ module ExpressTemplates
2
+ module Components
3
+ module Capabilities
4
+
5
+ # For compononets that only display themselves
6
+ # conditionally
7
+ module Suppressable
8
+ def self.included(base)
9
+ base.class_eval do
10
+
11
+ class_attribute :suppression_condition_name
12
+ self.suppression_condition_name = nil
13
+
14
+ class_attribute :reverse_suppression_condition
15
+ self.reverse_suppression_condition = false
16
+
17
+ def self.emits_unless(name)
18
+ self.suppression_condition_name = name
19
+ self.reverse_suppression_condition = true
20
+ include OverrideMethods
21
+ end
22
+
23
+ def self.emits_if(name)
24
+ self.suppression_condition_name = name
25
+ include OverrideMethods
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ module OverrideMethods
32
+ def start_tag
33
+ if reverse_suppression_condition
34
+ super unless self.send(suppression_condition_name)
35
+ else
36
+ super if self.send(suppression_condition_name)
37
+ end
38
+ end
39
+
40
+ def end_tag
41
+ if reverse_suppression_condition
42
+ super unless self.send(suppression_condition_name)
43
+ else
44
+ super if self.send(suppression_condition_name)
45
+ end
46
+ end
47
+
48
+ def build(*args)
49
+ if reverse_suppression_condition
50
+ super(*args) unless self.send(suppression_condition_name)
51
+ else
52
+ super(*args) if self.send(suppression_condition_name)
53
+ end
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
@@ -19,6 +19,7 @@ module ExpressTemplates
19
19
  class Component < Components::Base
20
20
  include Components::Capabilities::Configurable
21
21
  include Components::Capabilities::Hideable
22
+ include Components::Capabilities::Suppressable
22
23
  end
23
24
 
24
25
  class Container < Components::Container
@@ -1,3 +1,3 @@
1
1
  module ExpressTemplates
2
- VERSION = "0.11.14"
2
+ VERSION = "0.11.15"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: express_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.14
4
+ version: 0.11.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Talcott Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-14 00:00:00.000000000 Z
12
+ date: 2017-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -172,6 +172,7 @@ files:
172
172
  - lib/express_templates/components/capabilities/configurable.rb
173
173
  - lib/express_templates/components/capabilities/hideable.rb
174
174
  - lib/express_templates/components/capabilities/resourceful.rb
175
+ - lib/express_templates/components/capabilities/suppressable.rb
175
176
  - lib/express_templates/components/configurable.rb
176
177
  - lib/express_templates/components/container.rb
177
178
  - lib/express_templates/components/content_for.rb