Created
November 1, 2014 19:46
-
-
Save kgish/6ffd5ba62fb3e0cfaa5d to your computer and use it in GitHub Desktop.
// source http://jsbin.com/guxeva
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery.min.js"></script> | |
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.7.0/ember.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
/* Put your CSS here */ | |
.ember-application { | |
margin: 20px; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Welcome to Ember.js</h2> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" id="index"> | |
<p>Rating: {{rating}} | |
{{rating-widget value=rating}} | |
</script> | |
<script type="text/x-handlebars" id="components/rating-widget"> | |
<button {{action "rate" 1}} {{bindAttr disabled=isRatedOne}}>1</button> | |
<button {{action "rate" 2}} {{bindAttr disabled=isRatedTwo}}>2</button> | |
<button {{action "rate" 3}} {{bindAttr disabled=isRatedThree}}>3</button> | |
<button {{action "rate" 4}} {{bindAttr disabled=isRatedFour}}>4</button> | |
<button {{action "rate" 5}} {{bindAttr disabled=isRatedFive}}>5</button> | |
</script> | |
<script id="jsbin-javascript"> | |
App = Ember.Application.create(); | |
App.Router.map(function() { | |
// put your routes here | |
}); | |
App.RatingWidgetComponent = Ember.Component.extend({ | |
isRatedOne: Ember.computed.equal('value', 1), | |
isRatedTwo: Ember.computed.equal('value', 2), | |
isRatedThree: Ember.computed.equal('value', 3), | |
isRatedFour: Ember.computed.equal('value', 4), | |
isRatedFive: Ember.computed.equal('value', 5), | |
actions: { | |
rate: function(value) { | |
this.set('value', value); | |
} | |
} | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery.min.js"><\/script> | |
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"><\/script> | |
<script src="//code.jquery.com/jquery-1.11.1.min.js"><\/script> | |
<script src="//builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"><\/script> | |
<script src="//builds.emberjs.com/tags/v1.7.0/ember.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Welcome to Ember.js</h2> | |
{{outlet}} | |
<\/script> | |
<script type="text/x-handlebars" id="index"> | |
<p>Rating: {{rating}} | |
{{rating-widget value=rating}} | |
<\/script> | |
<script type="text/x-handlebars" id="components/rating-widget"> | |
<button {{action "rate" 1}} {{bindAttr disabled=isRatedOne}}>1</button> | |
<button {{action "rate" 2}} {{bindAttr disabled=isRatedTwo}}>2</button> | |
<button {{action "rate" 3}} {{bindAttr disabled=isRatedThree}}>3</button> | |
<button {{action "rate" 4}} {{bindAttr disabled=isRatedFour}}>4</button> | |
<button {{action "rate" 5}} {{bindAttr disabled=isRatedFive}}>5</button> | |
<\/script> | |
</body> | |
</html></script> | |
<script id="jsbin-source-css" type="text/css">/* Put your CSS here */ | |
.ember-application { | |
margin: 20px; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">App = Ember.Application.create(); | |
App.Router.map(function() { | |
// put your routes here | |
}); | |
App.RatingWidgetComponent = Ember.Component.extend({ | |
isRatedOne: Ember.computed.equal('value', 1), | |
isRatedTwo: Ember.computed.equal('value', 2), | |
isRatedThree: Ember.computed.equal('value', 3), | |
isRatedFour: Ember.computed.equal('value', 4), | |
isRatedFive: Ember.computed.equal('value', 5), | |
actions: { | |
rate: function(value) { | |
this.set('value', value); | |
} | |
} | |
});</script></body> | |
</html> |
This file contains hidden or 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
/* Put your CSS here */ | |
.ember-application { | |
margin: 20px; | |
} |
This file contains hidden or 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
App = Ember.Application.create(); | |
App.Router.map(function() { | |
// put your routes here | |
}); | |
App.RatingWidgetComponent = Ember.Component.extend({ | |
isRatedOne: Ember.computed.equal('value', 1), | |
isRatedTwo: Ember.computed.equal('value', 2), | |
isRatedThree: Ember.computed.equal('value', 3), | |
isRatedFour: Ember.computed.equal('value', 4), | |
isRatedFive: Ember.computed.equal('value', 5), | |
actions: { | |
rate: function(value) { | |
this.set('value', value); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment