Blame view

controllets/paper-card-controllet/paper-card-controllet.html 9.34 KB
eb240478   Luigi Serra   public room cards...
1
  <link rel="import" href="../../bower_components/polymer/polymer.html"/>

1b49624d   isisadmin   paper-card-contro...
2
3
4
5
  <link rel="import" href="../../bower_components/paper-material/paper-material.html"/>

  <link rel="import" href="../../bower_components/paper-fab/paper-fab.html"/>

  <link rel="import" href="../../bower_components/iron-icons/iron-icons.html"/>

  

1b49624d   isisadmin   paper-card-contro...
6
7
  <dom-module id="paper-card-controllet">

  

1b49624d   isisadmin   paper-card-contro...
8
      <template>

eb240478   Luigi Serra   public room cards...
9
10
11
12
13
14
15
16
17
18
19
          <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">

          <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>

          <style>

              :host {

                  display: inline-block;

                  margin: 0 8px 8px ;

                  font-size: 14px;

                  text-align: justify;

                  line-height: 10px;

                  --paper-fab-background: var(--accent-color);

                  font-family: 'Roboto', sans-serif;

6f8e74f7   Luigi Serra   card update
20
                  padding-bottom: 30px;

eb240478   Luigi Serra   public room cards...
21
22
23
              }

  

              paper-material {

eb240478   Luigi Serra   public room cards...
24
                  background-color: white;

7383b38e   Luigi Serra   paper-card-contro...
25
                  border-width: 1em;

eb240478   Luigi Serra   public room cards...
26
27
              }

  

7383b38e   Luigi Serra   paper-card-contro...
28
              .footer {

eb240478   Luigi Serra   public room cards...
29
                  position: relative;

36f13d09   Luigi Serra   selection control...
30
                  height: 21px;

eb240478   Luigi Serra   public room cards...
31
              }

7383b38e   Luigi Serra   paper-card-contro...
32
  

0fc2aafe   Luigi Serra   updates
33
              .legend {

7383b38e   Luigi Serra   paper-card-contro...
34
35
36
37
                  position: relative;

                  top: -50px;

                  background: rgba(0,0,0,0.8);

                  bottom: 0;

eb240478   Luigi Serra   public room cards...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
                  color: white;

                  height: 50px;

                  padding: 0 16px;

                  left: 0; right: 0;

                  z-index: 1;

              }

              paper-fab {

                  position: absolute;

                  right: 10px;

                  bottom: -18px;

                  z-index: 10;

                  --paper-fab-background:#2196F3;

              }

  

              #content ::content {

                  /*padding: 0 16px 8px;*/

7383b38e   Luigi Serra   paper-card-contro...
54
                  padding: 0 16px 8px;

eb240478   Luigi Serra   public room cards...
55
56
57
58
59
                  font-weight: 300;

                  color: var(--secondary-text-color);

                  line-height: 24px;

                  max-height: 400px;

                  position:relative;

7383b38e   Luigi Serra   paper-card-contro...
60
                  overflow: auto;

eb240478   Luigi Serra   public room cards...
61
              }

c76a9f85   Luigi Serra   card and controll...
62
  

eb240478   Luigi Serra   public room cards...
63
64
65
              ::content.buttons {

                  margin-top: 8px;

              }

c76a9f85   Luigi Serra   card and controll...
66
  

eb240478   Luigi Serra   public room cards...
67
68
69
70
              ::content paper-button, ::content paper-icon-button {

                  font-weight: 500;

                  color: var(--accent-color);

              }

7383b38e   Luigi Serra   paper-card-contro...
71
  

b047d169   Luigi Serra   updates
72
              #comment{

7383b38e   Luigi Serra   paper-card-contro...
73
74
                  position:relative;

                  top: -50px;

6f8e74f7   Luigi Serra   card update
75
                  min-height: 50px;

7383b38e   Luigi Serra   paper-card-contro...
76
77
78
79
80
                  height: auto;

                  padding: 8px 8px 8px 8px;

                  font-size: 10px;

                  color: rgba(0,0,0,0.4);

                  font-family: 'Roboto', sans-serif;

c2521a87   Luigi Serra   paper-card-contro...
81
                  word-wrap: break-word;

7383b38e   Luigi Serra   paper-card-contro...
82
              }

36f13d09   Luigi Serra   selection control...
83
  

15509ec7   Luigi Serra   controllets and b...
84
              .delete{

36f13d09   Luigi Serra   selection control...
85
86
87
88
89
90
91
92
93
                  position: absolute;

                  top: -12px;

                  left: -12px;

                  --iron-icon-height: 18px;

                  --iron-icon-width: 18px;

                  width: 24px;

                  height: 24px;

                  --paper-fab-background:#cccccc;

              }

c76a9f85   Luigi Serra   card and controll...
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  

              .fullscreen{

                  position: absolute;

                  top: 36px;

                  right: 54px;

                  --iron-icon-height: 18px;

                  --iron-icon-width: 18px;

                  width: 24px;

                  height: 24px;

                  --paper-fab-background:#cccccc;

              }

  

              #fullscreen_container{

                  position: fixed;

                  width: 80%;

52e4ded2   isisadmin   paper card contro...
109
                  height: 60%;

c76a9f85   Luigi Serra   card and controll...
110
111
                  right: 0;

                  left: 0;

52e4ded2   isisadmin   paper card contro...
112
                  top: 10%;

c76a9f85   Luigi Serra   card and controll...
113
114
115
116
                  margin-right: auto;

                  margin-left: auto;

                  z-index: 1000;

                  display: none;

52e4ded2   isisadmin   paper card contro...
117
118
                  padding: 40px;

                  line-height: 20px;

c76a9f85   Luigi Serra   card and controll...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
              }

  

              .close_fullscreen{

                  position: absolute;

                  top: 5px;

                  right: 1vw;

                  --iron-icon-height: 18px;

                  --iron-icon-width: 18px;

                  width: 24px;

                  height: 24px;

                  --paper-fab-background:#cccccc;

              }

  

              #fullscreen_content{

                  position: relative;

                  height: 100%;

                  width: 100%;

e27db669   isisadmin   paper card contro...
136
                  z-index: 1000;

c76a9f85   Luigi Serra   card and controll...
137
138
              }

  

eb240478   Luigi Serra   public room cards...
139
140
141
142
          </style>

  

  

          <paper-material animated elevation="{{elevation}}" flex>

7383b38e   Luigi Serra   paper-card-contro...
143
  

15509ec7   Luigi Serra   controllets and b...
144
              <paper-fab class="delete" mini icon="delete" on-click="_handleDeleteClick"></paper-fab>

36f13d09   Luigi Serra   selection control...
145
  

1b49624d   isisadmin   paper-card-contro...
146
              <div class="vertical layout">

7383b38e   Luigi Serra   paper-card-contro...
147
148
149
                  <div id="content">

                      <content></content>

                  </div>

eb240478   Luigi Serra   public room cards...
150
  

0fc2aafe   Luigi Serra   updates
151
                  <template is="dom-if" if="{{cardTitle}}">

eb240478   Luigi Serra   public room cards...
152
  

0fc2aafe   Luigi Serra   updates
153
154
                      <div class="legend horizontal layout center">

                          <span>{{cardTitle}}</span>

c76a9f85   Luigi Serra   card and controll...
155
156
157
  

                          <paper-fab class="fullscreen" mini icon="fullscreen" on-click="_handleFullscreenClick"></paper-fab>

  

6f8e74f7   Luigi Serra   card update
158
                          <!-- Adding icon based on card type -->

7383b38e   Luigi Serra   paper-card-contro...
159
  

4b412909   Luigi Serra   paper-card-contro...
160
                          <template is="dom-if" if="{{checkType(cardType, 'text')}}">

7383b38e   Luigi Serra   paper-card-contro...
161
  

15509ec7   Luigi Serra   controllets and b...
162
                              <paper-fab class="modify" mini icon="create" on-click="_handleDetailsClick"></paper-fab>

7383b38e   Luigi Serra   paper-card-contro...
163
  

6f8e74f7   Luigi Serra   card update
164
                          </template>

7383b38e   Luigi Serra   paper-card-contro...
165
  

4b412909   Luigi Serra   paper-card-contro...
166
                          <template is="dom-if" if="{{checkType(cardType, 'image')}}">

7383b38e   Luigi Serra   paper-card-contro...
167
  

15509ec7   Luigi Serra   controllets and b...
168
                              <paper-fab class="modify" mini icon="perm-media" on-click="_handleDetailsClick"></paper-fab>

7383b38e   Luigi Serra   paper-card-contro...
169
  

6f8e74f7   Luigi Serra   card update
170
                          </template>

7383b38e   Luigi Serra   paper-card-contro...
171
  

4b412909   Luigi Serra   paper-card-contro...
172
                          <template is="dom-if" if="{{checkType(cardType, 'datalet')}}">

7383b38e   Luigi Serra   paper-card-contro...
173
  

15509ec7   Luigi Serra   controllets and b...
174
                              <paper-fab class="modify" mini icon="assessment" on-click="_handleDetailsClick"></paper-fab>

7383b38e   Luigi Serra   paper-card-contro...
175
  

6f8e74f7   Luigi Serra   card update
176
                          </template>

7383b38e   Luigi Serra   paper-card-contro...
177
  

4b412909   Luigi Serra   paper-card-contro...
178
                          <template is="dom-if" if="{{checkType(cardType, 'link')}}">

7383b38e   Luigi Serra   paper-card-contro...
179
  

15509ec7   Luigi Serra   controllets and b...
180
                              <paper-fab class="modify" mini icon="link" on-click="_handleDetailsClick"></paper-fab>

7383b38e   Luigi Serra   paper-card-contro...
181
  

6f8e74f7   Luigi Serra   card update
182
                          </template>

7383b38e   Luigi Serra   paper-card-contro...
183
  

6f8e74f7   Luigi Serra   card update
184
                      </div>

7383b38e   Luigi Serra   paper-card-contro...
185
  

6f8e74f7   Luigi Serra   card update
186
                  </template>

7383b38e   Luigi Serra   paper-card-contro...
187
  

6f8e74f7   Luigi Serra   card update
188
                  <div class="footer">

59190a9b   Luigi Serra   update
189
190
                      <template is="dom-if" if="{{comment}}">

                         <div id="comment">{{comment}}</div>

eb240478   Luigi Serra   public room cards...
191
                      </template>

1b49624d   isisadmin   paper-card-contro...
192
                  </div>

eb240478   Luigi Serra   public room cards...
193
  

c76a9f85   Luigi Serra   card and controll...
194
195
196
197
198
                  <paper-material elevation="4" id="fullscreen_container">

                      <paper-fab class="close_fullscreen" mini icon="close" on-click="_handleCloseFullscreenClick"></paper-fab>

                      <div id="fullscreen_content"></div>

                  </paper-material>

  

1b49624d   isisadmin   paper-card-contro...
199
200
              </div>

          </paper-material>

eb240478   Luigi Serra   public room cards...
201
  

1b49624d   isisadmin   paper-card-contro...
202
203
      </template>

  

eb240478   Luigi Serra   public room cards...
204
205
      <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>

  

1b49624d   isisadmin   paper-card-contro...
206
207
      <script>

          Polymer({

eb240478   Luigi Serra   public room cards...
208
              is: "paper-card-controllet",

1b49624d   isisadmin   paper-card-contro...
209
210
211
              properties: {

                  width: {

                      type: Number,

1b49624d   isisadmin   paper-card-contro...
212
213
                      observer: "_changeWidth",

                  },

eb240478   Luigi Serra   public room cards...
214
215
216
217
                  height: {

                      type: Number,

                      observer: "_changeHeight",

                  },

4b412909   Luigi Serra   paper-card-contro...
218
                  cardType:{

eb240478   Luigi Serra   public room cards...
219
220
                      type: String,

                      value: "text"

6f8e74f7   Luigi Serra   card update
221
                  },

59190a9b   Luigi Serra   update
222
                  comment:{

b7101429   Luigi Serra   paper-card-contro...
223
                      cardType: String,

67b280f4   Luigi Serra   search feature
224
                      value: ""

6f8e74f7   Luigi Serra   card update
225
                  },

0fc2aafe   Luigi Serra   updates
226
                  cardTitle:{

6f8e74f7   Luigi Serra   card update
227
                      type: String,

67b280f4   Luigi Serra   search feature
228
                      value: ""

b9dd9495   Luigi Serra   selection control...
229
230
231
232
                  },

                  elevation:{

                      type: Number,

                      value: 3

6f8e74f7   Luigi Serra   card update
233
234
235
236
                  }

  

              },

  

e27db669   isisadmin   paper card contro...
237
              attached: function(){

4b412909   Luigi Serra   paper-card-contro...
238
                  if(this.cardType == "text"){

6f8e74f7   Luigi Serra   card update
239
                      this.$.content.style.backgroundColor = "#ffc";

eb240478   Luigi Serra   public room cards...
240
                  }

1b49624d   isisadmin   paper-card-contro...
241
              },

eb240478   Luigi Serra   public room cards...
242
  

1b49624d   isisadmin   paper-card-contro...
243
244
              _changeWidth: function(data){

                  this.style.width = data + "px";

7383b38e   Luigi Serra   paper-card-contro...
245
                  //this.$.content.style.width = data + "px";

eb240478   Luigi Serra   public room cards...
246
247
248
249
                  //$(this.$.content).perfectScrollbar();

              },

  

              _changeHeight: function(data){

6f8e74f7   Luigi Serra   card update
250
                  this.style.height = (data) + "px";

7383b38e   Luigi Serra   paper-card-contro...
251
                  this.$.content.style.height = data + "px";

6f8e74f7   Luigi Serra   card update
252
253
                  this.style.height = (this.height + ((this.text != "") ? 50 : 0)) + "px";

                  $(this.$.content).perfectScrollbar();

1b49624d   isisadmin   paper-card-contro...
254
              },

eb240478   Luigi Serra   public room cards...
255
256
257
  

              checkType: function(type, check){

                  return (type == check);

9d4a34db   Luigi Serra   selection control...
258
259
              },

  

e71c3328   Luigi Serra   selection control...
260
261
              _handleDetailsClick: function(e){

                  this.fire('paper-card-controllet_details-clicked', {data : this});

36f13d09   Luigi Serra   selection control...
262
263
264
              },

  

              _handleDeleteClick: function(e){

c76a9f85   Luigi Serra   card and controll...
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
                  this.fire('paper-card-controllet_delete-clicked', {data : this});

              },

  

              _handleFullscreenClick: function(e){

  

                  switch(this.cardType){

                      case 'text':

                          this.$.fullscreen_content.style.backgroundColor = "#ffc";

                          break;

                      case 'link':

                          window.open(this.getAttribute('card-link'),'_blank');

                          return;

                  }

  

                  this.$.fullscreen_container.style.display = "inline-block";

                  this.$.fullscreen_content.innerHTML = this.$.content.innerHTML;

              },

  

              _handleCloseFullscreenClick: function(e){

  

                  this.$.fullscreen_container.style.display = "none";

              }

1b49624d   isisadmin   paper-card-contro...
287
288
289
          })

      </script>

  

1b49624d   isisadmin   paper-card-contro...
290
  </dom-module>