Skip to content

Commit

Permalink
Import framework code using module syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblcc committed Nov 26, 2018
1 parent da81ab7 commit 2ecd53e
Show file tree
Hide file tree
Showing 263 changed files with 1,087 additions and 1,724 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = {
browser: true
},
rules: {
//'ember/new-module-imports': 'off'
//'ember/new-module-imports': 'off',
'no-console': 1
},
overrides: [
// node files
Expand Down
27 changes: 13 additions & 14 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
* @category docs
*/

import Ember from 'ember';
import LinkComponent from '@ember/routing/link-component';

import Route from '@ember/routing/route';
import Component from '@ember/component';
import Application from '@ember/application';
import {
computed,
defineProperty,
getWithDefault,
get
} from '@ember/object';
import { isNone } from '@ember/utils';
import { assert } from '@ember/debug';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

const {
LinkComponent,
Route,
Component,
Application,
get,
getWithDefault,
defineProperty,
computed,
isNone,
assert
} = Ember;

let App;

//Ember.MODEL_FACTORY_INJECTIONS = true;
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/add-em.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import { helper as buildHelper } from '@ember/component/helper';

export function addEm(params) {
return params.reduce((a, b) => Number(a) + Number(b));
}

export default Ember.Helper.helper(addEm);
export default buildHelper(addEm);
4 changes: 2 additions & 2 deletions app/helpers/bbox-to-poly.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import { helper as buildHelper } from '@ember/component/helper';

export function bboxToPoly(params/*, hash*/) {
let bbox = params[0];
Expand All @@ -16,4 +16,4 @@ export function bboxToPoly(params/*, hash*/) {
];
}

export default Ember.Helper.helper(bboxToPoly);
export default buildHelper(bboxToPoly);
8 changes: 2 additions & 6 deletions app/helpers/get-dash.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import Ember from 'ember';

const {
Helper,
get
} = Ember;
import Helper from '@ember/component/helper';
import { get } from '@ember/object';

export function getDash(params /*, hash*/ ) {
let obj = params[0];
Expand Down
11 changes: 4 additions & 7 deletions app/helpers/md-markdown.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import Ember from 'ember';
import { helper as buildHelper } from '@ember/component/helper';
import marked from 'npm:marked';

const {
String: EmString
} = Ember;
import { htmlSafe } from '@ember/string';

export function mdMarkdown(params /*, hash*/ ) {
marked.setOptions({
Expand All @@ -18,10 +15,10 @@ export function mdMarkdown(params /*, hash*/ ) {
});

if(params[0]) {
return EmString.htmlSafe(marked(params[0]));
return htmlSafe(marked(params[0]));
}

return params[1] || 'No text supplied.';
}

export default Ember.Helper.helper(mdMarkdown);
export default buildHelper(mdMarkdown);
5 changes: 1 addition & 4 deletions app/helpers/mod.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import Ember from 'ember';
const {
Helper
} = Ember;
import Helper from '@ember/component/helper';

export function mod(params) {
return params.reduce((a, b) => Number(a) % Number(b));
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/uc-words.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import { helper as buildHelper } from '@ember/component/helper';

export function ucWords(params, hash) {
var string = String(params[0]),
Expand All @@ -11,4 +11,4 @@ export function ucWords(params, hash) {
});
}

export default Ember.Helper.helper(ucWords);
export default buildHelper(ucWords);
10 changes: 4 additions & 6 deletions app/initializers/local-storage-export.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Ember from 'ember';
import { Promise } from 'rsvp';
import { assign } from '@ember/polyfills';
import { run } from '@ember/runloop';
import DS from 'ember-data';
import { singularize } from 'ember-inflector';

const {
run
} = Ember;
const assign = Ember.assign || Ember.merge;
const exportSelected = function(store, types, options) {
// merge defaults
options = assign({
Expand Down Expand Up @@ -49,7 +47,7 @@ const exportSelected = function(store, types, options) {
);
}

return new Ember.RSVP.Promise((resolve) => {
return new Promise((resolve) => {
run(null, resolve, data);
}, 'DS: LocalStorageAdapter#exportData');
};
Expand Down
17 changes: 7 additions & 10 deletions app/mixins/hash-poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
* @submodule mixins
*/

import Ember from 'ember';
import { inject as service } from '@ember/service';

export const pollInterval = 750; // time in milliseconds
import { Promise } from 'rsvp';
import Mixin from '@ember/object/mixin';
import { on } from '@ember/object/evented';

const {
Mixin,
//computed,
inject,
on
} = Ember;
export const pollInterval = 750; // time in milliseconds

export default Mixin.create({
settings: inject.service(),
settings: service(),

// autoSave: computed('settings.data.autoSave', function () {
// return this.get('settings')
Expand Down Expand Up @@ -56,7 +53,7 @@ export default Mixin.create({
onPoll() {
const model = this.currentRouteModel();

return new Ember.RSVP.Promise(function(resolve) {
return new Promise(function(resolve) {
if (model) {
model.notifyPropertyChange('currentHash');
}
Expand Down
14 changes: 5 additions & 9 deletions app/mixins/object-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
* @submodule mixins
*/

import Ember from 'ember';
import Mixin from '@ember/object/mixin';

const {
Mixin,
isArray,
getOwner,
A,
merge,
run
} = Ember;
import { getOwner } from '@ember/application';
import { A, isArray } from '@ember/array';
import { merge } from '@ember/polyfills';
import { run } from '@ember/runloop';

export default Mixin.create({
/**
Expand Down
4 changes: 2 additions & 2 deletions app/mixins/scroll-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* @submodule mixins
*/

import Ember from 'ember';
import Mixin from '@ember/object/mixin';

export default Ember.Mixin.create({
export default Mixin.create({
queryParams: {
scrollTo: true
},
Expand Down
41 changes: 24 additions & 17 deletions app/models/contact.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
import Ember from 'ember';
import {
alias,
notEmpty
} from '@ember/object/computed';
import {
isEmpty
} from '@ember/utils';
import EmberObject, {
get,
computed
} from '@ember/object';
import {
Copyable
} from 'ember-copy'
import DS from 'ember-data';
import uuidV4 from 'npm:uuid/v4';
import Validator from 'npm:validator';
Expand All @@ -10,12 +23,6 @@ import {
import {
inject as service
} from '@ember/service';
const {
Copyable,
computed,
isEmpty,
get
} = Ember;

const Validations = buildValidations({
'json.contactId': validator('presence', {
Expand All @@ -30,7 +37,7 @@ const Validations = buildValidations({
message: "Name should not be only white-space."
}),
validator('presence', {
disabled: computed.notEmpty('model.json.positionName'),
disabled: notEmpty('model.json.positionName'),
presence: true
})
],
Expand All @@ -42,7 +49,7 @@ const Validations = buildValidations({
message: "Position Name should not be only white-space."
}),
validator('presence', {
disabled: computed.notEmpty('model.json.name'),
disabled: notEmpty('model.json.name'),
presence: true
})
],
Expand All @@ -52,7 +59,7 @@ const Validations = buildValidations({
})
});

const JsonDefault = Ember.Object.extend({
const JsonDefault = EmberObject.extend({
init() {
this._super(...arguments);
this.setProperties({
Expand Down Expand Up @@ -121,8 +128,8 @@ const Contact = Model.extend(Validations, Copyable, {
}
}),

name: computed.alias('json.name'),
contactId: Ember.computed.alias('json.contactId'),
name: alias('json.name'),
contactId: alias('json.contactId'),

/**
* The formatted display string for the contact
Expand All @@ -133,7 +140,7 @@ const Contact = Model.extend(Validations, Copyable, {
* @category computed
* @requires json.name, json.positionName
*/
title: computed('json.name', 'json.positionName',
title: computed('json.{name,positionName}',
function () {
const json = this.get('json');

Expand Down Expand Up @@ -276,8 +283,8 @@ const Contact = Model.extend(Validations, Copyable, {
* @category computed
* @requires json.name, json.isOrganization
*/
combinedName: computed('name', 'json.isOrganization',
'json.positionName', 'json.memberOfOrganization[]',
combinedName: computed('name',
'json{isOrganization,positionName,memberOfOrganization[]}',
function () {
const json = this.get('json');

Expand Down Expand Up @@ -319,7 +326,7 @@ const Contact = Model.extend(Validations, Copyable, {
* @category computed
* @requires json.contactId
*/
shortId: Ember.computed('json.contactId', function () {
shortId: computed('json.contactId', function () {
const contactId = this.get('json.contactId');
if(contactId && Validator.isUUID(contactId)) {
let index = contactId.indexOf('-');
Expand Down Expand Up @@ -369,7 +376,7 @@ const Contact = Model.extend(Validations, Copyable, {
*/
copy() {
let current = this.get('cleanJson');
let json = Ember.Object.create(current);
let json = EmberObject.create(current);
let {
name,
positionName,
Expand Down
17 changes: 4 additions & 13 deletions app/models/dictionary.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import Ember from 'ember';
import { Copyable } from 'ember-copy'
import DS from 'ember-data';
import uuidV4 from "npm:uuid/v4";
import { alias } from '@ember/object/computed';
//import uuidV4 from 'npm:uuid/v4';
//import Validator from 'npm:validator';
import Model from 'mdeditor/models/base';
import {
validator,
buildValidations
} from 'ember-cp-validations';

const {
Copyable,
computed,
//isEmpty,
//get,
Object: EmObject
} = Ember;
import EmberObject, { computed } from '@ember/object';

const Validations = buildValidations({
'json.dataDictionary.citation.title': validator('presence', {
Expand All @@ -33,7 +24,7 @@ const Validations = buildValidations({
]
});

const JsonDefault = Ember.Object.extend({
const JsonDefault = EmberObject.extend({
init() {
this._super(...arguments);
this.setProperties({
Expand Down Expand Up @@ -106,7 +97,7 @@ export default Model.extend(Validations, Copyable, {

copy() {
let current = this.get('cleanJson');
let json = EmObject.create(current);
let json = EmberObject.create(current);
let name = current.dataDictionary.citation.title;

json.set('dataDictionary.citation.title', `Copy of ${name}`);
Expand Down
Loading

0 comments on commit 2ecd53e

Please sign in to comment.