Custom stylesheet for CMS module

edited February 2013 in Feature Requests
I've added a custom js file to one of my modules in fuel/Application/config/MY_fuel_modules.php like so...
'js' => array('filename')
Is there a way to add a custom stylesheet for the CMS as well? Something in the MY_fuel_modules.php config like...
'css' => array('filename')
Would be great!

Comments

  • edited 11:34AM
    If you create an advanced module, it will automatically load any css file in your fuel/modules/{module}/assets/{module}.css. Additionally there is a MY_fuel.php configuration parameter you can set of "xtra_css" which will load a CSS file globally. Also, if you are using a controller to render your admin page, you can pass a $css variable to your view which will automatically be rendered in the header. The reason it's handled a little different is because the CSS files for advanced modules need to be loaded for every request because they are used to render the left hand menu icons.
  • edited 11:34AM
    Thanks!
  • edited 11:34AM
    I have a players table in the db. In the list view of that module of the CMS I need to hide the edit and delete links for some fuel users. I want them to be able to export the items in the list as a csv but not be able to edit or delete any of the records - I have 'exportable' => TRUE and it works great.

    So I went into the user permissions area of the CMS as admin and checked the box 'Manage Players' but in the hierarchy just beneath it I have deselected Players Delete, Players Edit and Players Publish. The Edit and Delete text links still show up in the list view and the delete link as well as the multiple delete function even work for this user!

    So, I must be understanding permissions setting wrong. Is there a way out of the box to allow a user to see the list but not be able to edit or delete any of the records?
  • edited 11:34AM
    Is there a way to use jquery/javascript to detect whether or not the super admin is logged in? Maybe a cookie?
  • edited 11:34AM
    The default permissions on a simple module were incorrectly set in Fuel_modules.php which I've updated on GitHub on v1.0 to be "'permission' => array('create', 'edit', 'publish', 'delete'),". You can also set this for your simple module and it should work. The default use to be simply the modules name.

    Also included in that is a new feature Jonathan here at Daylight created which allows you to login as a someone else and quickly switch back. To do this, you must be a super admin and you'll see an extra action link in the list view of the users module that says LOGIN AS next to there name. Simply click that and you are logged in as that person. To switch back click the "Restore original user" link at the top next to your logged in user name.
  • edited 11:34AM
    I'm using a version of 1.0 from around 4 months ago. What would be the minimal set of files to update to be able to take advantage of the 'permissions' fix you mentioned above?

    There have been some pretty major changes over the last couple of months. Noticed several db tables have changed and much of the structure has as well. Is there an easy path to update to the latest version? For example, fuel_users password salt is gone and of course old passwords won't successfully copy over to the new table.

    Also, I now get several errors calling the $CI instance, etc. Would probably take a LONG time to sort through all this because I have created several MY_ files based on some old fuel files. For example, I have a my_assets_model.php file in the applications/models/ dir copied from the old fuel/modules/fuel/models/assets_model.php file.
  • edited February 2013
    This was the commit that fixed the permission:
    https://github.com/daylightstudio/FUEL-CMS/commit/12d822f1885500a0fa8375b406b960a07a48f54d

    With regards to updating, it's tough to say what would be easiest based on if you made any changes to the FUEL core that may need to be replicated. In general 1.0 has removed as much as it could from the application directory and put it in the fuel/modules/fuel directory to make updating the FUEL module core easier going forward. Also, another structural change is that all extra modules are now in their own development repos (https://github.com/daylightstudio?tab=repositories) and would need to be downloaded and installed. In particular, I'd install the user_guide module which has a lot of new documentation around 1.0 and some of the updates as well as a new advanced module installer command to install the proper permissions automatically for an advanced module. It also covers the new "fuel" object in which many things are attached.

    Here is what I would recommend on how to update:

    1. Create a new project folder and checkout the latest 1.0 branch from GitHub and leave it as a remote repo so you can easily pull in 1.0 updates while it's still in beta
    2. Go through the install directions for 1.0 beta
    3. Copy over from your old version to the new the following files:
    - fuel/application/config/MY_fuel.php
    - fuel/application/config/MY_fuel_modules.php
    - fuel/application/config/MY_fuel_layouts.php
    4. Copy over in models, controllers, views and custom helpers (not those that are part of the fuel core because they are now in the fuel/modules/fuel/helpers/ folder).

    I'd start there and see how it goes.
  • edited February 2013
    Thanks! I have it up and working now. Forked the 'correct' branch this time. Yikes.

    Ok, so what I want is to give a user access to a simple module's list view only (players_model) AND be able to export that list as csv. I created the following permissions in the CMS - players, players/create, players/delete, players/edit, players/export

    I pulled up the CMS user and edited their permissions by ticking the players box and the export box. When I use 'Log in as" (cool feature btw!) for that user I am able to see the EDIT link out beside each of the records and I don't see the export button across the top. If I click the edit link it of course takes me to an ugly page that says 'you don't have permission...'

    Would make more sense to not have the EDIT link there if that user has no edit permissions. Also, what do I do to get the Export button to show up for that user?

    Thanks in advance!
  • edited 11:34AM
    You are correct. There was an issue with the previous push. I've pushed another fix for that. You should be able to do a pull from the remote repo to fix.
  • edited 11:34AM
    Thanks so much! One more issue to consider, though, is the link still attached to each row in the list view. Clicking that now takes you to /fuel/undefined. Tried to find out where that was being generated. I assume it's a jquery click function but couldn't find any 'rowaction' or 'data_table_row' selectors.
  • edited 11:34AM
    Thanks for the heads up with that. I've posted a fix (in the fuel/modules/fuel/assets/js/fuel/controllers/BaseFuelController.js file).
  • edited 11:34AM
    Thanks!
Sign In or Register to comment.