diff --git a/.jshintrc b/.jshintrc index 08096effa..1c2469ac3 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,6 +5,7 @@ "-Promise" ], "browser": true, + "jquery": true, "boss": true, "curly": true, "debug": false, diff --git a/app/app.js b/app/app.js index 8d66b9587..0c64cddaf 100644 --- a/app/app.js +++ b/app/app.js @@ -1,18 +1,27 @@ -import Ember from 'ember'; -import Resolver from 'ember/resolver'; -import loadInitializers from 'ember/load-initializers'; -import config from './config/environment'; - -var App; - -Ember.MODEL_FACTORY_INJECTIONS = true; - -App = Ember.Application.extend({ - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix, - Resolver: Resolver -}); - -loadInitializers(App, config.modulePrefix); - -export default App; +import Ember from 'ember'; +import Resolver from 'ember/resolver'; +import loadInitializers from 'ember/load-initializers'; +import config from './config/environment'; + +let App; + +Ember.MODEL_FACTORY_INJECTIONS = true; + +App = Ember.Application.extend({ + modulePrefix: config.modulePrefix, + podModulePrefix: config.podModulePrefix, + Resolver +}); + +loadInitializers(App, config.modulePrefix); + +//for bootstrap +Ember.LinkComponent.reopen({ + attributeBindings: ['data-toggle', 'data-placement'] +}); +//for crumbly +Ember.Route.reopen({ + //breadCrumb: null +}); + +export default App; diff --git a/app/index.html b/app/index.html index 816a5664e..6701cbad3 100644 --- a/app/index.html +++ b/app/index.html @@ -12,6 +12,8 @@ + + {{content-for 'head-footer'}}
diff --git a/app/models/contact.js b/app/models/contact.js new file mode 100644 index 000000000..0b549b448 --- /dev/null +++ b/app/models/contact.js @@ -0,0 +1,33 @@ +import Ember from 'ember'; +import DS from 'ember-data'; +import UUID from "npm:node-uuid"; + +export default DS.Model.extend({ + json: DS.attr('json', { + defaultValue: function () { + var obj = { + "contactId": UUID.v4(), + "organizationName": null, + "individualName": "New Contact", + "positionName": null, + "phoneBook": [], + "address": {}, + "onlineResource": [], + "contactInstructions": null + }; + return obj; + } + }), + title: Ember.computed('json.individualName', 'json.organizationName', + function () { + const json = this.get('json'); + + return json.individualName || json.organizationName; + }), + icon: Ember.computed('json.individualName', 'json.organizationName', + function () { + const name = this.get('json.individualName'); + + return name ? 'user' : 'users'; + }) +}); diff --git a/app/models/dictionary.js b/app/models/dictionary.js new file mode 100644 index 000000000..41b6863a0 --- /dev/null +++ b/app/models/dictionary.js @@ -0,0 +1,31 @@ +import Ember from 'ember'; +import DS from 'ember-data'; + +export default DS.Model.extend({ + json: DS.attr('json', { + defaultValue() { + const obj = { + "dictionaryInfo": { + "citation": { + "title": "My Dictionary", + "date": [{ + "date": new Date() + .toISOString(), + "dateType": "creation" + }] + }, + "description": "Data dictionary.", + "resourceType": null + }, + "domain": [], + "entity": [] + }; + + return obj; + } + }), + title: Ember.computed('json.dictionaryInfo.citation.title', function () { + return this.get('json.dictionaryInfo.citation.title'); + }), + icon: 'book' +}); diff --git a/app/models/record.js b/app/models/record.js new file mode 100644 index 000000000..2c9ce064c --- /dev/null +++ b/app/models/record.js @@ -0,0 +1,56 @@ +import Ember from 'ember'; +import DS from 'ember-data'; +import UUID from "npm:node-uuid"; + +export default DS.Model.extend({ + profile: DS.attr('string', { + defaultValue: 'full' + }), + json: DS.attr('json', { + defaultValue() { + const obj = Ember.Object.create({ + "version": { + "name": "mdJson", + "version": "1.0.0" + }, + "contact": [], + "metadata": { + "metadataInfo": { + "metadataIdentifier": { + "identifier": UUID.v4(), + "type": "uuid" + } + }, + "resourceInfo": { + "resourceType": null, + "citation": { + "title": "My Record", + "date": [{ + "date": new Date() + .toISOString(), + "dateType": "creation" + }] + }, + "pointOfContact": [], + "abstract": null, + "status": null, + "language": ["eng; USA"] + } + } + }); + + return obj; + } + }), + + title: Ember.computed('json.metadata.resourceInfo.citation.title', function () { + return this.get('json.metadata.resourceInfo.citation.title'); + }), + icon: Ember.computed('json.metadata.resourceInfo.resourceType', function () { + const type = this.get('json.metadata.resourceInfo.resourceType'); + const list = Ember.getOwner(this) + .lookup('service:icon'); + + return type ? list.get(type) || list.get('default') : list.get('defaultFile'); + }) +}); diff --git a/app/pods/components/input/md-input-codelist-single/component.js b/app/pods/components/input/md-input-codelist-single/component.js new file mode 100644 index 000000000..7a215b169 --- /dev/null +++ b/app/pods/components/input/md-input-codelist-single/component.js @@ -0,0 +1,182 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + /** + * [service description] + * @param {[type]} 'codelist' [description] + * @return {[type]} [description] + */ + mdCodes: Ember.inject.service('codelist'), + + /** + * [service description] + * @return {Object} [description] + */ + icons: Ember.inject.service('icon'), + + /** + * [create description] + * @type {Boolean} + */ + create: false, + + /** + * [tooltip description] + * @type {Boolean} + */ + tooltip: false, + + /** + * [icon description] + * @type {Boolean} + */ + icon: false, + + /** + * [allowClear description] + * @type {Boolean} + */ + allowClear: false, + + /** + * [mdCodeName description] + * @type {String} mdCodeName + */ + + /** + * [placeholder description] + * @type {String} + */ + placeholder: "Select one option", + + /** + * [label description] + * @type {String} label + */ + + /** + * [width description] + * @type {String} width + */ + width: "100%", + + /** + * [disabled description] + * @type {Boolean} width + */ + disabled: false, + + /** + * codelist is an array of code objects in mdCodelist format + * the initial codelist for 'mdCodeName' is pulled from the 'codelist' service; + * then if a new value was created by the user a new object will be added into the codelist; + * then a new 'selected' element will be added to each codelist object to let select2 + * know if this item should be selected. + * + * @return {Array} + */ + codelist: Ember.computed('value', function() { + let codelist = []; + let codelistName = this.get('mdCodeName'); + let mdCodelist = this.get('mdCodes') + .get(codelistName) + .codelist + .sortBy('codeName'); + mdCodelist.forEach(function(item) { + let newObject = { + code: item['code'], + codeName: item['codeName'], + description: item['description'], + selected: false + }; + codelist.pushObject(newObject); + }); + + let selectedItem = this.get('value'); + let create = this.get('create'); + if(selectedItem) { + if(create) { + let index = mdCodelist.indexOf(selectedItem); + if(index === -1) { + let newObject = { + code: Math.floor(Math.random() * 100000) + 1, + codeName: selectedItem, + description: 'Undefined', + selected: false + }; + codelist.pushObject(newObject); + } + } + + codelist.forEach(function(item) { + item['selected'] = (item['codeName'] === selectedItem); + }); + } + + return codelist; + }), + + // Format options for the select tag + // Add tooltips,icons if requested + didInsertElement: function() { + let tooltip = this.get('tooltip'); + let icon = this.get('icon'); + let icons = this.get('icons'); + + function formatOption(option) { + let text = option['text']; + let $option = $(`+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, + sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud + exercitation ullamco laboris nisi ut aliquip ex ea + commodo consequat. +
++ Duis aute irure dolor in reprehenderit in voluptate + velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in + culpa qui officia deserunt mollit anim id est laborum. +
++ Lorem ipsum dolor sit amet, consectetur adipisicing elit, + sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud + exercitation ullamco laboris nisi ut aliquip ex ea + commodo consequat. +
++ Duis aute irure dolor in reprehenderit in voluptate + velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in + culpa qui officia deserunt mollit anim id est laborum. +
+# | +Header | +Header | +Header | +Header | +
---|---|---|---|---|
1,001 | +Lorem | +ipsum | +dolor | +sit | +
1,002 | +amet | +consectetur | +adipiscing | +elit | +
1,003 | +Integer | +nec | +odio | +Praesent | +
1,003 | +libero | +Sed | +cursus | +ante | +
1,004 | +dapibus | +diam | +Sed | +nisi | +
1,005 | +Nulla | +quis | +sem | +at | +
1,006 | +nibh | +elementum | +imperdiet | +Duis | +
1,007 | +sagittis | +ipsum | +Praesent | +mauris | +
1,008 | +Fusce | +nec | +tellus | +sed | +
1,009 | +augue | +semper | +porta | +Mauris | +
1,010 | +massa | +Vestibulum | +lacinia | +arcu | +
1,011 | +eget | +nulla | +Class | +aptent | +
1,012 | +taciti | +sociosqu | +ad | +litora | +
1,013 | +torquent | +per | +conubia | +nostra | +
1,014 | +per | +inceptos | +himenaeos | +Curabitur | +
1,015 | +sodales | +ligula | +in | +libero | +
To create a new metadata record, enter a title and select a record type.
+# | +Column heading | +Column heading | +Column heading | +
---|---|---|---|
1 | +Column content | +Column content | +Column content | +
2 | +Column content | +Column content | +Column content | +
3 | +Column content | +Column content | +Column content | +
4 | +Column content | +Column content | +Column content | +
5 | +Column content | +Column content | +Column content | +
6 | +Column content | +Column content | +Column content | +
7 | +Column content | +Column content | +Column content | +
8 | +Column content | +Column content | +Column content | +
9 | +Column content | +Column content | +Column content | +