sape 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/app/helpers/sape_helper.rb +6 -6
- data/lib/sape/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32375f833f6695fe42316ad9bc8588222d986294
|
4
|
+
data.tar.gz: e9d69ad7470915fa431ebbea8d95d7b0aff464ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e5eed516e19f9938677740bd824ceee03102d89657aa800010de39cff0f3642cec623c3a5d5642ab2b5a6d74bd8a6c9be29fb82aa3a3ab43578178515877b1e
|
7
|
+
data.tar.gz: 3441f604c712fe027455d1b2e211286cb61c8041e0da30342ab4e335811aa8c5448d175e8ab44faaaa33f22eb058404323c50c53a832ecc33781f986997e506e
|
data/README.md
CHANGED
@@ -35,13 +35,13 @@ charset: UTF-8
|
|
35
35
|
#### Inserting links
|
36
36
|
Simply put helper call in desired place. Like this:
|
37
37
|
```ruby
|
38
|
-
<% # SIMPLE LINKS %>
|
38
|
+
<% # SIMPLE LINKS, custom parameter 'site_host', default: request.host %>
|
39
39
|
<%= sape_links -%>
|
40
40
|
|
41
|
-
<% # BLOCK LINKS %>
|
41
|
+
<% # BLOCK LINKS, custom parameter 'site_host', default: request.host %>
|
42
42
|
<%= sape_links_block -%>
|
43
43
|
|
44
|
-
<% # CONTEXT LINKS %>
|
44
|
+
<% # CONTEXT LINKS, custom parameter 'site_host', default: request.host %>
|
45
45
|
<%= sape_context_links text -%>
|
46
46
|
```
|
47
47
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module SapeHelper
|
2
|
-
def sape_links_block
|
2
|
+
def sape_links_block(site_host = request.host)
|
3
3
|
request.original_fullpath.chomp!("/") if request.original_fullpath.last == "/" && request.original_fullpath != '/'
|
4
|
-
options = { links: SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host:
|
4
|
+
options = { links: SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host: site_host) }
|
5
5
|
if SapeConfig.bot_ips.include?(request.remote_addr)
|
6
6
|
options.merge!(check_code: SapeConfig.check_code)
|
7
7
|
end
|
@@ -11,9 +11,9 @@ module SapeHelper
|
|
11
11
|
"<!-- ERROR: #{e.message} -->".html_safe
|
12
12
|
end
|
13
13
|
|
14
|
-
def sape_links
|
14
|
+
def sape_links(site_host = request.host)
|
15
15
|
request.original_fullpath.chomp!("/") if request.original_fullpath.last == "/" && request.original_fullpath != '/'
|
16
|
-
links = SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host:
|
16
|
+
links = SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host: site_host).
|
17
17
|
pluck(:raw_link).
|
18
18
|
join(SapeConfig.delimiter)
|
19
19
|
|
@@ -22,9 +22,9 @@ module SapeHelper
|
|
22
22
|
"<!-- ERROR: #{e.message} -->".html_safe
|
23
23
|
end
|
24
24
|
|
25
|
-
def sape_context_links(text)
|
25
|
+
def sape_context_links(text, site_host = request.host)
|
26
26
|
request.original_fullpath.chomp!("/") if request.original_fullpath.last == "/" && request.original_fullpath != '/'
|
27
|
-
SapeLink.where(page: request.original_fullpath, link_type: "context", site_host:
|
27
|
+
SapeLink.where(page: request.original_fullpath, link_type: "context", site_host: site_host).each do |link|
|
28
28
|
text.sub!(link.anchor, link.raw_link)
|
29
29
|
end
|
30
30
|
|
data/lib/sape/version.rb
CHANGED