type_station 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64198e1d0a1273b9fecb551341af5f1dd507aee8
4
- data.tar.gz: bcd6250269e60220a515efc2f31aed120eaa4357
3
+ metadata.gz: dbc3bfe45610ed1a0658853f418a200ab072ae20
4
+ data.tar.gz: 242b1d85fc6f8d990db57990c3d8e010ce0917cd
5
5
  SHA512:
6
- metadata.gz: 78bc062d0939b0ccbb2d8f8e5a0e640dd708192c9e6735c2bebdb6aeee1a393018ba9274fbd83fde7fd0ca1bfccc4a83a2387f261dfe684047b8752f6c242ca5
7
- data.tar.gz: 15b28f3a70930074ac7ae99c4d1b58351183234cfcc9da4270ee47cdf6c928bbf8d9e3ee025af2bd05b9a618323e217338691f2d6618c6b862d537d56d97881f
6
+ metadata.gz: 903ab291d03f3f5cc70c5d8c5d2fffbc09e0393db2b58b5694ca1ad9eccf7b1f21a54dc54dc223692e7b2fde9ab4a7da66843dc07943967a47bc6b470376fd16
7
+ data.tar.gz: dc98920de5e9f4ae6f994593b3e38a6124916bdfc8b47a7706f3db81472c8faf52cae51870f4eda38a762ae424580ecace8feced32bb5b2295671bc28471eef3
@@ -4,16 +4,26 @@ module TypeStation
4
4
 
5
5
  def tag(default, options = {})
6
6
  css_class = options.delete(:class) if options.include?(:class)
7
- cl_image_tag((value.present? ? value['identifier'] : default), options.merge({class: ['ts-editable-image-tag', css_class], data: options}))
7
+ cl_image_tag((content.present? ? content['identifier'] : default), options.merge({class: ['ts-editable-image-tag', css_class], data: options}))
8
8
  end
9
9
 
10
10
  def link(default, html_options = nil, &block)
11
11
  css_class = html_options.delete(:class) if html_options.include?(:class)
12
- content_tag(:a, nil, html_options.merge({class: ['ts-editable-link-tag', css_class], href: (value.present? ? cloudinary_url(value['identifier'], format: value['format']) : default)}), &block)
12
+ content_tag(:a, nil, html_options.merge({class: ['ts-editable-link-tag', css_class], href: (content.present? ? cloudinary_url(content['identifier'], format: content['format']) : default)}), &block)
13
+ end
14
+
15
+ def value_is_hash?
16
+ content.is_a? Hash
13
17
  end
14
18
 
15
19
  def value
16
- content
20
+ sanitized_value
21
+ end
22
+
23
+ private
24
+
25
+ def sanitized_value
26
+ @sanitized_value ||= Rails::Html::WhiteListSanitizer.new.sanitize(content)
17
27
  end
18
28
 
19
29
  end
@@ -41,7 +41,7 @@ module TypeStation
41
41
  if content_attribute.present?
42
42
  content_presenter = ContentPresenter.new(content_attribute, h)
43
43
 
44
- if content_presenter.value.is_a? Hash
44
+ if content_presenter.value_is_hash?
45
45
  content += h.capture(content_presenter, &block)
46
46
  else
47
47
  content += content_presenter.value
@@ -15,9 +15,7 @@ module TypeStation
15
15
  @options = options
16
16
  end
17
17
 
18
- def render(raw_content)
19
- content = @sanitizer.sanitize(raw_content)
20
-
18
+ def render(content)
21
19
  if showifblock
22
20
  render_edit(content)
23
21
  else
@@ -2,7 +2,7 @@ module TypeStation
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 2
5
+ TINY = 3
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
8
8
  end