gradle module and build
This commit is contained in:
41
webapp/app/elements/elements.html
Normal file
41
webapp/app/elements/elements.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<!-- Iron elements -->
|
||||
<link rel="import" href="../bower_components/iron-flex-layout/classes/iron-flex-layout.html">
|
||||
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../bower_components/iron-pages/iron-pages.html">
|
||||
<link rel="import" href="../bower_components/iron-selector/iron-selector.html">
|
||||
<link rel="import" href="../bower_components/iron-localstorage/iron-localstorage.html">
|
||||
|
||||
<!-- Paper elements -->
|
||||
<link rel="import" href="../bower_components/paper-drawer-panel/paper-drawer-panel.html">
|
||||
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="../bower_components/paper-item/paper-item.html">
|
||||
<link rel="import" href="../bower_components/paper-material/paper-material.html">
|
||||
<link rel="import" href="../bower_components/paper-menu/paper-menu.html">
|
||||
<link rel="import" href="../bower_components/paper-scroll-header-panel/paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../bower_components/paper-styles/paper-styles-classes.html">
|
||||
<link rel="import" href="../bower_components/paper-toast/paper-toast.html">
|
||||
<link rel="import" href="../bower_components/paper-toolbar/paper-toolbar.html">
|
||||
|
||||
<!-- Uncomment next block to enable Service Worker Support (2/2) -->
|
||||
<!--
|
||||
<link rel="import" href="../bower_components/platinum-sw/platinum-sw-cache.html">
|
||||
<link rel="import" href="../bower_components/platinum-sw/platinum-sw-register.html">
|
||||
-->
|
||||
|
||||
<!-- Configure your routes here -->
|
||||
<link rel="import" href="routing.html">
|
||||
|
||||
<!-- Add your elements here -->
|
||||
<link rel="import" href="../styles/app-theme.html">
|
||||
<link rel="import" href="../styles/shared-styles.html">
|
||||
<link rel="import" href="message-list/message-list.html">
|
78
webapp/app/elements/message-list/message-list.html
Normal file
78
webapp/app/elements/message-list/message-list.html
Normal file
@ -0,0 +1,78 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
|
||||
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
|
||||
|
||||
<dom-module id="message-list">
|
||||
<template>
|
||||
<link rel="import" href="../../styles/app-theme.html">
|
||||
<style include="shared-styles"></style>
|
||||
<style>
|
||||
.received {
|
||||
float: right;
|
||||
font-size: 60%;
|
||||
}
|
||||
.paper-font-body2 {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<iron-ajax
|
||||
auto
|
||||
url="{{getUrl(server, address)}}"
|
||||
handle-as="json"
|
||||
last-response="{{broadcasts}}"
|
||||
debounce-duration="300"></iron-ajax>
|
||||
<template is="dom-repeat" items="{{broadcasts.messages}}">
|
||||
<paper-material elevation="1">
|
||||
<h1>{{item.subject}}<span class="received">{{toDate(item.received)}}</span></h1>
|
||||
|
||||
<p class="paper-font-body2">{{item.body}}</p>
|
||||
</paper-material>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
is: 'message-list',
|
||||
|
||||
properties: {
|
||||
address: {
|
||||
type: String,
|
||||
value: 'BM-2D9QKN4teYRvoq2fyzpiftPh9WP9qggtzh',
|
||||
notify: true
|
||||
},
|
||||
broadcasts: {
|
||||
type: Object,
|
||||
notify: true
|
||||
},
|
||||
server: {
|
||||
type: String,
|
||||
value: 'http://localhost:8080',
|
||||
notify: true
|
||||
}
|
||||
},
|
||||
|
||||
toDate: function(timestamp) {
|
||||
return new Date(timestamp * 1000).toLocaleString();
|
||||
},
|
||||
getUrl: function(server, address) {
|
||||
return server + '/read/' + address;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
</dom-module>
|
44
webapp/app/elements/my-greeting/my-greeting.html
Normal file
44
webapp/app/elements/my-greeting/my-greeting.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||
|
||||
<dom-module id="my-greeting">
|
||||
<template>
|
||||
<style include="shared-styles"></style>
|
||||
<style>
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<h2 class="page-title"><span>{{greeting}}</span></h2>
|
||||
<span class="paper-font-body2">Update text to change the greeting.</span>
|
||||
<!-- Listens for "input" event and sets greeting to <input>.value -->
|
||||
<input class="paper-font-body2" value="{{greeting::input}}">
|
||||
</template>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
is: 'my-greeting',
|
||||
|
||||
properties: {
|
||||
greeting: {
|
||||
type: String,
|
||||
value: 'Welcome!',
|
||||
notify: true
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
</dom-module>
|
52
webapp/app/elements/my-list/my-list.html
Normal file
52
webapp/app/elements/my-list/my-list.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||
|
||||
<dom-module id="my-list">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<ul>
|
||||
<template is="dom-repeat" items="{{items}}">
|
||||
<li><span class="paper-font-body1">{{item}}</span></li>
|
||||
</template>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
is: 'my-list',
|
||||
properties: {
|
||||
items: {
|
||||
type: Array,
|
||||
notify: true,
|
||||
}
|
||||
},
|
||||
ready: function() {
|
||||
this.items = [
|
||||
'Responsive Web App boilerplate',
|
||||
'Iron Elements and Paper Elements',
|
||||
'End-to-end Build Tooling (including Vulcanize)',
|
||||
'Unit testing with Web Component Tester',
|
||||
'Routing with Page.js',
|
||||
'Offline support with the Platinum Service Worker Elements'
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
</dom-module>
|
45
webapp/app/elements/routing.html
Normal file
45
webapp/app/elements/routing.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<script src="../bower_components/page/page.js"></script>
|
||||
<script>
|
||||
window.addEventListener('WebComponentsReady', function() {
|
||||
|
||||
// We use Page.js for routing. This is a Micro
|
||||
// client-side router inspired by the Express router
|
||||
// More info: https://visionmedia.github.io/page.js/
|
||||
|
||||
// Middleware
|
||||
function scrollToTop(ctx, next) {
|
||||
app.scrollPageToTop();
|
||||
next();
|
||||
}
|
||||
|
||||
// Routes
|
||||
page('/', scrollToTop, function() {
|
||||
app.route = 'home';
|
||||
});
|
||||
|
||||
page('/read', scrollToTop, function() {
|
||||
app.route = 'home';
|
||||
});
|
||||
|
||||
page('/read/:address', scrollToTop, function(data) {
|
||||
app.route = 'message-list';
|
||||
app.params = data.params;
|
||||
});
|
||||
|
||||
// add #! before urls
|
||||
page({
|
||||
hashbang: true
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user