Blame view

controllets/cocreation-paper-card-controllet/cocreation-paper-card-controllet.html 8.96 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;
7c272bb3   Andrea Petta   plugin update
97
                  padding: 0px;
f689abd6   Luigi Serra   updates
98
99
              }
  
4710a0b6   Renato De Donato   cocreation card
100
101
102
103
104
105
106
107
108
109
110
111
112
              #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...
113
114
                  /*color: #2196F3;*/
                  /*color: #4CAF50;*/
4710a0b6   Renato De Donato   cocreation card
115
116
117
118
119
120
121
122
123
                  white-space: nowrap;
              }
  
              #card_container p .description{
              }
  
              #card_container .name{
                  font-size: 18px;
                  font-weight: 700;
2f14a3f9   Renato De Donato   jsdatachecker+cor...
124
125
                  /*color: #2196F3;*/
                  /*color: #4CAF50;*/
4710a0b6   Renato De Donato   cocreation card
126
127
128
129
130
131
                  height: 32px;
  
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
              }
97f5fe0e   Andrea Petta   cocreation paper ...
132
  
4710a0b6   Renato De Donato   cocreation card
133
134
135
              #card_container .owner{
                  font-size: 14px;
                  height: 47px;
97f5fe0e   Andrea Petta   cocreation paper ...
136
  
4710a0b6   Renato De Donato   cocreation card
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
                  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...
158
159
              paper-fab.assessment,
              paper-fab.description {
4710a0b6   Renato De Donato   cocreation card
160
161
162
163
164
                  bottom: -20px;
                  right: 12px;
                  cursor: auto;
              }
  
2f14a3f9   Renato De Donato   jsdatachecker+cor...
165
166
167
168
169
170
171
172
              paper-fab.description {
                  background: #2196F3;
              }
  
              paper-fab.assessment {
                  background: #4CAF50;
              }
  
4710a0b6   Renato De Donato   cocreation card
173
174
175
          </style>
  
          <paper-card id="card_container">
97f5fe0e   Andrea Petta   cocreation paper ...
176
                  <div class="card-content">
4710a0b6   Renato De Donato   cocreation card
177
178
179
                      <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...
180
                      <div class="name" style$="color: {{color}};">{{name}}</div>
4710a0b6   Renato De Donato   cocreation card
181
182
183
184
185
186
187
188
                      <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 ...
189
                      </div>
8d261aa1   Renato De Donato   creator
190
                      <template is="dom-if" if="{{!_checkRoomType(roomType)}}">
2f14a3f9   Renato De Donato   jsdatachecker+cor...
191
                          <paper-fab mini icon="assessment" class="assessment" noink></paper-fab>
4710a0b6   Renato De Donato   cocreation card
192
                      </template>
8d261aa1   Renato De Donato   creator
193
                      <template is="dom-if" if="{{_checkRoomType(roomType)}}">
2f14a3f9   Renato De Donato   jsdatachecker+cor...
194
                          <paper-fab mini icon="description" class="description" noink></paper-fab>
4710a0b6   Renato De Donato   cocreation card
195
                      </template>
97f5fe0e   Andrea Petta   cocreation paper ...
196
                  </div>
2f14a3f9   Renato De Donato   jsdatachecker+cor...
197
                  <div class="card-actions" style$="border-color: {{color}};">
4710a0b6   Renato De Donato   cocreation card
198
                      <paper-button on-click="_onExplore"><span id="explore"></span></paper-button>
2f14a3f9   Renato De Donato   jsdatachecker+cor...
199
                      <paper-button id="goal_button" class="info" noink><span id="goal"></span></paper-button>
4710a0b6   Renato De Donato   cocreation card
200
201
202
203
                      <!--<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...
204
                              <span class="title" style$="color: {{color}};" id="tooltip_goal"></span>
4710a0b6   Renato De Donato   cocreation card
205
206
207
208
                              <br>
                              <span class="description">{{goal}}</span>
                          </p>
                      </paper-tooltip>
97f5fe0e   Andrea Petta   cocreation paper ...
209
                  </div>
97f5fe0e   Andrea Petta   cocreation paper ...
210
211
212
213
214
215
216
217
218
219
220
221
222
          </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
223
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
224
225
226
                  },
                  owner:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
227
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
228
229
230
                  },
                  from:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
231
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
232
233
234
                  },
                  to:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
235
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
236
237
238
                  },
                  goal:{
                      type: String,
4710a0b6   Renato De Donato   cocreation card
239
                      value: ""
97f5fe0e   Andrea Petta   cocreation paper ...
240
                  },
13c53ccd   Luigi Serra   cards updates
241
242
243
                  roomUrl: {
                      type: String,
                      value: undefined
bbfe6cb7   Luigi Serra   updates
244
245
246
247
                  },
                  roomType:{
                      type: String,
                      value: undefined
f689abd6   Luigi Serra   updates
248
249
250
251
252
253
254
255
                  },
                  isOwner: {
                      type: Boolean,
                      value: false
                  },
                  roomId:{
                      type: Number,
                      value: undefined
2f14a3f9   Renato De Donato   jsdatachecker+cor...
256
257
258
259
                  },
                  color:{
                      type: String,
                      value: ""
13c53ccd   Luigi Serra   cards updates
260
                  }
97f5fe0e   Andrea Petta   cocreation paper ...
261
262
              },
  
2f14a3f9   Renato De Donato   jsdatachecker+cor...
263
264
265
266
267
268
269
              ready: function() {
                  var color = "#4CAF50";
                  if(this.roomType == "knowledge")
                      color = "#2196F3";
                  this.color = color;
              },
  
97f5fe0e   Andrea Petta   cocreation paper ...
270
              attached: function(){
4710a0b6   Renato De Donato   cocreation card
271
                  cocreation_room_ln["ln"] = ODE.user_language;
97f5fe0e   Andrea Petta   cocreation paper ...
272
  
4710a0b6   Renato De Donato   cocreation card
273
274
275
                  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
276
277
              },
  
8d261aa1   Renato De Donato   creator
278
              _handleDeleteClick: function(){
f689abd6   Luigi Serra   updates
279
280
281
                  this.fire("cocreation-paper-card-controllet_delete", {roomId: this.roomId});
              },
  
8d261aa1   Renato De Donato   creator
282
              _onExplore: function(){
13c53ccd   Luigi Serra   cards updates
283
                  window.location = this.roomUrl;
bbfe6cb7   Luigi Serra   updates
284
              },
97f5fe0e   Andrea Petta   cocreation paper ...
285
  
8d261aa1   Renato De Donato   creator
286
              _checkRoomType: function(type){
f689abd6   Luigi Serra   updates
287
                 return (type == "knowledge") ? true : false;
bbfe6cb7   Luigi Serra   updates
288
              }
97f5fe0e   Andrea Petta   cocreation paper ...
289
290
291
292
          })
      </script>
  
  </dom-module>