see_more 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/see_more/helper.rb +36 -24
- data/lib/see_more/version.rb +1 -1
- data/see_more.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWZkZDZiYzgyNWMxYjc1NzYwOTA5NGEzNDVlNzZkMjY4MjgyMGExMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTczY2RiZTEyMGQxMjA5Y2MzZWRmNDA5YTk4NmMzNzdmMGI2YmFiMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODE2YWY0MGUxMWI5NmM2YjMyNTFkNzE0NmNhYjViZGFhZWJlNGFkNGJiNTNk
|
10
|
+
ZmY0Yzc1OTIwZGI0MWMxZmFhMjQ2NzQxYzcyMzVmMzIyOGE3YmJiY2I1NWQ3
|
11
|
+
NmFkZjM4MmY5NmNiNDdlYTE3N2IyNTBmMjE0YzJlMzEwY2ZjYTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmE2MmMzNjE3OTg1M2Q4ZWQwYzE5NjQ3NzI3N2YzMjcwNjMzNDI1ZmM1MTU3
|
14
|
+
NzI2YTc1NDYwYzIxY2U1MjA0M2RhNmRiMzIyZTQ1MmUwMTNhNjU3YjFlMDU5
|
15
|
+
NjE0MmNmYjMyMmQ2MzJiMDM3ZDU5OTI3ODU1YjU2ODcyNTdlMmU=
|
data/lib/see_more/helper.rb
CHANGED
@@ -1,29 +1,41 @@
|
|
1
1
|
module SeeMore
|
2
2
|
module SeeMoreHelpers
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
def see_more(object,field,opts = {})
|
4
|
+
content = object.send(field)
|
5
|
+
if !content.blank?
|
6
|
+
# setting classes to main span from opts as array
|
7
|
+
classes = ["see_more_span"]
|
8
|
+
unless opts[:classes].nil?
|
9
|
+
classes << opts[:classes]
|
10
|
+
classes.flatten!
|
11
|
+
end
|
12
|
+
# by default 20 chars will be displayed
|
13
|
+
ctnt_size = opts[:content_size] || 20
|
14
|
+
ctnt = content[0..ctnt_size]
|
15
|
+
# if you want the data to be fetch from db
|
16
|
+
frm_db = opts[:db] || false
|
17
|
+
if frm_db
|
18
|
+
# path can be changed if not the default show method of the current object is used(assuming restful routes)
|
19
|
+
rte = opts[:path] || send(object.class.name.downcase + "_path",*[object,{format: "json"}])
|
20
|
+
else
|
21
|
+
rte = "db-false"
|
22
|
+
end
|
23
|
+
# creating the actual content and the link
|
24
|
+
out = "<span class='#{classes.join(" ")}'><span class='see_more_content'>"
|
25
|
+
out << ctnt
|
26
|
+
out << "...</span>"
|
27
|
+
out << link_to("see more",
|
28
|
+
"#",
|
29
|
+
{data: {content_size: ctnt_size,
|
30
|
+
from_db: frm_db,
|
31
|
+
route: rte,
|
32
|
+
field: field.to_s,
|
33
|
+
content: content},
|
34
|
+
class: "see_more_link"})
|
35
|
+
out << "</span>"
|
36
|
+
out.html_safe
|
37
|
+
end
|
38
|
+
end
|
27
39
|
end
|
28
40
|
end
|
29
41
|
|
data/lib/see_more/version.rb
CHANGED
data/see_more.gemspec
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- beck03076
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jquery-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: ! ' This is Toggleable '
|
28
42
|
email:
|
29
43
|
- senthilkumar.hce@gmail.com
|