Jump to content

Module: ModulesSectionCollapse


Soma
 Share

Recommended Posts

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

post-1337-132614279013_thumb.png

Link to comment
Share on other sites

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

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

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

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

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

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

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

  • 4 weeks later...
  • 2 months later...

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

post-6450-132614281439_thumb.png

Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...