Last active
April 4, 2018 14:49
-
-
Save rossjha/080295dbb2d31f3b69ff46ad2a22ae70 to your computer and use it in GitHub Desktop.
Notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { Route: EmberRoute } = Ember; | |
export default EmberRoute.extend({ | |
// Defaults | |
// Single line CP | |
// Multiline CP | |
// Private | |
// Lifecycle hooks | |
afterModel() { | |
this.replaceWith('notifications'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { Helper: EmberHelper } = Ember; | |
export function sortable(params, namedArgs) { | |
let { attr } = namedArgs; | |
let sortBy = namedArgs.sortBy[0].split(':'); | |
if (attr === sortBy[0]) { | |
return sortBy[1]; | |
} | |
} | |
export default EmberHelper.helper(sortable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { Component: EmberComponent } = Ember; | |
export default EmberComponent.extend({ | |
// Defaults | |
// Single line CP | |
// Multiline CP | |
// Private | |
// Lifecycle hooks | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function() { | |
this.get('notifications'); | |
this.get('notifications/:id'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Factory, faker } from 'ember-cli-mirage'; | |
export default Factory.extend({ | |
approvedAt: faker.date.past(4), | |
approvedBy: 'samantha.carter@outplay.com', | |
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit', | |
content: { | |
title: 'Mystery Match', | |
body: 'Welcome! We hope you have a great time playing Mystery Match!' | |
}, | |
completedAt: faker.date.past(8), | |
completedBy: 'samantha.carter@outplay.com', | |
createdAt: faker.date.past(10), | |
createdBy: 'samantha.carter@outplay.com', | |
name: 'Welcome New Users', | |
tags: [{ | |
name: 'tag one' | |
}], | |
type: 'onboarding', | |
updatedAt: faker.date.past(9), | |
updatedBy: 'samantha.carter@outplay.com' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Model } from 'ember-cli-mirage'; | |
export default Model.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function(server) { | |
// added this line because global wasn't created otherwise. | |
let notification = server.createList('notification', 10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { JSONAPISerializer } from 'ember-cli-mirage'; | |
export default JSONAPISerializer.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from 'ember-data/model'; | |
import attr from 'ember-data/attr'; | |
const { computed, get } = Ember; | |
export const schema = { | |
// Attributes | |
approvedAt: attr('date'), | |
approvedBy: attr('string'), | |
description: attr('string'), | |
content: attr(), | |
completedAt: attr('date'), | |
completedBy: attr('string'), | |
createdAt: attr('date'), | |
createdBy: attr('string'), | |
name: attr('string'), | |
tags: attr(), | |
type: attr('string'), | |
updatedAt: attr('date'), | |
updatedBy: attr('string'), | |
// Associations | |
// Computed Properties | |
}; | |
export default Model.extend(schema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { Route: EmberRoute } = Ember; | |
export default EmberRoute.extend({ | |
// Defaults | |
// Single line CP | |
// Multiline CP | |
// Private | |
// Lifecycle hooks | |
model() { | |
return this.store.findAll('notification'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('notifications'); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Layout */ | |
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
html, body { | |
color: #444; | |
font-family: 'Roboto', sans-serif; | |
font-size: 100%; | |
} | |
.container{ | |
max-width: 960px; | |
margin: 0 auto; | |
} | |
/* Type */ | |
h1{ | |
margin-bottom: 30px; | |
padding-bottom: 15px; | |
border-bottom: 1px solid #eee; | |
} | |
/* Lists */ | |
main ul{ | |
margin-left: 17px; | |
} | |
/* Table */ | |
table{ | |
border-collapse: collapse; | |
} | |
th, td{ | |
padding: 10px; | |
text-align: left; | |
border: 1px solid #eee; | |
} | |
/* Actions */ | |
[data-ember-action] { | |
cursor: pointer; | |
} | |
/* Nav */ | |
nav{ | |
margin-bottom: 30px; | |
padding: 15px; | |
background: #efefef; | |
} | |
nav a{ | |
text-decoration: none; | |
color: #333; | |
} | |
nav a.active{ | |
color: #000; | |
font-weight: 500; | |
} | |
nav ul li{ | |
display: inline-block; | |
text-transform: uppercase; | |
} | |
nav ul li:not(:first-child) { | |
margin-left: 20px; | |
} | |
/* sortable-by */ | |
[data-sortable-by] { | |
cursor: pointer; | |
} | |
[data-sortable-order]::before { | |
color: #ccc; | |
font-weight: 300; | |
} | |
[data-sortable-order="asc"]::before { | |
content: '\02191\00a0'; | |
} | |
[data-sortable-order="desc"]::before { | |
content: '\02193\00a0'; | |
} | |
.sortable th { | |
text-transform: capitalize; | |
} | |
/* Notifications */ | |
.c-notification{ | |
padding: 15px; | |
border: 1px solid #ccc; | |
border-radius: 5px; | |
margin-bottom: 15px; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default function destroyApp(application) { | |
Ember.run(application, 'destroy'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | |
if (options.afterEach) { | |
options.afterEach.apply(this, arguments); | |
} | |
destroyApp(this.application); | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Resolver from '../../resolver'; | |
import config from '../../config/environment'; | |
const resolver = Resolver.create(); | |
resolver.namespace = { | |
modulePrefix: config.modulePrefix, | |
podModulePrefix: config.podModulePrefix | |
}; | |
export default resolver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import Application from '../../app'; | |
import config from '../../config/environment'; | |
export default function startApp(attrs) { | |
let application; | |
let attributes = Ember.merge({rootElement: "#test-root"}, config.APP); | |
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; | |
Ember.run(() => { | |
application = Application.create(attributes); | |
application.setupForTesting(); | |
application.injectTestHelpers(); | |
}); | |
return application; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resolver from './helpers/resolver'; | |
import { | |
setResolver | |
} from 'ember-qunit'; | |
setResolver(resolver); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.4", | |
"ENV": { | |
"ember-cli-mirage": { | |
"enabled": true | |
} | |
}, | |
"EmberENV": { | |
"FEATURES": { | |
"ds-finder-include": true | |
} | |
}, | |
"options": { | |
"use_pods": true | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2" | |
}, | |
"addons": { | |
"ember-cli-mirage": "0.2.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment