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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGE2MGYzYjhkMjQ1ODdmOTk3ODAzNDU3MGI3ZDg1Y2EyY2EwZmQwMw==
4
+ MGE3ZjAxNzRlNjg4YmNlZWMyMDg2NWE3ZjRhMDhhOWVkNDhhMTJkYQ==
5
5
  data.tar.gz: !binary |-
6
- NmQ4MTcwZDk1YTZjODQ5YWQ0OTdjY2Y3Zjg3YzBhYWQ1YWUxODBhNA==
6
+ YWE5M2Q5MWE4OGNlYjBiZTRiZTMxN2UzZTYyZjA3OWY1NWE0NzI4ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2QzMGY1YTNkNDQ5Njc0YjU2MzIyOTEyMThmYWY1YTIzMmE1ZWFiYjljNDZl
10
- NDE1ZDc0ZGI2ZmY5MWNkYjZlMDVkZDk5NWI1NGQ2OGRjOTY3NzM3OTQ4NWZi
11
- NWE0ZDJkNmI5OTM4YTQyMDAyMjM5OGY3N2ViZDRmY2FhNmQwMjA=
9
+ Y2VhNjNkZmM1YzhjZTcyOWRmZjJmMjhlZGE4MDBmODRiNTgzYjgzYjFkNmFl
10
+ ZGUxMWQxMmMyYzgzMzIzODBlZmZlN2ZiOWI0NjMwMzZkZmE4MTM0ZjNkZDRl
11
+ ZDkxMDE1NGQxYmYxOGVhZjc5ZDhiMjM0MGI1NmI4YmE2ZDFlODI=
12
12
  data.tar.gz: !binary |-
13
- MDNlYWJjMjA5ODQ4YzQ0YzZhYTY1M2YwODAzMmE0NTVkYjRiNTFlYjU1Y2Vl
14
- ODAzNzg1NzRmZWE3MjcwN2QzOWE0NmNjMDk3ZDdhMTVkNDA3ZWZlMjFjZjBi
15
- NDg5MTg2Njc2MDYwYzA4MGJkY2QwNjJjMmQ3NTdhNDhlNGMzZTM=
13
+ ODliNWEwMzE4MjRhNmYyYzQxOTc2YzNlZTIyMDVkOWNlNjQ2OTA0ZTdiMDVk
14
+ MDE3NTZiMjNjZjU4MTlkMThlODAyOGRkNzQ5MzBjZjk0MThkNzk3N2MyNWIw
15
+ MmFlZTEwNTAyZDZiZWQzMGYyZGVhNzRhNDI4NTJlYTY1YmM2N2E=
@@ -0,0 +1,8 @@
1
+ module SeeMore
2
+ class Engine < Rails::Engine
3
+ initializer "setup for rails" do
4
+ ActionView::Base.send(:include, SeeMore::SeeMoreHelpers)
5
+ #ActionController::Base.send(:include, BestInPlace::ControllerExtensions)
6
+ end
7
+ end
8
+ end
@@ -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
+
@@ -1,3 +1,3 @@
1
1
  module SeeMore
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
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: ''