Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typeoneerror/090a573b9e8f69123d4b to your computer and use it in GitHub Desktop.
Save typeoneerror/090a573b9e8f69123d4b to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'div',
classNames: 'btn-toolbar-affix',
attributeBindings: [
'dataSpy:data-spy',
'dataOffsetTop:data-offset-top'
],
dataSpy: 'affix',
dataOffsetTop: 0,
dataOffsetBottom: null,
didInsertElement: function() {
var options = {
offset: {
top: this.get('dataOffsetTop'),
bottom: this.get('dataOffsetBottom')
}
};
this.$().affix(options);
}
});
// components/help-text.js
import Ember from 'ember';
export default Ember.Component.extend({
action: 'doHelpForTopic',
helpText: 'Need help?',
text: null,
topic: null,
tagName: 'help-text',
classNames: ['help-text'],
layout: Ember.Handlebars.compile('{{text}} <a href="#" class="help-link nyi" {{action "doHelp"}}>{{helpText}}</a>'),
actions: {
doHelp: function() {
this.sendAction('action', this.topic);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment