Skip to content

Commit

Permalink
Remove ember views, fix segfault error (mike-north#320)
Browse files Browse the repository at this point in the history
* Remove ember views, fix segfault error

* Update ember-cli

* Test with node 5.10

* Fix version of ember-cli-sass

* Use external shims for materialize and md-icons

* Update navbar tests to account for updated show/hide mechanism in materialize

* Generalize some test assertions

* Skip cleanup for each scenario in CI
  • Loading branch information
mike-north authored and ChristianGreinke committed May 31, 2016
1 parent aa32f37 commit 1602ad5
Show file tree
Hide file tree
Showing 39 changed files with 123 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ install:
- bower install

script:
- ember try $EMBER_TRY_SCENARIO test
- ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup

# after_script:
# - sed -i -- 's/SF:ember-cli-materialize\/\(.*\)/SF:addon\/\1.js/' lcov.dat
Expand Down
3 changes: 1 addition & 2 deletions addon/components/md-collection.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import DefaultCollectionHeaderView from 'ember-cli-materialize/views/default-collection-header';
import layout from '../templates/components/md-collection';

const { Component, computed: { bool } } = Ember;
Expand All @@ -8,7 +7,7 @@ export default Component.extend({
layout,
classNames: ['collection'],
classNameBindings: ['_hasHeader:with-header'],
headerView: DefaultCollectionHeaderView,
headerComponentName: 'md-default-collection-header',
header: null,
_hasHeader: bool('header')
});
9 changes: 9 additions & 0 deletions addon/components/md-default-collection-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ember from 'ember';
import layout from '../templates/components/md-default-collection-header';

const { Component } = Ember;

export default Component.extend({
layout,
classNames: ['collection-header']
});
11 changes: 11 additions & 0 deletions addon/components/md-default-column-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Ember from 'ember';
import layout from '../templates/components/md-default-column-header';

const { Component, computed: { alias } } = Ember;

export default Component.extend({
tagName: 'th',
layout,
attributeBindings: ['data-field'],
'data-field': alias('column.valueBindingPath')
});
15 changes: 7 additions & 8 deletions addon/components/md-modal.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Ember from 'ember';
import UsesSettings from '../mixins/uses-settings';
import layout from '../templates/components/md-modal';
import { EKMixin, keyUp } from 'ember-keyboard';

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

export default Component.extend(UsesSettings, {
export default Component.extend(EKMixin, UsesSettings, {
layout,

acceptsKeyResponder: true,
attributeBindings: ['style:inlineStyle'],
concatenatedProperties: ['modalClassNames'],

Expand All @@ -26,15 +26,14 @@ export default Component.extend(UsesSettings, {
return names.join(' ');
}),

didInsertElement() {
init() {
this._super(...arguments);
this.becomeKeyResponder();
this.set('keyboardActivated', true);
},

willDestroyElement() {
this._super(...arguments);
this.resignKeyResponder();
},
_onEsc: Ember.on(keyUp('Escape'), function() {
this.cancel();
}),

cancel() {
this.sendAction('close');
Expand Down
13 changes: 13 additions & 0 deletions addon/components/md-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ export default MaterializeInputField.extend({
// jscs: enable
},

_parsedContent: Ember.computed('optionValuePath', 'optionLabelPath', 'content.[]', function() {
const contentRegex = /(content\.|^content$)/;
// keep backwards compatability for defining optionValuePath & as optionContentPath `content.{{attName}}`
const optionValuePath = (this.get('optionValuePath') || '').replace(contentRegex, '');
const optionLabelPath = (this.get('optionLabelPath') || '').replace(contentRegex, '');
return Ember.A((this.get('content') || []).map((option) => {
return Ember.Object.create({
value: optionValuePath ? Ember.get(option, optionValuePath) : option,
label: optionLabelPath ? Ember.get(option, optionLabelPath) : option
});
}));
}),

// TODO: clean up any listeners that $.select() puts in place
// _teardownSelect() {
//
Expand Down
3 changes: 1 addition & 2 deletions addon/components/md-table-col.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ 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;

Expand All @@ -11,7 +10,7 @@ export default Component.extend(ChildComponentSupport, {
tagName: 'td',
layout,
valueBindingPath: null,
headerView: DefaultColumnHeaderView,
headerComponentName: 'md-default-column-header',
header: oneWay('valueBindingPath'),
key: oneWay('valueBindingPath'),
_value: computed('valueBindingPath', 'row', function() {
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/md-collection.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if _hasHeader}}
{{view headerView}}
{{component headerComponentName header=header}}
{{/if}}
{{#each content as |item idx|}}
{{yield item idx}}
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/md-default-column-header.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{column.header}}
2 changes: 1 addition & 1 deletion addon/templates/components/md-navbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>

<a class='button-collapse' data-activates="{{_sideNavId}}">
<i class='mdi-navigation-menu'></i>
<i class='material-icons'>menu</i>
</a>
</div>

Expand Down
19 changes: 11 additions & 8 deletions addon/templates/components/md-select.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<label id="{{id}}" class="active">{{label}}</label>
{{view "select"
id=id
content=content
optionValuePath=optionValuePath
optionLabelPath=optionLabelPath
prompt=prompt
value=value
classNameBindings="validate:validate errors:invalid:valid"}}

<select onchange={{action (mut value) value="target.value"}}
class="{{if validate 'validate'}} {{if errors 'invalid' 'valid'}}"
disabled={{if disabled "true"}}>
{{#if prompt}}
<option value="" disabled selected={{unless value "true"}}>{{prompt}}</option>
{{/if}}
{{#each _parsedContent as |option|}}
<option value={{option.value}} selected={{if (eq value option.value) "true"}}>{{option.label}}</option>
{{/each}}
</select>

<small class="red-text">
{{#if errors}}
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/md-table.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<thead>
<tr>
{{#each columnComponents as |column|}}
{{view column.headerView column=column}}
{{component column.headerComponentName column=column}}
{{/each}}
</tr>
</thead>
Expand Down
1 change: 0 additions & 1 deletion addon/templates/default-column-header.hbs

This file was deleted.

9 changes: 0 additions & 9 deletions addon/views/default-collection-header.js

This file was deleted.

11 changes: 0 additions & 11 deletions addon/views/default-column-header.js

This file was deleted.

1 change: 1 addition & 0 deletions app/components/md-default-collection-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-materialize/components/md-default-collection-header';
1 change: 1 addition & 0 deletions app/components/md-default-column-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-materialize/components/md-default-column-header';
7 changes: 4 additions & 3 deletions app/styles/ember-cli-materialize.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
}

.lean-modal {
background-color: black;
opacity: 0.5;
background-color: rgba(0, 0, 0, 0.5);
opacity: 1.0;
z-index: 10001;
}

.input-field small.red-text{
Expand All @@ -29,4 +30,4 @@
.input-field.has-error small.red-text{
display:inherit;

}
}
1 change: 0 additions & 1 deletion app/views/default-collection-header.js

This file was deleted.

1 change: 0 additions & 1 deletion app/views/default-column-header.js

This file was deleted.

7 changes: 5 additions & 2 deletions blueprints/ember-cli-materialize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ module.exports = {
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.4.0'),
this.addPackageToProject('ember-keyboard', '1.0.3'),
this.addPackageToProject('ember-truth-helpers', '1.2.0'),
this.addPackageToProject('ember-modal-dialog', '~0.8.0'),
this.addPackageToProject('ember-cli-sass', '^5.2.1'),
this.addPackageToProject('ember-cli-sass', 'mike-north/ember-cli-sass#5e0c40ace35ef185e78f9ea921a5e3847958bc0c'),
this.addPackageToProject('ember-material-design-icons-shim', '0.1.1'),
this.addPackageToProject('ember-materialize-shim', '0.1.1'),
this.addPackageToProject('ember-legacy-views', '^0.2.0')
]);
}
Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "ember-cli-materialize",
"dependencies": {
"blanket": "~1.1.5",
"ember": "~2.4.2",
"ember-cli-shims": "0.1.0",
"ember": "~2.5.0",
"ember-cli-shims": "0.1.1",
"ember-cli-test-loader": "0.2.2",
"ember-qunit-notifications": "0.1.0",
"materialize": "~0.97.5"
"materialize": "0.97.6"
},
"resolutions": {
"blanket": "5e94fc30f2e694bb5c3718ddcbf60d467f4b4d26"
Expand Down
34 changes: 1 addition & 33 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,5 @@
'use strict';

module.exports = {
name: 'ember-cli-materialize',

included: function(app) {
this._super.included(app);

app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Thin.woff2', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Thin.woff', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Thin.ttf', { destDir: 'font/roboto' });

app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Light.woff2', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Light.woff', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Light.ttf', { destDir: 'font/roboto' });

app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Regular.woff2', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Regular.woff', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Regular.ttf', { destDir: 'font/roboto' });

app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Medium.woff2', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Medium.woff', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Medium.ttf', { destDir: 'font/roboto' });

app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Bold.woff2', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Bold.woff', { destDir: 'font/roboto' });
app.import(app.bowerDirectory + '/materialize/dist/font/roboto/Roboto-Bold.ttf', { destDir: 'font/roboto' });

app.import(app.bowerDirectory + '/materialize/dist/font/material-design-icons/Material-Design-Icons.eot', { destDir: 'font/material-design-icons' });
app.import(app.bowerDirectory + '/materialize/dist/font/material-design-icons/Material-Design-Icons.ttf', { destDir: 'font/material-design-icons' });
app.import(app.bowerDirectory + '/materialize/dist/font/material-design-icons/Material-Design-Icons.svg', { destDir: 'font/material-design-icons' });
app.import(app.bowerDirectory + '/materialize/dist/font/material-design-icons/Material-Design-Icons.woff', { destDir: 'font/material-design-icons' });
app.import(app.bowerDirectory + '/materialize/dist/font/material-design-icons/Material-Design-Icons.woff2', { destDir: 'font/material-design-icons' });

app.import(app.bowerDirectory + '/materialize/dist/js/materialize.js');
}
name: 'ember-cli-materialize'
};
34 changes: 19 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,40 @@
],
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.2.0",
"broccoli-asset-rev": "^2.4.2",
"ember-ajax": "0.7.1",
"ember-anchor": "~0.0.8",
"ember-cli": "2.4.3",
"ember-anchor": "~0.1.2",
"ember-cli": "2.5.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-github-pages": "0.0.6",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.2.1",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-qunit": "^1.4.0",
"ember-cli-release": "0.2.8",
"ember-cli-sass": "5.2.1",
"ember-cli-sass": "mike-north/ember-cli-sass#8ceb57d41f5774e8ececb5d1f05454449c19000c",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-code-snippet": "mike-north/ember-code-snippet#global",
"ember-cli-version-checker": "^1.1.6",
"ember-code-snippet": "1.2.1",
"ember-composability": "~0.3.1",
"ember-disable-prototype-extensions": "^1.1.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-key-responder": "~0.4.0",
"ember-legacy-views": "0.2.0",
"ember-load-initializers": "^0.5.0",
"ember-export-application-global": "^1.0.5",
"ember-keyboard": "^1.0.3",
"ember-load-initializers": "^0.5.1",
"ember-material-design-icons-shim": "0.1.0",
"ember-materialize-shim": "0.1.0",
"ember-modal-dialog": "~0.8.0",
"ember-new-computed": "~1.0.2",
"ember-radio-button": "1.0.7",
"ember-resolver": "^2.0.3",
"ember-suave": "^1.1.0",
"ember-try": "^0.1.2",
"loader.js": "^4.0.0"
"ember-truth-helpers": "1.2.0",
"ember-try": "^0.2.2",
"loader.js": "^4.0.1"
},
"keywords": [
"materialize",
Expand All @@ -67,8 +71,8 @@
"ember-addon"
],
"dependencies": {
"ember-cli-babel": "^5.1.5",
"ember-cli-htmlbars": "^1.0.1",
"ember-cli-babel": "^5.1.6",
"ember-cli-htmlbars": "^1.0.3",
"rsvp": "^3.0.18"
},
"ember-addon": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';
export default Ember.View.extend({

export default Ember.Component.extend({
classNames: ['navbar-fixed'],
didInsertElement() {
this._super(...arguments);
this.$('.demo-button-collapse').sideNav();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import layout from '../templates/snippets/my-column-header';

// BEGIN-SNIPPET my-column-header
import DefaultHeaderView from 'ember-cli-materialize/views/default-column-header';
import DefaultHeader from 'ember-cli-materialize/components/md-default-column-header';

export default DefaultHeaderView.extend({
export default DefaultHeader.extend({
layout
});
// END-SNIPPET
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// BEGIN-SNIPPET custom-collection-header
import DefaultCollectionHeader from 'ember-cli-materialize/views/default-collection-header';
import DefaultCollectionHeader from 'ember-cli-materialize/components/md-default-collection-header';
import layout from '../templates/snippets/my-custom-header';

export default DefaultCollectionHeader.extend({
Expand Down
Loading

0 comments on commit 1602ad5

Please sign in to comment.