Created
June 2, 2015 20:47
-
-
Save jasonbekolay/313220a5ebca5d369597 to your computer and use it in GitHub Desktop.
Ember Starter Kit // source http://emberjs.jsbin.com/hojala/7
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> | |
<meta charset="utf-8"> | |
<title>Ember Starter Kit</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.12.1/ember-template-compiler.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.12.1/ember.debug.js"></script> | |
<style id="jsbin-css"> | |
/* Put your CSS here */ | |
html, body { | |
margin: 20px; | |
} | |
.componentBox:disabled { | |
} | |
.overlayButton { | |
position: relative; | |
} | |
.clickIntercept { | |
width: 100%; | |
height: 100%; | |
background: transparent; | |
border: none !important; | |
font-size:0; | |
position: absolute; | |
top: 0; | |
left: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Welcome to Ember.js</h2> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
Component box: {{confirming-checkbox selected=model.componentChecked action='toggle'}} | |
Binding value: {{model.componentChecked}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="components/confirming-checkbox"> | |
<span class="overlayButton">{{input type='checkbox' class='componentBox' | |
checked=selected tabindex='-1'}} <button {{action 'toggle'}} class="clickIntercept"></button></span> | |
</script> | |
<script id="jsbin-javascript"> | |
App = Ember.Application.create(); | |
App.Router.map(function() { | |
// put your routes here | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return Ember.Object.create({ | |
componentChecked: false | |
}); | |
} | |
}); | |
App.IndexController = Ember.Controller.extend({ | |
actions: { | |
toggle: function() { | |
console.log('toggle'); | |
if (!this.get('model.componentChecked')) { | |
if (confirm("Are you sure you want this checked?")) { | |
this.set('model.componentChecked', !this.get('model.componentChecked')); | |
} | |
} else { | |
this.set('model.componentChecked', !this.get('model.componentChecked')); | |
} | |
} | |
} | |
}); | |
App.ConfirmingCheckboxComponent = Ember.Component.extend({ | |
actions: { | |
toggle: function() { | |
this.sendAction(); | |
} | |
} | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Ember Starter Kit</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"><\/script> | |
<script src="http://builds.emberjs.com/tags/v1.12.1/ember-template-compiler.js"><\/script> | |
<script src="http://builds.emberjs.com/tags/v1.12.1/ember.debug.js"><\/script> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Welcome to Ember.js</h2> | |
{{outlet}} | |
<\/script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
Component box: {{confirming-checkbox selected=model.componentChecked action='toggle'}} | |
Binding value: {{model.componentChecked}} | |
<\/script> | |
<script type="text/x-handlebars" data-template-name="components/confirming-checkbox"> | |
<span class="overlayButton">{{input type='checkbox' class='componentBox' | |
checked=selected tabindex='-1'}} <button {{action 'toggle'}} class="clickIntercept"></button></span> | |
<\/script> | |
</body> | |
</html> | |
</script> | |
<script id="jsbin-source-css" type="text/css">/* Put your CSS here */ | |
html, body { | |
margin: 20px; | |
} | |
.componentBox:disabled { | |
} | |
.overlayButton { | |
position: relative; | |
} | |
.clickIntercept { | |
width: 100%; | |
height: 100%; | |
background: transparent; | |
border: none !important; | |
font-size:0; | |
position: absolute; | |
top: 0; | |
left: 0; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">App = Ember.Application.create(); | |
App.Router.map(function() { | |
// put your routes here | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return Ember.Object.create({ | |
componentChecked: false | |
}); | |
} | |
}); | |
App.IndexController = Ember.Controller.extend({ | |
actions: { | |
toggle: function() { | |
console.log('toggle'); | |
if (!this.get('model.componentChecked')) { | |
if (confirm("Are you sure you want this checked?")) { | |
this.set('model.componentChecked', !this.get('model.componentChecked')); | |
} | |
} else { | |
this.set('model.componentChecked', !this.get('model.componentChecked')); | |
} | |
} | |
} | |
}); | |
App.ConfirmingCheckboxComponent = Ember.Component.extend({ | |
actions: { | |
toggle: function() { | |
this.sendAction(); | |
} | |
} | |
}); | |
</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 */ | |
html, body { | |
margin: 20px; | |
} | |
.componentBox:disabled { | |
} | |
.overlayButton { | |
position: relative; | |
} | |
.clickIntercept { | |
width: 100%; | |
height: 100%; | |
background: transparent; | |
border: none !important; | |
font-size:0; | |
position: absolute; | |
top: 0; | |
left: 0; | |
} |
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.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return Ember.Object.create({ | |
componentChecked: false | |
}); | |
} | |
}); | |
App.IndexController = Ember.Controller.extend({ | |
actions: { | |
toggle: function() { | |
console.log('toggle'); | |
if (!this.get('model.componentChecked')) { | |
if (confirm("Are you sure you want this checked?")) { | |
this.set('model.componentChecked', !this.get('model.componentChecked')); | |
} | |
} else { | |
this.set('model.componentChecked', !this.get('model.componentChecked')); | |
} | |
} | |
} | |
}); | |
App.ConfirmingCheckboxComponent = Ember.Component.extend({ | |
actions: { | |
toggle: function() { | |
this.sendAction(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment