Yangman - fix parameters duplicity validation
[dlux.git] / modules / yangman-resources / src / main / resources / yangman / models / collection.model.js
1 define([], function (){
2     'use strict';
3
4     /**
5      * Collection object used in CollectionListModel
6      * @param name
7      * @constructor
8      */
9     function CollectionModel(name){
10         var self = this;
11         self.name = name;
12         self.expanded = false;
13         self.data = [];
14
15         self.clone = clone;
16         self.toggleExpanded = toggleExpanded;
17
18         function clone(newName){
19             var result = new CollectionModel(newName);
20             self.data.forEach(function (item){
21                 var newItem = item.clone();
22                 newItem.collection = newName;
23                 result.data.push(newItem);
24             });
25             return result;
26         }
27
28         function toggleExpanded(){
29             self.expanded = !self.expanded;
30         }
31
32     }
33
34     return CollectionModel;
35 });