js_controller & advanced modules

edited April 2013 in Modules
Hi, I have an advanced module (newsletter), with sub-models. The config array for these is declared in the "newsletter_fuel_modules" file, but how do you set the js_controller to work from the advanced module assets folder, not the \fuel\modules\fuel\assets\js\fuel\controller directory? I've got this in the advanced module

$config['modules']['articles'] = array( 'model_location' => 'newsletter', 'module_uri' => 'newsletter/articles', 'js_controller' => 'fuel.controller.ArticlesController' );

but the model seems to expect the controller file to be loaded as per a simple module.

Comments

  • edited April 2013
    You'll need to add the 'js_controller_path' to your module configuration:
    'js_controller_path' => js_path('','articles');
    You'll also either need to change the controller to be either just "ArticlesController" to live at fuel/modules/articles/assets/ArticlesController.js or it will need to live at fuel/modules/articles/assets/fuel/controller/ArticlesController.js given it's current object path.
  • edited 1:58PM
    Hmm - but this model "articles" is a sub-model of "newsletter". It doesn't need its own path as you suggest, really?
  • edited 1:58PM
    My mistake. It should be the name of your advanced module like you suggest:
    'js_controller_path' => js_path('','newsletter');
  • edited April 2013
    You're forgiven!

    OK that all works nicely, and is much tidier.
Sign In or Register to comment.