actionview-link_to_blank 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2a6bc97117487fb592975b61e030831d2158dc1
4
- data.tar.gz: 0a076c6e6476238bc5e8f04090f331c2f88f018e
3
+ metadata.gz: 715f878476a9378270e1a4604e8fea8902d76b0d
4
+ data.tar.gz: 446cce5ca24c5ccbe7c32292f2f35f97eb1213ac
5
5
  SHA512:
6
- metadata.gz: c25435e9170635c4166247381facb01c89298d62674d83a49d5e0cd4bdf0dfe3f2f2fd4946e2103b0508795a59c0e2f24d99df31f788d1171b4ae2b02005c167
7
- data.tar.gz: 0a0a5ce22aac9360437ea6a4614266c2ad10e99e6a25fccdf491a4b086aeffcc6c28c6be8fcace11a37e5e0c7c16141c175ea6b1f71fd231a2e103265e02d2a8
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
- TODO: Write usage instructions here
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
 
@@ -13,7 +13,7 @@ module LinkToBlank
13
13
  html_options = args[2] || {}
14
14
 
15
15
  # override
16
- html_options.merge!(target: '_blank')
16
+ html_options.reverse_merge! target: '_blank'
17
17
 
18
18
  link_to(name, options, html_options)
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module ActionView
2
2
  module LinkToBlank
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview-link_to_blank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat