Generalize tag render_partial
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
I have a tag which I call:
{% render_partial 'my_partial' %}
This is the tag:
class RenderPartial < Liquid::Tag
def initialize(tag_name, partial_name, options)
super
@partial_name = partial_name.gsub(/\s|"|'/, "").strip
end
def render(context)
context.registers[:controller].dup.render(partial: @partial_name)
end
end
Liquid::Template.register_tag("render_partial", RenderPartial)
I want to generalize this tag for when I have to pass parameters to the partial. On rails would be:
<%= render("user/subscriptions/subscribable_box",
subscribable: current_site,
title: t("subscribable_box.title")) %>
Has anyone solved this kind of partial rendering? Thanks!!!!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the custom RenderPartial tag and the Liquid::Tag API shown in the issue. Clarify the parameter syntax and how values should reach the Rails partial, then identify the project entry points and tests needed to define supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100