Skip to content

Instantly share code, notes, and snippets.

@SaladFork
Created March 18, 2016 16:38
Show Gist options
  • Save SaladFork/f336de3314c20c6c5a37 to your computer and use it in GitHub Desktop.
Save SaladFork/f336de3314c20c6c5a37 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
notificationText: '',
notificationTextLimit: 140,
notificationTextOverLimit: Ember.computed('notificationText', 'notificationTextLimit', {
get() {
return this.get('notificationText.length') > this.get('notificationTextLimit');
}
})
});
<div class="label {{if notificationTextOverLimit 'red-text'}}">Notification Text:</div>
{{textarea value=notificationText}}
<div class="count {{if notificationTextOverLimit 'red-text'}}">
{{notificationText.length}} / {{notificationTextLimit}}
</div>
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.red-text {
color: red;
}
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment