Fixed Admin Budget's destroy button to a link

Why:

The Admin Budget form has a submit button for saving the record, adding
another submit input to destroy the record actually adds to the html:
`<input type="hidden" name="_method" value="delete">` and it collides
with the save button, forcing it to perform a destroy instead of save.

Previously the destroy button was not in the same div as the save button

How:
Just changing the Destroy from a button_to to a link_to.
This commit is contained in:
Bertocq
2018-01-20 11:17:56 +01:00
parent 94279448f3
commit 8eaf0982b1
2 changed files with 3 additions and 3 deletions

View File

@@ -62,7 +62,7 @@
<% end %>
<% if @budget.persisted? %>
<%= button_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right" %>
<%= link_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right" %>
<% end %>
</div>

View File

@@ -116,7 +116,7 @@ feature 'Admin budgets' do
scenario 'Destroy a budget without investments' do
visit admin_budgets_path
click_link 'Edit budget'
click_button 'Delete budget'
click_link 'Delete budget'
expect(page).to have_content('Budget deleted successfully')
expect(page).to have_content('budgets cannot be found')
@@ -127,7 +127,7 @@ feature 'Admin budgets' do
visit admin_budgets_path
click_link 'Edit budget'
click_button 'Delete budget'
click_link 'Delete budget'
expect(page).to have_content('You cannot destroy a Budget that has associated investments')
expect(page).to have_content('There is 1 budget')