tb_liquid 1.0.1 → 1.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e111b1f53eaf0121c70e9f2ee742ea93e58b7f8
|
4
|
+
data.tar.gz: bd40974fdb7851ecaedd06e2a4b3c2af2994a88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 778d73d4958391a69ddfefbcba1ca1b9e5f69ab4aabe4bc68ebdd9f14794e8e61208e88a7ac5d8923b24c7cfde6d0613eee35d4b3763fdb7e7494111a44d437d
|
7
|
+
data.tar.gz: 92f36f777a36ea3a120c1b8093ace7c1f24885444c46b82e202a5c1d585b094055d3f60a847de760dc48121f47d1540ee8f2ffae322968e53aa4cfe3e37db569
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module TbLiquid
|
2
2
|
module ActsAsLiquidContent
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
|
4
5
|
included do
|
5
|
-
|
6
|
+
|
6
7
|
end
|
7
8
|
|
8
9
|
def postprocess_content()
|
@@ -10,11 +11,11 @@ module TbLiquid
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def update_spud_liquid_tag_list()
|
13
|
-
if @
|
14
|
-
@
|
14
|
+
if @tb_liquid_template_parsed.nil?
|
15
|
+
@tb_liquid_template_parsed = ::Liquid::Template.parse(self.content)
|
15
16
|
end
|
16
17
|
self.spud_liquid_tags.destroy_all
|
17
|
-
@
|
18
|
+
@tb_liquid_template_parsed.root.nodelist.each do |node|
|
18
19
|
if !node.is_a?(String) && defined?(node.tag_name) && defined?(node.tag_value)
|
19
20
|
self.spud_liquid_tags.create(:tag_name => node.tag_name,:value => node.tag_value)
|
20
21
|
end
|
@@ -22,8 +23,12 @@ module TbLiquid
|
|
22
23
|
end
|
23
24
|
|
24
25
|
module ClassMethods
|
25
|
-
attr_accessor :
|
26
|
+
attr_accessor :tb_liquid_template_parsed
|
26
27
|
def acts_as_spud_liquid_content
|
28
|
+
ActiveSupport::Deprecation.warn "acts_as_spud_liquid_content is deprecated, use acts_as_tb_liquid_content.", caller
|
29
|
+
acts_as_tb_liquid_content()
|
30
|
+
end
|
31
|
+
def acts_as_tb_liquid_content
|
27
32
|
self.class_eval do
|
28
33
|
has_many :spud_liquid_tags, :as => :attachment, :dependent => :destroy
|
29
34
|
before_save :postprocess_content
|
@@ -1,17 +1,18 @@
|
|
1
1
|
module TbLiquid
|
2
2
|
module ActsAsLiquidTag
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
|
4
5
|
included do
|
5
|
-
|
6
|
+
|
6
7
|
end
|
7
8
|
|
8
|
-
def
|
9
|
-
value_property = self.class.
|
9
|
+
def expire_tb_liquid_tags
|
10
|
+
value_property = self.class.tb_liquid_tag_value_property
|
10
11
|
values = [self.send(value_property)]
|
11
12
|
if self.respond_to?("#{value_property}_changed?") && self.send("#{value_property}_changed?")
|
12
13
|
values << self.send("#{value_property}_was")
|
13
14
|
end
|
14
|
-
SpudLiquidTag.where(:tag_name => self.class.
|
15
|
+
::SpudLiquidTag.where(:tag_name => self.class.tb_liquid_tag_name, :value => values).includes(:attachment).each do |tag|
|
15
16
|
attachment = tag.attachment
|
16
17
|
if attachment.respond_to?(:postprocess_content)
|
17
18
|
attachment.postprocess_content()
|
@@ -23,13 +24,17 @@ module TbLiquid
|
|
23
24
|
end
|
24
25
|
|
25
26
|
module ClassMethods
|
26
|
-
attr_accessor :
|
27
|
+
attr_accessor :tb_liquid_tag_name, :tb_liquid_tag_value_property
|
27
28
|
def acts_as_spud_liquid_tag(tag_name, value_property)
|
28
|
-
|
29
|
-
|
29
|
+
ActiveSupport::Deprecation.warn "acts_as_spud_liquid_tag is deprecated, use acts_as_tb_liquid_tag.", caller
|
30
|
+
acts_as_tb_liquid_tag(tag_name, value_property)
|
31
|
+
end
|
32
|
+
def acts_as_tb_liquid_tag(tag_name, value_property)
|
33
|
+
@tb_liquid_tag_name = tag_name
|
34
|
+
@tb_liquid_tag_value_property = value_property
|
30
35
|
self.class_eval do
|
31
|
-
after_update :
|
32
|
-
after_touch :
|
36
|
+
after_update :expire_tb_liquid_tags
|
37
|
+
after_touch :expire_tb_liquid_tags
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
data/lib/tb_liquid/engine.rb
CHANGED
@@ -4,11 +4,8 @@ module TbLiquid
|
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
isolate_namespace TbLiquid
|
6
6
|
|
7
|
-
require "#{root}/app/concerns/tb_liquid/acts_as_liquid_content"
|
8
|
-
require "#{root}/app/concerns/tb_liquid/acts_as_liquid_tag"
|
9
|
-
|
10
7
|
initializer 'tb_liquid.acts_as_spud_liquid_tag' do |config|
|
11
|
-
|
8
|
+
ActiveSupport.on_load(:active_record) do
|
12
9
|
include TbLiquid::ActsAsLiquidTag
|
13
10
|
include TbLiquid::ActsAsLiquidContent
|
14
11
|
end
|
data/lib/tb_liquid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Westlake Design
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.2.
|
93
|
+
rubygems_version: 2.2.2
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Simgle engine for managing liquid tags in Twice Baked.
|