caboose-cms 0.2.92 → 0.2.93

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDg5OTM1Yzk0MjAxZGU5MDViZjIzZDc2ODFhZTg2ZDcxZWRmYjlmMg==
4
+ NDdhODU5NjFkMDk3NmMxYWY1ZWFmMWY5MDc3ZmFjMDZhNTA2ZWRhOQ==
5
5
  data.tar.gz: !binary |-
6
- NDdmZjlkYmIzYzI2NjExMWRjZGY2NmFmMWY0OTcxNDM0NWVmNjc5Ng==
6
+ MWI2ODBjNjgwNWI4OGMzNWE1MWIyM2EwODlmZjI2MzJhMzUxM2FmOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmNiNjFhNzg4ZWFlMjlhM2M0YTY1ZDJmYzc4MzNiOTkyMGE2OGI3YmY1Yjdl
10
- NWFjY2VjYjYyYzcxNWNjOGFlZDIwOWVkMWViMDM1NTVhMjcwMDQzNzNkOTZm
11
- M2FhZDVkN2M0OTc1NDliYmViZGRjY2YwMmIzZjg2Yzk4OWVkOGU=
9
+ MGMwZTIwNDU5NTRjOGNkODBjNDQ0NWNjYmE4ZWY5NDQxZmEwMTc5OTgwN2Zj
10
+ YmVkMzk4ZTMwZWM1ZjExZjU2YTJmMDZiNzkzMmU0Zjk5Yzc0NDE3M2U4ZTY3
11
+ MWFhOTFhNWUwNWViMTE2MjIxZGY0MzQ5NGIzZGNmOGFlMzMzMWI=
12
12
  data.tar.gz: !binary |-
13
- MzE1M2Y0OTZmY2M1ZWVkYmY5ZjhiMmU5NmU3YjVkOGFkNDQzOTAwOTczMTZm
14
- MjZiNmYwN2IxZjIwMjAyMDNhN2UyNmRkZDMxYmQwYTY0OGFiZGE2OTAxODhk
15
- MTkwZTA2MDAwNWJjM2QwM2Y4ZjU0YzM4YjBmY2JjYzc0ODFmZTE=
13
+ NjlmYjVlNzZiMWI5NTZmN2QwZjhlNGU0MDM1MmQ0ODUwMzZlZmViMzA5NTgw
14
+ YWQxMDJlMTIxZThmNzQyNWVlYzE0NWUzMTgwZDI0MjgyNjUzYTdkYThjMDZm
15
+ ZWQ3NjQzYzNhNDhlMTQxOGEwMTFkOTQ0NjcwN2M5NjA5YmE5Mzg=
@@ -77,6 +77,20 @@ module Caboose
77
77
  end
78
78
  end
79
79
 
80
+ # Strips html and returns the text that breaks closest to the given length
81
+ def Caboose.teaser_text(str, length = 100)
82
+ return "" if str.nil?
83
+ str2 = ActionController::Base.helpers.strip_tags(str)
84
+ if str2.length > 200
85
+ i = str2.index(' ', 200) - 1
86
+ i = 200 if i.nil?
87
+ str2 = str2[0..i]
88
+ str2[str2.length-1] = "" if str2.ends_with?(",")
89
+ str2 = "#{str2}..."
90
+ end
91
+ return str2
92
+ end
93
+
80
94
  class Engine < ::Rails::Engine
81
95
  isolate_namespace Caboose
82
96
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.2.92'
2
+ VERSION = '0.2.93'
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.2.92
4
+ version: 0.2.93
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry