Skip to content

Instantly share code, notes, and snippets.

View ericf's full-sized avatar

Eric Ferraiuolo ericf

View GitHub Profile
let defaults = {},
overrides = {};
function foo(bar, options) {
// YUI
options = Y.merge(defaults, options, overrides);
// Underscore
options = _.extend({}, defaults, options, overrides);
YUI.add('user-view', function (Y) {
Y.UserView = Y.Base.create('userView', Y.View, [], {
template: Y.Handlebars.templates['user'],
initializer: function () {
var user = this.get('user');
if (user) {
user.addTarget(this);

Improvements to New YUI Blog Theme

Objective

  • Wrong copyright. Should be: "© 2012 Yahoo! Inc." not: "© 2012 YUI Blog"
  • Search page is unusable: http://cl.ly/IiYS
  • Linen texture should only be at the lowest layer of the design (I don't care that iOS uses it for the notification sheets, they did it wrong :)
  • Home page's heading alignments are off:
/**
Provides Pjax-style content fetching and handling for `Y.App`.
@module app
@submodule app-content
@since 3.6.0
**/
var Lang = Y.Lang,
PjaxContent = Y.PjaxContent;
url: http://example.com/app/
root: /app/
save: /foo/
=> http://example.com/app/#/foo/
url: http://example.com/app
root: /app
save: /foo
=> http://example.com/app#/foo
diff --git a/src/app/js/router.js b/src/app/js/router.js
index c896a51..dcb52b3 100644
--- a/src/app/js/router.js
+++ b/src/app/js/router.js
@@ -620,8 +620,7 @@ Y.Router = Y.extend(Router, Y.Base, {
// Make sure the `hash` is path-like.
if (hash && hash.charAt(0) === '/') {
- return (this.get('root') ?
- this._resolvePath(hash.substring(1)) : hash);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>App Root Test</title>
</head>
<body>
<h1>App Root Test</h1>
<script src="http://yui.yahooapis.com/3.6.0pr2/build/yui/yui-min.js"></script>
<script>
YUI().use('app-base', function (Y) {
Y.BasicView = Y.Base.create('basicView', Y.View, [], {
render: function () {
this.get('container').set('text', this.get('text'));
return this;
}
});
Y.CompositeView = Y.Base.create('compositeView', Y.View, [], {
initializer: function () {
YUI().use('model', 'view', function (Y) {
Y.FooView = Y.Base.create('fooView', Y.View, [], {
initializer: function () {
var model = this.get('model');
// If this view was constructed with a `model` make its events
// bubble up.
model && model.addTarget(this);
@ericf
ericf / app.js
Created May 23, 2012 16:19 — forked from jshirley/app.js
var YUI = require('yui').YUI,
Y = YUI({useSync: true});
Y.use('parallel');
require('./second');