-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Rails native view tags support #598
Comments
i came with a smth: module MatestackCoreHelper
[
ActionView::Helpers::UrlHelper.instance_methods(false),
ActionView::Helpers::AssetTagHelper.instance_methods(false),
].flatten.each do |rails_view_method|
define_method rails_view_method do |*args, **opts, &block|
if block
args.unshift(matestack_to_s { block.call })
end
plain { super(*args, **opts) }
end
end
%i[
form_with form_for content_tag
].each do |rails_view_method|
define_method rails_view_method do |*args, **opts, &block|
plain do
super(*args, **opts) do |form|
matestack_to_s do
block.call(PlainWrapper.new(self, form))
end
end
end
end
end
class PlainWrapper
def initialize(ctx, form)
@ctx = ctx; @form = form
end
private def method_missing(method, *args, **opts, &block)
return super unless @form.respond_to?(method)
@ctx.plain @form.send(method, *args, **opts, &block)
end
end
end now the example above works w/o calling plain explicitly |
I also tried with simple_form and it works, just had to add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
would be nice if matestack would support rails view tags by default
I know matestack has it's own form way, but still
The text was updated successfully, but these errors were encountered: