SlideShare une entreprise Scribd logo
1  sur  72
Télécharger pour lire hors ligne
JavaScript in Plone:
What’s available; how to use it

              Steve McMahon (SteveM)
                        steve@dcn.org
                Plone Conference 2011
CM S!
         g M y
           JavaScript in Plone:
 What’s available; how to use it
B li n         Steve McMahon (SteveM)
                         steve@dcn.org
                 Plone Conference 2011
You Are:
You Are:




              rs  &
        ra to
I nt eg        rs
        em  e
     Th
You Want:
You Want:




   Widgets
You Want:




Validation      Widgets
You Want:


Popups


         Validation      Widgets
You Want:


 Popups


             Validation      Widgets




 Tabs ‘n
Accordions
You Want:


 Popups


             Validation               Widgets




 Tabs ‘n
Accordions                DragNDrop
But first …
But first …




Nuts & Bolts
JS & CSS Injection




Browser Resources
        ❦
Resource Registries
Two Ways




 Add-On
Packaging
Two Ways




 Add-On
Packaging


            Themes
Two Ways




 Add-On              Browser
Packaging
                      Layers
            Themes
Browser Layers




                                             Browser
<?xml version="1.0"?>
<layers>
  <layer
                                              Layers
   name="example.customization.layer"
   interface="…browser.interfaces.IExampleCustomization" />
</layers>
zopeskel.browserlayer
   [buildout]
   parts =
      zopeskel

   [zopeskel]
   recipe = zc.recipe.egg
   eggs =
      ZopeSkel
      zopeskel.browserlayer
      …
zopeskel.browserlayer
          [buildout]
          parts =
             zopeskel

          [zopeskel]
          recipe = zc.recipe.egg
          eggs =
             ZopeSkel
             zopeskel.browserlayer
             …




../bin/zopeskel browserlayer
zopeskel.browserlayer
          [buildout]
          parts =
             zopeskel

          [zopeskel]
          recipe = zc.recipe.egg
          eggs =
             ZopeSkel
             zopeskel.browserlayer
             …




../bin/zopeskel browserlayer
HTML5 Widgets




Widgets
HTML5 Widgets
            (Without HTML5)




Widgets
HTML5 Widgets
             (Without HTML5)


               jQuery Tools
           plone.app.jquerytools




Widgets
HTML5 Widgets
             (Without HTML5)


               jQuery Tools
           plone.app.jquerytools


                dateinput


Widgets
HTML5 Widgets
             (Without HTML5)


               jQuery Tools
           plone.app.jquerytools


                dateinput
                validation

Widgets
Activating Optionals


             profiles/default/jsregistry.xml
             <javascript
                id="++resource++plone.app.jquerytools.validator.js"
                enabled="True" />

             <javascript
                id="++resource++plone.app.jquerytools.dateinput.js"
                enabled="True" />

             profiles/default/cssregistry.xml
             <stylesheet
                id="++resource++plone.app.jquerytools.dateinput.css"
                enabled="1" />

Validation
Munging Old Stuff
                  Validation




Validation
Munging Old Stuff
                        Validation

              jQuery(function ($) {

                    // doc read code here;
                    // using $ alias for jQuery

              });




Validation
Munging Old Stuff
                           Validation


             jQuery(function ($) {

               $('form.fgBaseEditForm span.required')
                   .parents('div.field')
                   .children(':input')
                   .attr('required','required');

             });




Validation
Munging Old Stuff
                           Validation



             jQuery(function ($) {

               $('form.fgBaseEditForm span.required')
                   .parents('div.field')
                   .children(':input')
                   .attr('required','required');

             });



Validation
Munging Old Stuff
                           Validation



             jQuery(function ($) {

               $('form.fgBaseEditForm span.required')
                   .parents('div.field')
                   .children(':input')
                   .attr('required','required');

             });



Validation
Munging Old Stuff
                  Validation




Validation
Munging Old Stuff
                           Validation


             jQuery(function ($) {

               $('form.fgBaseEditForm span.required')
                   .parents('div.field')
                   .children(':input')
                   .attr('required','required');

               $('form.fgBaseEditForm')
                   .validator();

             });

Validation
Munging Old Stuff
                  Validation




Validation
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)



         <div class="photoAlbumEntry">
           <a href="http://anon:8080/p1/gallery/chapel/view" title="">
             <span class="photoAlbumEntryWrapper">
                <img src="http://anon:8080/p1/gallery/chapel/image_thumb"
                     alt="Chapel" title="" height="128" width="95" />
             </span>
             <span class="photoAlbumEntryTitle">Chapel</span>
           </a>
         </div>




Popups
Popups (Overlays)



         <div class="photoAlbumEntry">
           <a href="http://anon:8080/p1/gallery/chapel/view" title="">
             <span class="photoAlbumEntryWrapper">
                <img src="http://anon:8080/p1/gallery/chapel/image_thumb"
                     alt="Chapel" title="" height="128" width="95" />
             </span>
             <span class="photoAlbumEntryTitle">Chapel</span>
           </a>
         </div>




Popups
Popups (Overlays)



         <div class="photoAlbumEntry">
           <a href="http://anon:8080/p1/gallery/chapel/view" title="">
             <span class="photoAlbumEntryWrapper">
                <img src="http://anon:8080/p1/gallery/chapel/image_thumb"
                     alt="Chapel" title="" height="128" width="95" />
             </span>
             <span class="photoAlbumEntryTitle">Chapel</span>
           </a>
         </div>




Popups
Popups (Overlays)

         jQuery(function ($) {

               $('.photoAlbumEntry a').prepOverlay({
                   subtype: 'image',
                   urlmatch: '/view$',
                   urlreplace: '/image_large'
               });

         });




Popups
Popups (Overlays)

         jQuery(function ($) {

               $('.photoAlbumEntry a').prepOverlay({
                   subtype: 'image',
                   urlmatch: '/view$',
                   urlreplace: '/image_large'
               });

         });




Popups
Popups (Overlays)

         jQuery(function ($) {

               $('.photoAlbumEntry a').prepOverlay({
                   subtype: 'image',
                   urlmatch: '/view$',
                   urlreplace: '/image_large'
               });

         });




Popups
Popups (Overlays)

         jQuery(function ($) {

               $('.photoAlbumEntry a').prepOverlay({
                   subtype: 'image',
                   urlmatch: '/view$',
                   urlreplace: '/image_large'
               });

         });




Popups
Popups (Overlays)

         jQuery(function ($) {

               $('.photoAlbumEntry a').prepOverlay({
                   subtype: 'image',
                   urlmatch: '/view$',
                   urlreplace: '/image_large'
               });

         });




Popups
Popups (Overlays)

         jQuery(function ($) {

               $('.photoAlbumEntry a').prepOverlay({
                   subtype: 'image',
                   urlmatch: '/view$',
                   urlreplace: '/image_large'
               });

         });




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)




Popups
Popups (Overlays)

          Subtypes:
            Images
            AJAX
            iframe
          Extensive Form Support!



Popups
Tabs ’N Accordions

                 Tabs and Accordions:
              Pretty much the same thing!




 Tabs ‘n
Accordions
Tabs ’N Accordions

                 Tabs and Accordions:
              Pretty much the same thing!

                    jQuery Tools .tab()
                      handles both.




 Tabs ‘n
Accordions
Tabs ’N Accordions

                 Tabs and Accordions:
              Pretty much the same thing!

                    jQuery Tools .tab()
                      handles both.


                http://flowplayer.org/tools/

 Tabs ‘n
Accordions
Tabs ’N Accordions


             $(‘container).tabs(
             ‘pane selector’, {
                 tabs : ‘tab selector’,
                 effect: ‘slide’
             });



 Tabs ‘n
Accordions
Tabs ’N Accordions


             $(‘container’).tabs(
             ‘pane selector’, {
                 tabs : ‘tab selector’,
                 effect: ‘slide’
             });



 Tabs ‘n
Accordions
Tabs ’N Accordions


             $(‘container).tabs(
             ‘pane selector’, {
                 tabs : ‘tab selector’,
                 effect: ‘slide’
             });



 Tabs ‘n
Accordions
Tabs ’N Accordions


             $(‘container).tabs(
             ‘pane selector’, {
                 tabs : ‘tab selector’,
                 effect: ‘slide’
             });



 Tabs ‘n
Accordions
Tabs ’N Accordions


             $(‘container).tabs(
             ‘pane selector’, {
                 tabs : ‘tab selector’,
                 effect: ‘slide’
             });



 Tabs ‘n
Accordions
Tabs ’N Accordions




 Tabs ‘n
Accordions
Tabs ’N Accordions




 Tabs ‘n
Accordions
Tabs ’N Accordions
                    Fixing a Typical Gotcha


              $('#portal-column-two dl.portlet')
                  .each(function() {
                      $(this)
                         .children('dd')
                         .wrapAll(
                         '<dd class="portletContent"><dl /></dd>'
                         );
              });




 Tabs ‘n
Accordions
Tabs ’N Accordions
                       Activating the Accordion


             $('#portal-column-two')
                 .tabs(
                    '#portal-column-two dd.portletContent',
                    {
                        tabs:    'dl.portlet dt.portletHeader a',
                        effect:  'slide'
                    }
                 );




 Tabs ‘n
Accordions
Drag ’N Drop




DragNDrop
Drag ’N Drop




DragNDrop
Drag ’N Drop




            jQuery UI
            • draggable
            • droppable
            • sortable
DragNDrop
Drag ’N Drop




                 jQuery UI
                 • draggable
                 • droppable
                 • sortable
DragNDrop
            collective.js.jqueryui
Credits

bling_guy: by-nc-sa/2.0 http://www.flickr.com/photos/prawnpie/

bling_camera: by-nc-sa/2.0 http://www.flickr.com/photos/eleven/

bling_calculator: by-nc-sa/2.0 http://www.flickr.com/photos/mundoo/

bling_tshirt: by-nc-sa/2.0 http://www.flickr.com/photos/thewavingcat/

bling_dog: by-nc-sa/2.0 http://www.flickr.com/photos/splat/

bling_sunglasses: by-nc/2.0 http://www.flickr.com/photos/red-bubble/

bling_beer: by-nc-sa/2.0 http://www.flickr.com/photos/johnandchristina/

bling_dummy: by-nc-sa/2.0 http://www.flickr.com/photos/mark_w/

bling_cycle: by/2.0 http://www.flickr.com/photos/ketaiblogger/

bling_vespa: by-nc-sa/2.0 http://www.flickr.com/photos/lorena-david/

bling_mouse: by-nc-sa/2.0 kelly onassis

bling_desktop: by-nc-sa/2.0 http://www.flickr.com/photos/marblegravy/

bling_cat: by-nc-sa/2.0 http://www.flickr.com/photos/nicora/

bling_engine: by-nc-sa/2.0 http://www.flickr.com/photos/rpt/

Contenu connexe

Tendances

Mulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitMulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development Toolkit
Rebecca Murphey
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
Paul Irish
 

Tendances (20)

Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
jQuery
jQueryjQuery
jQuery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and more
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and moreSymfony Guard Authentication: Fun with API Token, Social Login, JWT and more
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and more
 
Mulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitMulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development Toolkit
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery Code
 
jQuery
jQueryjQuery
jQuery
 
A New Baseline for Front-End Devs
A New Baseline for Front-End DevsA New Baseline for Front-End Devs
A New Baseline for Front-End Devs
 
jQuery
jQueryjQuery
jQuery
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
Matters of State
Matters of StateMatters of State
Matters of State
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 

En vedette

Remedial Resource
Remedial ResourceRemedial Resource
Remedial Resource
eloiselg
 
Пасторское душепопечительство
Пасторское душепопечительствоПасторское душепопечительство
Пасторское душепопечительство
guest4df78
 

En vedette (20)

Oct 2013 IT Townhall
Oct 2013 IT TownhallOct 2013 IT Townhall
Oct 2013 IT Townhall
 
WeConnect
WeConnectWeConnect
WeConnect
 
Vlammen voor de Vrijheid
Vlammen voor de Vrijheid Vlammen voor de Vrijheid
Vlammen voor de Vrijheid
 
Milieu
MilieuMilieu
Milieu
 
Go to2011
Go to2011Go to2011
Go to2011
 
Arduino wifi logger node
Arduino wifi logger nodeArduino wifi logger node
Arduino wifi logger node
 
“How do you provide for everyone: success with diverse populations in the UK ...
“How do you provide for everyone: success with diverse populations in the UK ...“How do you provide for everyone: success with diverse populations in the UK ...
“How do you provide for everyone: success with diverse populations in the UK ...
 
“Library spaces in the knowledge society – knotting together global and local”
“Library spaces in the knowledge society – knotting together global and local”“Library spaces in the knowledge society – knotting together global and local”
“Library spaces in the knowledge society – knotting together global and local”
 
Behavior Change pres 3.8.16
Behavior Change  pres 3.8.16Behavior Change  pres 3.8.16
Behavior Change pres 3.8.16
 
Plone 3 2: What's New
Plone 3 2: What's NewPlone 3 2: What's New
Plone 3 2: What's New
 
Remedial Resource
Remedial ResourceRemedial Resource
Remedial Resource
 
St patricks day-1
St patricks day-1St patricks day-1
St patricks day-1
 
The 2nd and 3rd marketing revolutions darwinian revolution and neuroscientist...
The 2nd and 3rd marketing revolutions darwinian revolution and neuroscientist...The 2nd and 3rd marketing revolutions darwinian revolution and neuroscientist...
The 2nd and 3rd marketing revolutions darwinian revolution and neuroscientist...
 
Full-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with AnsibleFull-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with Ansible
 
Пасторское душепопечительство
Пасторское душепопечительствоПасторское душепопечительство
Пасторское душепопечительство
 
From the Client Side: JavaScript in Plone
From the Client Side: JavaScript in PloneFrom the Client Side: JavaScript in Plone
From the Client Side: JavaScript in Plone
 
406
406406
406
 
Microsoft Office 2010 Revealed
Microsoft Office 2010 RevealedMicrosoft Office 2010 Revealed
Microsoft Office 2010 Revealed
 
Marketing cross media: towards a narrative interpretation of experience(s)
Marketing cross media: towards a narrative interpretation of experience(s)Marketing cross media: towards a narrative interpretation of experience(s)
Marketing cross media: towards a narrative interpretation of experience(s)
 
Ilya interview leven#14
Ilya interview leven#14Ilya interview leven#14
Ilya interview leven#14
 

Similaire à Javascript in Plone

Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
Chris Alfano
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
smueller_sandsmedia
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
QConLondon2008
 
jQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a TreejQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a Tree
adamlogic
 
Bcblackpool jquery tips
Bcblackpool jquery tipsBcblackpool jquery tips
Bcblackpool jquery tips
Jack Franklin
 

Similaire à Javascript in Plone (20)

Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Jquery News Packages
Jquery News PackagesJquery News Packages
Jquery News Packages
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
 
Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9
 
jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to Jquery
 
J query training
J query trainingJ query training
J query training
 
jQuery Basic API
jQuery Basic APIjQuery Basic API
jQuery Basic API
 
jQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a TreejQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a Tree
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
jQuery
jQueryjQuery
jQuery
 
State of jQuery and Drupal
State of jQuery and DrupalState of jQuery and Drupal
State of jQuery and Drupal
 
Develop Netflix Movie Search App using jQuery, OData, JSONP and Netflix Techn...
Develop Netflix Movie Search App using jQuery, OData, JSONP and Netflix Techn...Develop Netflix Movie Search App using jQuery, OData, JSONP and Netflix Techn...
Develop Netflix Movie Search App using jQuery, OData, JSONP and Netflix Techn...
 
Bcblackpool jquery tips
Bcblackpool jquery tipsBcblackpool jquery tips
Bcblackpool jquery tips
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 

Plus de Steve McMahon (6)

How diazo works
How diazo worksHow diazo works
How diazo works
 
Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)
 
Plone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksPlone Deployment Secrets & Tricks
Plone Deployment Secrets & Tricks
 
How Plone Happens
How Plone HappensHow Plone Happens
How Plone Happens
 
Plone Foundation Annual Meeting, Budapest 2009
Plone Foundation Annual Meeting, Budapest 2009Plone Foundation Annual Meeting, Budapest 2009
Plone Foundation Annual Meeting, Budapest 2009
 
