Permalink
Browse files

gallery-2012.02.01-21-35 solmsted gallery-model-list-union

  • Loading branch information...
1 parent 5ad1854 commit 595e47e32e0ddc06b35fb2c07a6fb3bbf456ed22 YUI Builder committed Feb 1, 2012
@@ -0,0 +1,29 @@
+# Model List Union Build Properties
+
+# As long as the 'builder' project is cloned to the default folder
+# next to the 'yui3-gallery' project folder, the 'builddir' property does not
+# need to be changed
+#
+# If the 'builder' project is checked out to an alternate location, this
+# property should be updated to point to the checkout location.
+builddir=../../../builder/componentbuild
+
+# The name of the component. E.g. event, attribute, widget
+component=gallery-model-list-union
+
+# The list of files which should be concatenated to create the component
+# NOTE: For a css component. (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
+# component.jsfiles=async-pause.js, async-pauseHelperClass.js, async-pauseSubComponentClass.js
+component.jsfiles=model-list-union.js
+
+# The list of modules this component. requires. Used to set up the Y.add module call for YUI 3.
+component.requires=gallery-array-unnest, model-list
+
+# The list of modules this component. supersedes. Used to set up the Y.add module call for YUI 3.
+component.supersedes=
+
+# The list of modules that are optional for this module. Used to set up the Y.add module call for YUI 3.
+component.optional=
+# If your module has a skin file, set this flag to "true"
+component.skinnable=false
+#component.skinnable=true
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- YUI 3 Gallery Component Build File -->
+<project name="Model List Union" default="local">
+ <description>Model List Union Build File</description>
+ <property file="build.properties" />
+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
+</project>
@@ -0,0 +1,37 @@
+(function (Y) {
+ 'use strict';
+
+ var _Array = Y.Array,
+ _ModelList = Y.ModelList,
+
+ _invoke = _Array.invoke,
+ _isString = Y.Lang.isString,
+ _unnest = _Array.unnest;
+
+ Y.ModelList.union = function () {
+ var modelList,
+ modelLists = _unnest(arguments),
+ modelListType = modelLists.shift(),
+
+ updateModelList = function () {
+ return modelList.reset(_unnest(_invoke(modelLists, 'toArray')));
+ };
+
+ if (_isString(modelListType)) {
+ modelListType = Y.namespace(modelListType);
+ } else if (modelListType instanceof _ModelList) {
+ modelLists.unshift(modelListType);
+ modelListType = modelListType.constructor;
+ }
+
+ modelList = new modelListType();
+
+ _invoke(modelLists, 'after', [
+ 'add',
+ 'remove',
+ 'reset'
+ ], updateModelList);
+
+ return updateModelList();
+ };
+}(Y));

0 comments on commit 595e47e

Please sign in to comment.