kuhsaft 1.2.11 → 1.2.12

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.
@@ -41,6 +41,15 @@ sortableBrick = ->
41
41
  sortForm.trigger('submit')
42
42
  )
43
43
 
44
+ removeEmptyParagraphs = ->
45
+ # Clear read_more_text field if it just contains an empty p tag
46
+ #
47
+ # readctor.js injects an almost empty p-tag into empty form fields.
48
+ # However, instead of being really empty, it currently contains the ​ (Zero width space) Character.
49
+ $('.brick_read_more_text .redactor_box textarea').each ->
50
+ if ($(this).val() == "<p>\u200b</p>")
51
+ $(this).val('')
52
+
44
53
  window.initSubmitLinks = (selector = null)->
45
54
  selector ||= $('body')
46
55
 
@@ -63,8 +72,13 @@ window.initSavePopover = (selector) ->
63
72
  , 1500
64
73
  , 50
65
74
 
75
+ handleMagicReadMore = ->
76
+ $('.simple_form.edit_brick').submit ->
77
+ removeEmptyParagraphs()
78
+
66
79
  $(document).ajaxSuccess ->
67
80
  loadTextEditor($("body"))
81
+ handleMagicReadMore()
68
82
  sortableBrick()
69
83
 
70
84
  $(document).ready ->
@@ -72,6 +86,7 @@ $(document).ready ->
72
86
  checkPageType()
73
87
  sortableBrick()
74
88
  initSubmitLinks()
89
+ handleMagicReadMore()
90
+
75
91
  $('#page_page_type').change ->
76
92
  checkPageType()
77
-
@@ -2,8 +2,6 @@ module Kuhsaft
2
2
  class TextBrick < Brick
3
3
  attr_accessible :text, :read_more_text
4
4
 
5
- before_save :strip_read_more_text
6
-
7
5
  def user_can_add_childs?
8
6
  false
9
7
  end
@@ -11,20 +9,5 @@ module Kuhsaft
11
9
  def collect_fulltext
12
10
  [super, text, read_more_text].join(' ')
13
11
  end
14
-
15
- private
16
-
17
- # Clear read_more_text field if it just contains an empty p tag
18
- #
19
- # readctor.js injects an almost empty p-tag into empty form fields.
20
- # However, instead of being really empty, it currently contains the &#8203; (Zero width space)
21
- # Character.
22
- def strip_read_more_text
23
- read_more_text.clear if text_contains_funky_chars
24
- end
25
-
26
- def text_contains_funky_chars
27
- read_more_text && read_more_text.strip.hash == -1282209220116339654
28
- end
29
12
  end
30
13
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "1.2.11"
2
+ VERSION = "1.2.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.11
4
+ version: 1.2.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-03-18 00:00:00.000000000 Z
15
+ date: 2013-03-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -525,7 +525,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
525
525
  version: '0'
526
526
  segments:
527
527
  - 0
528
- hash: 2942074509989770939
528
+ hash: -3176159138110216419
529
529
  required_rubygems_version: !ruby/object:Gem::Requirement
530
530
  none: false
531
531
  requirements:
@@ -534,7 +534,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
534
534
  version: '0'
535
535
  segments:
536
536
  - 0
537
- hash: 2942074509989770939
537
+ hash: -3176159138110216419
538
538
  requirements: []
539
539
  rubyforge_project: kuhsaft
540
540
  rubygems_version: 1.8.24