Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanami 2 #199

Closed
wants to merge 36 commits into from
Closed

Hanami 2 #199

wants to merge 36 commits into from

Conversation

jodosha
Copy link
Member

@jodosha jodosha commented Mar 2, 2022

Changes

  • Update dependencies and code organization to make hanami-helpers to work with Hanami 2.
  • Hanami::Helpers::RoutingHelper was ported to hanami.
  • Simplified HTML helper implementation.
  • New HTML helper implementation is twice faster!
  • Simplified Form helper implementation and public API.

Form helper changes:

  • It only accepts an URL as only argument for <form> action.
  • It accepts keyword arguments for <form> tag attributes
  • It yields a form builder that MUST be used to generate form fields
  • Removed fields_for
  • Form fields helpers require to specify the full naming path as a dot separated String
# 1.0
form_for(:book, routes.books_path) do
  fields_for :author do
    fields_for :avatar do
      text_field :url
    end
  end

  submit "Create book"
end

# <form action="/path" method="POST" id="book-form">
#   <input type="text" name="book[author][avatar][url]" id="book-author-avatar-url">
#   <button type="submit">Create book</button>
# </form>

# 2.0
form_for(routes.books_path, id: "book-form") do |f|
  f.text_field "book.author.avatar.url"

  f.submit "Create book"
end

# <form action="/path" method="POST" id="book-form">
#   <input type="text" name="book[author][avatar][url]" id="book-author-avatar-url">
#   <button type="submit">Create book</button>
# </form>

Notes for reviewers

  • Form helper is about to be migrated to hanami in a subsequent PR.

Ref: hanami/hanami#1155
Ref: hanami/view#206

@jodosha jodosha added this to the v2.0.0 milestone Mar 2, 2022
@jodosha jodosha self-assigned this Mar 2, 2022
jodosha added 27 commits March 4, 2022 10:05
It was using deprecated `Hanami::Utils::String.capitalize`
timriley added a commit to hanami/view that referenced this pull request Apr 7, 2023
These are copied verbatim from the “Hanami 2” PR from hanami-helpers: hanami/helpers#199.

These helpers will not work in this commit, but it will allow for subsequent commits to show the changes required to bring these helpers into a working state.
timriley added a commit to hanami/view that referenced this pull request Apr 28, 2023
These are copied verbatim from the “Hanami 2” PR from hanami-helpers: hanami/helpers#199.

These helpers will not work in this commit, but it will allow for subsequent commits to show the changes required to bring these helpers into a working state.
@@ -165,5 +240,5 @@ View helpers for Ruby web applications
## v0.1.0 - 2015-03-23
### Added
- [Luca Guidi] Introduced `Lotus::Helpers::RoutingHelper`. It exposes `#routes` in views for compatibility with Lotus (`hanamirb` gem)
- [Alfonso Uceda Pompa] Introduced `Lotus::Helpers::EscapeHelper`. It implements OWASP/ESAPI suggestions for HTML, HTML attribute and URL escape helpers.
- [Alfonso Uceda Pompa] Introduced `Lotus::Helpers::EscapeHelper`. It implements O1.0P/ESAPI suggestions for HTML, HTML attribute and URL escape helpers.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this intentional?

@jodosha jodosha removed this from the v2.0.0 milestone Oct 21, 2023
@jodosha jodosha closed this Oct 21, 2023
@jodosha jodosha deleted the rewrite/hanami-2 branch October 21, 2023 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants