Housekeeping
This commit is contained in:
		
							parent
							
								
									d80ce9286b
								
							
						
					
					
						commit
						0d840b4586
					
				
					 15 changed files with 91 additions and 141 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,7 @@ import Ember from 'ember';
 | 
			
		|||
import config from '../config/environment';
 | 
			
		||||
 | 
			
		||||
var globals = Ember.Object.extend({
 | 
			
		||||
  genus: config.genus,
 | 
			
		||||
  genus: config.APP.genus,
 | 
			
		||||
  apiURL: config.apiURL,
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,18 +14,7 @@ export default DS.Model.extend({
 | 
			
		|||
  updatedAt          : DS.attr('date'),
 | 
			
		||||
  createdBy          : DS.attr('number'),
 | 
			
		||||
  updatedBy          : DS.attr('number'),
 | 
			
		||||
  // computedType: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() {
 | 
			
		||||
  //   if (this.get('textMeasurementType')) {
 | 
			
		||||
  //     return 'Fixed-text';
 | 
			
		||||
  //   }
 | 
			
		||||
  //   if (this.get('txtValue')) {
 | 
			
		||||
  //     return 'Free-text';
 | 
			
		||||
  //   }
 | 
			
		||||
  //   if (this.get('numValue')) {
 | 
			
		||||
  //     return 'Numerical';
 | 
			
		||||
  //   }
 | 
			
		||||
  //   return "error";
 | 
			
		||||
  // }),
 | 
			
		||||
 | 
			
		||||
  value: function() {
 | 
			
		||||
    if (this.get('textMeasurementType')) {
 | 
			
		||||
      return this.get('textMeasurementType');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ export default DS.Model.extend({
 | 
			
		|||
  speciesName : DS.attr('string'),
 | 
			
		||||
  typeSpecies : DS.attr('boolean'),
 | 
			
		||||
  etymology   : DS.attr('string'),
 | 
			
		||||
  genusName: DS.attr('string', { defaultValue: config.genus }),
 | 
			
		||||
  genusName   : DS.attr('string', { defaultValue: config.APP.genus }),
 | 
			
		||||
  strains     : DS.hasMany('strain', { async: true }),
 | 
			
		||||
  totalStrains: DS.attr('number'),
 | 
			
		||||
  createdAt   : DS.attr('date'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,13 +16,16 @@ export default DS.Model.extend({
 | 
			
		|||
  updatedBy        : DS.attr('number'),
 | 
			
		||||
  deletedBy        : DS.attr('number'),
 | 
			
		||||
  totalMeasurements: DS.attr('number'),
 | 
			
		||||
 | 
			
		||||
  strainNameMU: function() {
 | 
			
		||||
    let type = this.get('typeStrain') ? '<sup>T</sup>' : '';
 | 
			
		||||
    return `${this.get('strainName')}${type}`;
 | 
			
		||||
  }.property('strainName', 'typeStrain').readOnly(),
 | 
			
		||||
 | 
			
		||||
  fullName: function() {
 | 
			
		||||
    return `${this.get('species.speciesName')} (strain ${this.get('strainName')})`;
 | 
			
		||||
  }.property('species', 'strainName').readOnly(),
 | 
			
		||||
 | 
			
		||||
  fullNameMU: function() {
 | 
			
		||||
    return `<em>${this.get('species.speciesName')}</em> ${this.get('strainNameMU')}`;
 | 
			
		||||
  }.property('species', 'strainNameMU').readOnly(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,8 +6,5 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
 | 
			
		|||
    invalidateSession: function() {
 | 
			
		||||
      this.get('session').invalidate();
 | 
			
		||||
    },
 | 
			
		||||
    loading: function() {
 | 
			
		||||
      return true;
 | 
			
		||||
    },
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,23 +1,23 @@
 | 
			
		|||
  <div class="flakes-navigation">
 | 
			
		||||
    {{#link-to 'index' class='logo'}}
 | 
			
		||||
      {{site-name}}
 | 
			
		||||
      {{globals.genus}}.info
 | 
			
		||||
    {{/link-to}}
 | 
			
		||||
    {{#if session.isAuthenticated}}
 | 
			
		||||
      <ul>
 | 
			
		||||
        {{#link-to 'species' tagName='li' href=false}}
 | 
			
		||||
          {{#link-to 'species'}}Species{{/link-to}}
 | 
			
		||||
          {{link-to 'Species' 'species'}}
 | 
			
		||||
        {{/link-to}}
 | 
			
		||||
        {{#link-to 'strains' tagName='li' href=false}}
 | 
			
		||||
          {{#link-to 'strains'}}Strains{{/link-to}}
 | 
			
		||||
          {{link-to 'Strains' 'strains'}}
 | 
			
		||||
        {{/link-to}}
 | 
			
		||||
        {{#link-to 'characteristics' tagName='li' href=false}}
 | 
			
		||||
          {{#link-to 'characteristics'}}Characteristics{{/link-to}}
 | 
			
		||||
          {{link-to 'Characteristics' 'characteristics'}}
 | 
			
		||||
        {{/link-to}}
 | 
			
		||||
        {{#link-to 'measurements' tagName='li' href=false}}
 | 
			
		||||
          {{#link-to 'measurements'}}Measurements{{/link-to}}
 | 
			
		||||
          {{link-to 'Measurements' 'measurements'}}
 | 
			
		||||
        {{/link-to}}
 | 
			
		||||
        {{#link-to 'about' tagName='li' href=false}}
 | 
			
		||||
          {{#link-to 'about'}}About{{/link-to}}
 | 
			
		||||
          {{link-to 'About' 'about'}}
 | 
			
		||||
        {{/link-to}}
 | 
			
		||||
      </ul>
 | 
			
		||||
      <p class="foot">
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@
 | 
			
		|||
  <div class="flakes-content">
 | 
			
		||||
    <div class="flakes-mobile-top-bar">
 | 
			
		||||
      <a href="" class="logo-wrap">
 | 
			
		||||
        {{site-name}}
 | 
			
		||||
        {{globals.genus}}.info
 | 
			
		||||
      </a>
 | 
			
		||||
      <a href="" class="navigation-expand-target">
 | 
			
		||||
        <img src="img/navigation-expand-target.png" height="26px">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
{{globals.genus}}.info
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
              content=characteristics
 | 
			
		||||
              value=selectedCharacteristics
 | 
			
		||||
              optionValuePath="id"
 | 
			
		||||
              placeholder="Choose a characteristic"
 | 
			
		||||
              placeholder="All characteristics"
 | 
			
		||||
            }}
 | 
			
		||||
          </li>
 | 
			
		||||
          <li>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
 | 
			
		||||
 | 
			
		||||
export default Ember.Route.extend({
 | 
			
		||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
 | 
			
		||||
  model: function() {
 | 
			
		||||
    return this.store.createRecord('species');
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
 | 
			
		||||
 | 
			
		||||
export default Ember.Route.extend({
 | 
			
		||||
});
 | 
			
		||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
 | 
			
		||||
 | 
			
		||||
export default Ember.Route.extend({
 | 
			
		||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
 | 
			
		||||
  model: function() {
 | 
			
		||||
    return Ember.RSVP.hash({
 | 
			
		||||
      strain: this.store.createRecord('strain'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
 | 
			
		||||
 | 
			
		||||
export default Ember.Route.extend({
 | 
			
		||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
 | 
			
		||||
  model: function(params) {
 | 
			
		||||
    return Ember.RSVP.hash({
 | 
			
		||||
      strain: this.store.find('strain', params.strain_id),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,68 +8,46 @@ module.exports = function(environment) {
 | 
			
		|||
    locationType: 'auto',
 | 
			
		||||
    EmberENV: {
 | 
			
		||||
      FEATURES: {
 | 
			
		||||
        // Here you can enable experimental features on an ember canary build
 | 
			
		||||
        // e.g. 'with-controller': true
 | 
			
		||||
        // enable experimental features on an ember canary build
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    APP: {
 | 
			
		||||
      // Here you can pass flags/options to your application instance
 | 
			
		||||
      // when it is created
 | 
			
		||||
    },
 | 
			
		||||
      genus: 'hymenobacter',
 | 
			
		||||
    },
 | 
			
		||||
    podModulePrefix: 'hymenobacterdotinfo/pods',
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (environment === 'development') {
 | 
			
		||||
    ENV['simple-auth'] = {
 | 
			
		||||
    'simple-auth': {
 | 
			
		||||
      session: 'session:custom',
 | 
			
		||||
      authorizer: 'simple-auth-authorizer:token',
 | 
			
		||||
      crossOriginWhitelist: ['http://127.0.0.1:4200']
 | 
			
		||||
    }
 | 
			
		||||
    ENV['simple-auth-token'] = {
 | 
			
		||||
      serverTokenEndpoint: '/api/authenticate',
 | 
			
		||||
    },
 | 
			
		||||
    'simple-auth-token': {
 | 
			
		||||
      identificationField: 'email',
 | 
			
		||||
      passwordField: 'password',
 | 
			
		||||
      tokenPropertyName: 'token',
 | 
			
		||||
      authorizationPrefix: 'Bearer ',
 | 
			
		||||
      authorizationHeaderName: 'Authorization',
 | 
			
		||||
    }
 | 
			
		||||
    ENV.apiURL = 'http://127.0.0.1:4200';
 | 
			
		||||
    ENV.contentSecurityPolicy = {
 | 
			
		||||
    },
 | 
			
		||||
    contentSecurityPolicy: {
 | 
			
		||||
      'default-src': "'none'",
 | 
			
		||||
      'script-src': "'self'",
 | 
			
		||||
      'font-src': "'self'",
 | 
			
		||||
      'connect-src': "'self' http://127.0.0.1:4200",
 | 
			
		||||
      'img-src': "'self'",
 | 
			
		||||
      'style-src': "'self' 'unsafe-inline'",
 | 
			
		||||
      'media-src': "'self'"
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (environment === 'development') {
 | 
			
		||||
    ENV['simple-auth']['crossOriginWhitelist'] = ['http://127.0.0.1:4200'];
 | 
			
		||||
    ENV['simple-auth-token']['serverTokenEndpoint'] = '/api/authenticate';
 | 
			
		||||
    ENV.apiURL = 'http://127.0.0.1:4200';
 | 
			
		||||
    ENV.contentSecurityPolicy['connect-src'] = "'self' http://127.0.0.1:4200";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (environment === 'test') {
 | 
			
		||||
    ENV['simple-auth'] = {
 | 
			
		||||
      session: 'session:custom',
 | 
			
		||||
      authorizer: 'simple-auth-authorizer:token',
 | 
			
		||||
      crossOriginWhitelist: ['https://bactdb-test.herokuapp.com']
 | 
			
		||||
    }
 | 
			
		||||
    ENV['simple-auth-token'] = {
 | 
			
		||||
      serverTokenEndpoint: 'https://bactdb-test.herokuapp.com/api/authenticate',
 | 
			
		||||
      identificationField: 'email',
 | 
			
		||||
      passwordField: 'password',
 | 
			
		||||
      tokenPropertyName: 'token',
 | 
			
		||||
      authorizationPrefix: 'Bearer ',
 | 
			
		||||
      authorizationHeaderName: 'Authorization',
 | 
			
		||||
    }
 | 
			
		||||
    ENV['simple-auth']['crossOriginWhitelist'] = ['https://bactdb-test.herokuapp.com'];
 | 
			
		||||
    ENV['simple-auth-token']['serverTokenEndpoint'] = 'https://bactdb-test.herokuapp.com/api/authenticate';
 | 
			
		||||
    ENV.apiURL = 'https://bactdb-test.herokuapp.com';
 | 
			
		||||
    ENV.contentSecurityPolicy = {
 | 
			
		||||
      'default-src': "'none'",
 | 
			
		||||
      'script-src': "'self'",
 | 
			
		||||
      'font-src': "'self'",
 | 
			
		||||
      'connect-src': "'self' https://bactdb-test.herokuapp.com",
 | 
			
		||||
      'img-src': "'self'",
 | 
			
		||||
      'style-src': "'self'",
 | 
			
		||||
      'media-src': "'self'"
 | 
			
		||||
    }
 | 
			
		||||
    ENV.contentSecurityPolicy['connect-src'] = "'self' https://bactdb-test.herokuapp.com";
 | 
			
		||||
 | 
			
		||||
    // keep test console output quieter
 | 
			
		||||
    ENV.APP.LOG_ACTIVE_GENERATION = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -77,29 +55,10 @@ module.exports = function(environment) {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  if (environment === 'production') {
 | 
			
		||||
    ENV['simple-auth'] = {
 | 
			
		||||
      session: 'session:custom',
 | 
			
		||||
      authorizer: 'simple-auth-authorizer:token',
 | 
			
		||||
      crossOriginWhitelist: ['https://bactdb.herokuapp.com']
 | 
			
		||||
    }
 | 
			
		||||
    ENV['simple-auth-token'] = {
 | 
			
		||||
      serverTokenEndpoint: 'https://bactdb.herokuapp.com/api/authenticate',
 | 
			
		||||
      identificationField: 'email',
 | 
			
		||||
      passwordField: 'password',
 | 
			
		||||
      tokenPropertyName: 'token',
 | 
			
		||||
      authorizationPrefix: 'Bearer ',
 | 
			
		||||
      authorizationHeaderName: 'Authorization',
 | 
			
		||||
    }
 | 
			
		||||
    ENV['simple-auth']['crossOriginWhitelist'] = ['https://bactdb.herokuapp.com'];
 | 
			
		||||
    ENV['simple-auth-token']['serverTokenEndpoint'] = 'https://bactdb.herokuapp.com/api/authenticate';
 | 
			
		||||
    ENV.apiURL = 'https://bactdb.herokuapp.com';
 | 
			
		||||
    ENV.contentSecurityPolicy = {
 | 
			
		||||
      'default-src': "'none'",
 | 
			
		||||
      'script-src': "'self'",
 | 
			
		||||
      'font-src': "'self'",
 | 
			
		||||
      'connect-src': "'self' https://bactdb.herokuapp.com",
 | 
			
		||||
      'img-src': "'self'",
 | 
			
		||||
      'style-src': "'self'",
 | 
			
		||||
      'media-src': "'self'"
 | 
			
		||||
    }
 | 
			
		||||
    ENV.contentSecurityPolicy['connect-src'] = "'self' https://bactdb.herokuapp.com";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return ENV;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue