Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6549b99
commit 4f6eb9e
Showing
1 changed file
with
24 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
}); | ||
}); |
4f6eb9e
There was a problem hiding this comment.
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:
as you are commenting on the code from Part 1.
Opened a browser (Chrome) and it worked for me.
4f6eb9e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.