Re: [nesta] Menu is not working on my Nesta CMS on Rails3 integration
- From:
- Luca G. Soave
- Date:
- 2011-09-12 @ 19:36
Done as suggested :
my config/initializers/nesta.rb is like the following :
require "nesta/env"
Nesta::Env.root = ::File.expand_path("../../nesta-blog", File.dirname(__FILE__))
require "nesta/app"
... and nothing changes.
But I think anyway, the issue is something to look into the following snippets :
lsoave@ubuntu:~/rails/github/gitwatcher$ find
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/ -exec grep
"'/'" {} \; -print
Nesta::Page.find_by_path('/').title.should == 'Home - My blog'
Nesta::Page.find_by_path('/').title.should == 'Specific title'
Nesta::Page.find_by_path('/').title.should == 'My blog'
Nesta::Page.find_by_path('/').permalink.should == ''
Nesta::Page.find_by_path('/').abspath.should == '/'
Nesta::Menu.for_path('/').should == [@page]
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/spec/models_spec.rb
get '/'
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/spec/page_spec.rb
name = (path.empty? || path == "/") ? "index" :
Rack::Utils.unescape(path.sub(/^(\/)/,'').chomp('/'))
name << options.cache_page_extension unless
(name.split('/').last || name).include? '.'
cache_dir = cache_dir[0..-2] if cache_dir[-1,1] == '/'
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/lib/nesta/cache.rb
@menu_items = Nesta::Menu.for_path('/')
text.gsub!(/(<a href=['"])\//, '\1' + base_url + '/')
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/lib/nesta/app.rb
elsif abspath == '/'
if abspath == '/'
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/lib/nesta/models.rb
(page.abspath == '/') ? 'Home' : page.heading
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/lib/nesta/navigation.rb
lsoave@ubuntu:~/rails/github/gitwatcher$
... and also :
lsoave@ubuntu:~/rails/github/gitwatcher$ find
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10 -exec grep
"base_url" {} \; -print
File.join(base_url, page.path)
def base_url
text.gsub!(/(<a href=['"])\//, '\1' + base_url + '/')
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/lib/nesta/app.rb
%loc= base_url
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/views/sitemap.haml
%link(href="#{base_url}/articles.xml" rel='self')
%link(href=base_url rel='alternate')
/home/lsoave/.rvm/gems/ruby-1.9.2-p136/gems/nesta-0.9.10/views/atom.haml
lsoave@ubuntu:~/rails/github/gitwatcher$
What do you say ?
Thanks
Luca
On Mon, Sep 12, 2011 at 8:15 AM, Graham Ashton <graham@effectif.com> wrote:
> On 12 Sep 2011, at 02:25, Luca G. Soave wrote:
>
>> I've partially integrated nesta-0.9.10 into an existing rails-3.0.10
>> app. The only thing which doesn't work seems to be Menus. All menu's
>> link path are generated relative to / instead of /blog.
>
> I've just been looking through the code, and I think that's probably a
Nesta bug. Using `mount` in `routes.rb` should make this just work.
>
> I've filed a bug. https://github.com/gma/nesta/issues/68
>
>> config/initializers/nesta.rb initialize nesta root :
>> ------------------------------------------------------------------
>> 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__))
>
> The point of Nesta::Env (which lives in nesta/env) is to allow you to
set the root path before nesta/app gets loaded. I'm surprised that you
didn't need to swap lines two and three. Worth doing anyway, and then you
can delete line four.
>
Re: [nesta] Menu is not working on my Nesta CMS on Rails3 integration
- From:
- Graham Ashton
- Date:
- 2011-09-14 @ 08:01
On 12 Sep 2011, at 20:36, Luca G. Soave wrote:
> What do you say ?
I have a strong suspicion that Nesta's menus don't cope too well when
Nesta is mounted at a path other than "/". It's a bug. I'll file one.
This may not help at all, but have you considered mounting Nesta at "/"
and then creating a blog subfolder inside content/pages? It may allow you
to work around it before we get it fixed...
Re: [nesta] Menu is not working on my Nesta CMS on Rails3 integration
- From:
- Luca G. Soave
- Date:
- 2011-09-14 @ 13:32
What about subdomain ? Could something like
"http://blog.example.com/" works as well ?
In case of yes, how can be configured that ?
Thanks in advance
Luca G. Soave
On Wed, Sep 14, 2011 at 10:01 AM, Graham Ashton <graham@effectif.com> wrote:
> On 12 Sep 2011, at 20:36, Luca G. Soave wrote:
>
>> What do you say ?
>
> I have a strong suspicion that Nesta's menus don't cope too well when
Nesta is mounted at a path other than "/". It's a bug. I'll file one.
>
> This may not help at all, but have you considered mounting Nesta at "/"
and then creating a blog subfolder inside content/pages? It may allow you
to work around it before we get it fixed...
>
Re: [nesta] Menu is not working on my Nesta CMS on Rails3 integration
- From:
- Graham Ashton
- Date:
- 2011-09-14 @ 15:27
On 14 Sep 2011, at 14:32, Luca G. Soave wrote:
> What about subdomain ? Could something like
> "http://blog.example.com/" works as well ?
You can't link to other domains from menu.txt, no.
You could just write the HTML (Haml) for your menu by hand. All the helper
function really does is output a <ul> tag with some links in it. You could
make a views/menu.haml partial and write the relevant HTML in there. If
you're currently using a theme just copy all the .haml files in the theme
into a views/ folder in your site and then edit the file that calls
display_menu() so that it renders your menu template instead.