Getting started instructions
This commit is contained in:
parent
6869a07b13
commit
a2e45705c1
5 changed files with 54 additions and 3 deletions
23
app/controllers/index.js
Normal file
23
app/controllers/index.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import Controller from '@ember/controller';
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { A } from '@ember/array';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class IndexController extends Controller {
|
||||
@service store;
|
||||
@tracked items = A([]);
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.assignExistingItems();
|
||||
}
|
||||
|
||||
async assignExistingItems() {
|
||||
let items = await this.store.peekAll('meal');
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
get userHasMeals() {
|
||||
return this.items.length >= 1;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
{{content-for "head-footer"}}
|
||||
</head>
|
||||
<body>
|
||||
<body class="bg-gray-100">
|
||||
{{content-for "body"}}
|
||||
|
||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||
|
|
|
@ -1 +1,17 @@
|
|||
Browser Recipes on the Left :)
|
||||
{{#if this.userHasMeals}}
|
||||
<h1 class="text-5xl -mt-4 text-teal-500 font-hairline">
|
||||
Great, you have meals!
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-700 text-base">
|
||||
You can see more details of any meal by clicking on them. You may also reorder meals via drag and drop (or your keyboard).
|
||||
</p>
|
||||
{{else}}
|
||||
<h1 class="text-5xl -mt-4 text-teal-500 font-hairline">
|
||||
Welcome to Sortable Recipes!
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-700 text-base">
|
||||
Add some recipes to get started.
|
||||
</p>
|
||||
{{/if}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h1 class="text-5xl text-teal-500 font-hairline">
|
||||
<h1 class="text-5xl -mt-4 text-teal-500 font-hairline">
|
||||
{{@model.name}}
|
||||
</h1>
|
||||
|
||||
|
|
12
tests/unit/controllers/index-test.js
Normal file
12
tests/unit/controllers/index-test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Controller | index', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.owner.lookup('controller:index');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue