mercredi 13 décembre 2017

Ruby get cancel to be button and not link

I have some ruby code to create a basic blog.

I want buttons that allow a user to update or cancel when updating their password. This is in a 'Application Helper'

I want these as buttons but unsure how to make the 'cancel' a button to go back. It is currently just java script and text but the update user is a button.

the code is below

module ApplicationHelper


# Creates a submit button with the given name with a cancel link
  # Accepts two arguments: Form object and the cancel link name
  def submit_or_cancel(form, name='Cancel')
    form.submit + " or " +
      link_to(name, 'javascript:history.go(-1);', :class => 'cancel')
  end
end

Aucun commentaire:

Enregistrer un commentaire