//----------------------------------------------------------------------------
//  Copyright (C) 2012  The IPython Development Team
//
//  Distributed under the terms of the BSD License.  The full license is in
//  the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------

//============================================================================
//CellToolbar Example
//============================================================================

/**
 * Example Use for the CellToolbar library
 * add the following to your custom.js to load
 * metadata UI for slideshow
 *
 * ```
 * $.getScript('/static/js/examples/metaui.slideshow.js');
 * ```
 * or more generally  
 * ```
 * $.getScript('url to this file');
 * ```
 */
 // IIFE without asignement, we don't modifiy the IPython namespace
(function (IPython) {
    "use strict";

    var CellToolbar = IPython.CellToolbar;
    var slideshow_preset = [];

    var select_type = CellToolbar.utils.select_ui_generator([
            ["-"            ,undefined      ],
            ["Header Slide" ,"header_slide" ],
            ["Slide"        ,"slide"        ],
            ["Fragment"     ,"fragment"     ],
            ["Skip"         ,"skip"         ],
            ["Speaker Notes","notes"        ],
            ],
            // setter
            function(cell, value){
                // we check that the slideshow namespace exist and create it if needed
                if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
                // set the value
                cell.metadata.slideshow.slide_type = value
                },
            //geter
            function(cell){ var ns = cell.metadata.slideshow;
                // if the slideshow namespace does not exist return `undefined`
                // (will be interpreted as `false` by checkbox) otherwise
                // return the value
                return (ns == undefined)? undefined: ns.slide_type
                },
            "Slide Type");

    CellToolbar.register_callback('slideshow.select',select_type);

    slideshow_preset.push('slideshow.select');

    CellToolbar.register_preset('slideshow',slideshow_preset);
    console.log('Slideshow extension for metadata editting loaded.');

}(IPython));

@@ -1112,37 +1112,37 @@
   %5B%22
-Header Slide%22 ,%22header_slide%22
+Slide%22        ,%22slide%22       
  %5D,%0A
@@ -1147,32 +1147,36 @@
 ,%0A            %5B%22
+Sub-
 Slide%22        ,%22
@@ -1165,39 +1165,35 @@
 b-Slide%22    
-    ,%22
+,%22sub
 slide%22
-   
      %5D,%0A    
@@ -1300,22 +1300,22 @@
   %5B%22
-Speaker Notes%22
+Notes%22        
 ,%22no

Change Slide denomination