diff --git a/src/more-infos/more-info-lock.html b/src/more-infos/more-info-lock.html
index be9162a425..4824ee3ff6 100644
--- a/src/more-infos/more-info-lock.html
+++ b/src/more-infos/more-info-lock.html
@@ -4,13 +4,16 @@
+
-
-
+
diff --git a/src/more-infos/more-info-lock.js b/src/more-infos/more-info-lock.js
index 7d23a1b5ce..c47e6025c2 100644
--- a/src/more-infos/more-info-lock.js
+++ b/src/more-infos/more-info-lock.js
@@ -15,57 +15,23 @@ export default new Polymer({
type: String,
value: '',
},
- unlockButtonVisible: {
- type: Boolean,
- value: false,
- },
- lockButtonVisible: {
- type: Boolean,
- value: false,
- },
- codeInputVisible: {
- type: Boolean,
- value: false,
- },
- codeInputEnabled: {
- type: Boolean,
- value: false,
- },
- codeFormat: {
- type: String,
- value: '',
- },
- codeValid: {
- type: Boolean,
- computed: 'validateCode(enteredCode, codeFormat)',
- },
},
+
handleUnlockTap() {
this.callService('unlock', { code: this.enteredCode });
},
+
handleLockTap() {
this.callService('lock', { code: this.enteredCode });
},
- validateCode(code, format) {
- const re = new RegExp(format);
- if (format === null) {
- return true;
- }
- return re.test(code);
- },
+
stateObjChanged(newVal) {
if (newVal) {
- this.codeFormat = newVal.attributes.code_format;
- this.codeInputVisible = this.codeFormat !== null;
- this.codeInputEnabled = (
- newVal.state === 'locked' ||
- newVal.state === 'unlocked');
- this.unlockButtonVisible = (
- newVal.state === 'locked');
- this.lockButtonVisible = newVal.state === 'unlocked';
+ this.isLocked = newVal.state === 'locked';
}
this.async(() => this.fire('iron-resize'), 500);
},
+
callService(service, data) {
const serviceData = data || {};
serviceData.entity_id = this.stateObj.entityId;