[PLUGIN] Pages with dropdown

User avatar
Fergo
Jr. Bludit
Posts: 6
Joined: Sat Nov 07, 2015 2:04 am

Hi there!

Here is my first contribution to this wonderful project. It's basically a copy of the Pages plugin, but when a page has child items, the parent page shows a dropdown arrow that allows you to collapse and extend when clicked, showing it's child pages.

Image

Options:
- Page name
- Show Home link
- Collapsed by default

Download:
Pages Dropdown - v0.2

Installation:
Simply extract the attached zip (pages_dropdown.zip) file to the plugins directory and enable it in the admin panel (I suggest disabling the default pages plugin).

Other notes:
When using this plugin, clicking the parent page will only expand/collapse the menu instead of loading the parent page (unless it doesn't have any child items). This behavior can be changed by rolling back the original href tag in php file.

Version History:
v0.2 (07/11/2015)
- Improvements on installation. Just extract and enable, no need to manually edit theme files. Thanks Fred for the tips.
v0.1 (06/11/2015)
- Initial release

Greetings from your brazilian neighbor, diego :)
Keep up the excellent work you are doing.
Attachments
pages_dropdown.zip
Pages Dropdown Plugin - v0.2
(2.18 KiB) Downloaded 244 times
Last edited by Fergo on Sat Nov 07, 2015 5:09 pm, edited 2 times in total.
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Hi Fergo,

Thx for your contribution.
Just suggest to use the call hook Theme::plugins('siteHead') for insert the js file in theme ;)

Good idea for this plugin!
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
User avatar
Fergo
Jr. Bludit
Posts: 6
Joined: Sat Nov 07, 2015 2:04 am

Fred wrote:Hi Fergo,

Thx for your contribution.
Just suggest to use the call hook Theme::plugins('siteHead') for insert the js file in theme ;)

Good idea for this plugin!
Thanks Fred.
Can you elaborate more on that hook? Where do I insert it and how it works?
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

No problem, in this exemple i prefer use siteBodyEnd hook for load js in bottom page, use siteHead for css.
Add your menu.js in your plugin path.
Add this function in your plugin.php:

Code: Select all

	public function siteBodyEnd()
	{
		// Path plugin.
		$pluginPath = $this->htmlPath();		
		return '<script src="'.$pluginPath.'menu.js"></script>';
	}
Save and finish.

It must notify the user to disable that plugin page, to avoid having a duplicate.
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
User avatar
Fergo
Jr. Bludit
Posts: 6
Joined: Sat Nov 07, 2015 2:04 am

Thanks! It's much more organized now. :)
I updated the first post with version 0.2.
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

Hi Fergo, it's a nice feature, if you want you can push your plugin on github, https://github.com/dignajar/bludit-plugins

There are the plugins for Bludit.

Diego
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Thank you! Thought about doing something like this. Now it's yet done. :)
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Fergo
Jr. Bludit
Posts: 6
Joined: Sat Nov 07, 2015 2:04 am

diego wrote:Hi Fergo, it's a nice feature, if you want you can push your plugin on github, https://github.com/dignajar/bludit-plugins

There are the plugins for Bludit.

Diego
Sorry, I not used to version control systems. To create a pull request do I need to clone the entire repository so you can merge into the master branch?
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

Ok no problem. Here is a link with a little tutorial https://help.github.com/articles/using-pull-requests/
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

It's a nice plugin. The only problem: It does not show the content of the parent page, only the content of the child pages.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply