Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Add support for explicit positioning of dropdown component #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions addon/components/zf-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default Ember.Component.extend(zfWidget, {
classNameBindings: ['_position'],

/** @member Attribute bindings */
attributeBindings: ['data-dropdown', 'data-auto-focus', 'data-hover', 'data-hover-pane'],
attributeBindings: ['data-dropdown', 'data-auto-focus', 'data-hover', 'data-hover-pane',
'data-position', 'data-alignment'],

/** @member Makes the data attribute binding appear */
'data-dropdown': ' ',
Expand All @@ -30,11 +31,14 @@ export default Ember.Component.extend(zfWidget, {
/** @member Foundation type */
'zfType': 'Dropdown',

/** @private Hanlde attribute bindings for position **/
/** @private Handle attribute bindings for position **/
_position: computed('positionClass', function() {
let allowedPositions = ['top', 'right', 'left', 'bottom'];
let position = this.get('positionClass');
assert('Must provide a valid foundation position for dropdown', allowedPositions.includes(position));

if (Ember.isBlank(this.get('data-position')) && Ember.isBlank(this.get('data-alignment'))) {
assert('Must provide a valid foundation position for dropdown', allowedPositions.includes(position));
}

return position;
}),
Expand Down