module
Amber::Controller::Helpers::URLHelpers
Direct including types
Defined in:
amber/controller/helpers/url_helpers.crInstance Method Summary
-
#button_to(text : String, url : String, method : String = "POST", **attrs) : String
Generates a form containing a single submit button for non-GET actions.
-
#link_back(text : String = "Back", **attrs) : String
Generates a link back to the previous page using the Referer header.
-
#link_to(text : String, url : String, **attrs) : String
Generates an anchor tag.
-
#mail_to(email : String, text : String | Nil = nil, **attrs) : String
Generates a mailto link.
Instance Method Detail
Generates a form containing a single submit button for non-GET actions. Useful for delete links and other actions that should not be plain links.
button_to("Delete", "/users/1", method: "DELETE")
Generates a link back to the previous page using the Referer header. Falls back to "#" if no referer is present.
link_back # => "<a href=\"/previous\">Back</a>"
link_back(text: "Go Back") # => "<a href=\"/previous\">Go Back</a>"
Generates an anchor tag.
link_to("Home", "/") # => "<a href=\"/\">Home</a>"
link_to("Profile", "/users/1", class: "nav-link")
Generates a mailto link.
mail_to("[email protected]") # => "<a href=\"mailto:[email protected]\">[email protected]</a>"
mail_to("[email protected]", text: "Email us") # => "<a href=\"mailto:[email protected]\">Email us</a>"