Skip to content

Commit

Permalink
Enyo Tutorial: Part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkowalski committed Sep 3, 2012
1 parent 6549b99 commit 4f6eb9e
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions source/App.js
@@ -1,10 +1,28 @@
enyo.kind({
name: "App",
fit: true,
components:[
{name: "hello", content: "Hello World", allowHtml: true, ontap: "helloWorldTap"}
kind: enyo.Control,
style: "",
classes: "onyx",
components: [
{kind: "onyx.InputDecorator", components: [
{kind: "onyx.Input", name: "sumControl", placeholder: "Enter sum"}
]},
{kind: "onyx.InputDecorator", components: [
{kind: "onyx.Input", name: "percentControl", placeholder: "Enter percent"}
]},
{kind: "onyx.Button", content: "Calculate tip", ontap: "calculate"},
{tag: "div", name: "tipAmount"}
],
helloWorldTap: function(inSender, inEvent) {
this.$.hello.addContent("<br/><b>hello</b> control was tapped");
create: function() {
this.inherited(arguments);
},
calculate: function(inSource, inEvent) {
var sum = this.$.sumControl.hasNode().value;
var percent = this.$.percentControl.hasNode().value;

var result = (sum * percent) / 100;
this.$.tipAmount.setContent(result);

return true; // stop bubbling
}
});
});

2 comments on commit 4f6eb9e

@robertkowalski
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just cloned the repo and did:

(22:30:46) [robert@tequila-osx] ~/enyo-dailyjs (master) $ git reset --hard 4f6eb9e3b2371e4d1cce2c865955f30dbee4af66
HEAD is now at 4f6eb9e Enyo Tutorial: Part 1

as you are commenting on the code from Part 1.

Opened a browser (Chrome) and it worked for me.

@pkane
Copy link

@pkane pkane commented on 4f6eb9e Jan 15, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.