2017-09-27 61 views
0
Rails 5 
Bootstrap 4 
Devise 

我想修改view/devise/registrations/edit.html.slim視圖,通過更換具有引導按鈕上的文本鏈接,刪除和背部的操作的鏈接。請問像這樣的工作:使用一個按鈕,在軌

= link_to I18n.t 'devise.mailer.registrations.edit.cancel', registration_path(resource_name), class: "btn btn-primary", data: { confirm: I18n.t 'devise.mailer.registrations.edit.confirm' }, method: :delete 
= link_to I18n.t 'devise.mailer.registrations.edit.back', :back, class: "btn btn-warning" 
+1

試試看看! – jvillian

+0

[使按鈕標記爲鏈接](https://stackoverflow.com/questions/4418004/ruby-on-rails-link-to-button-css)這將幫助你,你可以相應地修改它。 – Gabbar

+0

[使按鈕標記作爲鏈接](https://stackoverflow.com/questions/4418004/ruby-on-rails-link-to-button-css)這將幫助你,你可以相應地修改它。 – Gabbar

回答

0

需要窩內link_to按鈕標籤來做到這一點。試試這個

= link_to registration_path(resource_name), data: { confirm: I18n.t 'devise.mailer.registrations.edit.confirm' }, method: :delete do 
    button.btn.btn-primary 
    = I18n.t 'devise.mailer.registrations.edit.cancel'