Soma Posted August 27, 2011 Share Posted August 27, 2011 Hey, my first, just a little module to generate a TOC with links on top of modules page for overview and easing navigation. Not sure if there's already something similar planed already for the Modules page in the core. But none the less, it was fun to try out captain Hook Just cleaned and checked this baby in: https://github.com/somatonic/ModulesSectionCollapse Link to comment Share on other sites More sharing options...
Pete Posted August 27, 2011 Share Posted August 27, 2011 Nice work It would be good if they were collapsible too Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 Thanks Pete. Yes, I also thought about this after I've done the TOC. Here's a even more simple module that collapses the sections, and uses the sections titles to toggle the module table. The new ModulesSectionCollapse Module is attached. Edit: updated first post with github repo. Link to comment Share on other sites More sharing options...
ryan Posted August 27, 2011 Share Posted August 27, 2011 Congrats on your first module and nice job! Also wanted to mention another way you can get the JS into the document without having to modify the HTML. Instead of an str_replace, you can do this in your loadJS function: $this->scripts->add($this->config->urls->ModulesTOC . "ModulesTOC.js"); The way you are doing it now is just fine too. But since PW already has a system for adding scripts in the admin theme, I figured I'd point out this option too. Thanks, Ryan Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 Also wanted to mention another way you can get the JS into the document without having to modify the HTML. Instead of an str_replace, you can do this in your loadJS function: $this->scripts->add($this->config->urls->ModulesTOC . "ModulesTOC.js"); Thanks Ryan, that's great. I thought there must be something like this, but couldn't figure it out yet (was too lazy). Now I'm trying this and It doesn't work with addHookAfter Page::render: Fatal error: Call to a member function add() on a non-object in /var/www/domains/zueblin.update.ch/site/modules/ModulesSectionCollapse/ModulesSectionCollapse.module on line 65 This error message was shown because the site is in DEBUG mode. SO I thought the hook must be different but can't get it work. addHookAfter Page::loaded etc... Can you give me a hint? Thanks. Link to comment Share on other sites More sharing options...
ryan Posted August 27, 2011 Share Posted August 27, 2011 Sorry Soma, typo--my mistake, it should be $this->config->scripts not $this->scripts Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 Still, the add error is gone but script isn't added. Any Ideas? <?php public function init() { $this->addHookAfter('Page::render', $this, 'loadJS'); } public function loadJS($event) { if($this->process == 'ProcessModule') $this->config->scripts->add($this->config->urls->ModulesSectionCollapse . "ModulesSectionCollapse.js"); } Link to comment Share on other sites More sharing options...
Pete Posted August 27, 2011 Share Posted August 27, 2011 Maybe add it before render? Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 No luck. :/ Link to comment Share on other sites More sharing options...
ryan Posted August 27, 2011 Share Posted August 27, 2011 Yes the before render is I think what you need. That should work. Always hard for me to tell the right things when away from the computer (just on mobile today) Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 I changed to addHookBefore('Page::render',.. It still doesn't load the script. Link to comment Share on other sites More sharing options...
ryan Posted August 27, 2011 Share Posted August 27, 2011 Not sure why. Double check all filenames are where. I will try when I get back to computer Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 Thanks for the help, but can't get it to work... checked files and tried all different variations. Link to comment Share on other sites More sharing options...
apeisa Posted August 27, 2011 Share Posted August 27, 2011 $this->addHookAfter('Process::execute', $this, 'loadJS'); Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 $this->addHookAfter('Process::execute', $this, 'loadJS'); Works! Thanks, you're my hero! Link to comment Share on other sites More sharing options...
apeisa Posted August 27, 2011 Share Posted August 27, 2011 No worries, glad you got it working. That is nice little module and got me thinking. Modules page is not only place where lists get very long and would benefit from some more js love. I have used Datatables a lot and I think it would be perfect on many lists that pw has. It has nice filter search, pagination, sorting, it is fast and easy to use. As a little bonus it supports themeroller. Also possible to use with huge datasets with ajax. http://www.datatables.net/ - just that you guys can take a look - don't wanna capture Soma's module topic here Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 Here's a new version of the modules section collapse module. Added count and +- Hope it's useful for someone. Edit: updated first post with github repo. Link to comment Share on other sites More sharing options...
Soma Posted August 27, 2011 Author Share Posted August 27, 2011 That is nice little module and got me thinking. Modules page is not only place where lists get very long and would benefit from some more js love. I have used Datatables a lot and I think it would be perfect on many lists that pw has. It has nice filter search, pagination, sorting, it is fast and easy to use. As a little bonus it supports themeroller. Also possible to use with huge datasets with ajax. Actually that's a very nice and simple to use plugin I also used (after trying some datatable plugins) in some codeigniter projects, with ajax and themeroller styling, especially like the cookie state save option and sortable, filterable. It was very nice as my apps also uses jquery ui. Would be nice to have such a feature for very large lists. Wasn't this already discussed somewhere? Link to comment Share on other sites More sharing options...
apeisa Posted August 27, 2011 Share Posted August 27, 2011 Wasn't this already discussed somewhere? Probably, but can't remember. I have used datatables many times, and I have only good to say about that plugin. Rock solid stuff it is! Here's a new version of the modules section collapse module. Added count and +- Nice update! Link to comment Share on other sites More sharing options...
Soma Posted September 20, 2011 Author Share Posted September 20, 2011 Just cleaned and checked in on github. Updated first post too. https://github.com/somatonic/ModulesSectionCollapse Makes things alot easier. Thanks Link to comment Share on other sites More sharing options...
teppo Posted December 9, 2011 Share Posted December 9, 2011 Just wanted to say that this module is great - I really prefer the simplicity it brings. Things like these can make a big difference in UX! Although, I must confess that I'm still using a slightly modified version with some extra information (installed modules vs. uninstalled, names of uninstalled modules on hover) visible. Added a screenshot as an attachment Link to comment Share on other sites More sharing options...
Pete Posted December 9, 2011 Share Posted December 9, 2011 Nice additions - would you mind sharing the code? Link to comment Share on other sites More sharing options...
Soma Posted December 9, 2011 Author Share Posted December 9, 2011 Yeah, glad you like the module and even have added things! - Though I don't see the benefit of seeing 10/5 that much but nice touch. - To see the installed ones on hover. How would this look with the 30 Fields? I thought it's nice but not something I would want really. But don't hestitate to make adaptions to your likeing. You could fork mine on github and let other people use it? Link to comment Share on other sites More sharing options...
teppo Posted December 9, 2011 Share Posted December 9, 2011 Soma: my modifications (especially the latter one) could prove out to be problematic in real world use - to be honest they were originally just something created as a temporary solution for a temporary problem, but I thought I'd share them anyway in case someone else happened to like 'em Only thing I've changed is ModulesSectionCollapse.js, but since I've never used GitHub before (...) I created an account and a fork of the original project anyway. If someone wants to try out these changes, you could just download the .js file and merge changes / replace original with it. Here's a direct link: https://github.com/TeppoKoivula/ModulesSectionCollapse/blob/master/ModulesSectionCollapse.js Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now