see_more 0.0.4 → 0.0.5
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 +8 -8
- data/lib/see_more/engine.rb +8 -0
- data/lib/see_more/helper.rb +29 -0
- data/lib/see_more/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGE3ZjAxNzRlNjg4YmNlZWMyMDg2NWE3ZjRhMDhhOWVkNDhhMTJkYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWE5M2Q5MWE4OGNlYjBiZTRiZTMxN2UzZTYyZjA3OWY1NWE0NzI4ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2VhNjNkZmM1YzhjZTcyOWRmZjJmMjhlZGE4MDBmODRiNTgzYjgzYjFkNmFl
|
10
|
+
ZGUxMWQxMmMyYzgzMzIzODBlZmZlN2ZiOWI0NjMwMzZkZmE4MTM0ZjNkZDRl
|
11
|
+
ZDkxMDE1NGQxYmYxOGVhZjc5ZDhiMjM0MGI1NmI4YmE2ZDFlODI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODliNWEwMzE4MjRhNmYyYzQxOTc2YzNlZTIyMDVkOWNlNjQ2OTA0ZTdiMDVk
|
14
|
+
MDE3NTZiMjNjZjU4MTlkMThlODAyOGRkNzQ5MzBjZjk0MThkNzk3N2MyNWIw
|
15
|
+
MmFlZTEwNTAyZDZiZWQzMGYyZGVhNzRhNDI4NTJlYTY1YmM2N2E=
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SeeMore
|
2
|
+
module SeeMoreHelpers
|
3
|
+
def see_more(object,field,opts = {})
|
4
|
+
content = object.send(field)
|
5
|
+
route = object.class.name.downcase + "_path"
|
6
|
+
|
7
|
+
if !content.blank?
|
8
|
+
# setting classes to main span from opts as array
|
9
|
+
classes = ["see_more"]
|
10
|
+
unless opts[:classes].nil?
|
11
|
+
classes << opts[:classes]
|
12
|
+
classes.flatten!
|
13
|
+
end
|
14
|
+
# by default 20 chars will be displayed
|
15
|
+
ctnt_size = opts[:content_size] || 20
|
16
|
+
ctnt = truncate(content,length: ctnt_size)
|
17
|
+
# creating the actual content and the link
|
18
|
+
out = "<span class='#{classes.join(" ")}'>"
|
19
|
+
out << ctnt
|
20
|
+
out link_to "see more",
|
21
|
+
send(route,*[object,{format: "json"}]),
|
22
|
+
{remote: true}
|
23
|
+
out << "</span>"
|
24
|
+
out
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/lib/see_more/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: see_more
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- beck03076
|
@@ -23,6 +23,8 @@ files:
|
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
25
|
- lib/see_more.rb
|
26
|
+
- lib/see_more/engine.rb
|
27
|
+
- lib/see_more/helper.rb
|
26
28
|
- lib/see_more/version.rb
|
27
29
|
- see_more.gemspec
|
28
30
|
homepage: ''
|