Blame view

controllets/create-card-controllet/create-card-controllet_old.html 10.6 KB
28265108   Renato De Donato   new link-text con...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
  <link rel="import" href="../../bower_components/polymer/polymer.html"/>

  <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"/>

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

  

  <link rel="import" href="../../datalets/preview-datalet/preview-datalet.html" />

  <link rel="import" href="../../controllets/paper-card-controllet/paper-card-controllet.html"/>

  

  <dom-module id="create-card-controllet">

  

      <template>

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

                  padding-bottom: 30px;

                  width: 100%;

              }

  

              paper-material {

                  background-color: white;

                  border-width: 1em;

                  padding: 5px;

                  margin-bottom: 20px;

              }

  

              paper-fab {

                  position: relative;

                  left: 90%;

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

              }

  

              #content ::content {

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

                  padding: 0 16px 8px;

                  font-weight: 300;

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

                  line-height: 24px;

                  max-height: 400px;

                  position:relative;

                  overflow: auto;

              }

              ::content.buttons {

                  margin-top: 8px;

              }

              ::content paper-button, ::content paper-icon-button {

                  font-weight: 500;

                  color: var(--accent-color);

              }

  

              .avatar

              {

                  display: inline-block;

                  height: 0.7em;

                  width: 0.7em;

                  border-radius: 50%;

                  background: var(--paper-blue-500);

                  color: white;

                  line-height: 2em;

                  font-size: 1.87em;

                  text-align: center;

              }

  

              .title

              {

                  position: relative;

                  left: 0px;

                  /*top: 0.60vh;

                  margin-left: 20px;*/

              }

  

              .big

              {

                  font-size: 1.37em;

                  color: var(--google-grey-500);

              }

  

              .medium

              {

                  font-size: 1em;

                  padding-bottom: 0.5em;

                  color : #000000;

                  font-weight: bold;

              }

  

              .small

              {

                  font-size: 0.8em;

                  padding-top: 10px;

                  color: var(--paper-blue-500);

                  font-weight: bold;

              }

  

              paper-textarea.custom_textarea{

                 /*max-width:40vw;*/

              }

  

              div.vertical{

                  margin: 20px;

              }

  

              ::content #card_preview .modify{

                  display: none;

              }

  

              ::content #card_preview .delete{

                  display: none;

              }

  

              ::content #card_preview .fullscreen{

                  display: none;

              }

  

  

          </style>

  

          <div class="horizontal layout">

  

              <div class="vertical layout" style="width: 60%;">

  

                  <div class="horizontal layout">

                      <div class="avatar"></div>

                      <div class="title">

                          <div class="big">Title</div>

                          <div class="small">This is the title for your new card. It'll be visualized in the bottom black section.</div>

                      </div>

                  </div>

  

                  <paper-material animated elevation="2">

                     <paper-textarea class="custom_textarea" id="cardTitle"

                                                             label=""

                                                             char-counter

                                                             maxlength="25"

                                                             rows="1"

                                                             value="{{cardTitle}}">

  

                     </paper-textarea>

                  </paper-material>

  

                  <template is="dom-if" if="{{checkType(type, 'link')}}">

  

                      <div class="horizontal layout">

                          <div class="avatar"></div>

                          <div class="title">

                              <div class="big">Link</div>

                              <div class="small">This is the link you want to share.</div>

                          </div>

                      </div>

  

                      <paper-material animated elevation="2">

                          <paper-textarea class="custom_textarea" id="link"

                                                                  label=""

                                                                  auto-validate

                                                                  pattern="^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?"

                                                                  error-message="Urls only!"

                                                                  value="{{link}}">

  

                          </paper-textarea>

                      </paper-material>

  

                  </template>

  

  

                  <template is="dom-if" if="{{checkType(type, 'text')}}">

  

                      <div class="horizontal layout">

                          <div class="avatar"></div>

                          <div class="title">

                              <div class="big">Text content</div>

                              <div class="small">It's the text content of your card. It'll be visualize in the body(yellow top section).</div>

                          </div>

                      </div>

  

                      <paper-material animated elevation="2">

                          <paper-textarea class="custom_textarea" id="text"

                                                                  label=""

                                                                  char-counter

                                                                  max-rows="50"

                                                                  maxlength="1024"

                                                                  value="{{text}}">

  

                          </paper-textarea>

                      </paper-material>

  

                  </template>

  

                  <div class="horizontal layout">

                      <div class="avatar"></div>

                      <div class="title">

                          <div class="big">Comment</div>

                          <div class="small">This is a comment you'll see on the bottom of the card.</div>

                      </div>

                  </div>

  

                  <paper-material animated elevation="2">

                      <paper-textarea class="custom_textarea" id="comment"

                                      label=""

                                      char-counter

                                      maxlength="100"

                                      value="{{comment}}">

  

                      </paper-textarea>

                  </paper-material>

  

              </div>

  

              <div class="vertical layout" style="width: 40%;">

  

                  <paper-fab mini icon="add-circle" on-click="_handleAddClick"></paper-fab>

  

                  <div id="card_preview"></div>

              </div>

  

  

          </div>

  

      </template>

  

      <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>

  

      <script>

          Polymer({

              is: "create-card-controllet",

              properties: {

                  type:{

                      type: String,

                      value: "text"

                  },

  

                  cardTitle:{

                      type: String,

                      value: "Title",

                      observer : '_valueChanged'

                  },

                  text:{

                      type: String,

                      value: "Text content",

                      observer : '_valueChanged'

                  },

                  content:{

                      type: String,

                      value: undefined,

                      observer : '_valueChanged'

                  },

                  comment:{

                      type: String,

                      value: "comment",

                      observer : '_valueChanged'

                  },

  

                  timer :{

                      type: Number,

                      value : 0

                  }

              },

  

              ready: function(){

  

                  this._valueChanged('','');

              },

  

  

              checkType: function(type, check){

                  return (type == check);

              },

  

              _handleAddClick: function(e){

                  this.fire('create-card-controllet_add-clicked', {data : this});

              },

  

              _valueChanged: function(oldvalue, newValue) {

                 var card = '<paper-card-controllet'   +

                                ' class="grid-item"'    +

                                ' width="300"'          +

                                ' height="300"'         +

                                ' card-type="'+ this.type    + '"' +

                                ' comment="'+ this.comment + '"' +

                                ' card-title="'+ this.cardTitle + '">';

                 if(this.type == 'link'){

                     card += '<preview-datalet data-url="'+ this.link + '" url="'+ this.link + '"></preview-datalet>';

                 }else{

                     card += this.text;

                 }

  

                 card += '</paper-card-controllet>';

  

                  clearTimeout (this.timer);

                  //Firefox stuff

                  var _this = this;

                  this.timer = setTimeout(function(){

                      _this.$.card_preview.innerHTML = card;

                  }, 1000);

  

  

              }

          })

      </script>

  

  </dom-module>