$ npm install
$ bower install
$ gulp serve
$ git checkout beginning
$ git checkout -b chat
<dom-module id="my-chat">
<script>
Polymer({
is: 'my-chat'
});
</script>
</dom-module>
<link rel="import" href="my-chat/my-chat.html">
<section data-route="home">
<paper-material elevation="1">
<my-chat></my-chat>
</paper-material>
</section>
<template is="paper-material" elevation="1">
<firebase-collection id="chat" data="{{messages}}" location="https://glaring-inferno-8663.firebaseio.com/chat">
</firebase-collection>
</template>
<template is="dom-repeat" items="{{messages}}">
<div>
<strong>{{item.user}}</strong>:
<span>{{item.message}}</span>
</div>
</template>
<div class="layout horizontal">
<paper-input id="message" label="Say something..." class="flex"></paper-input>
<paper-button raised on-tap="send">Send</paper-button>
</div>
<paper-dialog id="login" modal>
<paper-input id="nick" label="Input your nick..." class="flex"></paper-input>
<paper-button raised on-tap="login">Login</paper-button>
</paper-dialog>
send: function (e) {
this.$.chat.add({
user: this.$.nick.value,
message: this.$.message.value
});
this.$.message.value = "";
}
ready: function() {
this.$.login.toggle();
},
login: function() {
this.$.login.toggle();
}