Blame view

controllets/room-controllet/room-controllet.html 4.9 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
              }
  
cae62033   Renato De Donato   room tooltip
33
34
35
              paper-dialog {
                  margin: 0px;
              }
55ba476b   Renato De Donato   page-slider room
36
  
cae62033   Renato De Donato   room tooltip
37
38
39
40
41
42
43
              .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
44
45
              }
  
cae62033   Renato De Donato   room tooltip
46
47
48
49
50
51
              .div_icon{
                  display: inline-block;
                  height: 20px;
                  width: 20px;
                  margin:4px 6px 4px 2px;
              }
55ba476b   Renato De Donato   page-slider room
52
  
cae62033   Renato De Donato   room tooltip
53
              p {
cae62033   Renato De Donato   room tooltip
54
                  margin: 0px;
b53fef03   Renato De Donato   treemap tooltip
55
                  padding: 8px 0px 0px 0px;
cae62033   Renato De Donato   room tooltip
56
                  white-space: nowrap;
2c581ce4   Renato De Donato   room-controllet
57
              }
55ba476b   Renato De Donato   page-slider room
58
  
cae62033   Renato De Donato   room tooltip
59
60
              .ptop{
                  padding-top: 0px;
980ade3e   Renato De Donato   room-controllet
61
62
              }
  
2c581ce4   Renato De Donato   room-controllet
63
64
          </style>
  
cae62033   Renato De Donato   room tooltip
65
66
          <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
67
68
              <div class="room-subject"><span>{{subject}}</span></div>
              <div class="room-timestamp">{{timestamp}}</div>
2c581ce4   Renato De Donato   room-controllet
69
  
cae62033   Renato De Donato   room tooltip
70
71
72
73
74
75
76
              <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
77
78
              </paper-dialog>
          </div>
55ba476b   Renato De Donato   page-slider room
79
  
2c581ce4   Renato De Donato   room-controllet
80
81
82
83
84
85
86
87
88
89
      </template>
  
      <script>
  
          Polymer({
  
              is : 'room-controllet',
  
              properties : {
  
55ba476b   Renato De Donato   page-slider room
90
91
92
93
94
95
                  roomId : {
                      type  : Number,
                      value : undefined
                  },
  
                  roomColor : {
2c581ce4   Renato De Donato   room-controllet
96
97
98
99
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
100
                  roomHeight : {
980ade3e   Renato De Donato   room-controllet
101
102
                      type  : String,
                      value : ""
55ba476b   Renato De Donato   page-slider room
103
104
105
                  },
  
                  roomWidth : {
980ade3e   Renato De Donato   room-controllet
106
107
                      type  : String,
                      value : ""
55ba476b   Renato De Donato   page-slider room
108
109
                  },
  
cae62033   Renato De Donato   room tooltip
110
111
112
113
114
115
116
117
118
119
                  roomOwner : {
                      type  : String,
                      value : ""
                  },
  
                  roomShape : {
                      type  : Array,
                      value : undefined
                  },
  
55ba476b   Renato De Donato   page-slider room
120
                  body : {
2c581ce4   Renato De Donato   room-controllet
121
122
123
124
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
125
                  subject  : {
2c581ce4   Renato De Donato   room-controllet
126
127
128
129
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
130
                  timestamp : {
2c581ce4   Renato De Donato   room-controllet
131
132
133
134
                      type  : String,
                      value : ""
                  },
  
cae62033   Renato De Donato   room tooltip
135
                  roomViews : {
2c581ce4   Renato De Donato   room-controllet
136
                      type  : Number,
55ba476b   Renato De Donato   page-slider room
137
                      value : undefined
2c581ce4   Renato De Donato   room-controllet
138
139
140
141
                  },
  
                  comments : {
                      type  : Number,
55ba476b   Renato De Donato   page-slider room
142
                      value : undefined
cae62033   Renato De Donato   room tooltip
143
144
145
146
147
                  },
  
                  datasets : {
                      type  : Number,
                      value : undefined
2c581ce4   Renato De Donato   room-controllet
148
149
150
151
152
                  }
  
              },
  
              attached : function() {
cae62033   Renato De Donato   room tooltip
153
                  console.log(this.views);
55ba476b   Renato De Donato   page-slider room
154
155
156
              },
  
              _showTooltip: function() {
cae62033   Renato De Donato   room tooltip
157
                  this.$.room_info.open();
980ade3e   Renato De Donato   room-controllet
158
159
160
              },
  
              _hideTooltip: function() {
cae62033   Renato De Donato   room tooltip
161
162
163
164
165
166
167
                  this.$.room_info.close();
              },
  
              _howMany: function(A, i) {
  //                return this.roomShape[i];
  //                console.log(i);
                  return A[i];
2c581ce4   Renato De Donato   room-controllet
168
169
170
171
172
173
174
              }
  
          });
  
      </script>
  
  </dom-module>