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 = $(`
${text}
`); + + if(icon) { + $option.prepend( + ` ` + ); + } + + if(tooltip) { + let tip = $(option.element) + .data('tooltip'); + + $option = $option.append( + $( + `?` + ) + .on('mousedown', function(e) { + $(e.target) + .tooltip('destroy'); + return true; + }) + .tooltip()); + } + return $option; + } + + this.$('.md-input-codelist-single') + .select2({ + placeholder: this.get('placeholder'), + allowClear: this.get('allowClear'), + tags: this.get('create'), + templateResult: formatOption, + width: this.get('width'), + minimumResultsForSearch: 10, + theme: 'bootstrap' + }); + }, + + didRender() { + this.$('.md-input-codelist-single') + .trigger('change.select2'); + }, + + actions: { + // do the binding to value + setValue: function() { + let selectedEl = this.$('select'); + let selectedValue = selectedEl.val(); + this.set('value', selectedValue); + } + } + +}); diff --git a/app/pods/components/input/md-input-codelist-single/template.hbs b/app/pods/components/input/md-input-codelist-single/template.hbs new file mode 100644 index 000000000..94bc77ab1 --- /dev/null +++ b/app/pods/components/input/md-input-codelist-single/template.hbs @@ -0,0 +1,22 @@ +{{#if label}} +
+ + +
+{{else}} + +{{/if}} diff --git a/app/pods/components/input/md-select-profile/component.js b/app/pods/components/input/md-select-profile/component.js new file mode 100644 index 000000000..ebf9a407f --- /dev/null +++ b/app/pods/components/input/md-select-profile/component.js @@ -0,0 +1,9 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + actions: { + update(value) { + this.sendAction('updateProfile', value); + } + } +}); diff --git a/app/pods/components/input/md-select-profile/template.hbs b/app/pods/components/input/md-select-profile/template.hbs new file mode 100644 index 000000000..32a76526c --- /dev/null +++ b/app/pods/components/input/md-select-profile/template.hbs @@ -0,0 +1,17 @@ + diff --git a/app/pods/components/layout/md-breadcrumb/component.js b/app/pods/components/layout/md-breadcrumb/component.js new file mode 100644 index 000000000..926b61300 --- /dev/null +++ b/app/pods/components/layout/md-breadcrumb/component.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ +}); diff --git a/app/pods/components/layout/md-breadcrumb/template.hbs b/app/pods/components/layout/md-breadcrumb/template.hbs new file mode 100644 index 000000000..d0635bfd0 --- /dev/null +++ b/app/pods/components/layout/md-breadcrumb/template.hbs @@ -0,0 +1,2 @@ +{{bread-crumbs tagName="ol" outputStyle="bootstrap" linkable=true}} +{{yield}} diff --git a/app/pods/components/layout/md-nav-main/component.js b/app/pods/components/layout/md-nav-main/component.js new file mode 100644 index 000000000..2aca8b1e7 --- /dev/null +++ b/app/pods/components/layout/md-nav-main/component.js @@ -0,0 +1,18 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + didInsertElement: function () { + this.$('[data-toggle="tooltip"]') + .tooltip(); + }, + actions: { + toggleSidebar() { + $('#md-wrapper') + .toggleClass('toggled'); + //hack to force reflow + $('#md-navbar-main-collapse ul') + .hide() + .show(0); + } + } +}); diff --git a/app/pods/components/layout/md-nav-main/template.hbs b/app/pods/components/layout/md-nav-main/template.hbs new file mode 100644 index 000000000..aea3b28dc --- /dev/null +++ b/app/pods/components/layout/md-nav-main/template.hbs @@ -0,0 +1,48 @@ + diff --git a/app/pods/components/layout/md-nav-secondary/component.js b/app/pods/components/layout/md-nav-secondary/component.js new file mode 100644 index 000000000..1731abb16 --- /dev/null +++ b/app/pods/components/layout/md-nav-secondary/component.js @@ -0,0 +1,156 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + profile: Ember.inject.service('profile'), + links: Ember.computed('profile.active', function() { + const profile = this.get('profile').getActiveProfile(); + + return profile.secondaryNav; + }), + + //TODO: Fix this !!!!!!!!!!!HACKKKKKKKKKKKKKKKKKKK!!!!! + didInsertElement: function () { + //https://github.com/tomiford/bootstrap-overflow-navs + /** + * options: + * more - translated "more" text + * offset - width that needs to be subtracted from the parent div width + */ + $.fn.overflowNavs = function (options) { + // Create a handle to our ul menu + // @todo Implement some kind of check to make sure there is only one? If we accidentally get more than one + // then strange things happen + var ul = $(this); + + // This should work with all navs, not just the navbar, so you should be able to pass a parent in + var parent = options.parent ? options.parent : ul.parents( + '.navbar'); + + // Check if it is a navbar and twitter bootstrap collapse is in use + /*var collapse = $('div.nav-collapse').length; + // Boostrap < 2 + if (!collapse) { + var collapse = $('div.navbar-collapse').length; + // Boostrap > 2 + } + + // Check if bootstrap navbar is collapsed (mobile) + if (collapse) { + var collapsed = $('.btn-navbar').is(":visible"); + // Boostrap < 2 + if (!collapsed) { + var collapsed = $('.navbar-toggle').is(":visible"); + // Boostrap > 2 + } + } else { + var collapsed = false; + }*/ + + // Only process dropdowns if not collapsed + //if (collapsed === false) { + + // Get width of the navbar parent so we know how much room we have to work with + var parent_width = $(parent) + .width() - (options.offset ? parseInt($(options.offset) + .width()) : 0); + + // Find an already existing .overflow-nav dropdown + var dropdown = $('li.overflow-nav', ul); + + // Create one if none exists + if (!dropdown.length) { + dropdown = $(''); + dropdown.append($( + '' + + options.more + '')); + dropdown.append($('')); + } + + // Get the width of the navbar, need to add together
  • s as the ul wraps in bootstrap + var width = 100; + // Allow for padding + ul.children('li') + .each(function () { + var $this = $(this); + width += $this.outerWidth(); + }); + + // Window is shrinking + if (width >= parent_width) { + // Loop through each non-dropdown li in the ul menu from right to left (using .get().reverse()) + $($('li', ul) + .not('.dropdown') + .not('.dropdown li') + .get() + .reverse()) + .each(function () { + // Get the width of the navbar + var width = 100; + // Allow for padding + ul.children('li') + .each(function () { + var $this = $(this); + width += $this.outerWidth(); + }); + if (width >= parent_width) { + // Remember the original width so that we can restore as the window grows + $(this) + .attr('data-original-width', $(this) + .outerWidth()); + // Move the rightmost item to top of dropdown menu if we are running out of space + dropdown.children('ul.dropdown-menu') + .prepend(this); + } + // @todo on shrinking resize some menu items are still in drop down when bootstrap mobile navigation is displaying + }); + } + // Window is growing + else { + // We used to just look at the first one, but this doesn't work when the window is maximized + //var dropdownFirstItem = dropdown.children('ul.dropdown-menu').children().first(); + dropdown.children('ul.dropdown-menu') + .children() + .each(function () { + if (width + parseInt($(this) + .attr('data-original-width')) < parent_width) { + // Restore the topmost dropdown item to the main menu + dropdown.before(this); + } else { + // If the topmost item can't be restored, don't look any further + return false; + } + }); + } + + // Remove or add dropdown depending on whether or not it contains menu items + if (!dropdown.children('ul.dropdown-menu') + .children() + .length) { + dropdown.remove(); + } else { + // Append new dropdown menu to main menu iff it doesn't already exist + if (!ul.children('li.overflow-nav') + .length) { + ul.append(dropdown); + } + } + //} + }; + + var options = { + 'more': 'More', + 'parent': '#md-navbars', + 'override_width': true + }; + + this.$() + .overflowNavs(options); + + $(window) + .resize( + function () { + $('#md-navbar-secondary') + .overflowNavs(options); + }); + } +}); diff --git a/app/pods/components/layout/md-nav-secondary/template.hbs b/app/pods/components/layout/md-nav-secondary/template.hbs new file mode 100644 index 000000000..a91cbe01f --- /dev/null +++ b/app/pods/components/layout/md-nav-secondary/template.hbs @@ -0,0 +1,9 @@ + diff --git a/app/pods/components/layout/md-nav-sidebar/component.js b/app/pods/components/layout/md-nav-sidebar/component.js new file mode 100644 index 000000000..3cf99843b --- /dev/null +++ b/app/pods/components/layout/md-nav-sidebar/component.js @@ -0,0 +1,22 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + + actions: { + toggleHelp() { + const sw = $('#md-sidebar-wrapper'); + + $('#md-help') + .fadeToggle(); + sw.toggleClass('help'); + }, + toggleSidebar() { + $('#md-wrapper') + .toggleClass('toggled'); + //hack to force reflow + $('#md-navbar-main-collapse ul') + .hide() + .show(0); + } + } +}); diff --git a/app/pods/components/layout/md-nav-sidebar/template.hbs b/app/pods/components/layout/md-nav-sidebar/template.hbs new file mode 100644 index 000000000..57abf8340 --- /dev/null +++ b/app/pods/components/layout/md-nav-sidebar/template.hbs @@ -0,0 +1,50 @@ + diff --git a/app/pods/components/md-help/component.js b/app/pods/components/md-help/component.js new file mode 100644 index 000000000..926b61300 --- /dev/null +++ b/app/pods/components/md-help/component.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ +}); diff --git a/app/pods/components/md-help/template.hbs b/app/pods/components/md-help/template.hbs new file mode 100644 index 000000000..17f51039b --- /dev/null +++ b/app/pods/components/md-help/template.hbs @@ -0,0 +1,37 @@ +
    +
    + +

    + 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. +

    +
    +
    +{{yield}} diff --git a/app/pods/contact/new/route.js b/app/pods/contact/new/route.js new file mode 100644 index 000000000..1cfe7130e --- /dev/null +++ b/app/pods/contact/new/route.js @@ -0,0 +1,18 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function () { + return this.store.createRecord('contact'); + }, + deactivate: function () { + // We grab the model loaded in this route + var model = this.modelFor('contact/new'); + + // If we are leaving the Route we verify if the model is in + // 'isNew' state, which means it wasn't saved to the backend. + if (model.get('isNew')) { + // We call DS#destroyRecord() which removes it from the store + model.destroyRecord(); + } + } +}); diff --git a/app/pods/contact/new/template.hbs b/app/pods/contact/new/template.hbs new file mode 100644 index 000000000..cac3f3add --- /dev/null +++ b/app/pods/contact/new/template.hbs @@ -0,0 +1,9 @@ +
    + + {{input value=model.json.organizationName placeholder="Organization Name" class="form-control" id="input-org"}} +
    +
    + + {{input value=model.json.individualName placeholder="Individual Name" class="form-control" id="input-ind"}} +
    +{{outlet}} diff --git a/app/pods/contact/route.js b/app/pods/contact/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/contact/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/contact/show/edit/route.js b/app/pods/contact/show/edit/route.js new file mode 100644 index 000000000..fd32233a3 --- /dev/null +++ b/app/pods/contact/show/edit/route.js @@ -0,0 +1,9 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + renderTemplate() { + this.render('contact.show.edit', { + into: 'contact' + }); + } +}); diff --git a/app/pods/contact/show/edit/template.hbs b/app/pods/contact/show/edit/template.hbs new file mode 100644 index 000000000..e128f5e71 --- /dev/null +++ b/app/pods/contact/show/edit/template.hbs @@ -0,0 +1 @@ +Editing contact {{model.id}} diff --git a/app/pods/contact/show/route.js b/app/pods/contact/show/route.js new file mode 100644 index 000000000..cdd575783 --- /dev/null +++ b/app/pods/contact/show/route.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + +}); diff --git a/app/pods/contact/show/template.hbs b/app/pods/contact/show/template.hbs new file mode 100644 index 000000000..144b09f96 --- /dev/null +++ b/app/pods/contact/show/template.hbs @@ -0,0 +1,2 @@ +Showing contact {{model.id}} +{{outlet}} diff --git a/app/pods/contact/template.hbs b/app/pods/contact/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/contact/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/contacts/route.js b/app/pods/contacts/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/contacts/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/contacts/template.hbs b/app/pods/contacts/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/contacts/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/dashboard/route.js b/app/pods/dashboard/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/dashboard/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/dashboard/template.hbs b/app/pods/dashboard/template.hbs new file mode 100644 index 000000000..820457970 --- /dev/null +++ b/app/pods/dashboard/template.hbs @@ -0,0 +1,151 @@ +
    +
    + Generic placeholder thumbnail +

    Label

    + Something else +
    +
    + Generic placeholder thumbnail +

    Label

    + Something else +
    +
    + Generic placeholder thumbnail +

    Label

    + Something else +
    +
    + Generic placeholder thumbnail +

    Label

    + Something else +
    +
    + +

    Section title

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #HeaderHeaderHeaderHeader
    1,001Loremipsumdolorsit
    1,002ametconsecteturadipiscingelit
    1,003IntegernecodioPraesent
    1,003liberoSedcursusante
    1,004dapibusdiamSednisi
    1,005Nullaquissemat
    1,006nibhelementumimperdietDuis
    1,007sagittisipsumPraesentmauris
    1,008Fuscenectellussed
    1,009auguesemperportaMauris
    1,010massaVestibulumlaciniaarcu
    1,011egetnullaClassaptent
    1,012tacitisociosquadlitora
    1,013torquentperconubianostra
    1,014perinceptoshimenaeosCurabitur
    1,015sodalesligulainlibero
    +
    diff --git a/app/pods/dictionaries/route.js b/app/pods/dictionaries/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/dictionaries/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/dictionaries/template.hbs b/app/pods/dictionaries/template.hbs new file mode 100644 index 000000000..b333a41ae --- /dev/null +++ b/app/pods/dictionaries/template.hbs @@ -0,0 +1,2 @@ +List Dictionaries +{{outlet}} diff --git a/app/pods/dictionary/new/route.js b/app/pods/dictionary/new/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/dictionary/new/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/dictionary/new/template.hbs b/app/pods/dictionary/new/template.hbs new file mode 100644 index 000000000..40b2e1f2a --- /dev/null +++ b/app/pods/dictionary/new/template.hbs @@ -0,0 +1,2 @@ +New Dictionary +{{outlet}} diff --git a/app/pods/dictionary/route.js b/app/pods/dictionary/route.js new file mode 100644 index 000000000..7140c6aa6 --- /dev/null +++ b/app/pods/dictionary/route.js @@ -0,0 +1,9 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model(params) { + return Ember.Object.create({ + id: params.dictionary_id + }); + } +}); diff --git a/app/pods/dictionary/show/edit/domains/route.js b/app/pods/dictionary/show/edit/domains/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/dictionary/show/edit/domains/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/dictionary/show/edit/domains/template.hbs b/app/pods/dictionary/show/edit/domains/template.hbs new file mode 100644 index 000000000..2e4c05a76 --- /dev/null +++ b/app/pods/dictionary/show/edit/domains/template.hbs @@ -0,0 +1,2 @@ +Edit domains +{{outlet}} diff --git a/app/pods/dictionary/show/edit/entities/route.js b/app/pods/dictionary/show/edit/entities/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/dictionary/show/edit/entities/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/dictionary/show/edit/entities/template.hbs b/app/pods/dictionary/show/edit/entities/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/dictionary/show/edit/entities/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/dictionary/show/edit/index/route.js b/app/pods/dictionary/show/edit/index/route.js new file mode 100644 index 000000000..bc04b32ba --- /dev/null +++ b/app/pods/dictionary/show/edit/index/route.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + breadCrumb:{ + title: 'test' + } +}); diff --git a/app/pods/dictionary/show/edit/index/template.hbs b/app/pods/dictionary/show/edit/index/template.hbs new file mode 100644 index 000000000..7d8f9e122 --- /dev/null +++ b/app/pods/dictionary/show/edit/index/template.hbs @@ -0,0 +1,2 @@ +This is the index route. +{{outlet}} diff --git a/app/pods/dictionary/show/edit/route.js b/app/pods/dictionary/show/edit/route.js new file mode 100644 index 000000000..55c00a70e --- /dev/null +++ b/app/pods/dictionary/show/edit/route.js @@ -0,0 +1,27 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + /** + * The profile service + * + * @return {Ember.Service} profile + */ + profile: Ember.inject.service(), + + /** + * The route activate hook, sets the profile to 'dictionary'. + */ + activate() { + this.get('profile').set('active', 'dictionary'); + }, + + renderTemplate () { + this.render('nav-secondary', { + into: 'application', + outlet: 'nav-secondary' + }); + this.render('dictionary.show.edit', { + into: 'dictionary' + }); + } +}); diff --git a/app/pods/dictionary/show/edit/template.hbs b/app/pods/dictionary/show/edit/template.hbs new file mode 100644 index 000000000..a3513e4a2 --- /dev/null +++ b/app/pods/dictionary/show/edit/template.hbs @@ -0,0 +1,2 @@ +
    Editing Dictionary {{model.id}}
    +{{outlet}} diff --git a/app/pods/dictionary/show/route.js b/app/pods/dictionary/show/route.js new file mode 100644 index 000000000..cdd575783 --- /dev/null +++ b/app/pods/dictionary/show/route.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + +}); diff --git a/app/pods/dictionary/show/template.hbs b/app/pods/dictionary/show/template.hbs new file mode 100644 index 000000000..d3ae05dc1 --- /dev/null +++ b/app/pods/dictionary/show/template.hbs @@ -0,0 +1,2 @@ +Showing Dictionary {{model.id}} +{{outlet}} diff --git a/app/pods/dictionary/template.hbs b/app/pods/dictionary/template.hbs new file mode 100644 index 000000000..c55195ad5 --- /dev/null +++ b/app/pods/dictionary/template.hbs @@ -0,0 +1,2 @@ +This is dictionary {{model.id}} +{{outlet}} diff --git a/app/pods/export/route.js b/app/pods/export/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/export/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/export/template.hbs b/app/pods/export/template.hbs new file mode 100644 index 000000000..d67b48001 --- /dev/null +++ b/app/pods/export/template.hbs @@ -0,0 +1,2 @@ +Export the Record(s) +{{outlet}} diff --git a/app/pods/help/route.js b/app/pods/help/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/help/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/help/template.hbs b/app/pods/help/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/help/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/import/route.js b/app/pods/import/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/import/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/import/template.hbs b/app/pods/import/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/import/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/publish/route.js b/app/pods/publish/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/publish/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/publish/template.hbs b/app/pods/publish/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/publish/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/new/route.js b/app/pods/record/new/route.js new file mode 100644 index 000000000..d191b8fc0 --- /dev/null +++ b/app/pods/record/new/route.js @@ -0,0 +1,49 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function () { + return this.store.createRecord('record'); + }, + deactivate: function () { + // We grab the model loaded in this route + let model = this.modelFor('record/new'); + + // If we are leaving the Route we verify if the model is in + // 'isNew' state, which means it wasn't saved to the backend. + if (model.get('isNew')) { + // We call DS#destroyRecord() which removes it from the store + model.destroyRecord(); + } + }, + //some test actions + setupController: function (controller, model) { + controller.actions = { + save() { + this.send('saveMe'); + } + }; + // Call _super for default behavior + this._super(controller, model); + controller.notValid = Ember.computed( + 'model.json.metadata.resourceInfo.citation.title', + function () { + return model.get('title') ? false : true; + }); + }, + actions: { + saveMe() { + this.modelFor('record.new') + .save() + .then((model) => { + this.transitionTo('record.show.edit', model); + }); + + return false; + }, + cancel() { + this.transitionTo('records'); + + return false; + } + } +}); diff --git a/app/pods/record/new/template.hbs b/app/pods/record/new/template.hbs new file mode 100644 index 000000000..f63d3370e --- /dev/null +++ b/app/pods/record/new/template.hbs @@ -0,0 +1,50 @@ +
    +
    +

    Create New Record

    +

    To create a new metadata record, enter a title and select a record type.

    +
    +
    +
    +
    +
    +
    +
    + {{#if notValid}} + + {{/if}} +
    +
    +
    + +
    + {{input value=model.json.metadata.resourceInfo.citation.title placeholder='Enter a title' class='form-control' id='input-title'}} +
    +
    +
    + +
    + {{input/md-input-codelist-single + change=(action "save") + disabled=notValid + create=true + tooltip=true + icon=true + allowClear=false + value=model.json.metadata.resourceInfo.resourceType + mdCodeName="scope" + placeholder="Pick a record type" + label=false}} +
    +
    +
    +
    + +
    +
    +
    +
    +
    diff --git a/app/pods/record/show/edit/associated/route.js b/app/pods/record/show/edit/associated/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/associated/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/associated/template.hbs b/app/pods/record/show/edit/associated/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/associated/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/coverages/route.js b/app/pods/record/show/edit/coverages/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/coverages/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/coverages/template.hbs b/app/pods/record/show/edit/coverages/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/coverages/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/distribution/route.js b/app/pods/record/show/edit/distribution/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/distribution/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/distribution/template.hbs b/app/pods/record/show/edit/distribution/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/distribution/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/documents/route.js b/app/pods/record/show/edit/documents/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/documents/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/documents/template.hbs b/app/pods/record/show/edit/documents/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/documents/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/grid/route.js b/app/pods/record/show/edit/grid/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/grid/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/grid/template.hbs b/app/pods/record/show/edit/grid/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/grid/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/index/route.js b/app/pods/record/show/edit/index/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/index/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/index/template.hbs b/app/pods/record/show/edit/index/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/index/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/keywords/route.js b/app/pods/record/show/edit/keywords/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/keywords/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/keywords/template.hbs b/app/pods/record/show/edit/keywords/template.hbs new file mode 100644 index 000000000..6c073d5d4 --- /dev/null +++ b/app/pods/record/show/edit/keywords/template.hbs @@ -0,0 +1,2 @@ +Add some keywords. +{{outlet}} diff --git a/app/pods/record/show/edit/metadata/route.js b/app/pods/record/show/edit/metadata/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/metadata/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/metadata/template.hbs b/app/pods/record/show/edit/metadata/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/metadata/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/nav-secondary/template.hbs b/app/pods/record/show/edit/nav-secondary/template.hbs new file mode 100644 index 000000000..ae02c650d --- /dev/null +++ b/app/pods/record/show/edit/nav-secondary/template.hbs @@ -0,0 +1,32 @@ +{{#layout/md-nav-secondary links=model}} + +{{/layout/md-nav-secondary}} diff --git a/app/pods/record/show/edit/nav/template.hbs b/app/pods/record/show/edit/nav/template.hbs new file mode 100644 index 000000000..f163f25bf --- /dev/null +++ b/app/pods/record/show/edit/nav/template.hbs @@ -0,0 +1,5 @@ +
  • +
  • +
  • + {{input/md-select-profile value=model.profile updateProfile="updateProfile" }} +
  • diff --git a/app/pods/record/show/edit/quality/route.js b/app/pods/record/show/edit/quality/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/quality/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/quality/template.hbs b/app/pods/record/show/edit/quality/template.hbs new file mode 100644 index 000000000..283cde4e0 --- /dev/null +++ b/app/pods/record/show/edit/quality/template.hbs @@ -0,0 +1,2 @@ +{{model.id}} is Low quality. +{{outlet}} diff --git a/app/pods/record/show/edit/route.js b/app/pods/record/show/edit/route.js new file mode 100644 index 000000000..d5608cfcf --- /dev/null +++ b/app/pods/record/show/edit/route.js @@ -0,0 +1,67 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + breadCrumb: { + title: 'Edit', + linkable: false + }, + + /** + * The profile service + * + * @return {Ember.Service} profile + */ + profile: Ember.inject.service(), + + /** + * The route activate hook, sets the profile. + */ + afterModel(model) { + this.get('profile') + .set('active', model.get('profile')); + }, + + /** + * [renderTemplate description] + * @param {[type]} controller [description] + * @param {[type]} model [description] + * @return {[type]} [description] + */ + renderTemplate(controller, model) { + this.render('record.show.edit.nav', { + into: 'records.nav' + }); + this.render('nav-secondary', { + into: 'application', + outlet: 'nav-secondary' + }); + this.render('record.show.edit', { + into: 'record', + model: model + }); + }, + + actions: { + /** + * [delete description] + * @param {[type]} model [description] + * @return {[type]} [description] + */ + delete(model) { + model.destroyRecord(); + this.transitionTo('records'); + }, + + /** + * [updateProfile description] + * @param {[type]} profile [description] + * @return {[type]} [description] + */ + updateProfile(profile) { + this.get('profile') + .set('active', profile); + this.modelFor('record.show.edit') + .save(); + } + } +}); diff --git a/app/pods/record/show/edit/spatial/route.js b/app/pods/record/show/edit/spatial/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/record/show/edit/spatial/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/record/show/edit/spatial/template.hbs b/app/pods/record/show/edit/spatial/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/show/edit/spatial/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/record/show/edit/template.hbs b/app/pods/record/show/edit/template.hbs new file mode 100644 index 000000000..252570b74 --- /dev/null +++ b/app/pods/record/show/edit/template.hbs @@ -0,0 +1,4 @@ +
    + Editing: {{model.id}} {{outlet}} +

    +
    diff --git a/app/pods/record/show/nav/template.hbs b/app/pods/record/show/nav/template.hbs new file mode 100644 index 000000000..896c06feb --- /dev/null +++ b/app/pods/record/show/nav/template.hbs @@ -0,0 +1,13 @@ +
  • + {{#link-to "translate" data-toggle="tooltip" data-placement="bottom" title="Translate" }} + + Translate + {{/link-to}} +
  • +
  • + {{#link-to "publish" data-toggle="tooltip" data-placement="bottom" title="Publish" }} + + Publish + {{/link-to}} +
  • +{{outlet}} diff --git a/app/pods/record/show/route.js b/app/pods/record/show/route.js new file mode 100644 index 000000000..185f55117 --- /dev/null +++ b/app/pods/record/show/route.js @@ -0,0 +1,17 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + //breadCrumb: null, + model(params) { + return this.store.findRecord('record', params.record_id); + }, + renderTemplate() { + this.render('records.nav', { + into: 'application', + outlet: 'nav' + }); + this.render('record.show', { + into: 'record' + }); + } +}); diff --git a/app/pods/record/show/template.hbs b/app/pods/record/show/template.hbs new file mode 100644 index 000000000..bd6afa2a9 --- /dev/null +++ b/app/pods/record/show/template.hbs @@ -0,0 +1,2 @@ +Showing: {{model.id}} +{{outlet}} diff --git a/app/pods/record/template.hbs b/app/pods/record/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/record/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/records/nav/template.hbs b/app/pods/records/nav/template.hbs new file mode 100644 index 000000000..896c06feb --- /dev/null +++ b/app/pods/records/nav/template.hbs @@ -0,0 +1,13 @@ +
  • + {{#link-to "translate" data-toggle="tooltip" data-placement="bottom" title="Translate" }} + + Translate + {{/link-to}} +
  • +
  • + {{#link-to "publish" data-toggle="tooltip" data-placement="bottom" title="Publish" }} + + Publish + {{/link-to}} +
  • +{{outlet}} diff --git a/app/pods/records/route.js b/app/pods/records/route.js new file mode 100644 index 000000000..bba8501fc --- /dev/null +++ b/app/pods/records/route.js @@ -0,0 +1,17 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + /*beforeModel() { + this.transitionTo('records.list'); + },*/ + + renderTemplate() { + this.render('records.nav', { + into: 'application', + outlet: 'nav' + }); + this.render('records', { + into: 'application' + }); + } +}); diff --git a/app/pods/records/template.hbs b/app/pods/records/template.hbs new file mode 100644 index 000000000..16319f4b1 --- /dev/null +++ b/app/pods/records/template.hbs @@ -0,0 +1,70 @@ +

    List of records.

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #Column headingColumn headingColumn heading
    1Column contentColumn contentColumn content
    2Column contentColumn contentColumn content
    3Column contentColumn contentColumn content
    4Column contentColumn contentColumn content
    5Column contentColumn contentColumn content
    6Column contentColumn contentColumn content
    7Column contentColumn contentColumn content
    8Column contentColumn contentColumn content
    9Column contentColumn contentColumn content
    +
    diff --git a/app/pods/save/route.js b/app/pods/save/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/save/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/save/template.hbs b/app/pods/save/template.hbs new file mode 100644 index 000000000..d742c4bf3 --- /dev/null +++ b/app/pods/save/template.hbs @@ -0,0 +1,2 @@ +Save the Record(s) +{{outlet}} diff --git a/app/pods/settings/route.js b/app/pods/settings/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/settings/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/settings/template.hbs b/app/pods/settings/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/settings/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/pods/translate/route.js b/app/pods/translate/route.js new file mode 100644 index 000000000..26d9f3124 --- /dev/null +++ b/app/pods/translate/route.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/pods/translate/template.hbs b/app/pods/translate/template.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/app/pods/translate/template.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/router.js b/app/router.js index cef554b3d..ceb6dd0bc 100644 --- a/app/router.js +++ b/app/router.js @@ -5,7 +5,66 @@ var Router = Ember.Router.extend({ location: config.locationType }); -Router.map(function() { +Router.map(function () { + this.route('dashboard'); + this.route('export'); + this.route('import'); + this.route('translate'); + this.route('publish'); + this.route('help'); + this.route('settings'); + + //records + this.route('records'); + //record + this.route('record', function () { + this.route('new'); + this.route('show', { + path: ':record_id' + }, + function () { + this.route('edit', function () { + this.route('metadata'); + this.route('keywords'); + this.route('spatial'); + this.route('quality'); + this.route('distribution'); + this.route('associated'); + this.route('documents'); + this.route('coverages'); + this.route('grid'); + }); + } + ); + }); + //contacts + this.route('contacts'); + //contact + this.route('contact', function () { + this.route('new'); + + this.route('show', { + path: ':contact_id' + }, function () { + this.route('edit'); + }); + + }); + //dictionary + this.route('dictionaries'); + //dictionary + this.route('dictionary', function () { + this.route('new'); + this.route('show', { + path: ':dictionary_id' + }, function () { + this.route('edit', function () { + this.route('domains'); + this.route('entities'); + }); + }); + }); + }); export default Router; diff --git a/app/routes/application.js b/app/routes/application.js new file mode 100644 index 000000000..c64cee05c --- /dev/null +++ b/app/routes/application.js @@ -0,0 +1,42 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + /** + * Models for sidebar navigation + * + * @return {Ember.RSVP.hash} + */ + model() { + let promises = [this.store.findAll('record'), + this.store.findAll('contact'), + this.store.findAll('dictionary') + ]; + + let meta = [{ + type: 'record', + list: 'records', + title: 'Metadata Records' + }, { + type: 'contact', + list: 'contacts', + title: 'Contacts' + }, { + type: 'dictionary', + list: 'dictionaries', + title: 'Dictionaries' + }]; + + let idx = 0; + + let mapFn = function (item) { + + meta[idx].listId = Ember.guidFor(item); + item.meta = meta[idx]; + idx = ++idx; + + return item; + }; + + return Ember.RSVP.map(promises, mapFn); + } +}); diff --git a/app/routes/index.js b/app/routes/index.js new file mode 100644 index 000000000..167f9ad4e --- /dev/null +++ b/app/routes/index.js @@ -0,0 +1,8 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + /** Redirect to dashboard route */ + redirect() { + this.transitionTo('dashboard'); + } +}); diff --git a/app/services/codelist.js b/app/services/codelist.js index 3227ecc93..044668f42 100644 --- a/app/services/codelist.js +++ b/app/services/codelist.js @@ -22,4 +22,16 @@ Object.keys(codes) codelist[name] = list; }); +codelist.profile = { + codelist: [{ + code: '001', + codeName: 'full', + description: 'This profile includes all metadata properties.' + }, { + code: '002', + codeName: 'basic', + description: 'This profile includes metadata properties required for a minimal metadata record.' + }] +}; + export default Ember.Service.extend(codelist); diff --git a/app/services/icon.js b/app/services/icon.js new file mode 100644 index 000000000..70fada686 --- /dev/null +++ b/app/services/icon.js @@ -0,0 +1,38 @@ +import Ember from 'ember'; + +export default Ember.Service.extend({ + dataset: 'globe', + series: 'list-ol', + nonGeographicDataset: 'bar-chart', + feature: 'map-marker', + software: 'desktop', + service: 'exchange', + model: 'cubes', + tile: 'th-large', + metadata: 'file-code-o', + initiative: 'checklist', + sample: 'flask', + 'document': 'file-o', + repository: 'database', + aggregate: 'sitemap', + collection: 'files-o', + coverage: 'th', + application: 'android', + sciencePaper: 'flask', + userGuide: 'life-saver', + dataDictionary: 'book', + website: 'chrome', + publication: 'file-text-o', + report: 'file-text-o', + awardInfo: 'file-o', + collectionSite: 'map-marker', + project: 'wrench', + factSheet: 'file-o', + tabularDataset: 'table', + map: 'map-o', + drawing: 'picture-o', + photographicImage: 'camera', + presentation: 'file-powerpoint-o', + defaultFile: 'file-o', + defaultList: 'caret-right' +}); diff --git a/app/services/profile.js b/app/services/profile.js new file mode 100644 index 000000000..bb72ea01b --- /dev/null +++ b/app/services/profile.js @@ -0,0 +1,123 @@ +import Ember from 'ember'; + +/** + * Profile service + * + * Service that provides profile configurations for metadata records. + * + * @module + * @augments ember/Service + */ +export default Ember.Service.extend({ + /** + * String identifying the active profile + * + * @type {?String} + */ + active: null, + + /** + * Get the active profile. + * + * @function + * @returns {Object} + */ + getActiveProfile() { + const active = this.get('active'); + const profile = active && typeof active === 'string' ? active : 'full'; + const profiles = this.get('profiles'); + + return profiles[profile]; + }, + + /** + * An object defining the available profiles + * + * @type {Object} profiles + */ + profiles: { + full: { + profile: null, + secondaryNav: [{ + title: 'Main', + target: 'record.show.edit.index' + + }, { + title: 'Metadata', + target: 'record.show.edit.metadata' + + }, { + title: 'Keywords', + target: 'record.show.edit.keywords' + + }, { + title: 'Spatial', + target: 'record.show.edit.spatial' + + }, { + title: 'Quality', + target: 'record.show.edit.quality' + + }, { + title: 'Distribution', + target: 'record.show.edit.distribution' + + }, { + title: 'Associated', + target: 'record.show.edit.associated' + + }, { + title: 'Documents', + target: 'record.show.edit.documents' + + }, { + title: 'Coverage', + target: 'record.show.edit.coverages' + + }, { + title: 'Grid', + target: 'record.show.edit.grid' + + }] + }, + basic: { + profile: null, + secondaryNav: [{ + title: 'Main', + target: 'record.show.edit.index' + + }, { + title: 'Metadata', + target: 'record.show.edit.metadata' + + }, { + title: 'Keywords', + target: 'record.show.edit.keywords' + + }, { + title: 'Spatial', + target: 'record.show.edit.spatial' + + }, { + title: 'Distribution', + target: 'record.show.edit.distribution' + + }] + }, + dictionary: { + secondaryNav: [{ + title: 'Main', + target: 'dictionary.show.edit.index' + + }, { + title: 'Domains', + target: 'dictionary.show.edit.domains' + + }, { + title: 'Entities', + target: 'dictionary.show.edit.entities' + + }] + } + } +}); diff --git a/app/styles/_bootstrap_custom.scss b/app/styles/_bootstrap_custom.scss new file mode 100644 index 000000000..d84da43c7 --- /dev/null +++ b/app/styles/_bootstrap_custom.scss @@ -0,0 +1,48 @@ +// Bootstrap v3.3.6 (http://getbootstrap.com) +// Copyright 2011-2015 Twitter, Inc. +// Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) +// Core variables and mixins +@import 'bootstrap/variables'; +@import 'bootstrap/mixins'; +// Reset and dependencies +@import 'bootstrap/normalize'; +@import 'bootstrap/print'; +//@import 'bootstrap/glyphicons'; +// Core CSS +@import 'bootstrap/scaffolding'; +@import 'bootstrap/type'; +@import 'bootstrap/code'; +@import 'bootstrap/grid'; +@import 'bootstrap/tables'; +@import 'bootstrap/forms'; +@import 'bootstrap/buttons'; +// Components +@import 'bootstrap/component-animations'; +@import 'bootstrap/dropdowns'; +@import 'bootstrap/button-groups'; +@import 'bootstrap/input-groups'; +@import 'bootstrap/navs'; +@import 'bootstrap/navbar'; +@import 'bootstrap/breadcrumbs'; +@import 'bootstrap/pagination'; +@import 'bootstrap/pager'; +@import 'bootstrap/labels'; +@import 'bootstrap/badges'; +@import 'bootstrap/jumbotron'; +@import 'bootstrap/thumbnails'; +@import 'bootstrap/alerts'; +@import 'bootstrap/progress-bars'; +@import 'bootstrap/media'; +@import 'bootstrap/list-group'; +@import 'bootstrap/panels'; +@import 'bootstrap/responsive-embed'; +@import 'bootstrap/wells'; +@import 'bootstrap/close'; +// Components w/ JavaScript +@import 'bootstrap/modals'; +@import 'bootstrap/tooltip'; +@import 'bootstrap/popovers'; +@import 'bootstrap/carousel'; +// Utility classes +@import 'bootstrap/utilities'; +@import 'bootstrap/responsive-utilities'; diff --git a/app/styles/_breadcrumb.scss b/app/styles/_breadcrumb.scss new file mode 100644 index 000000000..acda9dfb4 --- /dev/null +++ b/app/styles/_breadcrumb.scss @@ -0,0 +1,5 @@ +.breadcrumb { + font-size: 12px; + margin-bottom: 0; + background-color: lighten($brand-primary, 50); +} diff --git a/app/styles/_form_elements.scss b/app/styles/_form_elements.scss new file mode 100644 index 000000000..c658a1cd4 --- /dev/null +++ b/app/styles/_form_elements.scss @@ -0,0 +1,20 @@ +#md-page-content fieldset { + margin-bottom: 30px; + + &.collapse { + padding: 15px 0 10px; + background-color: lighten($brand-primary, 47); + } +} + +#md-page-content legend { + margin-bottom: 0; + + a { + text-decoration: none; + } + + a.collapsed span:before { + content: '\f107'; + } +} diff --git a/app/styles/_help.scss b/app/styles/_help.scss new file mode 100644 index 000000000..702dda748 --- /dev/null +++ b/app/styles/_help.scss @@ -0,0 +1,45 @@ +#md-help-content { + overflow-x: hidden; + overflow-y: auto; + height: 100%; + padding: 0 10px; +} + +section#md-help { + background-color: lighten($brand-success, 40); + height: 100%; + overflow: hidden; + padding: 53px 0 0; + position: absolute; + top: 0; + width: 275px; + display: none; + z-index: 3; + + .page-header { + border-bottom-color: $gray-light; + margin: 0 0 20px; + + h3 { + margin-bottom: 0; + } + } +} + +#md-sidebar-wrapper.help { + .icon-mdeditor { + color: darken($brand-success, 10); + } + + section#md-help { + display: block; + } + + a#md-btn-help { + color: darken($brand-success, 10); + + &:hover { + color: $body-bg; + } + } +} diff --git a/app/styles/_layout.scss b/app/styles/_layout.scss new file mode 100644 index 000000000..7c15fe71e --- /dev/null +++ b/app/styles/_layout.scss @@ -0,0 +1,64 @@ +#md-wrapper { + @include transition(all .5s ease); + padding-left: 0; + + .hint--info::after { + background-color: $brand-primary; + } + + .hint--info.hint--bottom::before { + border-bottom-color: $brand-primary; + } + + &.toggled { + padding-left: 275px; + + #md-sidebar-wrapper { + width: 275px; + + .sidebar-brand { + display: list-item; + } + } + + #md-page-content-wrapper { + margin-right: -275px; + position: absolute; + } + + #md-navbar-main .navbar-brand { + display: none; + } + } +} + +#md-sidebar-wrapper { + @include transition(all .5s ease); + background: $body-bg none repeat scroll 0 0; + height: 100vh; + left: 275px; + margin-left: -275px; + overflow-x: hidden; + position: fixed; + width: 0; + z-index: 1000; +} +/*@media(min-width: 768px) { + #md-wrapper.toggled .navbar-header { + float: left; + } +}*/ +#md-page-content-wrapper { + padding: 0 1px 1px; + position: absolute; + width: 100%; +} + +#md-page-content { + //display: none; + padding-top: 90px; + + .md-section-secondary { + padding-top: 45px; + } +} diff --git a/app/styles/_mdeditor_font.scss b/app/styles/_mdeditor_font.scss new file mode 100644 index 000000000..327a3d9a5 --- /dev/null +++ b/app/styles/_mdeditor_font.scss @@ -0,0 +1,34 @@ +@font-face { + font-family: 'mdeditor'; + font-style: normal; + font-weight: 400; + src: url(../fonts/mdeditor.eot?#iefix) format('embedded-opentype'), url(../fonts/mdeditor.woff?70673711) format('woff'), url(../fonts/mdeditor.ttf?70673711) format('truetype'), url(../fonts/mdeditor.svg?70673711#mdeditor) format('svg'); +} + +[class*=' icon-']::before, +[class^='icon-']::before { + display: inline-block; + font-family: mdeditor; + font-style: normal; + font-variant: normal; + font-weight: 400; + line-height: 1em; + margin-left: .2em; + margin-right: .2em; + text-align: center; + text-decoration: inherit; + text-transform: none; + width: 1em; +} + +.icon-mdeditor::before { + content: '\e804'; +} + +.icon-mdeditor { + color: $brand-primary; +} + +.navbar-inverse .icon-mdeditor:hover { + color: $body-bg; +} diff --git a/app/styles/_media.scss b/app/styles/_media.scss new file mode 100644 index 000000000..d9bd46c3f --- /dev/null +++ b/app/styles/_media.scss @@ -0,0 +1,177 @@ +@media (min-width: 810px) { + #md-wrapper.toggled .navbar-header { + float: left; + } + + #md-wrapper #md-navbar-main .navbar-brand { + margin-left: 0; + } + + #md-navbar-main-collapse, + #md-navbar-main .container-fluid { + padding-left: 0; + } + + #md-navbar-main-collapse { + span.md-nav-text { + display: inline; + } + + span.md-nav-text.nav-settings { + display: none; + } + } +} + +@media (min-width: 1040px) { + #md-wrapper { + padding-left: 275px; + + &.toggled { + padding-left: 0; + } + } + + #md-sidebar-wrapper { + width: 275px; + } + + #md-wrapper.toggled #md-sidebar-wrapper { + width: 0; + } + + #md-page-content-wrapper { + position: relative; + } + + #md-wrapper.toggled #md-page-content-wrapper { + margin-right: 0; + position: relative; + } + + .sidebar-nav > .sidebar-brand { + display: list-item; + } + + .navbar-brand { + display: none; + } + + #md-wrapper.toggled { + #md-sidebar-wrapper .sidebar-brand { + display: none; + } + + #md-navbar-main .navbar-brand { + display: inline-block; + } + } +} + +@media (max-width: 1039px) { + #md-page-content fieldset .collapse { + padding: 15px 15px 10px; + } + + #md-wrapper #md-navbar-main .nav.navbar-nav.navbar-right { + margin-right: -15px; + } +} + +@media(max-width: 532px) { + .navbar-collapse .nav > .divider-vertical { + display: none; + } +} + +@media(min-width: 532px) { + .navbar-form { + .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + + .form-control { + display: inline-block; + vertical-align: middle; + width: auto; + } + + .form-control-static { + display: inline-block; + } + + .input-group { + display: inline-table; + vertical-align: middle; + + .input-group-addon { + width: auto; + } + + .input-group-btn { + width: auto; + } + + .form-control { + width: auto; + } + + > .form-control { + width: 100%; + } + } + + .control-label { + margin-bottom: 0; + vertical-align: middle; + } + + .radio { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + + label { + padding-left: 0; + } + + input[type="radio"] { + position: relative; + margin-left: 0; + } + } + + .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + + label { + padding-left: 0; + } + + input[type="checkbox"] { + position: relative; + margin-left: 0; + } + } + + .has-feedback .form-control-feedback { + top: 0; + } + } + + #md-navbar-main-collapse .md-nav-text { + display: none; + } +} + +@media (min-width: 533px) and (max-width: 809px) { + div#md-navbar-main-collapse li .tooltip { + display: block !important; + } +} diff --git a/app/styles/_navbars.scss b/app/styles/_navbars.scss new file mode 100644 index 000000000..ec2975d84 --- /dev/null +++ b/app/styles/_navbars.scss @@ -0,0 +1,140 @@ +%extend_1 { + font-size: 13px; + height: 28px; + padding: 4px; +} + +#menu-toggle { + background-color: $gray-base; + color: $body-bg; + margin-right: 1em; + + &:hover { + background-color: $gray-darker; + } +} + +#md-nav-stacked { + position: fixed; + + li { + > a { + &:focus { + background-color: inherit; + } + + > span { + display: block; + padding: 10px 15px; + } + + &.no-padding { + padding: 0; + } + } + + &.active > a { + background-color: $brand-primary; + } + } +} + +#md-navbars { + background-color: $body-bg; + border-top: 1px solid $body-bg; + position: fixed; + top: 0; + width: 100%; + z-index: 100; + + .navbar { + border-radius: 0; + } +} + +#md-navbar-main { + margin-bottom: 1px; + + a.active { + color: $brand-warning; + } + + .navbar-form { + margin: 0; + padding: 10px; + + .form-control { + @extend %extend_1; + } + + .bootstrap-select button { + @extend %extend_1; + } + } + + .navbar { + margin-bottom: 0; + } + + .navbar-nav.navbar-right { + margin-right: 260px; + } + + .select-profile { + display: inline-block; + } +} + +#md-wrapper.toggled { + #md-navbar-main .navbar-nav.navbar-right { + margin-right: -15px; + } +} + +#md-navbar-secondary { + background-color: lighten($gray-base, 96); + max-height: 40px; + + a.active { + color: $brand-warning; + } +} + +.navbar { + .divider-vertical { + border-left: 1px solid lighten($gray-base, 95); + border-right: 1px solid $body-bg; + height: 50px; + margin: 0; + } + + form label { + float: none; + font-weight: 500; + margin-right: 7px; + margin-top: 0; + padding-top: 0 !important; + } +} + +.navbar-brand { + padding-right: 0; +} + +#tool-navbar [data-hint]::after { + white-space: normal; +} + +.navbar-inverse .divider-vertical { + border-left-color: $gray-darker; + border-right-color: lighten($gray-base, 27); +} + +.nav > li > a:focus { + background-color: inherit; + color: $brand-primary; +} + +div#md-navbar-main-collapse .tooltip { + display: none !important; +} diff --git a/app/styles/_select2_custom.scss b/app/styles/_select2_custom.scss new file mode 100644 index 000000000..186ee4f30 --- /dev/null +++ b/app/styles/_select2_custom.scss @@ -0,0 +1,48 @@ +.select2-container { + box-sizing: border-box; + + display: inline-block; + margin: 0; + position: relative; + vertical-align: middle; + + @import "single"; + @import "multiple"; +} + +@import "dropdown"; + +.select2-close-mask { + border: 0; + margin: 0; + padding: 0; + display: block; + position: fixed; + left: 0; + top: 0; + min-height: 100%; + min-width: 100%; + height: auto; + width: auto; + opacity: 0; + z-index: 99; + + // styles required for IE to work + + background-color: #fff; + filter: alpha(opacity=0); +} + +.select2-hidden-accessible { + border: 0 !important; + clip: rect(0 0 0 0) !important; + height: 1px !important; + margin: -1px !important; + overflow: hidden !important; + padding: 0 !important; + position: absolute !important; + width: 1px !important; +} + +//@import "theme/default/layout"; +//@import "theme/classic/layout"; diff --git a/app/styles/_sidebar_nav.scss b/app/styles/_sidebar_nav.scss new file mode 100644 index 000000000..003892356 --- /dev/null +++ b/app/styles/_sidebar_nav.scss @@ -0,0 +1,167 @@ +.sidebar-nav { + position: absolute; + top: 0; + overflow: hidden; + width: 275px; + height: 100vh; + margin: 0; + padding: 53px 0 10px; + list-style: outside none none; + background-color: $gray-darker; + + li { + line-height: 40px; + text-indent: 0; + + .fa { + text-indent: 0; + } + + [class^='icon-'] { + text-indent: 0; + } + + a { + overflow: hidden; + white-space: nowrap; + text-decoration: none; + text-overflow: ellipsis; + color: lighten($gray-dark, 40); + + &:active { + text-decoration: none; + } + + &:focus { + text-decoration: none; + } + } + + > a:hover { + text-decoration: none; + color: $body-bg; + background: rgba($gray-base, .2) none repeat scroll 0 0; + } + } + + > .sidebar-brand { + font-size: 18px; + line-height: 52.5px; + position: fixed; + z-index: 1000; + top: 0; + display: none; + width: 275px; + height: 52.5px; + padding: 0 10px; + border-top: 1px solid $body-bg; + background-color: $gray-darker; + + a { + color: lighten($gray-dark, 40); + + &:hover { + background: none repeat scroll 0 0; + color: $body-bg; + } + } + } +} + +#md-sidebar-lists { + height: 100%; + + .panel-group { + overflow-x: hidden; + overflow-y: auto; + height: 100%; + margin: 0 0 15px; + background-color: $gray-darker; + + .panel { + border-image: none; + border-radius: 0; + border-style: solid none none; + border-width: 1px 0 0; + margin-top: 0; + + .btn { + font-size: 16px; + width: 38px; + height: 40px; + margin: 0; + padding: 9px; + text-indent: 0; + color: $body-bg; + border: 0 none; + //Instead of the line below you could use @include border-radius($radius, $vertical-radius) + border-radius: 0; + + &.btn-primary { + background-color: darken($brand-primary, 6%); + + &:hover { + background-color: darken($brand-primary, 12%); + } + } + } + + .btn-group { + margin-right: -1px; + padding: 0; + //Instead of the line below you could use @include border-radius($radius, $vertical-radius) + border-radius: 0; + background-color: $body-bg; + } + } + + .panel-heading { + padding: 0; + + .panel-title a { + line-height: 40px; + padding-left: 10px; + color: $body-bg; + + &:hover { + //background-color: darken($brand-primary, 12%); + color: lighten($brand-primary, 46.5%); + } + + span::before { + content: '\f106'; + } + + &.collapsed span::before { + content: '\f107'; + } + } + } + } + + .list-group { + border-top: 0 none; + + .list-group-item { + line-height: 40px; + overflow: hidden; + padding: 0; + text-overflow: ellipsis; + white-space: nowrap; + + &:hover { + background-color: lighten($brand-primary, 46.5); + + .sidebar-row { + color: $brand-primary; + } + } + } + } + + a.sidebar-row { + max-width: 220px; + padding-left: 10px; + display: block; + } +} diff --git a/app/styles/app.css b/app/styles/app.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/styles/app.scss b/app/styles/app.scss new file mode 100644 index 000000000..96badf813 --- /dev/null +++ b/app/styles/app.scss @@ -0,0 +1,23 @@ +//** Point at which the navbar becomes uncollapsed. +$grid-float-breakpoint: 532px !default; + +@import 'bootstrap_custom'; +@import 'select2_custom'; +@import 'select2-bootstrap'; + +@import 'mdeditor_font'; +@import 'layout'; +@import 'sidebar_nav'; +@import 'media'; +@import 'navbars'; +@import 'breadcrumb'; +@import 'help'; +@import 'form_elements'; + +/*body.relative { + position: relative; +} + +#md-scrollspy ul { + position: fixed; +}*/ diff --git a/app/templates/application.hbs b/app/templates/application.hbs index f8bc38e7b..ab9eeb811 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -1,3 +1,23 @@ -

    Welcome to Ember

    +
    + +
    + {{layout/md-nav-sidebar items=model}} {{md-help}} +
    + -{{outlet}} + +
    +
    + {{#layout/md-nav-main}} + {{outlet "nav"}} + {{/layout/md-nav-main}} + {{layout/md-breadcrumb}} + {{outlet "nav-secondary"}} +
    +
    + {{outlet}} +
    +
    + + +
    diff --git a/app/templates/nav-secondary.hbs b/app/templates/nav-secondary.hbs new file mode 100644 index 000000000..4ffbcfb74 --- /dev/null +++ b/app/templates/nav-secondary.hbs @@ -0,0 +1 @@ +{{layout/md-nav-secondary}} diff --git a/bower.json b/bower.json index 80633b04b..c0542b101 100644 --- a/bower.json +++ b/bower.json @@ -2,17 +2,20 @@ "name": "mdeditor", "dependencies": { "ember": "~2.3.0", - "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.6", - "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", + "ember-cli-shims": "0.0.6", + "ember-cli-test-loader": "0.2.1", "ember-data": "~2.3.0", - "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5", - "ember-qunit": "0.4.9", - "ember-qunit-notifications": "0.0.7", - "ember-resolver": "~0.1.18", - "jquery": "latest", - "loader.js": "ember-cli/loader.js#3.2.1", - "qunit": "~1.18.0", - "blob-polyfill": "~1.0.20150320" + "ember-load-initializers": "0.1.7", + "ember-qunit": "0.4.16", + "ember-qunit-notifications": "0.1.0", + "ember-resolver": "~0.1.20", + "jquery": "^2.1.0", + "loader.js": "ember-cli/loader.js#3.4.0", + "qunit": "~1.20.0", + "font-awesome": "~4.5.0", + "bootstrap-sass": "~3.3.6", + "select2": "^4.0.1", + "select2-bootstrap-theme": "^0.1.0-beta.4" }, "resolutions": { "ember": "~2.3.0" diff --git a/ember-cli-build.js b/ember-cli-build.js index a0c0b8462..67fe3eb0b 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,9 +1,16 @@ /* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); -module.exports = function(defaults) { +module.exports = function (defaults) { var app = new EmberApp(defaults, { // Add options here + sassOptions: { + includePaths: [ + 'bower_components/bootstrap-sass/assets/stylesheets', + 'bower_components/select2/src/scss', + 'bower_components/select2-bootstrap-theme/src', + ] + } }); // Use `app.import` to add additional libraries to the generated @@ -19,5 +26,19 @@ module.exports = function(defaults) { // please specify an object with the list of modules as keys // along with the exports of each module as its value. + //bootstrap js + app.import(app.bowerDirectory + + '/bootstrap-sass/assets/javascripts/bootstrap/transition.js'); + app.import(app.bowerDirectory + + '/bootstrap-sass/assets/javascripts/bootstrap/collapse.js'); + app.import(app.bowerDirectory + + '/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js'); + app.import(app.bowerDirectory + + '/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js'); + + //select2 + app.import(app.bowerDirectory + + '/select2/dist/js/select2.js'); + return app.toTree(); }; diff --git a/package.json b/package.json index 3de6f7079..db8ce3ae6 100644 --- a/package.json +++ b/package.json @@ -19,26 +19,30 @@ "author": "", "license": "MIT", "devDependencies": { - "broccoli-asset-rev": "^2.1.2", + "broccoli-asset-rev": "^2.2.0", "ember-browserify": "^1.1.4", - "ember-cli": "1.13.8", - "ember-cli-app-version": "0.5.0", - "ember-cli-babel": "^5.1.3", + "ember-cli": "1.13.15", + "ember-cli-app-version": "^1.0.0", + "ember-cli-babel": "^5.1.5", "ember-cli-content-security-policy": "0.4.0", - "ember-cli-dependency-checker": "^1.0.1", - "ember-cli-htmlbars": "0.7.9", - "ember-cli-htmlbars-inline-precompile": "^0.2.0", - "ember-cli-ic-ajax": "0.2.1", + "ember-cli-dependency-checker": "^1.1.0", + "ember-cli-font-awesome": "1.4.0", + "ember-cli-htmlbars": "^1.0.1", + "ember-cli-htmlbars-inline-precompile": "^0.3.1", + "ember-cli-ic-ajax": "0.2.4", "ember-cli-inject-live-reload": "^1.3.1", - "ember-cli-qunit": "^1.2.0", - "ember-cli-release": "0.2.3", - "ember-cli-sri": "^1.0.3", + "ember-cli-qunit": "^1.0.4", + "ember-cli-release": "0.2.8", + "ember-cli-sass": "5.2.1", + "ember-cli-sri": "^1.2.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "1.13.8", - "ember-disable-proxy-controllers": "^1.0.0", - "ember-export-application-global": "^1.0.3", + "ember-crumbly": "git+https://github.com/poteto/ember-crumbly.git#66d5dcfcb2061818f36fa933ca3140654956e34b", + "ember-data": "1.13.15", + "ember-disable-proxy-controllers": "^1.0.1", + "ember-export-application-global": "^1.0.4", "ember-local-storage": "1.0.1", "ember-try": "0.0.8", - "mdcodes": "^1.2.3" + "mdcodes": "^1.2.3", + "node-uuid": "^1.4.7" } } diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 000000000..774d84bc0 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/fonts/mdeditor.eot b/public/fonts/mdeditor.eot new file mode 100644 index 000000000..623c1eda2 Binary files /dev/null and b/public/fonts/mdeditor.eot differ diff --git a/public/fonts/mdeditor.svg b/public/fonts/mdeditor.svg new file mode 100644 index 000000000..90e276c03 --- /dev/null +++ b/public/fonts/mdeditor.svg @@ -0,0 +1,12 @@ + + + +Copyright (C) 2015 by original authors @ fontello.com + + + + + + + + \ No newline at end of file diff --git a/public/fonts/mdeditor.ttf b/public/fonts/mdeditor.ttf new file mode 100644 index 000000000..8cd8f3e20 Binary files /dev/null and b/public/fonts/mdeditor.ttf differ diff --git a/public/fonts/mdeditor.woff b/public/fonts/mdeditor.woff new file mode 100644 index 000000000..3d97deb6e Binary files /dev/null and b/public/fonts/mdeditor.woff differ diff --git a/tests/acceptance/pods/components/layout/md-breadcrumb-test.js b/tests/acceptance/pods/components/layout/md-breadcrumb-test.js new file mode 100644 index 000000000..0f7829ccf --- /dev/null +++ b/tests/acceptance/pods/components/layout/md-breadcrumb-test.js @@ -0,0 +1,42 @@ +import { + test +} +from 'qunit'; +import moduleForAcceptance from 'mdeditor/tests/helpers/module-for-acceptance'; + +let componentInstance; + +moduleForAcceptance('Acceptance | pods/components/md breadcrumb', { + beforeEach() { + componentInstance = this.application.__container__.lookup( + 'component:layout/md-breadcrumb'); + }, + afterEach() { + componentInstance = null; + } +}); + +test('visiting /record/new', function(assert) { + assert.expect(5); + + visit('/record/new'); + + andThen(function() { + assert.equal(currentURL(), '/record/new'); + + const listItems = find('ol.breadcrumb li').text(); + const linkItems = find('ol.breadcrumb li a').text(); + + const hasRecordInallList = listItems.indexOf('Record') >= 0; + const hasNewTextInallList = listItems.indexOf('New') >= 0; + + const hasRecordInLinkList = linkItems.indexOf('Record') >= 0; + const doesNotHaveNewInLinkList = linkItems.indexOf('New') === -1; + + assert.ok(hasRecordInallList, 'renders the right inferred name'); + assert.ok(hasNewTextInallList, 'renders the right inferred name'); + assert.ok(hasRecordInLinkList, 'renders the right inferred name'); + assert.ok(doesNotHaveNewInLinkList, 'renders the right inferred name'); + + }); +}); diff --git a/tests/helpers/create-contact.js b/tests/helpers/create-contact.js new file mode 100644 index 000000000..ee83c8212 --- /dev/null +++ b/tests/helpers/create-contact.js @@ -0,0 +1,31 @@ +import Ember from 'ember'; + +export default function createContact(total) { + + const contacts = []; + + for(let i = 0; i < total; i++) { + + const contact = Ember.Object.create({ + + json: { + "contactId": i, + "organizationName": null, + "individualName": "Contact" + i, + "positionName": null, + "phoneBook": [], + "address": {}, + "onlineResource": [], + "contactInstructions": null + }, + title: 'Contact' + i, + icon: 'user' + }); + + contacts.push(contact); + + } + + return contacts; + +} diff --git a/tests/helpers/create-dictionary.js b/tests/helpers/create-dictionary.js new file mode 100644 index 000000000..1e56882b7 --- /dev/null +++ b/tests/helpers/create-dictionary.js @@ -0,0 +1,37 @@ +import Ember from 'ember'; + +export default function createDictionary(total) { + + const dictionaries = []; + + for(let i = 0; i < total; i++) { + + const dictionary = Ember.Object.create({ + + json: { + "dictionaryInfo": { + "citation": { + "title": "My Dictionary", + "date": [{ + "date": new Date() + .toISOString(), + "dateType": "creation" + }] + }, + "description": "Data dictionary.", + "resourceType": null + }, + "domain": [], + "entity": [] + }, + title: 'My Dictionary' + i, + icon: 'book' + }); + + dictionaries.push(dictionary); + + } + + return dictionaries; + +} diff --git a/tests/helpers/create-record.js b/tests/helpers/create-record.js new file mode 100644 index 000000000..73a2503c5 --- /dev/null +++ b/tests/helpers/create-record.js @@ -0,0 +1,51 @@ +import Ember from 'ember'; + +export default function createRecord(total) { + + const records = []; + + for(let i = 0; i < total; i++) { + + const record = Ember.Object.create({ + + json: { + "version": { + "name": "mdJson", + "version": "1.0.0" + }, + "record": [], + "metadata": { + "metadataInfo": { + "metadataIdentifier": { + "identifier": 'r' +i, + "type": "uuid" + } + }, + "resourceInfo": { + "resourceType": null, + "citation": { + "title": "My Record"+ i, + "date": [{ + "date": new Date() + .toISOString(), + "dateType": "creation" + }] + }, + "pointOfrecord": [], + "abstract": null, + "status": null, + "language": ["eng; USA"] + } + } + }, + title: 'My Record' + i, + icon: 'project' + }); + + records.push(record); + + } + + return records; + +} diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js new file mode 100644 index 000000000..c3d4d1abb --- /dev/null +++ b/tests/helpers/destroy-app.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default function destroyApp(application) { + Ember.run(application, 'destroy'); +} diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js new file mode 100644 index 000000000..ed23003db --- /dev/null +++ b/tests/helpers/module-for-acceptance.js @@ -0,0 +1,23 @@ +import { module } from 'qunit'; +import startApp from '../helpers/start-app'; +import destroyApp from '../helpers/destroy-app'; + +export default function(name, options = {}) { + module(name, { + beforeEach() { + this.application = startApp(); + + if (options.beforeEach) { + options.beforeEach.apply(this, arguments); + } + }, + + afterEach() { + destroyApp(this.application); + + if (options.afterEach) { + options.afterEach.apply(this, arguments); + } + } + }); +} diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js index 28f4ece46..8df2acd60 100644 --- a/tests/helpers/resolver.js +++ b/tests/helpers/resolver.js @@ -1,11 +1,11 @@ -import Resolver from 'ember/resolver'; -import config from '../../config/environment'; - -var resolver = Resolver.create(); - -resolver.namespace = { - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix -}; - -export default resolver; +import Resolver from 'ember/resolver'; +import config from '../../config/environment'; + +const resolver = Resolver.create(); + +resolver.namespace = { + modulePrefix: config.modulePrefix, + podModulePrefix: config.podModulePrefix +}; + +export default resolver; diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index 0f7aab1af..e098f1d5b 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -3,12 +3,12 @@ import Application from '../../app'; import config from '../../config/environment'; export default function startApp(attrs) { - var application; + let application; - var attributes = Ember.merge({}, config.APP); + let attributes = Ember.merge({}, config.APP); attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; - Ember.run(function() { + Ember.run(() => { application = Application.create(attributes); application.setupForTesting(); application.injectTestHelpers(); diff --git a/tests/index.html b/tests/index.html index eec823dea..b19dc7e7d 100644 --- a/tests/index.html +++ b/tests/index.html @@ -1,33 +1,34 @@ - - - - - - Mdeditor Tests - - - - {{content-for 'head'}} - {{content-for 'test-head'}} - - - - - - {{content-for 'head-footer'}} - {{content-for 'test-head-footer'}} - - - - {{content-for 'body'}} - {{content-for 'test-body'}} - - - - - - - {{content-for 'body-footer'}} - {{content-for 'test-body-footer'}} - - + + + + + + Mdeditor Tests + + + + {{content-for 'head'}} + {{content-for 'test-head'}} + + + + + + {{content-for 'head-footer'}} + {{content-for 'test-head-footer'}} + + + {{content-for 'body'}} + {{content-for 'test-body'}} + + + + + + + + + {{content-for 'body-footer'}} + {{content-for 'test-body-footer'}} + + diff --git a/tests/integration/pods/components/input/md-input-codelist-single/component-test.js b/tests/integration/pods/components/input/md-input-codelist-single/component-test.js new file mode 100644 index 000000000..d23530542 --- /dev/null +++ b/tests/integration/pods/components/input/md-input-codelist-single/component-test.js @@ -0,0 +1,70 @@ +import { + moduleForComponent, test +} +from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import Ember from 'ember'; + +const codelist = Ember.Service.extend({ + foobar: { + codelist: [{ + code: '001', + codeName: 'foo', + description: 'This is foo.' + }, { + code: '002', + codeName: 'bar', + description: 'This is bar.' + }] + } +}); + +moduleForComponent('input/md-input-codelist-single', + 'Integration | Component | input/md input codelist single', { + integration: true, + beforeEach: function() { + this.register('service:codelist', codelist); + this.inject.service('codelist', { + as: 'codelist' + }); + } + }); + +test('it renders', function(assert) { + assert.expect(2); + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + + + this.render(hbs `{{input/md-input-codelist-single + value='foo' mdCodeName="foobar"}}`); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), '|bar|foo|foo|'); + + // Template block usage:" + EOL + + this.render(hbs ` + {{#input/md-input-codelist-single value='foo' mdCodeName="foobar"}} + + {{/input/md-input-codelist-single}} + `); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), '|bar|foo|baz|foo|', 'render block ok'); +}); + +test('set value action', function(assert) { + // test dummy for the external profile action + this.on('update', (actual) => { + assert.equal(actual, 'bar', + 'submitted value is passed to external action'); + }); + + this.render(hbs `{{input/md-input-codelist-single + value='foo' mdCodeName="foobar" + change=(action "update" "bar")}}`); + + this.$('select') + .trigger('change'); +}); diff --git a/tests/integration/pods/components/input/md-select-profile/component-test.js b/tests/integration/pods/components/input/md-select-profile/component-test.js new file mode 100644 index 000000000..e7594214b --- /dev/null +++ b/tests/integration/pods/components/input/md-select-profile/component-test.js @@ -0,0 +1,42 @@ +import { + moduleForComponent, test +} +from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('input/md-select-profile', + 'Integration | Component | input/md select profile', { + integration: true + }); + +test('it renders', function(assert) { + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + + + this.render(hbs `{{input/md-select-profile value=full updateProfile="updateProfile" }}`); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), '|Profile|basic|full|Choose|profile|'); +}); + +test('should trigger external action on change', function(assert) { + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + + + // test dummy for the external profile action + this.set('updateProfile', (actual) => { + assert.equal(actual, 'basic', + 'submitted value is passed to external action'); + }); + + this.render(hbs `{{input/md-select-profile value=full updateProfile=(action updateProfile)}}`); + + // select a value and force an onchange + this.$('select') + .val('basic'); + this.$('select') + .change(); +}); diff --git a/tests/integration/pods/components/layout/md-nav-main/component-test.js b/tests/integration/pods/components/layout/md-nav-main/component-test.js new file mode 100644 index 000000000..97b905b72 --- /dev/null +++ b/tests/integration/pods/components/layout/md-nav-main/component-test.js @@ -0,0 +1,37 @@ +import { + moduleForComponent, test +} +from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('layout/md-nav-main', + 'Integration | Component | md nav main', { + integration: true + }); + +test('it renders', function(assert) { + assert.expect(2); + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... }); + + this.render(hbs `{{layout/md-nav-main}}`); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), + '|Toggle|navigation|Dashboard|Export|Import|Settings|'); + + // Template block usage: + this.render(hbs ` + {{#layout/md-nav-main}} + template block text {{record/show/edit/nav}} + {{/layout/md-nav-main}} + `); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), + '|Toggle|navigation|Dashboard|Export|Import|template|block|text|Settings|' + ); +}); diff --git a/tests/integration/pods/components/layout/md-nav-secondary/component-test.js b/tests/integration/pods/components/layout/md-nav-secondary/component-test.js new file mode 100644 index 000000000..2cb870054 --- /dev/null +++ b/tests/integration/pods/components/layout/md-nav-secondary/component-test.js @@ -0,0 +1,97 @@ +import { + moduleForComponent, test +} +from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import Ember from 'ember'; + +//Stub profile service +const profileStub = Ember.Service.extend({ + getActiveProfile() { + const active = this.get('active'); + const profile = active && typeof active === 'string' ? active : + 'full'; + const profiles = this.get('profiles'); + + return profiles[profile]; + }, + profiles: { + full: { + profile: null, + secondaryNav: [{ + title: 'Foo', + target: 'record.show.edit.index' + + }, { + title: 'Bar', + target: 'record.show.edit.metadata' + + }] + }, + basic: { + profile: null, + secondaryNav: [{ + title: 'FooBar', + target: 'record.show.edit.index' + + }, { + title: 'BarFoo', + target: 'record.show.edit.metadata' + + }] + } + } +}); + +moduleForComponent('layout/md-nav-secondary', + 'Integration | Component | md nav secondary', { + integration: true, + + beforeEach: function() { + this.register('service:profile', profileStub); + // Calling inject puts the service instance in the test's context, + // making it accessible as "locationService" within each test + this.inject.service('profile', { + as: 'profileService' + }); + } + }); + +test('it renders', function(assert) { + assert.expect(2); + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... }); + + this.render(hbs `{{layout/md-nav-secondary}}`); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), '|More|Foo|Bar|'); + + // Template block usage: + this.render(hbs ` + {{#layout/md-nav-secondary}} +
  • template block text
  • + {{/layout/md-nav-secondary}} + `); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), '|More|Foo|Bar|template|block|text|'); +}); + +test('render after setting profile', function(assert) { + assert.expect(1); + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... }); + + this.set('profileService.active', 'basic'); + + this.render(hbs `{{layout/md-nav-secondary}}`); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), '|More|FooBar|BarFoo|'); +}); diff --git a/tests/integration/pods/components/layout/md-nav-sidebar/component-test.js b/tests/integration/pods/components/layout/md-nav-sidebar/component-test.js new file mode 100644 index 000000000..4bdc48e9e --- /dev/null +++ b/tests/integration/pods/components/layout/md-nav-sidebar/component-test.js @@ -0,0 +1,67 @@ +import { + moduleForComponent, test +} +from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import createContact from '../../../../../helpers/create-contact'; +import createRecord from '../../../../../helpers/create-record'; +import createDictionary from '../../../../../helpers/create-dictionary'; + +moduleForComponent('layout/md-nav-sidebar', + 'Integration | Component | md nav sidebar', { + integration: true + }); + +test('it renders', function(assert) { + assert.expect(1); + + const contacts = createContact(2); + contacts.meta = { + type: 'contact', + list: 'contacts', + title: 'Contacts' + }; + + const records = createRecord(2); + records.meta = { + type: 'record', + list: 'records', + title: 'Records' + }; + + const dicts = createDictionary(2); + dicts.meta = { + type: 'dictionary', + list: 'dictionaries', + title: 'Dictionaries' + }; + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... }); + + this.set('model', [records, contacts, dicts]); + + this.render(hbs `{{layout/md-nav-sidebar items=model}}`); + + assert.equal(this.$() + .text() + .replace(/[ \n]+/g, '|'), + '|mdditor|Records|(2)|My|Record0|My|Record1|Contacts|(2)|Contact0|Contact1|Dictionaries|(2)|My|Dictionary0|My|Dictionary1|' + ); +}); + +test('toggle help action', function(assert) { + this.render(hbs `
    {{layout/md-nav-sidebar}}
    `); + this.$('#md-btn-help') + .click(); + assert.ok(this.$('#md-sidebar-wrapper') + .hasClass('help')); +}); + +test('toggle sidebar action', function(assert) { + this.render(hbs `
    {{layout/md-nav-sidebar}}
    `); + this.$('.sidebar-brand-link') + .click(); + assert.ok(this.$('#md-wrapper') + .hasClass('toggled')); +}); diff --git a/tests/integration/pods/components/md-help/component-test.js b/tests/integration/pods/components/md-help/component-test.js new file mode 100644 index 000000000..2fe451600 --- /dev/null +++ b/tests/integration/pods/components/md-help/component-test.js @@ -0,0 +1,34 @@ +import { + moduleForComponent, test +} +from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('md-help', 'Integration | Component | md help', { + integration: true +}); + +test('it renders', function(assert) { + assert.expect(2); + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... }); + + this.render(hbs `{{md-help}}`); + + assert.ok(this.$() + .text() + .indexOf('Lorem ipsum' > 0)); + + // Template block usage: + this.render(hbs ` + {{#md-help}} + template block text + {{/md-help}} + `); + + assert.ok(this.$() + .text() + .trim() + .indexOf('template block text' > 0)); +}); diff --git a/tests/unit/models/contact-test.js b/tests/unit/models/contact-test.js new file mode 100644 index 000000000..08c942626 --- /dev/null +++ b/tests/unit/models/contact-test.js @@ -0,0 +1,34 @@ +import { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('contact', 'Unit | Model | contact', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('it exists', function(assert) { + let model = this.subject(); + // var store = this.store(); + assert.ok(!!model); +}); + +test('should correctly compute title', function(assert) { + const me = this.subject(); + + assert.expect(2); + me.set('json.individualName', undefined); + me.set('json.organizationName', 'bar'); + assert.equal(me.get('title'), 'bar'); + me.set('json.individualName', 'foo'); + assert.equal(me.get('title'), 'foo'); +}); + +test('should correctly compute icon', function(assert) { + const me = this.subject(); + + assert.expect(2); + me.set('json.individualName', undefined); + me.set('json.organizationName', 'bar'); + assert.equal(me.get('icon'), 'users'); + me.set('json.individualName', 'foo'); + assert.equal(me.get('icon'), 'user'); +}); diff --git a/tests/unit/models/dictionary-test.js b/tests/unit/models/dictionary-test.js new file mode 100644 index 000000000..d7d69392d --- /dev/null +++ b/tests/unit/models/dictionary-test.js @@ -0,0 +1,23 @@ +import { + moduleForModel, test +} +from 'ember-qunit'; + +moduleForModel('dictionary', 'Unit | Model | dictionary', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('it exists', function(assert) { + var model = this.subject(); + // var store = this.store(); + assert.ok(!!model); +}); + +test('should correctly compute title', function(assert) { + const me = this.subject(); + + assert.expect(1); + me.set('json.dictionaryInfo.citation.title', 'bar'); + assert.equal(me.get('title'), 'bar'); +}); diff --git a/tests/unit/models/record-test.js b/tests/unit/models/record-test.js new file mode 100644 index 000000000..47eee7262 --- /dev/null +++ b/tests/unit/models/record-test.js @@ -0,0 +1,34 @@ +import Ember from 'ember'; +import { + moduleForModel, test +} +from 'ember-qunit'; + +moduleForModel('record', 'Unit | Model | record', { + // Specify the other units that are required for this test. + needs: ['service:icon'] +}); + +test('it exists', function(assert) { + var model = this.subject(); + // var store = this.store(); + assert.ok(!!model); +}); + +test('should correctly compute title', function(assert) { + const me = this.subject(); + + assert.expect(1); + me.set('json.metadata.resourceInfo.citation.title', 'foo'); + assert.equal(me.get('title'), 'foo'); +}); + +test('should correctly compute icon', function(assert) { + const me = this.subject(); + const list = Ember.getOwner(this) + .lookup('service:icon'); + + assert.expect(1); + me.set('json.metadata.resourceInfo.resourceType', 'project'); + assert.equal(me.get('icon'), list.get('project')); +}); diff --git a/tests/unit/pods/contact/new/route-test.js b/tests/unit/pods/contact/new/route-test.js new file mode 100644 index 000000000..c53cdbc91 --- /dev/null +++ b/tests/unit/pods/contact/new/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:contact/new', 'Unit | Route | contact/new', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/contact/show/edit/route-test.js b/tests/unit/pods/contact/show/edit/route-test.js new file mode 100644 index 000000000..db326749a --- /dev/null +++ b/tests/unit/pods/contact/show/edit/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:contact/show/edit', 'Unit | Route | contact/edit', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/contact/show/route-test.js b/tests/unit/pods/contact/show/route-test.js new file mode 100644 index 000000000..b9fec7392 --- /dev/null +++ b/tests/unit/pods/contact/show/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:contact/show', 'Unit | Route | contact/show', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/contacts/route-test.js b/tests/unit/pods/contacts/route-test.js new file mode 100644 index 000000000..63cc87f06 --- /dev/null +++ b/tests/unit/pods/contacts/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:contacts', 'Unit | Route | contacts', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dashboard/route-test.js b/tests/unit/pods/dashboard/route-test.js new file mode 100644 index 000000000..15e122efb --- /dev/null +++ b/tests/unit/pods/dashboard/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dashboard', 'Unit | Route | dashboard', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionaries/route-test.js b/tests/unit/pods/dictionaries/route-test.js new file mode 100644 index 000000000..ff5aeab71 --- /dev/null +++ b/tests/unit/pods/dictionaries/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionaries', 'Unit | Route | dictionaries', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionary/new/route-test.js b/tests/unit/pods/dictionary/new/route-test.js new file mode 100644 index 000000000..8df492674 --- /dev/null +++ b/tests/unit/pods/dictionary/new/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionary/new', 'Unit | Route | dictionary/new', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionary/show/edit/domains/route-test.js b/tests/unit/pods/dictionary/show/edit/domains/route-test.js new file mode 100644 index 000000000..6b814223c --- /dev/null +++ b/tests/unit/pods/dictionary/show/edit/domains/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionary/show/edit/domains', 'Unit | Route | dictionary/edit/domains', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionary/show/edit/entities/route-test.js b/tests/unit/pods/dictionary/show/edit/entities/route-test.js new file mode 100644 index 000000000..c2c1ca82f --- /dev/null +++ b/tests/unit/pods/dictionary/show/edit/entities/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionary/show/edit/entities', 'Unit | Route | dictionary/edit/entities', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionary/show/edit/index/route-test.js b/tests/unit/pods/dictionary/show/edit/index/route-test.js new file mode 100644 index 000000000..ebc9ae520 --- /dev/null +++ b/tests/unit/pods/dictionary/show/edit/index/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionary/show/edit/index', 'Unit | Route | dictionary/show/edit/index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionary/show/edit/route-test.js b/tests/unit/pods/dictionary/show/edit/route-test.js new file mode 100644 index 000000000..66a915800 --- /dev/null +++ b/tests/unit/pods/dictionary/show/edit/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionary/show/edit', 'Unit | Route | dictionary/edit', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/dictionary/show/route-test.js b/tests/unit/pods/dictionary/show/route-test.js new file mode 100644 index 000000000..37a3ef9e0 --- /dev/null +++ b/tests/unit/pods/dictionary/show/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:dictionary/show', 'Unit | Route | dictionary/show', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/export/route-test.js b/tests/unit/pods/export/route-test.js new file mode 100644 index 000000000..0ea2b0d50 --- /dev/null +++ b/tests/unit/pods/export/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:save', 'Unit | Route | save', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/help/route-test.js b/tests/unit/pods/help/route-test.js new file mode 100644 index 000000000..a1e2a2628 --- /dev/null +++ b/tests/unit/pods/help/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:help', 'Unit | Route | help', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/import/route-test.js b/tests/unit/pods/import/route-test.js new file mode 100644 index 000000000..3e048d5ad --- /dev/null +++ b/tests/unit/pods/import/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:import', 'Unit | Route | import', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/publish/route-test.js b/tests/unit/pods/publish/route-test.js new file mode 100644 index 000000000..c23ab89ff --- /dev/null +++ b/tests/unit/pods/publish/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:publish', 'Unit | Route | publish', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/new/route-test.js b/tests/unit/pods/record/new/route-test.js new file mode 100644 index 000000000..2b708611d --- /dev/null +++ b/tests/unit/pods/record/new/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/new', 'Unit | Route | record/new', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/associated/route-test.js b/tests/unit/pods/record/show/edit/associated/route-test.js new file mode 100644 index 000000000..df7607cac --- /dev/null +++ b/tests/unit/pods/record/show/edit/associated/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/associated', 'Unit | Route | record/edit/associated', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/coverages/route-test.js b/tests/unit/pods/record/show/edit/coverages/route-test.js new file mode 100644 index 000000000..0a736aeef --- /dev/null +++ b/tests/unit/pods/record/show/edit/coverages/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/coverages', 'Unit | Route | record/edit/coverages', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/distribution/route-test.js b/tests/unit/pods/record/show/edit/distribution/route-test.js new file mode 100644 index 000000000..c048b55db --- /dev/null +++ b/tests/unit/pods/record/show/edit/distribution/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/distribution', 'Unit | Route | record/edit/distribution', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/documents/route-test.js b/tests/unit/pods/record/show/edit/documents/route-test.js new file mode 100644 index 000000000..6870d7c55 --- /dev/null +++ b/tests/unit/pods/record/show/edit/documents/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/documents', 'Unit | Route | record/edit/documents', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/grid/route-test.js b/tests/unit/pods/record/show/edit/grid/route-test.js new file mode 100644 index 000000000..141d726ab --- /dev/null +++ b/tests/unit/pods/record/show/edit/grid/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/grid', 'Unit | Route | record/edit/grid', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/index/route-test.js b/tests/unit/pods/record/show/edit/index/route-test.js new file mode 100644 index 000000000..cadaf6f72 --- /dev/null +++ b/tests/unit/pods/record/show/edit/index/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/index', 'Unit | Route | record/show/edit/index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/keywords/route-test.js b/tests/unit/pods/record/show/edit/keywords/route-test.js new file mode 100644 index 000000000..e4739cc02 --- /dev/null +++ b/tests/unit/pods/record/show/edit/keywords/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/keywords', 'Unit | Route | record/edit/keywords', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/metadata/route-test.js b/tests/unit/pods/record/show/edit/metadata/route-test.js new file mode 100644 index 000000000..ffb74251b --- /dev/null +++ b/tests/unit/pods/record/show/edit/metadata/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/metadata', 'Unit | Route | record/show/edit/metadata', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + let route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/quality/route-test.js b/tests/unit/pods/record/show/edit/quality/route-test.js new file mode 100644 index 000000000..3e7bccf1e --- /dev/null +++ b/tests/unit/pods/record/show/edit/quality/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/quality', 'Unit | Route | record/edit/quality', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/route-test.js b/tests/unit/pods/record/show/edit/route-test.js new file mode 100644 index 000000000..b53c55c56 --- /dev/null +++ b/tests/unit/pods/record/show/edit/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit', 'Unit | Route | record/edit', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/edit/spatial/route-test.js b/tests/unit/pods/record/show/edit/spatial/route-test.js new file mode 100644 index 000000000..5dcb2d74e --- /dev/null +++ b/tests/unit/pods/record/show/edit/spatial/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show/edit/spatial', 'Unit | Route | record/edit/spatial', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/record/show/route-test.js b/tests/unit/pods/record/show/route-test.js new file mode 100644 index 000000000..3e8475456 --- /dev/null +++ b/tests/unit/pods/record/show/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:record/show', 'Unit | Route | record/show', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/records/route-test.js b/tests/unit/pods/records/route-test.js new file mode 100644 index 000000000..3afdb17b4 --- /dev/null +++ b/tests/unit/pods/records/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:records', 'Unit | Route | records', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/settings/route-test.js b/tests/unit/pods/settings/route-test.js new file mode 100644 index 000000000..7b80c5a00 --- /dev/null +++ b/tests/unit/pods/settings/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:settings', 'Unit | Route | settings', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/pods/translate/route-test.js b/tests/unit/pods/translate/route-test.js new file mode 100644 index 000000000..647652bc9 --- /dev/null +++ b/tests/unit/pods/translate/route-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:translate', 'Unit | Route | translate', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/routes/application-test.js b/tests/unit/routes/application-test.js new file mode 100644 index 000000000..7caba15b4 --- /dev/null +++ b/tests/unit/routes/application-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:application', 'Unit | Route | application', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/routes/index-test.js b/tests/unit/routes/index-test.js new file mode 100644 index 000000000..18c8f139b --- /dev/null +++ b/tests/unit/routes/index-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:index', 'Unit | Route | index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/services/icon-test.js b/tests/unit/services/icon-test.js new file mode 100644 index 000000000..f4b510b4a --- /dev/null +++ b/tests/unit/services/icon-test.js @@ -0,0 +1,12 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('service:icon', 'Unit | Service | icon', { + // Specify the other units that are required for this test. + // needs: ['service:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + var service = this.subject(); + assert.ok(service); +}); diff --git a/tests/unit/services/profile-test.js b/tests/unit/services/profile-test.js new file mode 100644 index 000000000..f24843310 --- /dev/null +++ b/tests/unit/services/profile-test.js @@ -0,0 +1,12 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('service:profile', 'Unit | Service | profile', { + // Specify the other units that are required for this test. + // needs: ['service:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + var service = this.subject(); + assert.ok(service); +});