forked from parth-r-patel/outpost-polymer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutpost-engage.html
70 lines (68 loc) · 3.07 KB
/
outpost-engage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/paper-input/paper-input.html">
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/paper-toast/paper-toast.html">
<polymer-element name="outpost-engage">
<template>
<paper-input label="Enter Passphrase" id="instanceId"></paper-input>
<paper-icon-button id="submit" on-tap="{{engage}}" icon="send"></paper-icon-button>
<paper-toast id="toast" text="{{msg}}" duration="1500"></paper-toast>
</template>
<script>
Polymer({
engage: function(event, detail, sender)
{
var alert = false;
switch(this.$.instanceId.value)
{
case "Red1":
this.msg = "Red Station 1 -- Scout";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
case "Red2":
this.msg = "Red Station 2 -- Scout";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
case "Red3":
this.msg = "Red Station 3 -- Scout";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
case "Blue1":
this.msg = "Blue Station 1 -- Scout";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
case "Blue2":
this.msg = "Blue Station 2 -- Scout";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
case "Blue3":
this.msg = "Blue Station 3 -- Scout";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
case "strat":
this.msg = "Strategy Summary -- Read Only";
window.sessionStorage.setItem("instanceId", this.$.instanceId.value);
break;
default:
this.msg = "Please enter a valid passphrase!";
alert = true;
window.sessionStorage.removeItem("instanceId");
break;
}
this.$.toast.show();
if(!alert && this.$.instanceId.value != "strat")
{
this.fire('engage', {user: "scout"});
}
else if(!alert && this.$.instanceId.value == "strat")
{
this.fire('engage', {user: "strat"});
}
},
ready: function()
{
window.sessionStorage.clear();
}
});
</script>
</polymer-element>