lucasefe / themes_for_rails

Theme Support for Rails 3
This very same page :)
MIT License
308 stars 102 forks source link

Mountable Engine #64

Open jackbit opened 12 years ago

jackbit commented 12 years ago

How to implement it on mountable engine? because i tested, it doesnt work. many thanks.

lucasefe commented 12 years ago

I never use it that context. Can you provide some context and errors messages? Maybe I can help you.

Lucas Florio @lucasefe http://lucasefe.com.ar/

On Wednesday, August 15, 2012 at 12:04 AM, Yacobus Reinhart wrote:

How to implement it on mountable engine? because i tested, it doesnt work. many thanks.

— Reply to this email directly or view it on GitHub (https://github.com/lucasefe/themes_for_rails/issues/64).

jackbit commented 12 years ago

there's no error message, the problem is the routes can't reach view in my engine, here is my engine.rb snipped code:

require 'rubygems'
require 'themes_for_rails'
module Shopping
  class Engine < ::Rails::Engine
    isolate_namespace Shopping
    config.autoload_paths += %W( #{config.root}/lib )
    ...
    ThemesForRails.config do |config|
      config.assets_dir            = 'app/assets/:name'
      config.themes_dir           = 'app/themes'
      config.views_dir              = 'app/themes/:name/views/shopping'
      config.themes_routes_dir = 'assets'
    end
    ...
  end
end

I decided to group view and assets by themes. each time i access the engine view, it could not find view file in app/themes/my_theme/views/shopping, it keeps pointing views to app/views/shopping. any idea?

lucasefe commented 12 years ago

Are you sure the ThemesForRails.config block is being executed?

jasherai commented 12 years ago

You might also want to make sure your engine is loading the themes_for_rails routes too.

jackbit commented 12 years ago

Hi All,

I did include themes_for_rails in my engine routes.rb, how i could know the ThemeForRails.config block is executed or not? I have also tested about:

config.theme_for_rails.assets_dir = 'app/assets/:name' config.theme_for_rails.themes_dir = 'app/themes' config.theme_for_rails.views_dir = 'app/themes/:name/views/shopping' config.theme_for_rails.themes_routes_dir = 'assets'

but still can't find my themes location. if i put config.themes_for_rails = 'app/assets/:name', automatically raise an error about can not produce string, doest it means the theme_for_rails configuration executed?

I still have no idea, at the moment i revert back my view to main application.

jasherai commented 12 years ago

I would try a rake routes in your main app.. if that returns the TFR routes then your engine is loading that route which suggests that TFR is being loaded.

I would also turn off the themes_routes_dir = 'assets' until you have it working as this is meant to work with the asset pipeline which will only muddy things for you right now.

@lucasefe please let us know if I have misunderstood any of this.