themes_for_rails icon indicating copy to clipboard operation
themes_for_rails copied to clipboard

Mountable Engine

Open jackbit opened this issue 12 years ago • 6 comments

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

jackbit avatar Aug 15 '12 03:08 jackbit

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).

lucasefe avatar Aug 15 '12 07:08 lucasefe

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?

jackbit avatar Aug 15 '12 08:08 jackbit

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

lucasefe avatar Aug 16 '12 12:08 lucasefe

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

jasherai avatar Aug 16 '12 13:08 jasherai

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.

jackbit avatar Aug 16 '12 14:08 jackbit

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.

jasherai avatar Aug 16 '12 17:08 jasherai