Blame view

controllets/room-controllet/room-controllet.html 3.15 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">
  
2c581ce4   Renato De Donato   room-controllet
5
6
7
8
9
10
  <dom-module id="room-controllet">
  
      <template>
  
          <style is="custom-style">
  
55ba476b   Renato De Donato   page-slider room
11
12
13
14
15
16
17
18
19
20
21
22
23
24
              .room {
                  cursor: pointer;
              }
  
              .room-body {
  
              }
  
              .room-subject {
  
              }
  
              .room-timestamp {
  
2c581ce4   Renato De Donato   room-controllet
25
              }
55ba476b   Renato De Donato   page-slider room
26
  
980ade3e   Renato De Donato   room-controllet
27
28
29
30
31
32
33
34
35
              .room-tooltip {
                  position: absolute;
                  border: 2px solid #2196F3;
                  background-color: #E0E0E0;
                  min-width: 248px;
                  top: 0px;
                  left: 0px;
              }
  
2c581ce4   Renato De Donato   room-controllet
36
37
          </style>
  
980ade3e   Renato De Donato   room-controllet
38
          <div id={{roomId}} class$="grid-item room {{roomHeight}} {{roomWidth}}" on-mouseover="_showTooltip" on-mouseout="_hideTooltip">
2c581ce4   Renato De Donato   room-controllet
39
40
41
              <div class="room-body"><span>{{body}}</span></div>
              <div class="room-subject"><span>{{subject}}</span></div>
              <div class="room-timestamp">{{timestamp}}</div>
2c581ce4   Renato De Donato   room-controllet
42
  
980ade3e   Renato De Donato   room-controllet
43
44
45
46
              <paper-dialog id="pippo" class="room-tooltip">
                  {{roomId}}
              </paper-dialog>
          </div>
55ba476b   Renato De Donato   page-slider room
47
  
2c581ce4   Renato De Donato   room-controllet
48
49
50
51
52
53
54
55
56
57
      </template>
  
      <script>
  
          Polymer({
  
              is : 'room-controllet',
  
              properties : {
  
55ba476b   Renato De Donato   page-slider room
58
59
60
61
62
63
                  roomId : {
                      type  : Number,
                      value : undefined
                  },
  
                  roomColor : {
2c581ce4   Renato De Donato   room-controllet
64
65
66
67
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
68
                  roomHeight : {
980ade3e   Renato De Donato   room-controllet
69
70
                      type  : String,
                      value : ""
55ba476b   Renato De Donato   page-slider room
71
72
73
                  },
  
                  roomWidth : {
980ade3e   Renato De Donato   room-controllet
74
75
                      type  : String,
                      value : ""
55ba476b   Renato De Donato   page-slider room
76
77
78
                  },
  
                  body : {
2c581ce4   Renato De Donato   room-controllet
79
80
81
82
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
83
                  subject  : {
2c581ce4   Renato De Donato   room-controllet
84
85
86
87
                      type  : String,
                      value : ""
                  },
  
55ba476b   Renato De Donato   page-slider room
88
                  timestamp : {
2c581ce4   Renato De Donato   room-controllet
89
90
91
92
93
94
                      type  : String,
                      value : ""
                  },
  
                  openData : {
                      type  : Number,
55ba476b   Renato De Donato   page-slider room
95
                      value : undefined
2c581ce4   Renato De Donato   room-controllet
96
97
98
99
                  },
  
                  comments : {
                      type  : Number,
55ba476b   Renato De Donato   page-slider room
100
                      value : undefined
2c581ce4   Renato De Donato   room-controllet
101
102
103
104
105
                  }
  
              },
  
              attached : function() {
55ba476b   Renato De Donato   page-slider room
106
                  var room = document.getElementById(this.roomId);
980ade3e   Renato De Donato   room-controllet
107
                  $(room).css('background', this.roomColor);
55ba476b   Renato De Donato   page-slider room
108
109
110
              },
  
              _showTooltip: function() {
980ade3e   Renato De Donato   room-controllet
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  
                  var room = document.getElementById(this.roomId);
                  var pos = room.getBoundingClientRect();
                  console.log(pos.top);
                  console.log(pos.left);
  //                $(this.$.pippo).css("top", 1000);
  //                $(this.$.pippo).css("left", 100);
  //                $("#pippo").css("top", pos.top - 4);
  //                $("#pippo").css("left", pos.left - 4);
                  this.$.pippo.open();
              },
  
              _hideTooltip: function() {
                  this.$.pippo.close();
                  console.log("eeeeeeeeeeeeeeeeee")
2c581ce4   Renato De Donato   room-controllet
126
127
128
129
130
131
132
              }
  
          });
  
      </script>
  
  </dom-module>