Pods, pods, everywhere

This commit is contained in:
Matthew Dillon 2015-06-04 12:18:59 -08:00
parent 33f783bc42
commit e623d52f34
66 changed files with 53 additions and 113 deletions

View file

@ -0,0 +1,26 @@
import DS from 'ember-data';
import Ember from 'ember';
import config from '../../config/environment';
export default DS.RESTAdapter.extend({
namespace: 'api/' + config.genus,
host: config.apiURL,
coalesceFindRequests: true,
ajaxError: function(jqXHR) {
// http://stackoverflow.com/a/24027443
var error = this._super(jqXHR);
if (jqXHR && jqXHR.status === 422) {
var response = Ember.$.parseJSON(jqXHR.responseText),
errors = {};
if (response.errors !== undefined) {
var jsonErrors = response.errors;
Ember.EnumerableUtils.forEach(Ember.keys(jsonErrors), function(key) {
errors[Ember.String.camelize(key)] = jsonErrors[key];
});
}
return new DS.InvalidError(errors);
} else {
return error;
}
}
});

View file

@ -0,0 +1,17 @@
import Ember from 'ember';
import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';
/* global NProgress */
export default Ember.Route.extend(ApplicationRouteMixin, {
actions: {
loading: function() {
NProgress.start();
this.router.one('didTransition', function() {
return setTimeout((function() {
return NProgress.done();
}), 50);
});
return true;
}
}
});

View file

@ -0,0 +1,46 @@
<div class="flakes-navigation">
{{#link-to 'index' class='logo'}}
<img src="img/logo.png" width="120">
{{/link-to}}
{{#if session.isAuthenticated}}
<ul>
{{#link-to 'species' tagName='li' href=false}}
{{#link-to 'species'}}Species{{/link-to}}
{{/link-to}}
{{#link-to 'strains' tagName='li' href=false}}
{{#link-to 'strains'}}Strains{{/link-to}}
{{/link-to}}
{{#link-to 'characteristics' tagName='li' href=false}}
{{#link-to 'characteristics'}}Characteristics{{/link-to}}
{{/link-to}}
{{#link-to 'about' tagName='li' href=false}}
{{#link-to 'about'}}About{{/link-to}}
{{/link-to}}
</ul>
<p class="foot">
{{session.currentUser.name}}<br>
<a {{ action 'invalidateSession' }}>Logout</a>
</p>
{{else}}
<p class="foot">
{{#link-to 'login' Login}}Login{{/link-to}}
<br>
Sign Up
</p>
{{/if}}
</div>
<div class="flakes-content">
<div class="flakes-mobile-top-bar">
<a href="" class="logo-wrap">
<img src="img/logo.png" height="30px">
</a>
<a href="" class="navigation-expand-target">
<img src="img/navigation-expand-target.png" height="26px">
</a>
</div>
<div class="view-wrap">
{{outlet}}
</div>
</div>

View file

@ -0,0 +1,8 @@
import Ember from 'ember';
export default Ember.View.extend({
classNames: ['flakes-frame'],
didInsertElement: function() {
FlakesFrame.init();
}
});