-
Notifications
You must be signed in to change notification settings - Fork 63
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
Apotomo doesn't look for views in Engines #54
Comments
Yes, the same problem! It does not search widget view in an engine module path (app/widgets/my_engine/my_widget/). |
Try updating |
I can't make this work either. Exactly how would this work for apotomo? Do I need to define a In my case I want to call Would be nice if at least specifying :partial on the render, it would fallback to classic Rails partial behavior. Please help fix this ASAP. Thanks! |
Been trying this cruel hack... just for the hell of it, but no success! module Apotomo
class Widget < Cell::Rails
DEFAULT_VIEW_PATHS = [File.join('app', 'widgets'), File.join('app', 'cells'), File.join('app', 'views')] then copied Also tried renaming the partial to a "normal" view, i.e no underscore prefix:
What the fuck!? |
Crazy stuff! The only way I could make it work was to copy the partial into the current widget view container to make another widget view for the widget. There MUST be another way?
Damn! |
Another curious thing is that it seems like my methods in |
@kristianmandrup: perhaps you should first gather your full intel, and then pour it into a single, witty, comment. This is annoying... Imo; not being able to access all the views you mentioned (incl. helpers) is a very good design decision. |
I'm sorry. It is just coz I spent 2 frustrating hours deep diving into cells and apotomo in order to figure out how to solve this... It wasn't clear from the documentation that it wasn't possible or specifically designed not to allow it. On another note: is it possible to mount widgets with views from other engines, similar to how it is possible in cells? |
You can try creating initializer file in your application with code: Rails.application.config.after_initialize do
Apotomo::Widget.append_view_path YourEngine::Engine.root + 'app/widgets'
end This works for me. |
If you are trying to render a global partial, @kristianmandrup here is what you have to do: https://github.com/apotonick/cells#rendering-global-partials Also, check out the test: https://github.com/apotonick/cells/blob/master/test/rails/view_test.rb#L22 This has been working ever since, BTW ;-) |
Thanks a lot. I will look into it. Very exciting! |
So are you saying that doing I understand it should be used with care for sure since it breaks the widget encapsulation. In fact I don't really like that gmaps4rails has those partials. They should instead be available as view helpers IMO. I guess you still have access to anything added to Would be nice if the docs made all this a little more clear. Thanks! |
On Fri, Sep 14, 2012 at 12:53 PM, Kristian Mandrup <[email protected]
|
So to mount the widgets of an engine, I could add a Rails.application.config.after_initialize do
Apotomo::Widget.append_view_path My::Engine.root + 'app/widgets'
end This would in turn add this engines' view path to the Rails app hosting this engine. Sweet :) |
In my own "version" of apotomo, I've added an |
I've got a problem when using Apotomo in conjunction with Engines:
Looks to me that Apotomo/Cells doesn't respect engines when looking for
views.
app/widgets/usage_widget.rb
works if in an Engine, though.PS: This was already posted here, but this looks like an issue, so I'm posting it here. Sorry for duplcating stuff around, Nick. ;)
The text was updated successfully, but these errors were encountered: