amberframework / jasper-helpers

A library of helpers for working with html for apps Crystal
https://amberframework.org
MIT License
19 stars 7 forks source link

Link/Url Helpers #4

Closed eliasjpr closed 6 years ago

eliasjpr commented 7 years ago

Conveniences for working with links and URLs in HTML.

Acceptance Criteria

skunkworker commented 7 years ago

We should also make a link like link(opts, &block) for multi line text inside, ex: glyphicons or other icons and text.

skunkworker commented 7 years ago

@eliasjpr should the button helper create a form with a single input? like https://apidock.com/rails/ActionView/Helpers/UrlHelper/button_to

skunkworker commented 7 years ago

Same with adding a :method option so that you can have a link submit with another http verb.

eliasjpr commented 7 years ago

Yes, something like

button("hello", to: "/world")
#=> <form action="/world" class="button" method="post">
      <input name="_csrf_token" value="">
      <button type="submit">hello</button>
    </form>

button("hello", to: "/world", method: "get", class: "btn")
#=> <form action="/world" class="btn" method="get">
      <button type="submit">hello</button>
    </form>
skunkworker commented 7 years ago

@eliasjpr Working on it, and right now you don't have to use the to: as it assumes that :url is the second or first item, depending if a block is given.

faustinoaq commented 6 years ago

Is this already fixed? @eliasjpr

Is there any issue about creating a link_to Controller, :action ?

eliasjpr commented 6 years ago

Addressed with https://github.com/amberframework/jasper-helpers/pull/18