Blame view

controllets/cocreation-paper-card-controllet/cocreation-paper-card-controllet.html 8.93 KB
97f5fe0e   Andrea Petta   cocreation paper ...
1
2
  <link rel="import" href="../../bower_components/polymer/polymer.html"/>
  <link rel="import" href="../../bower_components/paper-card/paper-card.html"/>
bbfe6cb7   Luigi Serra   updates
3
  <link rel="import" href="../../bower_components/paper-fab/paper-fab.html">
97f5fe0e   Andrea Petta   cocreation paper ...
4
5
6
  <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"/>
  <link rel="import" href="../../bower_components/paper-button/paper-button.html"/>
  <link rel="import" href="../../bower_components/iron-icon/iron-icon.html"/>
4710a0b6   Renato De Donato   cocreation card
7
  <link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html">
97f5fe0e   Andrea Petta   cocreation paper ...
8
  
4710a0b6   Renato De Donato   cocreation card
9
  <script src="../../locales/cocreation_paper_card_ln.js"></script>
97f5fe0e   Andrea Petta   cocreation paper ...
10
11
12
13
14
15
  
  <dom-module id="cocreation-paper-card-controllet">
  
      <template>
          <style>
  
4710a0b6   Renato De Donato   cocreation card
16
17
18
19
20
21
              #card_container {
                  height: 200px;
                  width: 300px;
                  margin-top: 32px;
                  margin-left: 32px;
                  margin-right: -3.7px;
97f5fe0e   Andrea Petta   cocreation paper ...
22
23
              }
  
4710a0b6   Renato De Donato   cocreation card
24
25
26
27
              #card_container * {
                  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
                  font-size: 16px;
                  line-height: 24px;
97f5fe0e   Andrea Petta   cocreation paper ...
28
29
              }
  
4710a0b6   Renato De Donato   cocreation card
30
31
32
33
34
              .card-content {
                  padding: 12px;
                  height: 103px;
                  /*overflow: hidden;*/
                  background: #E0E0E0;
97f5fe0e   Andrea Petta   cocreation paper ...
35
36
              }
  
4710a0b6   Renato De Donato   cocreation card
37
38
39
              .card-actions {
                  padding: 12px;
                  height: 48px;
2f14a3f9   Renato De Donato   jsdatachecker+cor...
40
41
                  /*border-color: #2196F3;*/
                  /*border-color: #4CAF50;*/
97f5fe0e   Andrea Petta   cocreation paper ...
42
43
              }
  
4710a0b6   Renato De Donato   cocreation card
44
45
46
47
48
49
50
51
52
              paper-button {
                  height: 48px;
                  width: 136px;/*+2*/
                  padding: 12px;
                  margin: 0;
                  font-weight: 700;
  
                  background: #FFFFFF;
                  color: #000000;
2f14a3f9   Renato De Donato   jsdatachecker+cor...
53
                  --paper-button-ink-color: #00BCD4;
97f5fe0e   Andrea Petta   cocreation paper ...
54
55
              }
  
4710a0b6   Renato De Donato   cocreation card
56
57
58
              paper-button.info {
                  cursor: help;
                  float: right;
97f5fe0e   Andrea Petta   cocreation paper ...
59
60
              }
  
4710a0b6   Renato De Donato   cocreation card
61
62
63
              paper-button.info:hover {
                  color: #000000;
              }
97f5fe0e   Andrea Petta   cocreation paper ...
64
  
4710a0b6   Renato De Donato   cocreation card
65
              paper-button:hover {
2f14a3f9   Renato De Donato   jsdatachecker+cor...
66
                  color: #00BCD4;
97f5fe0e   Andrea Petta   cocreation paper ...
67
68
              }
  
4710a0b6   Renato De Donato   cocreation card
69
70
71
72
73
74
75
76
              paper-icon-button[icon="info-outline"] {
                  cursor: help;
                  float: right;
  
                  height: 48px;
                  width: 48px;
                  padding: 8px;
                  color: #000000;
97f5fe0e   Andrea Petta   cocreation paper ...
77
78
              }
  
4710a0b6   Renato De Donato   cocreation card
79
80
81
              paper-tooltip {
                  min-width: 400px;
                  --paper-tooltip-background: black;
bbfe6cb7   Luigi Serra   updates
82
83
              }
  
4710a0b6   Renato De Donato   cocreation card
84
              paper-fab {
f689abd6   Luigi Serra   updates
85
                  position: absolute;
4710a0b6   Renato De Donato   cocreation card
86
                  z-index: 10;
4710a0b6   Renato De Donato   cocreation card
87
88
89
90
91
              }
  
              paper-fab.delete {
                  top: -12px;
                  right: -12px;
f689abd6   Luigi Serra   updates
92
93
94
95
                  --iron-icon-height: 18px;
                  --iron-icon-width: 18px;
                  width: 24px;
                  height: 24px;
4710a0b6   Renato De Donato   cocreation card
96
                  --paper-fab-background:#B6B6B6;
f689abd6   Luigi Serra   updates
97
98
              }
  
4710a0b6   Renato De Donato   cocreation card
99
100
101
102
103
104
105
106
107
108
109
110
111
              #card_container br {
                  display: block;
                  margin-top: 8px;
                  content: " ";
              }
  
              #card_container p {
                  margin: 0;
                  padding: 0;
              }
  
              #card_container p .title{
                  font-weight: 700;
2f14a3f9   Renato De Donato   jsdatachecker+cor...
112
113
                  /*color: #2196F3;*/
                  /*color: #4CAF50;*/
4710a0b6   Renato De Donato   cocreation card
114
115
116
117
118
119
120
121
122
                  white-space: nowrap;
              }
  
              #card_container p .description{
              }
  
              #card_container .name{
                  font-size: 18px;
                  font-weight: 700;
2f14a3f9   Renato De Donato   jsdatachecker+cor...
123
124
                  /*color: #2196F3;*/
                  /*color: #4CAF50;*/
4710a0b6   Renato De Donato   cocreation card
125
126
127
128
129
130
                  height: 32px;
  
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
              }
97f5fe0e   Andrea Petta   cocreation paper ...
131
  
4710a0b6   Renato De Donato   cocreation card
132
133
134
              #card_container .owner{
                  font-size: 14px;
                  height: 47px;
97f5fe0e   Andrea Petta   cocreation paper ...
135
  
4710a0b6   Renato De Donato   cocreation card
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
              }
  
              #card_container .time{
                  display: flex;
                  flex-direction: row;
                  height: 24px;
              }
  
              #card_container .from {
                  width: 50%;
                  font-size: 12px;
              }
  
              #card_container .to {
                  width: 50%;
                  font-size: 12px;
              }
  
2f14a3f9   Renato De Donato   jsdatachecker+cor...
157
158
              paper-fab.assessment,
              paper-fab.description {
4710a0b6   Renato De Donato   cocreation card
159
160
161
162
163
                  bottom: -20px;
                  right: 12px;
                  cursor: auto;
              }
  
2f14a3f9   Renato De Donato   jsdatachecker+cor...
164
165
166
167
168
169
170
171
              paper-fab.description {
                  background: #2196F3;
              }
  
              paper-fab.assessment {
                  background: #4CAF50;
              }
  
4710a0b6   Renato De Donato   cocreation card
172
173
174
          </style>
  
          <paper-card id="card_container">
97f5fe0e   Andrea Petta   cocreation paper ...
175
                  <div class="card-content">
4710a0b6   Renato De Donato   cocreation card
176
177
178
                      <template is="dom-if" if="{{isOwner}}">
                          <paper-fab id="card_delete" class="delete" mini icon="delete" on-click="_handleDeleteClick"></paper-fab>
                      </template>
2f14a3f9   Renato De Donato   jsdatachecker+cor...
179
                      <div class="name" style$="color: {{color}};">{{name}}</div>
4710a0b6   Renato De Donato   cocreation card
180
181
182
183
184
185
186
187
                      <div class="owner">{{owner}}</div>
                      <div class="time">
                          <div class="from">
                              <iron-icon class="icon-from" icon="alarm"></iron-icon>&nbsp; {{from}}
                          </div>
                          <div class="to">
                              <iron-icon class="icon-to" icon="alarm-off"></iron-icon>&nbsp; {{to}}
                          </div>
97f5fe0e   Andrea Petta   cocreation paper ...
188
                      </div>
4710a0b6   Renato De Donato   cocreation card
189
                      <template is="dom-if" if="{{!checkRoomType(roomType)}}">
2f14a3f9   Renato De Donato   jsdatachecker+cor...
190
                          <paper-fab mini icon="assessment" class="assessment" noink></paper-fab>
4710a0b6   Renato De Donato   cocreation card
191
192
                      </template>
                      <template is="dom-if" if="{{checkRoomType(roomType)}}">
2f14a3f9   Renato De Donato   jsdatachecker+cor...
193
                          <paper-fab mini icon="description" class="description" noink></paper-fab>
