link_to_action 0.2.4 → 0.2.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.
- data/README.md +8 -3
- data/lib/generators/link_to_action/install_generator.rb +11 -4
- data/lib/generators/link_to_action/templates/edit.html.erb +6 -0
- data/lib/generators/link_to_action/templates/index.html.erb +33 -0
- data/lib/generators/link_to_action/templates/link_to_action.rb +2 -1
- data/lib/generators/link_to_action/templates/new.html.erb +5 -0
- data/lib/generators/link_to_action/templates/show.html.erb +13 -0
- data/lib/link_to_action/helpers.rb +10 -3
- data/lib/link_to_action/locale/en.yml +3 -2
- data/lib/link_to_action/version.rb +1 -1
- data/lib/link_to_action.rb +5 -2
- data/test/default_values_test.rb +2 -1
- data/test/dummy/log/development.log +24 -0
- data/test/dummy/log/test.log +3842 -9110
- data/test/helpers_test.rb +14 -7
- metadata +38 -34
data/test/helpers_test.rb
CHANGED
@@ -37,46 +37,53 @@ class HelperTest < ActionView::TestCase
|
|
37
37
|
assert_equal "<a href=\"/users/1\">#{user.login}</a>",
|
38
38
|
link_to_show(user, raw: :login)
|
39
39
|
end
|
40
|
+
|
41
|
+
test 'link_to_show using i18n text instead of sending method' do
|
42
|
+
user = @user
|
43
|
+
user.login = '<a href="http://example.com">example</a>'
|
44
|
+
assert_equal "<a href=\"/users/1\">Show</a>",
|
45
|
+
link_to_show(user, i18n: true)
|
46
|
+
end
|
40
47
|
|
41
48
|
test 'link_to_edit' do
|
42
|
-
assert_equal "<a href=\"/users/1/edit\">Edit
|
49
|
+
assert_equal "<a href=\"/users/1/edit\">Edit</a>", link_to_edit(@user)
|
43
50
|
end
|
44
51
|
|
45
52
|
test 'link_to_destroy' do
|
46
|
-
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" rel=\"nofollow\">Delete
|
53
|
+
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" rel=\"nofollow\">Delete</a>",
|
47
54
|
link_to_destroy(@user)
|
48
55
|
end
|
49
56
|
|
50
57
|
test 'link_to_destroy with skip_pjax' do
|
51
58
|
swap LinkToAction, destroy_skip_pjax: true do
|
52
|
-
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-skip-pjax=\"true\" rel=\"nofollow\">Delete
|
59
|
+
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-skip-pjax=\"true\" rel=\"nofollow\">Delete</a>",
|
53
60
|
link_to_destroy(@user)
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
57
64
|
test 'link_to_destroy without confirm' do
|
58
65
|
swap LinkToAction, destroy_confirm: false do
|
59
|
-
assert_equal "<a href=\"/users/1\" data-method=\"delete\" rel=\"nofollow\">Delete
|
66
|
+
assert_equal "<a href=\"/users/1\" data-method=\"delete\" rel=\"nofollow\">Delete</a>",
|
60
67
|
link_to_destroy(@user)
|
61
68
|
end
|
62
69
|
end
|
63
70
|
|
64
71
|
test 'link_to_destroy with per-link confirm' do
|
65
72
|
swap LinkToAction, destroy_confirm: false do
|
66
|
-
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" rel=\"nofollow\">Delete
|
73
|
+
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" rel=\"nofollow\">Delete</a>",
|
67
74
|
link_to_destroy(@user, confirm: true)
|
68
75
|
end
|
69
76
|
end
|
70
77
|
|
71
78
|
test 'link_to_destroy with per-link confirm and specific text' do
|
72
79
|
swap LinkToAction, destroy_confirm: false do
|
73
|
-
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you really sure?\" data-method=\"delete\" rel=\"nofollow\">Delete
|
80
|
+
assert_equal "<a href=\"/users/1\" data-confirm=\"Are you really sure?\" data-method=\"delete\" rel=\"nofollow\">Delete</a>",
|
74
81
|
link_to_destroy(@user, confirm: 'Are you really sure?')
|
75
82
|
end
|
76
83
|
end
|
77
84
|
|
78
85
|
test 'link_to_destroy without per-link confirm' do
|
79
|
-
assert_equal "<a href=\"/users/1\" data-method=\"delete\" rel=\"nofollow\">Delete
|
86
|
+
assert_equal "<a href=\"/users/1\" data-method=\"delete\" rel=\"nofollow\">Delete</a>",
|
80
87
|
link_to_destroy(@user, confirm: false)
|
81
88
|
end
|
82
89
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: link_to_action
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -90,7 +90,11 @@ files:
|
|
90
90
|
- Rakefile
|
91
91
|
- lib/generators/link_to_action/USAGE
|
92
92
|
- lib/generators/link_to_action/install_generator.rb
|
93
|
+
- lib/generators/link_to_action/templates/edit.html.erb
|
94
|
+
- lib/generators/link_to_action/templates/index.html.erb
|
93
95
|
- lib/generators/link_to_action/templates/link_to_action.rb
|
96
|
+
- lib/generators/link_to_action/templates/new.html.erb
|
97
|
+
- lib/generators/link_to_action/templates/show.html.erb
|
94
98
|
- lib/link_to_action.rb
|
95
99
|
- lib/link_to_action/helpers.rb
|
96
100
|
- lib/link_to_action/locale/en.yml
|
@@ -142,8 +146,8 @@ files:
|
|
142
146
|
- test/link_to_action_test.rb
|
143
147
|
- test/support/misc_helpers.rb
|
144
148
|
- test/test_helper.rb
|
145
|
-
- test/dummy/log/test.log
|
146
149
|
- test/dummy/log/development.log
|
150
|
+
- test/dummy/log/test.log
|
147
151
|
homepage: https://github.com/denispeplin/link_to_action
|
148
152
|
licenses: []
|
149
153
|
post_install_message:
|
@@ -158,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
162
|
version: '0'
|
159
163
|
segments:
|
160
164
|
- 0
|
161
|
-
hash:
|
165
|
+
hash: -2198198113135722753
|
162
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
167
|
none: false
|
164
168
|
requirements:
|
@@ -167,54 +171,54 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
171
|
version: '0'
|
168
172
|
segments:
|
169
173
|
- 0
|
170
|
-
hash:
|
174
|
+
hash: -2198198113135722753
|
171
175
|
requirements: []
|
172
176
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.8.
|
177
|
+
rubygems_version: 1.8.23
|
174
178
|
signing_key:
|
175
179
|
specification_version: 3
|
176
180
|
summary: Links to actions
|
177
181
|
test_files:
|
182
|
+
- test/support/misc_helpers.rb
|
178
183
|
- test/helpers_test.rb
|
179
|
-
- test/link_to_action_test.rb
|
180
184
|
- test/test_helper.rb
|
181
|
-
- test/support/misc_helpers.rb
|
182
|
-
- test/dummy/log/test.log
|
183
|
-
- test/dummy/log/development.log
|
184
|
-
- test/dummy/config.ru
|
185
|
-
- test/dummy/public/404.html
|
186
|
-
- test/dummy/public/422.html
|
187
|
-
- test/dummy/public/favicon.ico
|
188
|
-
- test/dummy/public/500.html
|
189
|
-
- test/dummy/script/rails
|
190
185
|
- test/dummy/README.rdoc
|
191
|
-
- test/dummy/config/environments/test.rb
|
192
|
-
- test/dummy/config/environments/development.rb
|
193
|
-
- test/dummy/config/environments/production.rb
|
194
|
-
- test/dummy/config/environment.rb
|
195
186
|
- test/dummy/config/routes.rb
|
196
|
-
- test/dummy/config/database.yml
|
197
187
|
- test/dummy/config/locales/en.yml
|
188
|
+
- test/dummy/config/environment.rb
|
189
|
+
- test/dummy/config/environments/development.rb
|
190
|
+
- test/dummy/config/environments/production.rb
|
191
|
+
- test/dummy/config/environments/test.rb
|
192
|
+
- test/dummy/config/boot.rb
|
193
|
+
- test/dummy/config/application.rb
|
194
|
+
- test/dummy/config/initializers/secret_token.rb
|
195
|
+
- test/dummy/config/initializers/link_to_action.rb
|
198
196
|
- test/dummy/config/initializers/session_store.rb
|
199
197
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
198
|
+
- test/dummy/config/initializers/inflections.rb
|
200
199
|
- test/dummy/config/initializers/mime_types.rb
|
201
|
-
- test/dummy/config/initializers/secret_token.rb
|
202
|
-
- test/dummy/config/initializers/link_to_action.rb
|
203
200
|
- test/dummy/config/initializers/wrap_parameters.rb
|
204
|
-
- test/dummy/config/
|
205
|
-
- test/dummy/
|
206
|
-
- test/dummy/config
|
201
|
+
- test/dummy/config/database.yml
|
202
|
+
- test/dummy/Rakefile
|
203
|
+
- test/dummy/config.ru
|
204
|
+
- test/dummy/app/assets/stylesheets/application.css
|
205
|
+
- test/dummy/app/assets/javascripts/application.js
|
206
|
+
- test/dummy/app/controllers/application_controller.rb
|
207
207
|
- test/dummy/app/helpers/application_helper.rb
|
208
208
|
- test/dummy/app/views/layouts/application.html.erb
|
209
|
-
- test/dummy/app/controllers/application_controller.rb
|
210
|
-
- test/dummy/app/assets/javascripts/application.js
|
211
|
-
- test/dummy/app/assets/stylesheets/application.css
|
212
|
-
- test/dummy/app/models/user.rb
|
213
209
|
- test/dummy/app/models/comment.rb
|
214
|
-
- test/dummy/
|
210
|
+
- test/dummy/app/models/user.rb
|
211
|
+
- test/dummy/log/development.log
|
212
|
+
- test/dummy/log/test.log
|
215
213
|
- test/dummy/db/test.sqlite3
|
216
|
-
- test/dummy/db/migrate/20121003103958_create_comments.rb
|
217
|
-
- test/dummy/db/migrate/20121003103906_create_users.rb
|
218
|
-
- test/dummy/db/migrate/20121005032141_add_login_to_users.rb
|
219
214
|
- test/dummy/db/schema.rb
|
215
|
+
- test/dummy/db/migrate/20121005032141_add_login_to_users.rb
|
216
|
+
- test/dummy/db/migrate/20121003103906_create_users.rb
|
217
|
+
- test/dummy/db/migrate/20121003103958_create_comments.rb
|
218
|
+
- test/dummy/public/422.html
|
219
|
+
- test/dummy/public/404.html
|
220
|
+
- test/dummy/public/500.html
|
221
|
+
- test/dummy/public/favicon.ico
|
222
|
+
- test/dummy/script/rails
|
220
223
|
- test/default_values_test.rb
|
224
|
+
- test/link_to_action_test.rb
|