Blame view

controllets/paper-card-controllet/paper-card-controllet.html 9.5 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
                  color: white;

                  height: 50px;

                  padding: 0 16px;

                  left: 0; right: 0;

35420b08   Luigi Serra   paper-card-contro...
42
                  z-index: 1000;

a1f9b957   Luigi Serra   create card updates
43
                  word-wrap: break-word;

eb240478   Luigi Serra   public room cards...
44
45
46
47
48
49
50
51
52
53
54
              }

              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...
55
                  padding: 0 16px 8px;

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

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

                  line-height: 24px;

                  max-height: 400px;

                  position:relative;

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

eb240478   Luigi Serra   public room cards...
62
              }

c76a9f85   Luigi Serra   card and controll...
63
  

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

                  margin-top: 8px;

              }

c76a9f85   Luigi Serra   card and controll...
67
  

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

                  font-weight: 500;

                  color: var(--accent-color);

              }

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

b047d169   Luigi Serra   updates
73
              #comment{

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

                  top: -50px;

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

7383b38e   Luigi Serra   paper-card-contro...
77
78
79
80
81
                  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...
82
                  word-wrap: break-word;

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

36f13d09   Luigi Serra   selection control...
84
  

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

36f13d09   Luigi Serra   selection control...
86
87
88
89
90
91
92
93
94
                  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...
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  

              .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%;

9f4f803a   Luigi Serra   paper-card-contro...
110
                  /*height: 60%;*/

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

                  left: 0;

9f4f803a   Luigi Serra   paper-card-contro...
113
                  top: 5%;

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

                  margin-left: auto;

35420b08   Luigi Serra   paper-card-contro...
116
                  z-index: 1100;

c76a9f85   Luigi Serra   card and controll...
117
                  display: none;

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

                  line-height: 20px;

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

  

              .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...
137
                  z-index: 1000;

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

  

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

  

  

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

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

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

36f13d09   Luigi Serra   selection control...
146
  

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

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

                      <content></content>

                  </div>

1f76071f   Luigi Serra   paper card update
151
152
153
                  

                  <div class="legend horizontal layout center">

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

eb240478   Luigi Serra   public room cards...
154
  

1f76071f   Luigi Serra   paper card update
155
                      <paper-fab class="fullscreen" mini icon="fullscreen" on-click="_handleFullscreenClick"></paper-fab>

eb240478   Luigi Serra   public room cards...
156
  

1f76071f   Luigi Serra   paper card update
157
                      <!-- Adding icon based on card type -->

c76a9f85   Luigi Serra   card and controll...
158
  

1f76071f   Luigi Serra   paper card update
159
                      <template is="dom-if" if="{{checkType(cardType, 'text')}}">

c76a9f85   Luigi Serra   card and controll...
160
  

1f76071f   Luigi Serra   paper card update
161
                          <paper-fab class="modify" mini icon="create" on-click="_handleDetailsClick"></paper-fab>

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

1f76071f   Luigi Serra   paper card update
163
                      </template>

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

1f76071f   Luigi Serra   paper card update
165
                      <template is="dom-if" if="{{checkType(cardType, 'image')}}">

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

1f76071f   Luigi Serra   paper card update
167
                          <paper-fab class="modify" mini icon="perm-media" on-click="_handleDetailsClick"></paper-fab>

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

1f76071f   Luigi Serra   paper card update
169
                      </template>

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

1f76071f   Luigi Serra   paper card update
171
                      <template is="dom-if" if="{{checkType(cardType, 'datalet')}}">

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

1f76071f   Luigi Serra   paper card update
173
                          <paper-fab class="modify" mini icon="assessment" on-click="_handleDetailsClick"></paper-fab>

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

1f76071f   Luigi Serra   paper card update
175
                      </template>

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

1f76071f   Luigi Serra   paper card update
177
                      <template is="dom-if" if="{{checkType(cardType, 'link')}}">

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

1f76071f   Luigi Serra   paper card update
179
                          <paper-fab class="modify" mini icon="link" on-click="_handleDetailsClick"></paper-fab>

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

1f76071f   Luigi Serra   paper card update
181
                      </template>

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

1f76071f   Luigi Serra   paper card update
183
                  </div>

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

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

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

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

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

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

eb240478   Luigi Serra   public room cards...
190
  

c76a9f85   Luigi Serra   card and controll...
191
192
193
194
195
                  <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...
196
197
              </div>

          </paper-material>

eb240478   Luigi Serra   public room cards...
198
  

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

  

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

  

1b49624d   isisadmin   paper-card-contro...
203
204
      <script>

          Polymer({

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

1b49624d   isisadmin   paper-card-contro...
206
207
208
              properties: {

                  width: {

                      type: Number,

563db87f   isisadmin   bug fix
209
                      observer: "_changeWidth"

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

eb240478   Luigi Serra   public room cards...
211
212
                  height: {

                      type: Number,

563db87f   isisadmin   bug fix
213
                      observer: "_changeHeight"

eb240478   Luigi Serra   public room cards...
214
                  },

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

eb240478   Luigi Serra   public room cards...
216
217
                      type: String,

                      value: "text"

6f8e74f7   Luigi Serra   card update
218
                  },

59190a9b   Luigi Serra   update
219
                  comment:{

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

67b280f4   Luigi Serra   search feature
221
                      value: ""

6f8e74f7   Luigi Serra   card update
222
                  },

0fc2aafe   Luigi Serra   updates
223
                  cardTitle:{

6f8e74f7   Luigi Serra   card update
224
                      type: String,

67b280f4   Luigi Serra   search feature
225
                      value: ""

b9dd9495   Luigi Serra   selection control...
226
227
228
229
                  },

                  elevation:{

                      type: Number,

                      value: 3

6f8e74f7   Luigi Serra   card update
230
231
232
233
                  }

  

              },

  

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

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

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

eb240478   Luigi Serra   public room cards...
237
                  }

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

eb240478   Luigi Serra   public room cards...
239
  

1b49624d   isisadmin   paper-card-contro...
240
241
              _changeWidth: function(data){

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

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

eb240478   Luigi Serra   public room cards...
243
244
245
246
                  //$(this.$.content).perfectScrollbar();

              },

  

              _changeHeight: function(data){

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

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

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

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

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

eb240478   Luigi Serra   public room cards...
252
253
254
  

              checkType: function(type, check){

                  return (type == check);

9d4a34db   Luigi Serra   selection control...
255
256
              },

  

e71c3328   Luigi Serra   selection control...
257
258
              _handleDetailsClick: function(e){

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

36f13d09   Luigi Serra   selection control...
259
260
261
              },

  

              _handleDeleteClick: function(e){

c76a9f85   Luigi Serra   card and controll...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
                  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;

                  }

  

35420b08   Luigi Serra   paper-card-contro...
276
277
278
279
                  var html = this.$.content.innerHTML;

                  this.$.content.innerHTML = "";

                  this.$.fullscreen_content.innerHTML = html;

  

c76a9f85   Luigi Serra   card and controll...
280
                  this.$.fullscreen_container.style.display = "inline-block";

c76a9f85   Luigi Serra   card and controll...
281
282
283
284
              },

  

              _handleCloseFullscreenClick: function(e){

  

35420b08   Luigi Serra   paper-card-contro...
285
286
287
288
                  var html = this.$.fullscreen_content.innerHTML;

                  this.$.fullscreen_content.innerHTML = "";

                  this.$.content.innerHTML = html;

  

c76a9f85   Luigi Serra   card and controll...
289
290
                  this.$.fullscreen_container.style.display = "none";

              }

1b49624d   isisadmin   paper-card-contro...
291
292
293
          })

      </script>

  

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