-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
23 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
const COMMUNITY_CATEGORIES = ['Condo', 'TownHouse', 'Apartment']; | ||
|
||
export default class IndexRoute extends Route { | ||
async model() { | ||
return { | ||
title: 'Grand Old Mansion', | ||
owner: 'Veruca Salt', | ||
city: 'San Francisco', | ||
location: { | ||
lat: 37.7749, | ||
lng: -122.4194, | ||
}, | ||
category: 'Estate', | ||
type: 'Standalone', | ||
bedrooms: 15, | ||
image: | ||
'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | ||
description: | ||
'This grand old mansion sits on over 100 acres of rolling hills and dense redwood forests.', | ||
}; | ||
let response = await fetch('/api/rentals.json'); | ||
let { data } = await response.json(); | ||
return data.map((model) => { | ||
let { attributes } = model; | ||
let type; | ||
if (COMMUNITY_CATEGORIES.includes(attributes.category)){ | ||
type = 'Community'; | ||
|
||
} else { | ||
type = 'Standalone'; | ||
} | ||
return { type, ...attributes} | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
<Jumbo> | ||
<h2>Welcome to Super Rentals!</h2> | ||
<p>We hope you find exactly what you're looking for in a place to stay.</p> | ||
<LinkTo @route="about" class="button"> | ||
About Us | ||
</LinkTo> | ||
</Jumbo> | ||
<h1>{{@model.title}}</h1> | ||
<div class="rentals"> | ||
<ul class="results"> | ||
<li><Rental @rental={{@model}}/></li> | ||
<li><Rental @rental={{@model}}/></li> | ||
<li><Rental @rental={{@model}}/></li> | ||
{{#each @model as |rental|}} | ||
<li><Rental @rental={{rental}} /></li> | ||
{{/each}} | ||
</ul> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{yield}} | ||
<article class="rental"> | ||
<div class="details"> | ||
<h3>{{@rental.title}}</h3> | ||
|
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
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