0

I already made some successfully experiments integrating nesta with rails 3 (see Is it possble include Nesta CMS into Rails3 application? and Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 application)

But than, I needed a menu on the right side of the blog, like explained in "Working with menus"

To give it a try, I built the famous content-demo site with nesta demo:content, but all links appearing on the right side, which are coming from content-demo/menu.txt, are broken because related to the main Rails app (http://example.com) and not to the embedded nesta blog (http://example.com/blog)

Here it is my current file configs, the integration is between Rails 3.0.10 and Nesta 0.9.10 :

config/routes.rb

  match '/blog' => Nesta::App
  match '/css/*style.css' => Nesta::App
  match '/attachments/*file' => Nesta::App
  root :to => "home#index"

UPDATE:

using mount Nesta::App, :at => '/blog' instead of match '/blog' => Nesta::App rich the same result ...

config/initializers/nesta.rb

require "nesta/env"
require "nesta/app"
Nesta::Env.root = ::File.expand_path("../../nesta-blog", File.dirname(__FILE__))
Nesta::App.root = ::File.expand_path("../../nesta-blog", File.dirname(__FILE__))

nesta-blog/config/config.yml

...
content: nesta-blog/content-demo
...

I thought was depending by how nesta built the relative path of menu's liks and that was depending on base_url method in nesta-0.9.10/lib/nesta/app.rb.

Than I tried unpacking locally nesta-0.9.10 changing url = "http://#{request.host}" in url = "http://#{request.host}/blog":

  def base_url
    url = "http://#{request.host}/blog"
    request.port == 80 ? url : url + ":#{request.port}"
  end

put gem 'nesta', :path => 'vendor/gems/nesta-0.9.10' on Gemfile and build update nesta but no, doesn't work.

UPDATE:

Also few tries with Nesta::Menu.for_path('/') in ./vendor/gems/nesta-0.9.10/lib/nesta/app.rb

  def set_common_variables
    @menu_items = Nesta::Menu.for_path('/')
    @site_title = Nesta::Config.title
    set_from_config(:title, :subtitle, :google_analytics_code)
    @heading = @title
  end

didn't get results.

My nesta-blog/content-demo/menu.txt don't currently refers to the home page (like in default generation with nesta demo:content):

marking-up-pages
  examples/using-markdown
  examples/using-textile
  examples/using-haml
  adding-attachments
menu-editing
publishing-a-feed

and if I try putting on top something like :

/ or /blog or /nesta-blog the menu disappear ...

So my question is, how does it work ? Do you have any suggestion / workaround ?

Thanks in advance Luca G. Soave

Community
  • 1
  • 1
Luca G. Soave
  • 12,271
  • 12
  • 58
  • 109

1 Answers1

0

Did you try mounting Nesta, instead of justing matching a route (as described in Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 application)?

I would expect that mount in routes.rb might deal with all these relative path issues for you.

I think stack overflow is great, but I suspect you'll do better with this stuff on the Nesta mailing list. The number of people who use Nesta who see your posts on here will be relatively small...

Community
  • 1
  • 1
Graham Ashton
  • 614
  • 5
  • 10
  • Yes I tried. mount Nesta::App, :at => '/blog' works the same way and this sound strange to me too after I read the following article: http://library.edgecase.com/Rails/2011/01/04/rails-routing-and-rack-endpoints.html but the two ways don't affect menu's relative path. Moreover everything else works fine ... – Luca G. Soave Sep 11 '11 at 23:28
  • ... i use mount Nesta::App, :at => '/blog' and not mount Nesta::App, :at => '/' because I already have root :to => "home#index" which route the main Rails3 app ... – Luca G. Soave Sep 11 '11 at 23:33