PloneFormGen: Past, Present, Future
PloneFormGen: Past, Present, FuturePloneFormGen: Past, Present, Future
PloneFormGen: Past, Present, Future
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Javascript in Plone

  • 1. JavaScript in Plone: What’s available; how to use it Steve McMahon (SteveM) steve@dcn.org Plone Conference 2011
  • 2. CM S! g M y JavaScript in Plone: What’s available; how to use it B li n Steve McMahon (SteveM) steve@dcn.org Plone Conference 2011
  • 4. You Are: rs & ra to I nt eg rs em e Th
  • 6. You Want: Widgets
  • 8. You Want: Popups Validation Widgets
  • 9. You Want: Popups Validation Widgets Tabs ‘n Accordions
  • 10. You Want: Popups Validation Widgets Tabs ‘n Accordions DragNDrop
  • 13. JS & CSS Injection Browser Resources ❦ Resource Registries
  • 16. Two Ways Add-On Browser Packaging Layers Themes
  • 17. Browser Layers Browser <?xml version="1.0"?> <layers> <layer Layers name="example.customization.layer" interface="…browser.interfaces.IExampleCustomization" /> </layers>
  • 18. zopeskel.browserlayer [buildout] parts = zopeskel [zopeskel] recipe = zc.recipe.egg eggs = ZopeSkel zopeskel.browserlayer …
  • 19. zopeskel.browserlayer [buildout] parts = zopeskel [zopeskel] recipe = zc.recipe.egg eggs = ZopeSkel zopeskel.browserlayer … ../bin/zopeskel browserlayer
  • 20. zopeskel.browserlayer [buildout] parts = zopeskel [zopeskel] recipe = zc.recipe.egg eggs = ZopeSkel zopeskel.browserlayer … ../bin/zopeskel browserlayer
  • 22. HTML5 Widgets (Without HTML5) Widgets
  • 23. HTML5 Widgets (Without HTML5) jQuery Tools plone.app.jquerytools Widgets
  • 24. HTML5 Widgets (Without HTML5) jQuery Tools plone.app.jquerytools dateinput Widgets
  • 25. HTML5 Widgets (Without HTML5) jQuery Tools plone.app.jquerytools dateinput validation Widgets
  • 26. Activating Optionals profiles/default/jsregistry.xml <javascript id="++resource++plone.app.jquerytools.validator.js" enabled="True" /> <javascript id="++resource++plone.app.jquerytools.dateinput.js" enabled="True" /> profiles/default/cssregistry.xml <stylesheet id="++resource++plone.app.jquerytools.dateinput.css" enabled="1" /> Validation
  • 27. Munging Old Stuff Validation Validation
  • 28. Munging Old Stuff Validation jQuery(function ($) { // doc read code here; // using $ alias for jQuery }); Validation
  • 29. Munging Old Stuff Validation jQuery(function ($) { $('form.fgBaseEditForm span.required') .parents('div.field') .children(':input') .attr('required','required'); }); Validation
  • 30. Munging Old Stuff Validation jQuery(function ($) { $('form.fgBaseEditForm span.required') .parents('div.field') .children(':input') .attr('required','required'); }); Validation
  • 31. Munging Old Stuff Validation jQuery(function ($) { $('form.fgBaseEditForm span.required') .parents('div.field') .children(':input') .attr('required','required'); }); Validation
  • 32. Munging Old Stuff Validation Validation
  • 33. Munging Old Stuff Validation jQuery(function ($) { $('form.fgBaseEditForm span.required') .parents('div.field') .children(':input') .attr('required','required'); $('form.fgBaseEditForm') .validator(); }); Validation
  • 34. Munging Old Stuff Validation Validation
  • 43. Popups (Overlays) <div class="photoAlbumEntry"> <a href="http://anon:8080/p1/gallery/chapel/view" title=""> <span class="photoAlbumEntryWrapper"> <img src="http://anon:8080/p1/gallery/chapel/image_thumb" alt="Chapel" title="" height="128" width="95" /> </span> <span class="photoAlbumEntryTitle">Chapel</span> </a> </div> Popups
  • 44. Popups (Overlays) <div class="photoAlbumEntry"> <a href="http://anon:8080/p1/gallery/chapel/view" title=""> <span class="photoAlbumEntryWrapper"> <img src="http://anon:8080/p1/gallery/chapel/image_thumb" alt="Chapel" title="" height="128" width="95" /> </span> <span class="photoAlbumEntryTitle">Chapel</span> </a> </div> Popups
  • 45. Popups (Overlays) <div class="photoAlbumEntry"> <a href="http://anon:8080/p1/gallery/chapel/view" title=""> <span class="photoAlbumEntryWrapper"> <img src="http://anon:8080/p1/gallery/chapel/image_thumb" alt="Chapel" title="" height="128" width="95" /> </span> <span class="photoAlbumEntryTitle">Chapel</span> </a> </div> Popups
  • 46. Popups (Overlays) jQuery(function ($) { $('.photoAlbumEntry a').prepOverlay({ subtype: 'image', urlmatch: '/view$', urlreplace: '/image_large' }); }); Popups
  • 47. Popups (Overlays) jQuery(function ($) { $('.photoAlbumEntry a').prepOverlay({ subtype: 'image', urlmatch: '/view$', urlreplace: '/image_large' }); }); Popups
  • 48. Popups (Overlays) jQuery(function ($) { $('.photoAlbumEntry a').prepOverlay({ subtype: 'image', urlmatch: '/view$', urlreplace: '/image_large' }); }); Popups
  • 49. Popups (Overlays) jQuery(function ($) { $('.photoAlbumEntry a').prepOverlay({ subtype: 'image', urlmatch: '/view$', urlreplace: '/image_large' }); }); Popups
  • 50. Popups (Overlays) jQuery(function ($) { $('.photoAlbumEntry a').prepOverlay({ subtype: 'image', urlmatch: '/view$', urlreplace: '/image_large' }); }); Popups
  • 51. Popups (Overlays) jQuery(function ($) { $('.photoAlbumEntry a').prepOverlay({ subtype: 'image', urlmatch: '/view$', urlreplace: '/image_large' }); }); Popups
  • 55. Popups (Overlays) Subtypes: Images AJAX iframe Extensive Form Support! Popups
  • 56. Tabs ’N Accordions Tabs and Accordions: Pretty much the same thing! Tabs ‘n Accordions
  • 57. Tabs ’N Accordions Tabs and Accordions: Pretty much the same thing! jQuery Tools .tab() handles both. Tabs ‘n Accordions
  • 58. Tabs ’N Accordions Tabs and Accordions: Pretty much the same thing! jQuery Tools .tab() handles both. http://flowplayer.org/tools/ Tabs ‘n Accordions
  • 59. Tabs ’N Accordions $(‘container).tabs( ‘pane selector’, { tabs : ‘tab selector’, effect: ‘slide’ }); Tabs ‘n Accordions
  • 60. Tabs ’N Accordions $(‘container’).tabs( ‘pane selector’, { tabs : ‘tab selector’, effect: ‘slide’ }); Tabs ‘n Accordions
  • 61. Tabs ’N Accordions $(‘container).tabs( ‘pane selector’, { tabs : ‘tab selector’, effect: ‘slide’ }); Tabs ‘n Accordions
  • 62. Tabs ’N Accordions $(‘container).tabs( ‘pane selector’, { tabs : ‘tab selector’, effect: ‘slide’ }); Tabs ‘n Accordions
  • 63. Tabs ’N Accordions $(‘container).tabs( ‘pane selector’, { tabs : ‘tab selector’, effect: ‘slide’ }); Tabs ‘n Accordions
  • 64. Tabs ’N Accordions Tabs ‘n Accordions
  • 65. Tabs ’N Accordions Tabs ‘n Accordions
  • 66. Tabs ’N Accordions Fixing a Typical Gotcha $('#portal-column-two dl.portlet') .each(function() { $(this) .children('dd') .wrapAll( '<dd class="portletContent"><dl /></dd>' ); }); Tabs ‘n Accordions
  • 67. Tabs ’N Accordions Activating the Accordion $('#portal-column-two') .tabs( '#portal-column-two dd.portletContent', { tabs: 'dl.portlet dt.portletHeader a', effect: 'slide' } ); Tabs ‘n Accordions
  • 70. Drag ’N Drop jQuery UI • draggable • droppable • sortable DragNDrop
  • 71. Drag ’N Drop jQuery UI • draggable • droppable • sortable DragNDrop collective.js.jqueryui
  • 72. Credits bling_guy: by-nc-sa/2.0 http://www.flickr.com/photos/prawnpie/ bling_camera: by-nc-sa/2.0 http://www.flickr.com/photos/eleven/ bling_calculator: by-nc-sa/2.0 http://www.flickr.com/photos/mundoo/ bling_tshirt: by-nc-sa/2.0 http://www.flickr.com/photos/thewavingcat/ bling_dog: by-nc-sa/2.0 http://www.flickr.com/photos/splat/ bling_sunglasses: by-nc/2.0 http://www.flickr.com/photos/red-bubble/ bling_beer: by-nc-sa/2.0 http://www.flickr.com/photos/johnandchristina/ bling_dummy: by-nc-sa/2.0 http://www.flickr.com/photos/mark_w/ bling_cycle: by/2.0 http://www.flickr.com/photos/ketaiblogger/ bling_vespa: by-nc-sa/2.0 http://www.flickr.com/photos/lorena-david/ bling_mouse: by-nc-sa/2.0 kelly onassis bling_desktop: by-nc-sa/2.0 http://www.flickr.com/photos/marblegravy/ bling_cat: by-nc-sa/2.0 http://www.flickr.com/photos/nicora/ bling_engine: by-nc-sa/2.0 http://www.flickr.com/photos/rpt/