4710a0b6   Renato De Donato   cocreation card
194
                      </template>
97f5fe0e   Andrea Petta   cocreation paper ...
195
                  </div>
2f14a3f9   Renato De Donato   jsdatachecker+cor...
196
                  <div class="card-actions" style$="border-color: {{color}};">
4710a0b6   Renato De Donato   cocreation card
197
                      <paper-button on-click="_onExplore"><span id="explore"></span></paper-button>
2f14a3f9   Renato De Donato   jsdatachecker+cor...
198
                      <paper-button id="goal_button" class="info" noink><span id="goal"></span></paper-button>
4710a0b6   Renato De Donato   cocreation card
199
200
201
202
                      <!--<paper-icon-button id="goal_button" icon="info-outline" noink></paper-icon-button>-->
  
                      <paper-tooltip for="goal_button" position="bottom" offset="-8">
                          <p>
2f14a3f9   Renato De Donato   jsdatachecker+cor...
203
                              <span class="title" style$="color: {{color}};" id="tooltip_goal"></span>
4710a0b6   Renato De Donato   cocreation card
204
205
206
207
                              <br>
                              <span class="description">{{goal}}</span>
                          </p>
                      </paper-tooltip>
97f5fe0e   Andrea Petta   cocreation paper ...
208
                  </div>
97f5fe0e   Andrea Petta   cocreation paper ...
209
210
211
212
213
214
215
216
217
218
219
220
221
          </paper-card>
  
      </template>
  
      <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  
      <script>
          Polymer({
              is: "cocreation-paper-card-controllet",
  
              properties: {
                  name:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
222
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
223
224
225
                  },
                  owner:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
226
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
227
228
229
                  },
                  from:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
230
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
231
232
233
                  },
                  to:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
234
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
235
236
237
                  },
                  goal:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
238
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
239
                  },
13c53ccd   Luigi Serra   cards updates
240
241
242
                  roomUrl: {
                      type: String,
                      value: undefined
bbfe6cb7   Luigi Serra   updates
243
244
245
246
                  },
                  roomType:{
                      type: String,
                      value: undefined
f689abd6   Luigi Serra   updates
247
248
249
250
251
252
253
254
                  },
                  isOwner: {
                      type: Boolean,
                      value: false
                  },
                  roomId:{
                      type: Number,
                      value: undefined
2f14a3f9   Renato De Donato   jsdatachecker+cor...
255
256
257
258
                  },
                  color:{
                      type: String,
                      value: ""
13c53ccd   Luigi Serra   cards updates
259
                  }
97f5fe0e   Andrea Petta   cocreation paper ...
260
261
              },
  
2f14a3f9   Renato De Donato   jsdatachecker+cor...
262
263
264
265
266
267
268
              ready: function() {
                  var color = "#4CAF50";
                  if(this.roomType == "knowledge")
                      color = "#2196F3";
                  this.color = color;
              },
  
97f5fe0e   Andrea Petta   cocreation paper ...
269
              attached: function(){
4710a0b6   Renato De Donato   cocreation card
270
                  cocreation_room_ln["ln"] = ODE.user_language;
97f5fe0e   Andrea Petta   cocreation paper ...
271
  
4710a0b6   Renato De Donato   cocreation card
272
273
274
                  this.$.goal.innerHTML = cocreation_room_ln["goal_" + cocreation_room_ln["ln"]];
                  this.$.tooltip_goal.innerHTML = cocreation_room_ln["goal_" + cocreation_room_ln["ln"]];
                  this.$.explore.innerHTML = cocreation_room_ln["explore_" + cocreation_room_ln["ln"]];
13c53ccd   Luigi Serra   cards updates
275
276
              },
  
f689abd6   Luigi Serra   updates
277
278
279
280
              _handleDeleteClick: function(e){
                  this.fire("cocreation-paper-card-controllet_delete", {roomId: this.roomId});
              },
  
13c53ccd   Luigi Serra   cards updates
281
282
              _onExplore: function(e){
                  window.location = this.roomUrl;
bbfe6cb7   Luigi Serra   updates
283
              },
97f5fe0e   Andrea Petta   cocreation paper ...
284
  
bbfe6cb7   Luigi Serra   updates
285
              checkRoomType: function(type){
f689abd6   Luigi Serra   updates
286
                 return (type == "knowledge") ? true : false;
bbfe6cb7   Luigi Serra   updates
287
              }
97f5fe0e   Andrea Petta   cocreation paper ...
288
289
290
291
          })
      </script>
  
  </dom-module>