Skip to content

Instantly share code, notes, and snippets.

@nambrot
Created January 5, 2012 21:56
Show Gist options
  • Save nambrot/1567546 to your computer and use it in GitHub Desktop.
Save nambrot/1567546 to your computer and use it in GitHub Desktop.
//ViewPane
addModel: function (model, scroll) {
if (model != null)
{
// we want to set a new model, check whether we already have one or not
if (this.model == null)
{
// split the views
a.setRatio(0.5);
// set the maximiztion and close tools
this.tools = $('<div class="tools"><div id="close"><img src="/close.png" alt="" /></div><div id="max"><img src="/max.png" alt="" /></div></div>');
$(this.el).append(this.tools);
}
else
{
// we do have a model set, so just remove it
$(this.view.el).remove()
}
// add the model to the view
this.model = model;
this.view = new a.modelmap[model.type].fullView({model: model});
$(this.el).append(this.view.el);
$(this.view.el).addClass('fastanimated bounceIn');
// if we are in full screen, add it to there too
if (a.fullscreenviewer)
a.fullscreenviewer.addModel(model);
}
else
{
// we want to reset it in case we have something in the viewer
if (this.model != null)
this.close();
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment