-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to override "Remove" button text on has_many forms (#6523)
* Allow custom text for Remove button on has_many form builder * Add has_many feature spec to test remove_record functionality * Add remove_record to the form examples
- Loading branch information
1 parent
82002e0
commit b5b89ce
Showing
4 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@javascript | ||
Feature: Has Many | ||
|
||
A resource has many other resources | ||
|
||
Background: | ||
Given I am logged in | ||
And a post with the title "Hello World" written by "John Doe" exists | ||
|
||
Scenario: Updating the parent resource page with default text for Remove button | ||
Given a configuration of: | ||
""" | ||
ActiveAdmin.register User do | ||
form do |f| | ||
f.inputs do | ||
f.has_many :posts do |ff| | ||
ff.input :title | ||
ff.input :body | ||
end | ||
end | ||
f.actions | ||
end | ||
end | ||
ActiveAdmin.register Post | ||
""" | ||
When I go to the last author's show page | ||
And I follow "Edit User" | ||
Then I should see a link to "Add New Post" | ||
|
||
When I click "Add New Post" | ||
Then I should see a link to "Remove" | ||
|
||
Scenario: Updating the parent resource page with custom text for Remove button | ||
Given a configuration of: | ||
""" | ||
ActiveAdmin.register User do | ||
form do |f| | ||
f.inputs do | ||
f.has_many :posts, remove_record: "Hide" do |ff| | ||
ff.input :title | ||
ff.input :body | ||
end | ||
end | ||
f.actions | ||
end | ||
end | ||
ActiveAdmin.register Post | ||
""" | ||
When I go to the last author's show page | ||
And I follow "Edit User" | ||
Then I should see a link to "Add New Post" | ||
|
||
When I click "Add New Post" | ||
Then I should see a link to "Hide" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters