Author: jmorliaguet Date: Mon Dec 26 02:07:31 2005 New Revision: 2080 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html Log:
- saving work, concept code. Ideally contextual menus will be registered with: <cpsskins:contextualmenu controller="actions" area="testArea1" class="large"> <item action="edit" visible="editable">Edit</item> <item action="copy">Copy</item> <item action="paste" visible="editable">Paste</item> <item action="format" visible="format">Formattable</item> <item action="delete" visible="editable" confirm="Deleting, are you sure?">Delete</item> </cpsskins:contextmenu> for the View and with: displayChoice: function() { ... }; var menu_actions = new CPSSkins.Controller('actions'); menu_actions.add({ 'edit': displayChoice, 'copy': displayChoice, 'paste': displayChoice, 'format': displayChoice, 'delete': displayChoice, }) for the Controller part. Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html Mon Dec 26 02:07:31 2005 @@ -8,20 +8,41 @@ <script src="../../cpsskins.js" type="text/javascript"></script> <link rel="stylesheet" href="../test.css" type="text/css" /> <link rel="stylesheet" href="contextualmenus.css" type="text/css" /> + + <script type="text/javascript"> + function displayChoice(selected, choice) { + alert('You have clicked on "' + selected.getAttribute('id') + + '" and selected the "' + choice + '" menu item.'); + } + var menu_actions = new CPSSkins.Controller('actions'); + menu_actions.add({ + 'edit': displayChoice, + 'copy': displayChoice, + 'paste': displayChoice, + 'format': displayChoice, + 'delete': displayChoice, + }); + + </script> + </head> -<body> +<body onload="init()"> <h1>CPSSkins Contextual menus</h1> + <div id="message">...</div> + <div style="float: left; margin: 1em"> <h2>Menu 1</h2> <div id="testArea1"> - <div id="area1" class="pad"></div> - <div id="area2" class="pad" formattable="1"></div> - <div id="area3" class="pad" editable="1"></div> - <div id="area4" class="pad" formattable="1"> - <div id="area5" class="pad" editable="1"></div> + <div id="area1" class="pad" copyable="1">area1</div> + <div id="area2" class="pad" formattable="1" + formats="style:Style,widget:Widget">area2</div> + <div id="area3" class="pad" editable="1">area3</div> + <div id="area4" class="pad" formattable="1" + formats="style:Style,widget:Widget,effect:Effect">area4 + <div id="area5" class="pad" editable="1">area5</div> </div> </div> </div> @@ -29,67 +50,28 @@ <div style="float: left; margin: 1em"> <h2>Menu 2</h2> <div id="testArea2"> - <div id="area6" class="pad" editable="1" formattable="1"></div> + <div id="area6" class="pad" editable="1" formattable="1">area6</div> </div> </div> - <div id="contextmenu1" class="contextMenu large"> - <a action="edit" href="#">Edit</a> - <div class="separator"></div> - <a action="copy" href="#">Copy</a> - <a action="paste" href="#">Paste</a> - <div class="separator"></div> - <a action="format" href="#">Format</a> - <div class="separator"></div> - <a action="delete" href="#" confirm="Deleting, are you sure?">Delete</a> - </div> + <cpsskins:contextualmenu controller="actions" area="testArea1" class="large"> + <item action="edit" visible="editable">Edit</item> + <item action="copy">Copy</item> + <item action="paste" visible="editable">Paste</item> + <item action="format" visible="format">Formattable</item> + <item action="delete" visible="editable" + confirm="Deleting, are you sure?">Delete</item> + </cpsskins:contextmenu> + + <cpsskins:contextualmenu controller="actions" area="testArea2" class="small"> + <item action="edit" visible="editable">Edit</item> + <item action="copy">Copy</item> + <item action="paste" visible="editable">Paste</item> + <item action="format" visible="format">Formattable</item> + <item action="delete" visible="editable" + confirm="Deleting, are you sure?">Delete</item> + </cpsskins:contextmenu> - <div id="contextmenu2" class="contextMenu small"> - <a action="copy" href="#">Copy</a> - <a action="paste" href="#">Paste</a> - <a action="format" href="#">Format</a> - <a action="edit" href="#">Edit</a> - <a action="delete" href="#" confirm="Deleting, are you sure?">Delete</a> - </div> - - <script type="text/javascript"> - function displayChoice(selected, choice) { - alert('You have selected the ' + choice + ' item'); - } - - var contextmenu1 = new CPSSkins.ContextualMenu( - menu='contextmenu1', - area='testArea1', - actions = { - 'menu1.edit': { - handler: displayChoice, - visibility: 'editable' - }, - 'menu1.copy': { - handler: displayChoice, - visibility: 'copyable' - }, - 'menu1.paste': { - handler: displayChoice, - visibility: 'editable' - }, - 'menu1.formats': { - handler: displayChoice, - visibility: 'formattable' - }, - 'menu1.delete': { - handler: displayChoice, - visibility: 'editable' - } - }); - - var contextmenu2 = new CPSSkins.ContextualMenu( - menu='contextmenu2', - area='testArea2', - actions = contextmenu1.actions - ); - - </script> </body> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins