Class: Cybertrain::Template::Helpers

Inherits:
HelperBase
  • Object
show all
Defined in:
cybertrain/template/helpers.rb,
cybertrain/template/stream_helpers.rb

Instance Method Summary collapse

Instance Method Details

#button_to_path(text, path, attrs = {}) ⇒ Object

button_to for Ruby helpers: button_to_path("Delete", article_path(a), method: "delete", class: "danger").



284
285
286
# File 'cybertrain/template/helpers.rb', line 284

def button_to_path(text, path, attrs = {})
  button_to([text, path], string_keys_of(attrs))
end

link_to for Ruby helpers: link_to_path("Edit", edit_article_path(a), class: "btn"). The text is escaped unless it is a SafeString; attrs takes class:, id:, data_confirm: and data: as link_to does.



277
278
279
# File 'cybertrain/template/helpers.rb', line 277

def link_to_path(text, path, attrs = {})
  link_to([text, path], string_keys_of(attrs))
end