例如,在下表中,我在整个应用程序中一遍又一遍地使用这些操作,但我不太确定如何将其干燥,无论是部分视图还是 Rails 助手(这对于处理 html 片段似乎不太好) )...(我正在使用 Slim 顺便说一句)
我希望能够执行以下操作: = edit_button (path, 'optional display text', 'optional extra classes)
table.grid
thead
tr
th Researcher
th Email Address
th Last Activity
th Activated
th Failed logins
th Locked
th Actions
tbody
- @users.each do |user|
tr
td
= "#{user.first_name} #{user.last_name}"
td
= user.email
td
| About 1 day ago
td
| Yes
td
= user.failed_logins_count
td
| No
td
div.actions
a.small.button.edit href=edit_user_path(user)
i.general.foundicon-edit
| Edit
a.small.button.delete href=user_path(user) method='delete' data-confirm='Are you sure?'
i.general.foundicon-trash
| Delete