caboose-cms 0.4.108 → 0.4.109

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2IzMjhmNzliOTI2YTc4ZWVmMTQzNmM0OTFkYThhNDBjYzA3NmJhMA==
4
+ MGJlYTVjNGY4Y2I2NjgwMDA0MDAwOTZhMTJlM2RlNGJlYzEyZjJiNw==
5
5
  data.tar.gz: !binary |-
6
- YTUyNzBmZWYzNmExMDUyYWViNGI1MWM4NzZmYTNjNWY2NzMzOTg0OQ==
6
+ OTgwYmYzMGYwY2MyMDJmNWFkNzI0MTgzNjNlZTA5MjFlYjM4MGJjYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTBkYmZiOTk5NzA3MjAzNWY4YWE3YmQ3M2YxNGUwZWE2MjI5ZmViZmQwMWIw
10
- ZTMwZmU5MDM3ZDlkYjNlOThkNjNhM2ZiZGFiZGVkMDZlNTE0ZjhlZTAyZWEx
11
- NDJhZDMxZDZhYTIzMmM3ZWQ1NDY5OTJhNWVmNTZkMDliNGNiOTY=
9
+ NzUyMGIyNmU0M2U0MjkxMTY4MTU5ZDRiYzk1ZmM1N2YzZGMyZDUxYjE3ZWYy
10
+ ZGU4NmU2OTAxZmFlMWQxNjVlZmViODgwMmI0MThiOWY1MGRkYTU3ZjUwNWRi
11
+ YjFhZGU2ZDUwZTcwMzVlZGNkZTU4YTliNGMzNDljOTgyMDBlOTA=
12
12
  data.tar.gz: !binary |-
13
- N2NhMDY1ZjVjNjJkYjExZGYyNzM5YWM0MzhjNDcwODNkYmRiMzc2ZmYzY2Yy
14
- MmUzNDQzZTBmMTdhZTBkY2VkMzA2YTIxZGE4MDNlZGRjNzVlYzkwMDlmMDE4
15
- ZTFmODljNjM4Yzg4ODdlZjVjYjNhZjJjMTM5MmY2OWNjMWNjMzI=
13
+ Yzg2Nzk0NTUyNDU1NzY1MjUzNmM2MzE4MDMzZjBkNmQwMjI1NGU3NmRjNTM5
14
+ MjJkZDMwOGRjYTc2YWZhM2ViZGRmY2Y5NjdkYmQwNzMzZjljMmMwMTMxYzY3
15
+ Y2U2YjQzOTZjYzY2MjEzNzFhYjM4YTUwYjZhOTM0Y2M1YjEzZGM=
@@ -55,11 +55,16 @@ module Caboose
55
55
 
56
56
  # Strips html and returns the text that breaks closest to the given length
57
57
  def Caboose.teaser_text(str, length = 100)
58
- return "" if str.nil?
58
+ return '' if str.nil?
59
59
  str2 = ActionController::Base.helpers.strip_tags(str).gsub("\n", ' ')
60
+ return '' if str2.nil? || str2.length == 0
60
61
  if str2.length > length
61
- i = str2.index(' ', length) - 1
62
- i = length if i.nil?
62
+ i = str2.index(' ', length)
63
+ if i.nil?
64
+ i = length
65
+ else
66
+ i = i - 1
67
+ end
63
68
  str2 = str2[0..i]
64
69
  str2[str2.length-1] = "" if str2.ends_with?(",")
65
70
  str2 = "#{str2}..."
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.4.108'
2
+ VERSION = '0.4.109'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.108
4
+ version: 0.4.109
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry