Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Metaui slideshow #2687

Merged
merged 4 commits into from Jan 15, 2013
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,63 @@
//----------------------------------------------------------------------------
// 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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This preset should always be loaded by default. All notebook users are going to use this much of the time. Let's put it after the "Default" one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and the path for loading needs to be updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with an updated path, I can't load this preset. I tried:

$.getScript('/static/js/celltoolbarpresets/slideshow.js');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, it does work for me...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just hadn't saved my custom.js file ;(

On Mon, Jan 14, 2013 at 1:22 PM, Bussonnier Matthias <
notifications@github.com> wrote:

In
IPython/frontend/html/notebook/static/js/celltoolbarpresets/slideshow.js:

+//
+// 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');

Weird, it does work for me...


Reply to this email directly or view it on GitHubhttps://github.com//pull/2687/files#r2641460.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

* ```
* 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 ],
["Slide" ,"slide" ],
["Sub-Slide" ,"subslide" ],
["Fragment" ,"fragment" ],
["Skip" ,"skip" ],
["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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's capitalize slideshow here for the menu.

console.log('Slideshow extension for metadata editting loaded.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editting -> editing


}(IPython));