Skip to content

Commit

Permalink
Fix #221 (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Garcia authored Jun 17, 2016
1 parent c4ecced commit 5ce4995
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions demo/scroll-threshold.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
<!doctype html>
<html id="html">
<head>

<title>Load data using iron-scroll-threshold</title>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no">
<meta name="mobile-web-app-capable" content="yes">
Expand All @@ -24,12 +22,12 @@
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../iron-scroll-threshold/iron-scroll-threshold.html">
<link rel="import" href="../../iron-image/iron-image.html">
<link rel="import" href="../../paper-styles/color.html">
<link rel="import" href="../../paper-styles/typography.html">
<link rel="import" href="../../app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../paper-spinner/paper-spinner.html">
<link rel="import" href="../../iron-ajax/iron-ajax.html">
<link rel="import" href="../../iron-icons/iron-icons.html">
<link rel="import" href="../iron-list.html">

<style is="custom-style">
Expand Down Expand Up @@ -85,6 +83,14 @@
border: 1px solid #ddd;
}

.avatar {
height: 40px;
width: 40px;
border-radius: 20px;
box-sizing: border-box;
background-color: #DDD;
}

.pad {
padding: 0 16px;
@apply(--layout-flex);
Expand All @@ -96,12 +102,9 @@
font-weight: bold;
}

.secondary {
address {
font-size: 14px;
}

.dim {
color: gray;
margin: 10px 0;
}

.spacer {
Expand All @@ -120,9 +123,8 @@
<template is="dom-bind" id="app">

<iron-ajax id="ajax"
url="//www.filltext.com/"
params='{"rows": "20", "delay": 1, "fname":"{firstName}", "lname": "{lastName}", "address": "{streetAddress}",
"city": "{city}", "state": "{usState|abb}", "zip": "{zip}", "business": "{business}", "index": "{index}"}'
url="//randomuser.me/api/"
params='{"results": 20}'
handle-as="json"
loading="{{loadingPeople}}"
on-response="_didRespond">
Expand All @@ -136,13 +138,14 @@
<template>
<div>
<div class="personItem" tabindex$="[[tabIndex]]">
<iron-image class="avatar" sizing="contain" src="[[person.picture.medium]]"></iron-image>
<div class="pad">
<div class="primary">[[person.fname]] [[person.lname]]</div>
<div class="secondary">[[person.address]] [[person.city]]</div>
<div class="secondary">[[person.city]], [[person.state]] [[person.zip]]</div>
<div class="secondary dim">[[person.business]]</div>
<div class="primary">[[person.name.first]] [[person.name.last]]</div>
<address>
[[person.location.street]] [[person.city]] <br />
[[person.location.city]], [[person.location.state]] [[person.location.postcode]]
</address>
</div>
<iron-icon icon$="[[_iconForPerson(person)]]"></iron-icon>
</div>
</div>
</template>
Expand All @@ -165,16 +168,12 @@

(function(scope) {

scope._iconForPerson = function(person) {
return person.integer < 50 ? 'star-border' : 'star';
};

scope._loadMoreData = function() {
scope.$.ajax.generateRequest();
};

scope._didRespond = function(e) {
var people = e.detail.response;
var people = e.detail.response.results;

people.forEach(function(person) {
scope.$.list.push('items', person);
Expand Down

0 comments on commit 5ce4995

Please sign in to comment.