mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-26 01:36:18 -04:00

commit dd00d53895b824fbe4170c4a34b104303f722ccd
Merge: 2b3698e
cb9ea12
Author: Robin Linus <robin_woll@capira.de>
Date: Wed Feb 10 00:27:32 2016 -0600
Merge branch 'name-device' into merge123
# Conflicts:
# app/elements/buddy-finder/buddy-avatar.html
# app/elements/buddy-finder/buddy-finder.html
# app/elements/buddy-finder/personal-avatar.html
# app/index.html
commit cb9ea1235001f0cc23514cb622ce711cdc0538af
Author: Robin Linus <robin_woll@capira.de>
Date: Tue Feb 9 23:43:49 2016 -0600
#13 Feature Request: Name your device
commit 6fa43b56f4e705a19e68b62bc671a4948b6968fb
Author: Robin Linus <robin_woll@capira.de>
Date: Fri Jan 1 19:54:56 2016 +0100
Initial
commit fc55c86f5cf95039355d85be7409e68f27246696
Author: Robin Linus <robin_woll@capira.de>
Date: Fri Jan 1 18:06:27 2016 +0100
Fix fullscreen layout on iOS
95 lines
3.1 KiB
HTML
95 lines
3.1 KiB
HTML
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
|
|
<link rel="import" href="../../bower_components/iron-localstorage/iron-localstorage.html">
|
|
<link rel="import" href="device-name-dialog.html">
|
|
<dom-module id="device-name">
|
|
<template>
|
|
<style>
|
|
:host {
|
|
display: inline-block;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.name-label {
|
|
@apply(--paper-font-subhead);
|
|
text-align: center;
|
|
cursor: pointer;
|
|
width: 160px;
|
|
line-height: 18px !important;
|
|
}
|
|
|
|
:root {
|
|
/* Label and underline color when the input is not focused */
|
|
--paper-input-container-color: #333;
|
|
/* Label and underline color when the input is focused */
|
|
--paper-input-container-focus-color: #4285f4;
|
|
/* Label and underline color when the input is invalid */
|
|
--paper-input-container-invalid-color: red;
|
|
/* Input foreground color */
|
|
--paper-input-container-input-color: #333;
|
|
}
|
|
|
|
@media all and (max-height: 370px) {
|
|
:host {}
|
|
}
|
|
|
|
paper-dialog {
|
|
width: 300px;
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
<div class="name-label" hidden$="{{name}}">My Name</div>
|
|
<div class="name-label" hidden$="{{!name}}">{{name}}</div>
|
|
<iron-localstorage name="device-name" value="{{name}}" iron-localstorage-load="_nameChanged"></iron-localstorage>
|
|
</template>
|
|
<script>
|
|
'use strict';
|
|
Polymer({
|
|
is: 'device-name',
|
|
properties: {
|
|
name: {
|
|
observer: '_nameChanged'
|
|
}
|
|
},
|
|
open: function() {
|
|
this.deviceNameDialog.open();
|
|
},
|
|
_nameChanged: function(name) {
|
|
if (!name) {
|
|
return;
|
|
}
|
|
this.cancelAsync(this.timer);
|
|
this.timer = this.async(function() {
|
|
if (!app.conn.notifyServer) {
|
|
this._nameChanged(name);
|
|
return;
|
|
}
|
|
this._sendNameToServer(name);
|
|
|
|
}, 300);
|
|
|
|
},
|
|
_sendNameToServer: function(name) {
|
|
app.conn.notifyServer({
|
|
serverMsg: 'device-name',
|
|
name: name
|
|
});
|
|
},
|
|
_initialize: function() {
|
|
console.log('initialize name');
|
|
},
|
|
get deviceNameDialog() {
|
|
var deviceNameDialog = document.querySelector('device-name-dialog');
|
|
if (!deviceNameDialog) {
|
|
deviceNameDialog = Polymer.Base.create('device-name-dialog');
|
|
deviceNameDialog.addEventListener('save-device-name', function(e) {
|
|
this.name = e.detail;
|
|
console.log(this.name);
|
|
}.bind(this));
|
|
document.body.appendChild(deviceNameDialog);
|
|
};
|
|
deviceNameDialog.deviceName = this.name;
|
|
return deviceNameDialog;
|
|
}
|
|
});
|
|
</script>
|
|
</dom-module>
|