Adding custom Javascript to simple modules + Advances modules in dashboard + account management

edited July 2011 in Feature Requests
Hi there, I'm very happy with Fuel so far, but I'm kind of stuck right now with something.

I have a simple module on the dashboard which allows me to create members. One of the fields there is a select control in which the user type is chosen. I'd like to hide/display additional fields according to that choice using javascript, is it possible to load my custom javascript file with the module?

The other way I had thought about was doing it with an advanced module, but in that case how could I "embed" an advanced module into the dashboard?

Last question, is there a way to provide users the ability to access their account on the dashboard, something like Users for admin, but limited to their own account, so they can edit their email, password, etc. I understand this wouldn't be very difficult to achieve with a simple module but I figured it might already be there.

Thanks a lot,
Daniel.

Comments

  • edited 4:32PM
    A simple module has a few parameters to help in bringing in custom Javascript:
    The parameters are:
    js_controller
    js_controller_path
    js_controller_params
    js

    Documentation for them can be found here:
    http://www.getfuelcms.com/user_guide/modules/simple

    In your case, unless you are wanting to use the jQX framework to do your javascript, you can just use the "js" parameter which can be a string or an array of javascript files to load using the js() function:
    http://www.getfuelcms.com/user_guide/javascript/jqx
    http://www.getfuelcms.com/user_guide/libraries/asset (js function)

    With regards to a user being able to change their specific information, if they click on their name in the upper right, they should be able to change that information.
  • edited 4:32PM
    So simple, can't believe I missed that.

    Thanks a lot.
  • edited 4:32PM
    One thing though, you can add these params to the js function:

    js('file', ['module'], [params])

    but I don't a way to add them (apart from file) through module config.
  • edited July 2011
    If you are wanting the javascript to pull from a certain module folder then you can use an associative array with the key being the module name to pull from. The additional parameters aren't supported though at this point.
  • edited July 2011
    Hoping it might help, here's an example:

    look inside your advanced module's config/modulename_fuel_modules.php file where you declare your modules' properties in the $config array for each module and add

    'js' => array('module_name' => 'file.js')
    this will load the file.js inside fuel/modules/modelname/assets/js and make it available ONLY throughout module's views inside the backend (meaning the list/tree and form views)
  • edited 4:32PM
    Thanks for the example pierlo.
Sign In or Register to comment.