-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A better dummy app to demonstrate what this addon can do. Suitable fo…
…r deploying on github pages
- Loading branch information
Mike North
committed
May 22, 2015
1 parent
8c4dac8
commit 4d59180
Showing
12 changed files
with
118 additions
and
13 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
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
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Ember from 'ember'; | ||
import InfinityRoute from 'ember-infinity/mixins/route'; | ||
import Pretender from 'pretender'; | ||
import faker from 'faker'; | ||
|
||
|
||
function generateFakeData(qty) { | ||
var data = []; | ||
for (var i = 0; i < qty; i++) { | ||
data.push({id: i, name: faker.company.companyName()}); | ||
} | ||
return data; | ||
} | ||
|
||
|
||
export default Ember.Route.extend(InfinityRoute, { | ||
init: function () { | ||
this._super(...arguments); | ||
var fakeData = generateFakeData(104); | ||
this.set('pretender', new Pretender()); | ||
this.get('pretender').get('/posts', request => { | ||
var queryParams = request.queryParams; | ||
var fd = fakeData; | ||
var page = parseInt(request.queryParams.page, 10); | ||
var per = parseInt(request.queryParams.per_page, 10); | ||
var payload = { | ||
posts: fd.slice((page - 1) * per, Math.min((page) * per, fd.length)), | ||
meta: { | ||
total_pages: Math.ceil(fd.length/per) | ||
} | ||
}; | ||
return [200, {}, JSON.stringify(payload)]; | ||
|
||
}, 500 /*ms*/); | ||
}, | ||
|
||
tearDownPretender: Ember.observer('deactivate', function () { | ||
this.set('pretender', undefined); | ||
}), | ||
|
||
model() { | ||
return this.infinityModel('post'); | ||
} | ||
}); |
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,3 +1,46 @@ | ||
ul li { | ||
body { | ||
font-family: 'Arial'; | ||
padding: 0; | ||
margin: 0; | ||
width: 100%; | ||
} | ||
.demo-view { | ||
margin-top: 160px; | ||
} | ||
|
||
.test-list li { | ||
height: 500px; | ||
} | ||
|
||
.text-center { | ||
text-align: center; | ||
} | ||
|
||
.fixed-to-top { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
|
||
.jumbo-header { | ||
color: #fff; | ||
background: purple; | ||
font-size: 36px; | ||
width: 100%; | ||
height: 150px; | ||
box-shadow: 0 15px 15px rgba(0,0,0,0.5); | ||
} | ||
|
||
.demo-items { | ||
list-style: none; | ||
} | ||
.demo-items li { | ||
border: 1px solid #999; | ||
margin: 10px; | ||
background: #fff; | ||
box-shadow: 0 0 3px rgba(0,0,0,0.5); | ||
padding: 10px; | ||
width: 90%; | ||
} |
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,3 +1 @@ | ||
<h2 id="title">Welcome to Ember.js</h2> | ||
|
||
{{outlet}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="demo-view"> | ||
|
||
<div class="fixed-to-top jumbo-header text-center"> | ||
<a href="https://github.com/hhff/ember-infinity"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a> | ||
<h2 id="title">ember-infinity</h2> | ||
</div> | ||
<ul class="demo-items"> | ||
{{#each content as |item|}} | ||
<li>{{item.id}}. {{item.name}}</li> | ||
{{/each}} | ||
{{infinity-loader | ||
infinityModel=content | ||
loadingText="Loading more awesome records..." | ||
loadedText="Loaded all the records!"}} | ||
</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
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