Nesta CMS和Rails3集成:菜单不起作用

时间:2011-09-10 16:10:12

标签: ruby-on-rails ruby ruby-on-rails-3 content-management-system nestacms

我已经成功完成了将nesta与rails 3集成的实验(请参阅Is it possble include Nesta CMS into Rails3 application?Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 application

但是,我需要在博客右侧显示一个菜单,如“Working with menus”中所述

为了试一试,我用nesta demo:content构建了着名的内容演示网站,但右侧出现的所有链接都来自content-demo / menu.txt,因为它们与主要的Rails应用程序(http://example.com)而不是嵌入式nesta博客(http://example.com/blog

这是我当前的文件配置,集成在Rails 3.0.10和Nesta 0.9.10之间:

配置/ routes.rb中

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

更新:

使用mount Nesta::App, :at => '/blog'代替match '/blog' => Nesta::App丰富相同的结果......

配置/初始化/ 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__))

内斯塔-博客/配置/ config.yml

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

我认为这取决于nesta如何构建菜单liks的相对路径,这取决于base_url中的nesta-0.9.10/lib/nesta/app.rb方法。

我尝试在url = "http://#{request.host}"更改url = "http://#{request.host}/blog"本地解压缩nesta-0.9.10:

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

gem 'nesta', :path => 'vendor/gems/nesta-0.9.10'放在Gemfile和build update nesta上,但不,不起作用。

更新:

Nesta::Menu.for_path('/')

中使用./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

没有得到结果。

我的nesta-blog / content-demo / menu.txt目前不是指主页(就像使用nesta demo:content的默认代一样):

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

如果我尝试使用以下内容:

//blog/nesta-blog菜单消失...

所以我的问题是,它是如何工作的? 你有任何建议/解决方法吗?

提前致谢 Luca G. Soave

1 个答案:

答案 0 :(得分:0)

您是否尝试过安装Nesta,而不仅仅是匹配路线(如Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 application中所述)?

我希望mount中的routes.rb可以为您处理所有这些相对路径问题。

我认为堆栈溢出很棒,但我怀疑你会在Nesta邮件列表上做得更好。使用内斯塔在这里看到你的帖子的人数相对较少......