Linked Cells #372

Merged
merged 3 commits into from Oct 12, 2012

Projects

None yet

3 participants

@ihanson
Contributor
ihanson commented Oct 12, 2012

This pull request allows an embedder to specify that a group of cells is to be linked (using the same kernel).

To create linked cells, run

makeSagecell({"inputLocation": ".cellSelector", "linked": true});
@jasongrout
Member

@rbeezer: ping

@rbeezer
rbeezer commented Oct 12, 2012

Fantastic! Thanks for the ping, Jason, and for the work on this Ira. Will it be live on aleph/aleph2 once the pull request is merged? I have a 5-day weekend and will be working extensively on the web version of FCLA the next few days. It'd be a good time to experiment.

@jasongrout jasongrout merged commit 80b92ad into sagemath:master Oct 12, 2012
@jasongrout
Member

Ira: I'm merging this now, but can you add something to the docs about it, either as a separate pull request, or just push directly to the repository. Thanks!

@jasongrout
Member

@rbeezer: okay, this is live on aleph now. Have fun!

@rbeezer
rbeezer commented Oct 15, 2012

Thanks, Ira and Jason. I've got this working in the textbook now. Watch sage-edu for news, once I tidy up a few things.

Being a novice javascript programmer, here's a bit more guidance on how to use this, for those who might see this later. Four cells in two linked groups of two.

sagecell.makeSagecell({inputLocation: '#cellone'  });
sagecell.makeSagecell({inputLocation: '#celltwo'  });
sagecell.makeSagecell({inputLocation: '#cellthree'});
sagecell.makeSagecell({inputLocation: '#cellfour' });
sagecell.makeSagecell({inputLocation: '.groupone', linked: true});
sagecell.makeSagecell({inputLocation: '.grouptwo', linked: true});
<div id="cellone"   class="groupone"><script type="text/code"></script></div>
<div id="celltwo"   class="groupone"><script type="text/code"></script></div>
<div id="cellthree" class="grouptwo"><script type="text/code"></script></div>
<div id="cellfour"  class="grouptwo"><script type="text/code"></script></div>```
@jasongrout
Member

Do you need those first four lines? I don't think you should need those lines. I thought this should work:

sagecell.makeSagecell({inputLocation: '.groupone', linked: true});
sagecell.makeSagecell({inputLocation: '.grouptwo', linked: true});
<div id="cellone"   class="groupone"><script type="text/code"></script></div>
<div id="celltwo"   class="groupone"><script type="text/code"></script></div>
<div id="cellthree" class="grouptwo"><script type="text/code"></script></div>
<div id="cellfour"  class="grouptwo"><script type="text/code"></script></div>

To clarify, the inputLocation can be any jquery selector (http://api.jquery.com/category/selectors/, http://www.w3schools.com/jquery/jquery_ref_selectors.asp, http://codylindley.com/jqueryselectors/) or any jquery list of objects.

@rbeezer
rbeezer commented Oct 15, 2012

I guess so. Once I found something that "worked", I quit experimenting and started implementing. The id's don't seem to be needed either.

sagecell.makeSagecell({inputLocation: '.groupone', linked: true});
sagecell.makeSagecell({inputLocation: '.grouptwo', linked: true});
<div class="groupone"><script type="text/code"></script></div>
<div class="groupone"><script type="text/code"></script></div>
<div class="grouptwo"><script type="text/code"></script></div>
<div class="grouptwo"><script type="text/code"></script></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment