Created
August 6, 2012 17:48
-
-
Save tivac/3277093 to your computer and use it in GitHub Desktop.
View transforms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global YUI:true */ | |
YUI.add("view-base", function(Y) { | |
var gw2 = Y.namespace("GW2"), | |
Views = Y.namespace("GW2.Views"); | |
Views.Base = Y.Base.create("viewBase", Y.View, [], { | |
transforms : [], | |
initializer : function(config) { | |
var self = this; | |
if(config && config.transforms) { | |
self.transforms = Y.merge(self.transforms, config.transforms); | |
} | |
}, | |
transform : function(data) { | |
var self = this; | |
Y.Array.each(self.transforms, function(transform) { | |
var fn = transform.fn || transform, | |
args = transform.cfg ? transform.cfg.slice(0) : []; | |
args.unshift(data); | |
data = fn.apply(self, args); | |
}); | |
return data; | |
} | |
}); | |
}, "@VERSION", { | |
requires : [ | |
"base", | |
"view" | |
] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global YUI:true */ | |
YUI.add("view-home-list", function(Y) { | |
var gw2 = Y.namespace("GW2"), | |
Views = Y.namespace("GW2.Views"), | |
Templates = Y.namespace("GW2.Templates"), | |
Extensions = Y.namespace("GW2.Extensions"), | |
Transforms = Y.namespace("GW2.Transforms"); | |
Views.HomeList = Y.Base.create("homeListView", Views.Base, [...], { | |
... | |
transforms : [ | |
Transforms.idAttribute, | |
Transforms.buttonDir, | |
{ fn : Transforms.imageSizer, cfg : [ "medium" ] } | |
], | |
... | |
}); | |
}, "@VERSION@", { | |
requires : [ | |
"view-base", | |
"extension-view-purchasing", | |
"extension-view-tooltips", | |
"transform-imagesizer", | |
"transform-buttondir", | |
"transform-idattribute", | |
"gw2-template-home-list", | |
"item-templates", | |
"gw2-i18n-gemstore-tags" | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment