actionview-link_to_blank 0.0.3 → 0.0.4
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 715f878476a9378270e1a4604e8fea8902d76b0d
|
4
|
+
data.tar.gz: 446cce5ca24c5ccbe7c32292f2f35f97eb1213ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd1af6c26c444bb273bff7eb31a0105f17cba233fed92c52767ec850947e3228d9d09c886f9da497ad17a510f0c0419d7dc55ecd38fc2774a10e43b3e8a31d4
|
7
|
+
data.tar.gz: a83cabe7ee673970841c3d42d25e2e28d06c8cbd8d52e2534ac03a5ba3aab9d78eb3189598509036bda43893bf042ce7d67cff0ebf269bf78e8582079f8074de
|
data/README.md
CHANGED
@@ -20,7 +20,37 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
Use the `link_to_blank` helper method, equal `link_to('foo', target: '_blank')`
|
24
|
+
|
25
|
+
### Signatures
|
26
|
+
|
27
|
+
link_to_blank(body, url, html_options = {})
|
28
|
+
# url is a String; you can use URL helpers like
|
29
|
+
# posts_path
|
30
|
+
|
31
|
+
link_to_blank(body, url_options = {}, html_options = {})
|
32
|
+
# url_options, except :confirm or :method,
|
33
|
+
# is passed to url_for
|
34
|
+
|
35
|
+
link_to_blank(options = {}, html_options = {}) do
|
36
|
+
# name
|
37
|
+
end
|
38
|
+
|
39
|
+
link_to_blank(url, html_options = {}) do
|
40
|
+
# name
|
41
|
+
end
|
42
|
+
|
43
|
+
### Examples
|
44
|
+
|
45
|
+
link_to_blank "Profile", profile_path(@profile)
|
46
|
+
# => <a href="/profiles/1" target="_blank">Profile</a>
|
47
|
+
|
48
|
+
<%= link_to_blank(@profile) do %>
|
49
|
+
<strong><%= @profile.name %></strong> -- <span>Check it out!</span>
|
50
|
+
<% end %>
|
51
|
+
# => <a href="/profiles/1" target="_blank">
|
52
|
+
<strong>David</strong> -- <span>Check it out!</span>
|
53
|
+
</a>
|
24
54
|
|
25
55
|
## Testing
|
26
56
|
|
@@ -270,6 +270,10 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
|
|
270
270
|
link_to_blank("Malicious <script>content</script>".html_safe, "/")
|
271
271
|
end
|
272
272
|
|
273
|
+
def test_link_tag_override_specific
|
274
|
+
assert_dom_equal %{<a href="http://www.example.com" target="override">Hello</a>}, link_to_blank("Hello", "http://www.example.com", target: 'override')
|
275
|
+
end
|
276
|
+
|
273
277
|
private
|
274
278
|
# MiniTest does not have build_message method, so I copy from below:
|
275
279
|
# https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/assertions/dom.rb
|