Last active
January 26, 2017 10:03
-
-
Save alisdair/a465f76aa8d8e4c9228f89e1c9e52877 to your computer and use it in GitHub Desktop.
Disabling links prototype
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
import Ember from 'ember'; | |
let linkHref = Ember.Component.extend({ | |
tagName: 'a', | |
attributeBindings: ['href', 'target'], | |
classNameBindings: ['disabled'], | |
click(event) { | |
if (this.get('disabled')) { | |
event.preventDefault(); | |
} | |
} | |
}); | |
linkHref.reopenClass({ | |
positionalParams: 'href' | |
}); | |
export default linkHref; |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
disableLinks: false, | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
a.disabled, a[disabled] { | |
cursor: not-allowed; | |
color: #999; | |
} | |
a[disabled]:hover, a[disabled]:active, a.disabled:hover, a.disabled:active { | |
color: #999; | |
} |
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
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment