2017 © Pedro Peláez
 

symfony1-plugin pm-j-s-cook-menu-plugin

symfony 1 plugin that wraps JSCookMenu and provides an easy way of creating menues

image

desarrollo-cespi/pm-j-s-cook-menu-plugin

symfony 1 plugin that wraps JSCookMenu and provides an easy way of creating menues

  • Saturday, December 28, 2013
  • by ncuesta
  • Repository
  • 7 Watchers
  • 0 Stars
  • 2 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

pmJSCookMenuPlugin

The pmJSCookMenuPlugin is a wrapper for JSCookMenu. It provides a nice way (using the Composite Design Pattern) for creating menues., (*1)

Installation

{
  "require": {
    "desarrollo-cespi/pm-j-s-cook-menu-plugin": "dev-master"
  }
}
  • Or install from git source.

Usage

  • Load javascript an stylesheets (IE: ThemePanel)
# in apps/<app>/config/view.yml
stylesheets:    [main.css, /pmJSCookMenuPlugin/css/ThemePanel/theme.css]
javascripts:    [/pmJSCookMenuPlugin/js/JSCookMenu.js, /pmJSCookMenuPlugin/js/ThemePanel/theme.js]
  • Select the theme (IE: ThemePanel)
// in apps/<app>/templates/layout.php (BEFORE include_javascript call)
<script>
var myBase = "<?php echo $sf_request->getRelativeUrlRoot() ?>/pmJSCookMenuPlugin/images/ThemePanel/";
var cmBase = myBase;
</script>

Display a menu using a yaml file:, (*2)

  • Create a yaml file for the menu
# in apps/<app>/config/menu.yml (or other file)
root:
  root: true
  orientation: hbr
  theme: ThemePanel

  menu1:
    title: Start here
    icon: menu.png #this is found in web/images
    submenu: # a submenu for menu1
      menu1.1:
        title: go to google
        url: http://www.google.com
      menu1.2:
        title: go to yahoo
        description: another search engine
        url: http://www.yahoo.com
        target: blank
      menu2:
        title: some actions
        submenu:
      menu2.1:
        title: Create an object
        credentials: [some, credentials]
        url: module/actions
      _cmSplit:
      menu2.2:
        title: another menu
        url: module/actions
  • Display the menu
// in apps/<app>/templates/layout.php
<?php $menu = pmJSCookMenu::createFromYaml(sfConfig::get("sf_app_config_dir")."/menu.yml") ?>
<?php echo $menu->render() ?>
  • Display a menu programatically:

setTitle("Integrador")?>
setRoot() ?>
setOrientation("hbr") ?>
setTheme("ThemePanel") ?>


setTitle("some module")->setUrl("@some_module") ?>
addChild("som_module", $menu_item) ?>


setTitle("another_module")->setUrl("@another_module") ?>
addChild("another_module", $menu_item) ?>


setTitle("and_another")->setUrl("@and_another") ?>
addChild("and_another", $menu_item) ?>

render() ?>

The Versions

28/12 2013

dev-master

9999999-dev

symfony 1 plugin that wraps JSCookMenu and provides an easy way of creating menues

  Sources   Download

MIT

The Requires

 

by Desarrollo CeSPI