我有一些ruby代码来创建基本博客。
我想要更新密码时允许用户更新或取消的按钮。这是一个'应用程序助手'
我希望这些作为按钮,但不确定如何使“取消”按钮返回。它目前只是java脚本和文本,但更新用户是一个按钮。
代码在
之下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
答案 0 :(得分:0)
我不喜欢这个,但你可以尝试做这样的事情
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, '#',:onclick => 'history.go(-1);', :class => 'cancel')
end
end
我希望这可以帮助你