Blame view

controllets/room-controllet/room-controllet.html 4.89 KB
2c581ce4   Renato De Donato   room-controllet
1
2
  <link rel="import" href="../../bower_components/polymer/polymer.html" />
  
55ba476b   Renato De Donato   page-slider room
3
4
  <link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
  
cae62033   Renato De Donato   room tooltip
5
6
7
8
  <link rel="import" href="../../bower_components/iron-icons/editor-icons.html">
  <link rel="import" href="../../bower_components/iron-icons/communication-icons.html">
  <link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
  
2c581ce4   Renato De Donato   room-controllet
9
10
11
12
13
14
  <dom-module id="room-controllet">
  
      <template>
  
          <style is="custom-style">
  
cae62033   Renato De Donato   room tooltip
15
16
17
              iron-icon {
                  padding: 0px;
                  margin: 0px;
55ba476b   Renato De Donato   page-slider room
18
19
              }
  
cae62033   Renato De Donato   room tooltip
20
21
22
23
24
25
26
27
28
29
30
              iron-icon.this {
                  position: absolute;
                  top: -3px;
                  left: -3px;
  
                  -moz-transform: scaleX(-1);
                  -o-transform: scaleX(-1);
                  -webkit-transform: scaleX(-1);
                  transform: scaleX(-1);
                  filter: FlipH;
                  -ms-filter: "FlipH";
55ba476b   Renato De Donato   page-slider room
31
32
33
  
              }
  
cae62033   Renato De Donato   room tooltip
34
35
36
              paper-dialog {
                  margin: 0px;
              }
55ba476b   Renato De Donato   page-slider room
37
  
cae62033   Renato De Donato   room tooltip
38
39
40
41
42
43
44
              .room-tooltip {
                  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
                  position: absolute;
                  min-width: 250px;
                  top: 49px;
                  left: 98px;
                  padding: 16px;
55ba476b   Renato De Donato   page-slider room
45
46
              }
  
cae62033   Renato De Donato   room tooltip
47
48
49
50
51
52
              .div_icon{
                  display: inline-block;
                  height: 20px;
                  width: 20px;
                  margin:4px 6px 4px 2px;
              }
55ba476b   Renato De Donato   page-slider room
53
  
cae62033   Renato De Donato   room tooltip
54
55
56
57
              p {
                  padding-top: 8px;
                  margin: 0px;
                  white-space: nowrap;
2c581ce4   Renato De Donato   room-controllet
58
              }
55ba476b   Renato De Donato   page-slider room
59
  
cae62033   Renato De Donato   room tooltip
60
61
              .ptop{
                  padding-top: 0px;
980ade3e   Renato De Donato   room-controllet
62
63
              }
  
2c581ce4   Renato De Donato   room-controllet
64
65
          </style>
  
cae62033   Renato De Donato   room tooltip
66
67
          <div id={{roomId}} class$="grid-item {{roomHeight}} {{roomWidth}}" on-mouseover="_showTooltip" on-mouseout="_hideTooltip" style$="background-color: {{roomColor}};">
              <div class="room-body">{{body}}</div>
2c581ce4   Renato De Donato   room-controllet
68
69
              <div class="room-subject"><span>{{subject}}</span></div>
              <div class="room-timestamp">{{timestamp}}</div>
2c581ce4   Renato De Donato   room-controllet
70
  
cae62033   Renato De Donato   room tooltip
71
72
73
74
75
76
77
              <paper-dialog id="room_info" class="room-tooltip">
                  <iron-icon icon="communication:call-made" class="this" style="color: #2196F3;"></iron-icon>
                  <p class="ptop">This room <b style="color: #2196F3;">{{subject}}</b>,</p>
                  <p>created by <b style="color: #2196F3;">{{roomOwner}}</b> has:</p>
                  <p><iron-icon class="div_icon" style$="background-color: {{roomColor}};"></iron-icon><b style$="color: {{roomColor}};">{{_howMany(roomShape, 0)}} views</b> (<b style$="color: {{roomColor}};">{{roomViews}}</b>),</p>
                  <p><iron-icon icon="editor:border-left"></iron-icon> <b>{{_howMany(roomShape, 1)}} comments</b> (<b>{{comments}}</b>) and</p>
                  <p><iron-icon icon="editor:border-bottom"></iron-icon> <b>{{_howMany(roomShape, 2)}} datasets</b> (<b>{{datasets}}</b>).</p>
980ade3e   Renato De Donato   room-controllet
78
79
              </paper-dialog>
          </div>
55ba476b   Renato De Donato   page-slider room
80
  
2c581ce4   Renato De Donato   room-controllet
81
82
83
84
85
86
87
88
89
90
      </template>
  
      <script>
  
          Polymer({
  
              is : 'room-controllet',
  
              properties : {
  
55ba476b   Renato De Donato   page-slider room
91
92
93
94
95
96
                  roomId : {
                      type  : Number,
                      value : undefined
                  },
  
                  roomColor : {
2c581ce4   Renato De Donato   room-controllet
97
98
99
100
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
101
                  roomHeight : {
980ade3e   Renato De Donato   room-controllet
102
103
                      type  : String,
                      value : ""
55ba476b   Renato De Donato   page-slider room
104
105
106
                  },
  
                  roomWidth : {
980ade3e   Renato De Donato   room-controllet
107
108
                      type  : String,
                      value : ""
55ba476b   Renato De Donato   page-slider room
109
110
                  },
  
cae62033   Renato De Donato   room tooltip
111
112
113
114
115
116
117
118
119
120
                  roomOwner : {
                      type  : String,
                      value : ""
                  },
  
                  roomShape : {
                      type  : Array,
                      value : undefined
                  },
  
55ba476b   Renato De Donato   page-slider room
121
                  body : {
2c581ce4   Renato De Donato   room-controllet
122
123
124
125
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
126
                  subject  : {
2c581ce4   Renato De Donato   room-controllet
127
128
129
130
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
131
                  timestamp : {
2c581ce4   Renato De Donato   room-controllet
132
133
134
135
                      type  : String,
                      value : ""
                  },
  
cae62033   Renato De Donato   room tooltip
136
                  roomViews : {
2c581ce4   Renato De Donato   room-controllet
137
                      type  : Number,
55ba476b   Renato De Donato   page-slider room
138
                      value : undefined
2c581ce4   Renato De Donato   room-controllet
139
140
141
142
                  },
  
                  comments : {
                      type  : Number,
55ba476b   Renato De Donato   page-slider room
143
                      value : undefined
cae62033   Renato De Donato   room tooltip
144
145
146
147
148
                  },
  
                  datasets : {
                      type  : Number,
                      value : undefined
2c581ce4   Renato De Donato   room-controllet
149
150
151
152
153
                  }
  
              },
  
              attached : function() {
cae62033   Renato De Donato   room tooltip
154
                  console.log(this.views);
55ba476b   Renato De Donato   page-slider room
155
156
157
              },
  
              _showTooltip: function() {
cae62033   Renato De Donato   room tooltip
158
                  this.$.room_info.open();
980ade3e   Renato De Donato   room-controllet
159
160
161
              },
  
              _hideTooltip: function() {
cae62033   Renato De Donato   room tooltip
162
163
164
165
166
167
168
                  this.$.room_info.close();
              },
  
              _howMany: function(A, i) {
  //                return this.roomShape[i];
  //                console.log(i);
                  return A[i];
2c581ce4   Renato De Donato   room-controllet
169
170
171
172
173
174
175
              }
  
          });
  
      </script>
  
  </dom-module>