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

Kill deprecations #207

Merged
merged 9 commits into from
Aug 17, 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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ env:
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- ALLOW_DEPRECATIONS=true EMBER_TRY_SCENARIO=ember-canary

matrix:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary
- env: ALLOW_DEPRECATIONS=true EMBER_TRY_SCENARIO=ember-canary

before_install:
- mkdir travis-phantomjs
Expand Down
28 changes: 0 additions & 28 deletions Brocfile.js

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Stefan Gasser <[email protected]>
Copyright (c) 2015 Stefan Gasser <[email protected]> and Mike North <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
4 changes: 4 additions & 0 deletions addon/components/md-checks-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import CheckboxComponent from './md-check';
import GroupSelectableItemMixin from '../mixins/group-selectable-item';

export default CheckboxComponent.extend(GroupSelectableItemMixin, { });
6 changes: 1 addition & 5 deletions addon/components/md-checks.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import SelectableItemGroup from './selectable-item-group';
import CheckboxComponent from './md-check';
import GroupSelectableItemMixin from '../mixins/group-selectable-item';

const GroupCheckboxComponent = CheckboxComponent.extend(GroupSelectableItemMixin, { });

export default SelectableItemGroup.extend({
selectableItemView: GroupCheckboxComponent,
selectableItemView: 'md-checks-check',
multiple: true
});
4 changes: 4 additions & 0 deletions addon/components/md-radios-radio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import RadioComponent from './md-radio';
import GroupSelectableItemMixin from '../mixins/group-selectable-item';

export default RadioComponent.extend(GroupSelectableItemMixin, {});
7 changes: 2 additions & 5 deletions addon/components/md-radios.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import SelectableItemGroup from './selectable-item-group';
import RadioComponent from './md-radio';
import GroupSelectableItemMixin from '../mixins/group-selectable-item';

const GroupRadioComponent = RadioComponent.extend(GroupSelectableItemMixin, {});

export default SelectableItemGroup.extend({
selectableItemView: GroupRadioComponent
classNames: ['md-radios'],
selectableItemView: 'md-radios-radio'
});
4 changes: 4 additions & 0 deletions addon/components/md-switches-switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import GroupSelectableItemMixin from '../mixins/group-selectable-item';
import SwitchComponent from './md-switch';

export default SwitchComponent.extend(GroupSelectableItemMixin, { });
6 changes: 1 addition & 5 deletions addon/components/md-switches.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import SelectableItemGroup from './selectable-item-group';
import GroupSelectableItemMixin from '../mixins/group-selectable-item';
import SwitchComponent from './md-switch';

const GroupSwitchComponent = SwitchComponent.extend(GroupSelectableItemMixin, { });

export default SelectableItemGroup.extend({
selectableItemView: GroupSwitchComponent,
selectableItemView: 'md-switches-switch',
multiple: true
});
22 changes: 17 additions & 5 deletions addon/components/md-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,24 @@ export default Component.extend(ChildComponentSupport, {

colWidth: oneWay('composableParent.colWidth'),

click() {
this.get('composableParent').send('tabClicked', this);
},

_colClass: computed('colWidth', function() {
return `s${this.get('colWidth')}`;
})
}),

active: computed('composableParent.composableChildren.[]', 'composableParent.selected', 'value', function() {
const selected = this.get('composableParent.selected');
if (selected) {
return selected === this.get('value');
} else {
const values = this.get('composableParent')
.tabComponents()
.map(t => t.get('value'));
return values.indexOf(this.get('value')) === 0;
}
}).readOnly(),

click() {
this.get('composableParent').set('selected', this.get('value'));
}

});
25 changes: 4 additions & 21 deletions addon/components/md-table-col.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Ember from 'ember';
import layout from '../templates/components/md-table-col';
import Table from './md-table';
import ChildComponentSupport from 'ember-composability/mixins/child-component-support';
import DefaultColumnHeaderView from 'ember-cli-materialize/views/default-column-header';

const { Component, computed, get, computed: { oneWay } } = Ember;

export default Component.extend({
export default Component.extend(ChildComponentSupport, {
_parentComponentTypes: [Table],
tagName: 'td',
layout,
valueBindingPath: null,
Expand All @@ -19,24 +21,5 @@ export default Component.extend({
} else {
return get(this.get('row'), this.get('valueBindingPath'));
}
}),

didInsertElement() {
this._super(...arguments);
this.registerWithTable();
},
willDestroyElement() {
this._super(...arguments);
this.unregisterWithTable();
},

registerWithTable() {
let table = this.nearestOfType(Table);
table.registerColumn(this.get('key'), this);
},

unregisterWithTable() {
let table = this.nearestOfType(Table);
table.unregisterColumn(this.get('key'), this);
}
})
});
28 changes: 13 additions & 15 deletions addon/components/md-table.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import Ember from 'ember';
import ParentComponentSupport from 'ember-composability/mixins/parent-component-support';
import layout from '../templates/components/md-table';

const { A, Component, computed } = Ember;

export default Component.extend({
export default Component.extend(ParentComponentSupport, {
tagName: 'table',
layout,
columns: null,

composableChildrenDebounceTime: 1,
init() {
this._super(...arguments);
this.set('columns', Ember.A());
},

registerColumn(key, column) {
let existingColumn = this.get('columns').findBy('key', key);
if (existingColumn) {
return;
} else {
this.get('columns').addObject({ key, column });
}
},
columnComponents: computed('composableChildren', function() {
return new A(this.get('composableChildren'));
}).readOnly(),

columnComponents: computed('[email protected]', function() {
return new A(this.get('columns').mapBy('column'));
}),
registerChildComponent(childComponent) {
this.get('_childComponents').add(childComponent, childComponent.get('key'));
this._notifyComposableChildrenChanged();
},

unregisterColumn(key) {
this.get('columns').removeObject(this.get('columns').findBy('key', key));
unregisterChildComponent(childComponent) {
this.get('_childComponents').delete(childComponent, childComponent.get('key'));
this._notifyComposableChildrenChanged();
}
});
56 changes: 5 additions & 51 deletions addon/components/md-tabs.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,32 @@
import Ember from 'ember';
import ParentComponentSupport from 'ember-composability/mixins/parent-component-support';
import layout from '../templates/components/md-tabs';
import _computed from 'ember-new-computed';

const { get, Component, computed, computed: { alias }, run: { debounce } } = Ember;

export default Component.extend(ParentComponentSupport, {
layout,
classNames: ['materialize-tabs', 'row'],

composableChildrenDebounceTime: 1,
content: null,
numTabs: alias('composableChildren.length'),
_selected: null,
optionValuePath: 'id',
optionLabelPath: 'title',
colWidth: 2,

selected: null,

didInsertElement() {
this._super(...arguments);
this._setInitialTabSelection();
this._updateIndicatorPosition(false);
},

selected: _computed('_selected', {
get() {
return this.get('_selected');
},
set(key, newVal) {
const tabComponents = this.tabComponents();
let tc = tabComponents.findBy('value', newVal);
if (tc) {
this._setActiveTab(tc);
}
return newVal;
}
}),

_indicatorUpdater: Ember.observer('selected', 'content.[]', 'composableChildren.[]', function() {
debounce(this, this._updateIndicatorPosition, 100);
}),

tabComponents() {
const tabComponents = this.get('composableChildren') || Ember.A();
tabComponents.reverse();
return tabComponents;
},

_setInitialTabSelection() {
const tabComponents = this.tabComponents();
if (this.get('selected') === null && tabComponents.length > 0) {
let tc = tabComponents[tabComponents.length - 1];
this._setActiveTab(tc);
} else {
if (this.get('selected')) {
let tc = tabComponents.findBy('value', this.get('selected'));
this._setActiveTab(tc);
}
}
return Ember.A(this.get('composableChildren')) || Ember.A();
},

_updateIndicatorPosition(animate=true) {
Expand Down Expand Up @@ -86,21 +56,5 @@ export default Component.extend(ParentComponentSupport, {
const labelPath = this.get('optionLabelPath');
const valuePath = this.get('optionValuePath');
return new Ember.A((this.get('content') || []).map(contentItem => ({ id: contentItem[valuePath], title: contentItem[labelPath] })));
}),

_setActiveTab(tabComponent) {
this.set('_selected', tabComponent.get('value'));
tabComponent.set('active', true);
this.tabComponents().forEach(tc => {
if (tc !== tabComponent) {
tc.set('active', false);
}
});
},

actions: {
tabClicked(tab) {
this._setActiveTab(tab);
}
}
})
});
2 changes: 1 addition & 1 deletion addon/components/selectable-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default Component.extend(ChildComponentSupport, {
isSelected: Ember.computed.alias('_checked'),

_setupLabel() {
const [$input] = this.$('.materialize-selectable-item-input').toArray();
const [$input] = this.$('.materialize-selectable-item-input, .materialize-selectable-item-input-container input').toArray();

const inputId = $input ? $input.id : null;
this.$('.materialize-selectable-item-label').attr('for', inputId);
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/md-checks-check.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{yield}}
2 changes: 1 addition & 1 deletion addon/templates/components/md-loader.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if isBarType}}
<div class="{{barClassName}}" style="{{barStyle}}"></div>
<div class="{{barClassName}}" style={{barStyle}}></div>
{{/if}}

{{#each spinnerClassNames as |spinnerClassName|}}
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/md-radio.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
disabled=disabled
value=value
groupValue=groupValue
class="materialize-selectable-item-input"}}
radioClass="materialize-selectable-item-input"}}
<label class="materialize-selectable-item-label materialize-selectable-item-label" >
{{name}}{{yield}}
</label>
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/md-radios-radio.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{yield}}
1 change: 1 addition & 0 deletions addon/templates/components/md-switches-switch.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{yield}}
2 changes: 1 addition & 1 deletion addon/templates/components/selectable-item-group.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{yield}}
{{#each _content as |item|}}
<p>{{view selectableItemView content=item disabled=disabled}}</p>
<p>{{component selectableItemView content=item disabled=disabled groupId="group-{{elementId}}"}}</p>
{{/each}}
1 change: 1 addition & 0 deletions app/components/md-checks-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-materialize/components/md-checks-check';
1 change: 1 addition & 0 deletions app/components/md-radios-radio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-materialize/components/md-radios-radio';
1 change: 1 addition & 0 deletions app/components/md-switches-switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-materialize/components/md-switches-switch';
4 changes: 2 additions & 2 deletions blueprints/ember-cli-materialize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = {

afterInstall: function() {
return RSVP.all([
this.addPackageToProject('ember-composability', '~0.0.3'),
this.addPackageToProject('ember-radio-button', '1.0.4'),
this.addPackageToProject('ember-composability', '~0.1.1'),
this.addPackageToProject('ember-radio-button', '1.0.7'),
this.addPackageToProject('ember-new-computed', '~1.0.0'),
this.addPackageToProject('ember-key-responder', '0.2.1'),
this.addPackageToProject('ember-modal-dialog', '~0.7.5'),
Expand Down
2 changes: 1 addition & 1 deletion ember-cli-materialize.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[
{
"path": ".",
"folder_exclude_patterns": ["tmp", ".git", "node_modules", "bower_components"],
"folder_exclude_patterns": ["tmp", ".git", "bower_components"],
"file_exclude_patterns": [".npmignore", ".ember-cli", ".bowerrc", ".watchmanconfig"]
}
]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
"ember-cli-sass": "3.3.0",
"ember-cli-uglify": "^1.2.0",
"ember-code-snippet": "mike-north/ember-code-snippet#global",
"ember-composability": "~0.0.3",
"ember-composability": "~0.1.1",
"ember-disable-prototype-extensions": "^1.0.0",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3",
"ember-key-responder": "~0.4.0",
"ember-legacy-views": "0.2.0",
"ember-modal-dialog": "~0.7.5",
"ember-new-computed": "~1.0.2",
"ember-radio-button": "1.0.4",
"ember-radio-button": "1.0.7",
"ember-suave": "1.0.0",
"ember-try": "0.0.7"
},
Expand Down
Loading