diff --git a/.jshintrc b/.jshintrc index 08096ef..2f30d16 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,5 +1,6 @@ { "predef": [ + "server", "document", "window", "-Promise" diff --git a/app/mirage/config.js b/app/mirage/config.js new file mode 100644 index 0000000..9b41d41 --- /dev/null +++ b/app/mirage/config.js @@ -0,0 +1,82 @@ +export default function() { + + // These comments are here to help you get started. Feel free to delete them. + + /* + Config (with defaults). + + Note: these only affect routes defined *after* them! + */ + // this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server + // this.namespace = ''; // make this `api`, for example, if your API is namespaced + // this.timing = 400; // delay for each request, automatically set to 0 during testing + + /* + Route shorthand cheatsheet + */ + /* + GET shorthands + + // Collections + this.get('/contacts'); + this.get('/contacts', 'users'); + this.get('/contacts', ['contacts', 'addresses']); + + // Single objects + this.get('/contacts/:id'); + this.get('/contacts/:id', 'user'); + this.get('/contacts/:id', ['contact', 'addresses']); + */ + + /* + POST shorthands + + this.post('/contacts'); + this.post('/contacts', 'user'); // specify the type of resource to be created + */ + + /* + PUT shorthands + + this.put('/contacts/:id'); + this.put('/contacts/:id', 'user'); // specify the type of resource to be updated + */ + + /* + DELETE shorthands + + this.del('/contacts/:id'); + this.del('/contacts/:id', 'user'); // specify the type of resource to be deleted + + // Single object + related resources. Make sure parent resource is first. + this.del('/contacts/:id', ['contact', 'addresses']); + */ + + /* + Function fallback. Manipulate data in the db via + + - db.{collection} + - db.{collection}.find(id) + - db.{collection}.where(query) + - db.{collection}.update(target, attrs) + - db.{collection}.remove(target) + + // Example: return a single object with related models + this.get('/contacts/:id', function(db, request) { + var contactId = +request.params.id; + + return { + contact: db.contacts.find(contactId), + addresses: db.addresses.where({contact_id: contactId}); + }; + }); + + */ +} + +/* +You can optionally export a config that is only loaded during tests +export function testConfig() { + +} +*/ diff --git a/app/mirage/scenarios/default.js b/app/mirage/scenarios/default.js new file mode 100644 index 0000000..e07271c --- /dev/null +++ b/app/mirage/scenarios/default.js @@ -0,0 +1,7 @@ +export default function(/* server */) { + + // Seed your development database using your factories. This + // data will not be loaded in your tests. + + // server.createList('contact', 10); +} diff --git a/app/router.js b/app/router.js index cef554b..b43c911 100644 --- a/app/router.js +++ b/app/router.js @@ -6,6 +6,7 @@ var Router = Ember.Router.extend({ }); Router.map(function() { + this.route('lab-mashup', { path: '/' }, function() {}); }); export default Router; diff --git a/app/routes/lab-mashup.js b/app/routes/lab-mashup.js new file mode 100644 index 0000000..52a6bc4 --- /dev/null +++ b/app/routes/lab-mashup.js @@ -0,0 +1,20 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model() { + //return this.store.findAll('property'); + let properties = [ + { + name: "voltage", + value: 2.3 + }, + { + nane: "current", + value: 1.6 + } + ]; + + return properties; + } +}); + diff --git a/app/styles/app.css b/app/styles/app.css index e69de29..ed1af53 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -0,0 +1,112 @@ +html, body { + margin: 0; + padding: 0; +} + +body { + background: #ccc; + color: #4d4d4d; + + min-width: 300px; + max-width: 1500px; + margin: 0 auto; + + font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-weight: 300; + font-smoothing: antialiased; + -webkit-font-smoothing: antialiased; + -moz-font-smoothing: antialiased; +} + +.hidden { + display: none; +} + +#lapMashupApp { + background: #fff; + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), + 0 25px 50px 0 rgba(0, 0, 0, 0.1); + + margin: 150px 0 40px 0; + position: relative; +} + +#lapMashupApp h1 { + color: rgba(95, 95, 95, 0.7); + + position: absolute; + top: -175px; + width: 100%; + + font-size: 70px; + font-weight: 100; + text-align: center; + text-rendering: optimizeLegibility; + -webkit-text-rendering: optimizeLegiblity; + -moz-text-rendering: optimizeLegibitliy; +} + +#main { + border-top: 1px solid #e6e6e6; + + padding: 20px; + position: relative; + z-index: 2; +} + +#footer { + color: #777; + border-top: 1px solid #e6e6e6; + + padding: 10px 15px; + height: 20px; + + text-align: center; +} + +#info { + color: #777; + + margin: 65px auto 0; + + font-size: 12px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-align: center; +} + +#last-update-info { + margin: 30px auto auto 0; + + font-size: 12px; + text-align: center; +} + +#properties-table { + background: #eee; + + border: 1px solid #999; + border-collapse: collapse; + + width: 50%; + margin: 0 auto; +} + +#properties-table th { + background: #ddd; + + border: 1px solid #999; + border-collapse: collapse; + + padding: 5px; + + font-size: 16px; +} + +#properties-table td { + border: 1px solid #999; + border-collapse: collapse; + + padding: 5px; + + font-size: 14px; +} diff --git a/app/templates/application.hbs b/app/templates/application.hbs index f8bc38e..2544389 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -1,3 +1,11 @@ -

Welcome to Ember

+
+ + + {{outlet}} +
-{{outlet}} + diff --git a/app/templates/lab-mashup.hbs b/app/templates/lab-mashup.hbs new file mode 100644 index 0000000..d32b2b9 --- /dev/null +++ b/app/templates/lab-mashup.hbs @@ -0,0 +1,16 @@ +
+ + + + + + + + + + + + + +
NameValue
Voltage2.34 kV
Current7.6 A
+
diff --git a/bower.json b/bower.json index 3957c8c..671be51 100644 --- a/bower.json +++ b/bower.json @@ -1,16 +1,19 @@ { "name": "lab-mashup", "dependencies": { - "ember": "1.13.7", + "ember": "2.0", "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", - "ember-data": "1.13.8", + "ember-data": "2.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": "^1.11.3", "loader.js": "ember-cli/loader.js#3.2.1", - "qunit": "~1.18.0" + "qunit": "~1.18.0", + "pretender": "~0.9.0", + "lodash": "~3.7.0", + "Faker": "~3.0.0" } } diff --git a/package.json b/package.json index 564704c..1c65920 100644 --- a/package.json +++ b/package.json @@ -29,12 +29,14 @@ "ember-cli-htmlbars-inline-precompile": "^0.2.0", "ember-cli-ic-ajax": "0.2.1", "ember-cli-inject-live-reload": "^1.3.1", + "ember-cli-mirage": "0.1.8", "ember-cli-qunit": "^1.0.0", "ember-cli-release": "0.2.3", "ember-cli-sri": "^1.0.3", "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-export-application-global": "^1.0.3", + "mirage": "0.0.5" } } diff --git a/tests/.jshintrc b/tests/.jshintrc index 6ec0b7c..4f9f51d 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -1,5 +1,6 @@ { "predef": [ + "server", "document", "window", "location",