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

enable passing of html_options hash #26

Merged
merged 2 commits into from
Jul 25, 2020
Merged

enable passing of html_options hash #26

merged 2 commits into from
Jul 25, 2020

Conversation

leastbad
Copy link
Contributor

Type of PR (feature, enhancement, bug fix, etc.)

Enhancement

Description

All calls to the futurize helper now accept a new parameter, html_options which is a hash. This gets passed directly to content_tag.

eg.

<%= futurize @posts, extends: :tr, html_options: {style: "color: red"} do %>
  <td class="placeholder">&nbsp;</td>
<% end %>

will produce:

<tr data-signed-params="BAhvOglQb3N0EDoQQG5ld19yZWNvcmRGOhBAYXR0cmlidXRlc286HkFjdGl2ZU1vZGVsOjpBdHRyaWJ1dGVTZXQGOwdVOiNBY3RpdmVNb2RlbDo6TGF6eUF0dHJpYnV0ZUhhc2hbCn0JSSIHaWQGOgZFVG86H0FjdGl2ZU1vZGVsOjpUeXBlOjpJbnRlZ2VyCToPQHByZWNpc2lvbjA6C0BzY2FsZTA6C0BsaW1pdGkNOgtAcmFuZ2VvOgpSYW5nZQg6CWV4Y2xUOgpiZWdpbmwtCQAAAAAAAACAOghlbmRsKwkAAAAAAAAAgEkiCnRpdGxlBjsKVG86HkFjdGl2ZU1vZGVsOjpUeXBlOjpTdHJpbmcIOwwwOw0wOw4wSSIPY3JlYXRlZF9hdAY7ClRVOkpBY3RpdmVSZWNvcmQ6OkF0dHJpYnV0ZU1ldGhvZHM6OlRpbWVab25lQ29udmVyc2lvbjo6VGltZVpvbmVDb252ZXJ0ZXJbCToLX192Ml9fWwBbAG86QEFjdGl2ZVJlY29yZDo6Q29ubmVjdGlvbkFkYXB0ZXJzOjpQb3N0Z3JlU1FMOjpPSUQ6OkRhdGVUaW1lCDsMaQs7DTA7DjBJIg91cGRhdGVkX2F0BjsKVFU7FVsJOxZbAFsAQBZvOh1BY3RpdmVNb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TdXBwb3J0OjpQYXJhbWV0ZXJGaWx0ZXI6OkNvbXBpbGVkRmlsdGVyCToNQHJlZ2V4cHNbBkkvDXBhc3N3b3JkAQY7CkY6EkBkZWVwX3JlZ2V4cHMwOgxAYmxvY2tzWwA7LkA4--2b48904b0251e074f7c718ef2d7737e7bd4ce555" is="futurism-table-row" style="color: red">
  <td class="placeholder">&nbsp;</td>
</tr>

Why should this be added

Layouts might require placeholder elements to have CSS classes or styles to enforce layout. Some scripts also make calculations based on dimensions.

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing

Copy link
Contributor

@julianrubisch julianrubisch left a comment

Choose a reason for hiding this comment

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

Also, asking you this is kind of a sacrilege, but would you add that change to the README, too? 😁

lib/futurism/helpers.rb Outdated Show resolved Hide resolved
@leastbad
Copy link
Contributor Author

No problem at all!

@julianrubisch julianrubisch merged commit 75e8914 into stimulusreflex:master Jul 25, 2020
@leastbad leastbad deleted the html_options branch July 25, 2020 10:31
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