Integrate Monologue to existing views

350 views
Skip to first unread message

nwais...@gmail.com

unread,
Mar 18, 2013, 11:07:12 AM3/18/13
to monolo...@googlegroups.com
I want to use monologue to integrate it to my app, but I want it to be included inside a view (i.e. inside the layout and navigation of my site).

How could I do this? How could I customize more than the css?

Thanks

Jean-Philippe Boily

unread,
Mar 19, 2013, 1:34:19 PM3/19/13
to nwais...@gmail.com, monolo...@googlegroups.com
Hi,
   you can set the layout to be used here in your Monologue configuration. Here is an example: https://github.com/jipiboily/monologue/wiki/Configuration#version-011.

Hope it answers your question!

Jean-Philippe Boily

--
You received this message because you are subscribed to the Google Groups "Monologue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to monologue-rb...@googlegroups.com.

fzu...@gmail.com

unread,
Mar 20, 2013, 3:54:36 PM3/20/13
to monolo...@googlegroups.com, nwais...@gmail.com
Hi Jean,
First of all, congratulations for the gem, looks very nice. I just integrated the blog with my app and configured the layoyt, but for some reason it throws an error when trying to access one of the rails generated path variable helpers. Let me paste the code to be clearer

I have a model called 'center'

and in application.html.erb, I am showing a menu using these helpers

<ul class="menu">
<li <%= 'class = active' if request.url == centers_url %>>
<a href="<%= centers_path %>"><i class="icon-chevron-down"></i> Centros</a>
</li>

but for some reason, the variable centers_url is not available when I access the blog

ActionView::Template::Error (undefined local variable or method `centers_path' for #<#<Class:0x007fe53e013b70>:0x007fe53e1bc328>):
113: <nav id="combined-nav" class="nav-collapse">
114: <ul class="menu">
115: <li <%= 'class = active' if request.url == "http://localhost:3000/centers" %>>
116: <a href="<%= centers_path %>"><i class="icon-chevron-down"></i> Centros</a>
117: </li>
118: <li <%= 'class = active' if request.url == promotions_url %>>
119: <a href="<%= promotions_path %>"><i class="icon-chevron-down"></i> Promociones</a>
app/views/layouts/application.html.erb:116:in `_app_views_layouts_application_html_erb__99968385403352858_70311284176080'

Here's how I mounted monologue

mount Monologue::Engine, at: '/'


Is there something else I'm missing?

fzu...@gmail.com

unread,
Mar 20, 2013, 4:35:35 PM3/20/13
to monolo...@googlegroups.com, nwais...@gmail.com, fzu...@gmail.com
It seems you can include the routes inside the engine this way

Monologue::Engine.routes.draw do
resources :centers
end

Really not sure if this is a best practice...

Jean-Philippe Boily

unread,
Mar 20, 2013, 5:03:22 PM3/20/13
to fzu...@gmail.com, monolo...@googlegroups.com, nwais...@gmail.com
Hey,
   I can't test that right now, but I think adding main.your_route_here should work. Would be main_app.centers_path (or only main.*). There was something like that. I did not play with Rails Engines for a while now so not 100% sure.

For sure, you should not have your main app's routes in Monologue routes…;)

Jean-Philippe Boily

fto...@deviget.com

unread,
Apr 9, 2015, 12:56:51 PM4/9/15
to monolo...@googlegroups.com, nwais...@gmail.com
updated for Rails 4:
main_app.my_path
Reply all
Reply to author
Forward
0 new messages