mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-13 00:44:55 +08:00
43 lines
868 B
JavaScript
43 lines
868 B
JavaScript
// dependencies
|
|
define(['plugin/models/groups'], function(Groups) {
|
|
|
|
|
|
// model
|
|
return Backbone.Model.extend(
|
|
{
|
|
// defaults
|
|
defaults : {
|
|
id : null,
|
|
title : '',
|
|
type : '',
|
|
date : null
|
|
},
|
|
|
|
// initialize
|
|
initialize: function(options)
|
|
{
|
|
this.groups = new Groups();
|
|
},
|
|
|
|
// reset
|
|
reset: function()
|
|
{
|
|
this.clear({silent: true}).set(this.defaults);
|
|
this.groups.reset();
|
|
this.trigger('reset', this);
|
|
},
|
|
|
|
// copy
|
|
copy: function(new_chart) {
|
|
// copy chart/groups
|
|
var current = this;
|
|
current.set(new_chart.attributes);
|
|
current.groups.reset();
|
|
new_chart.groups.each(function(group) {
|
|
current.groups.add(group.clone());
|
|
});
|
|
current.trigger('change', current);
|
|
}
|
|
});
|
|
|
|
}); |