Skip to content

Instantly share code, notes, and snippets.

@webOS101
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webOS101/73e14b8ff016eeef87f5 to your computer and use it in GitHub Desktop.
Save webOS101/73e14b8ff016eeef87f5 to your computer and use it in GitHub Desktop.
RestaurantView
enyo.ready(function() {
enyo.kind({
name: 'RestaurantView',
components: [
{ name: 'name' },
{ name: 'cuisine' },
{ name: 'specialty' },
{ name: 'rating' }
],
bindings: [
{ from: 'model.name', to: '$.name.content' },
{ from: 'model.cuisine', to: '$.cuisine.content' },
{ from: 'model.specialty', to: '$.specialty.content' },
{ from: 'model.rating', to: '$.rating.content' }
]
});
enyo.kind({
name: 'RestaurantModel',
kind: 'enyo.Model',
attributes: {
name: 'unknown',
cuisine: 'unknown',
specialty: 'unknown',
rating: 0
}
});
enyo.kind({
name: 'MainView',
components: [{ name: 'restaurant', kind: 'RestaurantView' }],
bindings: [
{ from: 'model', to: '$.restaurant.model' }
],
create: function() {
this.inherited(arguments);
this.set('model', new RestaurantModel({
name: 'Orenchi',
cuisine: 'Japanese',
specialty: 'ramen'
}));
}
});
new enyo.Application({ name: 'app', view: 'MainView' });
});
name: RestaurantView
description: A kind to display the RestaurantModel
authors:
- Roy Sutton
normalize_css: no
@webOS101
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment