Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove blockless form #61

Merged
merged 1 commit into from
Aug 11, 2015
Merged
Show file tree
Hide file tree
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
63 changes: 0 additions & 63 deletions addon/components/x-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,6 @@ export default Ember.Component.extend({
*/
tabindex: 0,

/**
* Auxiliary computed property that replaces `content.`
* in `optionValuePath`.
*
* @private
* @property _valuePath
*/
_valuePath: Ember.computed('optionValuePath', function() {
var optionValuePath = this.get('optionValuePath');
if (optionValuePath) {
return optionValuePath.replace(/^content\.?/, '');
}
return null;
}),

/**
* Auxiliary computed property that replaces `content.`
* in `optionLabelPath`.
*
* @private
* @property _labelPath
*/
_labelPath: Ember.computed('optionLabelPath', function() {
var optionLabelPath = this.get('optionLabelPath');

if (optionLabelPath) {
return optionLabelPath.replace(/^content\.?/, '');
}
return null;
}),

/**
* Alias to `value`.
* This way we accept `value` or `selection` properties.
Expand All @@ -102,38 +71,6 @@ export default Ember.Component.extend({
*/
placeholder: Ember.computed.alias('prompt'),

/**
* Auxiliary computed array that holds `content` array
* values and their labels. Used only in the blockless version.
*
* @private
* @property _optionValues
*/
_optionValues: Ember.computed('_labelPath', '_valuePath', 'content.[]', function() {
var content = this.get('content') || [];
return content.map((object) => {
var label;
var value = object;
var valuePath = this.get('_valuePath');
var labelPath = this.get('_labelPath');

if (valuePath) {
value = Ember.get(object, valuePath);
}

if (labelPath) {
label = Ember.get(object, labelPath);
} else {
label = value;
}

return {
value: value,
label: label
};
});
}),

/**
* The collection of options for this select box. When options are
* inserted into the dom, they will register themselves with their
Expand Down
11 changes: 1 addition & 10 deletions app/templates/components/x-select.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
{{#if hasBlock}}
{{yield}}
{{else}}
{{#if placeholder}}
<option>{{placeholder}}</option>
{{/if}}
{{#each _optionValues as |option|}}
{{#x-option value=option.value}}{{option.label}}{{/x-option}}
{{/each}}
{{/if}}
{{yield}}
87 changes: 0 additions & 87 deletions tests/acceptance/x-select-multiple-blockless-test.js

This file was deleted.

104 changes: 0 additions & 104 deletions tests/acceptance/x-select-single-blockless-option-value-test.js

This file was deleted.

93 changes: 0 additions & 93 deletions tests/acceptance/x-select-single-blockless-test.js

This file was deleted.

14 changes: 0 additions & 14 deletions tests/dummy/app/controllers/blockless-multiple.js

This file was deleted.

Loading