Blame view

controllets/postit-container-controllet/postit-container-controllet.html 10.9 KB
2d8cf127   Luigi Serra   postit and google...
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
  <link rel="import" href="../../bower_components/polymer/polymer.html">

  

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

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

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

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

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

  

  <link rel="import" href="../../controllets/search-panel-controllet/search-panel-controllet.html">

  

  <dom-module id="postit-container-controllet">

  

      <style>

  

          iron-icon.postit {

              padding: 2px;

              margin: 0px;

              color: #FFFFFF;

              height: 32px;

              width: 32px;

              background-color: #00BCD4;

          }

  

          .button-container {

              cursor: pointer;

              text-decoration:none;

              color:#000;

              background:#ffc;

              display:block;

              height:40px;

              width:40px;

              padding:10px;

              /* Firefox */

              -moz-box-shadow:5px 5px 7px rgba(33,33,33,1);

              /* Safari+Chrome */

              -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);

              /* Opera */

              box-shadow: 5px 5px 7px rgba(33,33,33,.7);

              -o-transform:rotate(4deg);

              -webkit-transform:rotate(4deg);

              -moz-transform:rotate(4deg);

          }

  

          .button-container p{

              -o-transform:rotate(4deg);

              -webkit-transform:rotate(4deg);

              -moz-transform:rotate(4deg);

              font-size: 5px;

              line-height: 3px;

          }

  

          .button-container:hover {

              box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);

              -webkit-transition: 0.2s ease-out;

              -moz-transition: 0.2s ease-out;

              -o-transition: 0.2s ease-out;

              -ms-transition: 0.2s ease-out;

              transition: 0.2s ease-out;

          }

  

c405e5ba   Luigi Serra   updates
61
          .postitwindow {

2d8cf127   Luigi Serra   postit and google...
62
63
64
              /*height: 80vh;

              width: 120vh;*/

              display: none;

13c53ccd   Luigi Serra   cards updates
65
              width: 50%;

2d8cf127   Luigi Serra   postit and google...
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
              height: 80%;

              position: fixed;

              top: 15%;

              left: 50%;

              margin-right: auto;

              margin-left: auto;

              z-index: 1000;

          }

  

          .transparent {

              position:absolute;

              top:0;

              left:0;

              width: 100%;

              height: 12%;

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

          }

  

          paper-fab.close {

              position: absolute;

              height: 32px;

              width: 32px;

              margin: 8px;

              top: 0px;

              right: 0px;

              --paper-fab-background:#B6B6B6;

13c53ccd   Luigi Serra   cards updates
92
              /*z-index: 9999;*/

2d8cf127   Luigi Serra   postit and google...
93
94
95
96
97
98
99
100
101
102
          }

  

          paper-fab#addPostit {

              position: absolute;

              height: 32px;

              width: 32px;

              margin: 8px;

              top: 0px;

              right: 48px;

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

13c53ccd   Luigi Serra   cards updates
103
              /*z-index: 9999;*/

2d8cf127   Luigi Serra   postit and google...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
          }

  

          #container_content {

              position: relative;

              overflow: auto;

              height: 100%;

              background-color: transparent;

              z-index: 1000;

              margin-top : 7%;

          }

  

          h2,p{

              font-size:100%;

              font-weight:normal;

13c53ccd   Luigi Serra   cards updates
118
              word-break: break-all;

2d8cf127   Luigi Serra   postit and google...
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
          }

          ul,li{

              list-style:none;

          }

          ul{

              overflow:hidden;

              padding:3em;

          }

          ul li a{

              text-decoration:none;

              color:#000;

              background:#ffc;

              display:block;

              height:10em;

              width:10em;

              padding:1em;

              -moz-box-shadow:5px 5px 7px rgba(33,33,33,1);

              -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);

              box-shadow: 5px 5px 7px rgba(33,33,33,.7);

              -moz-transition:-moz-transform .15s linear;

              -o-transition:-o-transform .15s linear;

              -webkit-transition:-webkit-transform .15s linear;

          }

          ul li{

              margin:10px;

              float:left;

          }

          ul li h3{

              font-size:100%;

              font-weight:bold;

          }

          ul li p{

              /*font-family:"Reenie Beanie",arial,sans-serif;*/

              font-size:60%;

          }

          ul li a{

              -webkit-transform: rotate(-6deg);

              -o-transform: rotate(-6deg);

              -moz-transform:rotate(-6deg);

          }

          ul li:nth-child(even) a{

              -o-transform:rotate(4deg);

              -webkit-transform:rotate(4deg);

              -moz-transform:rotate(4deg);

              position:relative;

              top:5px;

              background:#cfc;

          }

          ul li:nth-child(3n) a{

              -o-transform:rotate(-3deg);

              -webkit-transform:rotate(-3deg);

              -moz-transform:rotate(-3deg);

              position:relative;

              top:-5px;

              background:#ccf;

          }

          ul li:nth-child(5n) a{

              -o-transform:rotate(5deg);

              -webkit-transform:rotate(5deg);

              -moz-transform:rotate(5deg);

              position:relative;

              top:-10px;

          }

          ul li a:hover,ul li a:focus{

              box-shadow:10px 10px 7px rgba(0,0,0,.7);

              -moz-box-shadow:10px 10px 7px rgba(0,0,0,.7);

              -webkit-box-shadow: 10px 10px 7px rgba(0,0,0,.7);

              -webkit-transform: scale(1.25);

              -moz-transform: scale(1.25);

              -o-transform: scale(1.25);

              position:relative;

              z-index:5;

          }

  

13c53ccd   Luigi Serra   cards updates
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
          #addForm{

              text-decoration:none;

              color:#000;

              background:#ffc;

              display:none;

              height:20em;

              width:20em;

              padding:1em;

              -moz-box-shadow:5px 5px 7px rgba(33,33,33,1);

              -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);

              box-shadow: 5px 5px 7px rgba(33,33,33,.7);

              -moz-transition:-moz-transform .15s linear;

              -o-transition:-o-transform .15s linear;

              -webkit-transition:-webkit-transform .15s linear;

              position: absolute;

              top: 25%;

              left: 25%;

          }

  

          #newTitle{

              background: #E6E6E6;

              border-radius: 3px;

          }

  

          #newTitle:focus{

              background: transparent;

              border-radius: 3px;

              border: 2px solid #2196F3;

          }

  

          #newContent{

              background: #E6E6E6;

              border-radius: 3px;

          }

  

          #newContent:focus{

              background: transparent;

              border-radius: 3px;

              border: 2px solid #2196F3;

          }

  

          [contenteditable=true]:empty:before {

              content: attr(placeholder);

              display: block; /* For Firefox */

          }

  

2d8cf127   Luigi Serra   postit and google...
239
240
241
242
243
244
245
246
247
248
      </style>

  

      <template>

  

          <div class="button-container" title$="{{tooltip}}" on-click="_onOpenClick">

              <p>

                  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

              </p>

          </div>

  

c405e5ba   Luigi Serra   updates
249
          <paper-material id="window" class="postitwindow" elevation="0">

2d8cf127   Luigi Serra   postit and google...
250
251
252
253
  

              <div class="transparent"></div>

  

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

13c53ccd   Luigi Serra   cards updates
254
              <paper-fab id="addPostit" icon="add" title='Add new postit' class="dropdown-trigger" on-click="_onAddPostitClick"></paper-fab>

2d8cf127   Luigi Serra   postit and google...
255
256
              <div id="container_content">

                  <content>

13c53ccd   Luigi Serra   cards updates
257
258
259
                      <ul id="postit_container">

  

                          <template is="dom-repeat" items="{{data}}">

2d8cf127   Luigi Serra   postit and google...
260
261
                              <li>

                                  <a href="#">

13c53ccd   Luigi Serra   cards updates
262
                                      <h3>{{item.title}}</h3>

d450fdaf   Luigi Serra   postits controlle...
263
                                      <p>{{unescapeString(item.content)}}</p>

2d8cf127   Luigi Serra   postit and google...
264
265
                                  </a>

                              </li>

13c53ccd   Luigi Serra   cards updates
266
                          </template>

2d8cf127   Luigi Serra   postit and google...
267
                      </ul>

13c53ccd   Luigi Serra   cards updates
268
269
270
271
272
273
274
275
  

                      <div id="addForm">

                          <h3 id="newTitle" contentEditable="true" onkeypress="return (this.innerText.length <= 13)" placeholder="Title"></h3>

                          <p id="newContent" contentEditable="true" onkeypress="return (this.innerText.length <= 199)" placeholder="Content"></p>

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

                          <paper-fab id="addPostit" icon="save" title='Add new postit' class="dropdown-trigger" on-click="_onAddNewPostitFormClick" ></paper-fab>

                      </div>

  

2d8cf127   Luigi Serra   postit and google...
276
277
278
279
280
                  </content>

              </div>

  

          </paper-material>

  

13c53ccd   Luigi Serra   cards updates
281
  

2d8cf127   Luigi Serra   postit and google...
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
      </template>

  

      <script type="text/javascript" src="../shared_js/perfect-scrollbar/js/perfect-scrollbar.jquery.js"></script>

  

      <script>

  

          Polymer({

  

              is: 'postit-container-controllet',

  

              properties: {

                  tooltip: {

                      type: String,

                      value: ""

                  },

                  data : {

                      type: Array,

                      value: undefined

13c53ccd   Luigi Serra   cards updates
300
301
302
303
304
                  },

  

                  open : {

                      type: Boolean,

                      value: false

2d8cf127   Luigi Serra   postit and google...
305
306
307
308
309
                  }

              },

  

              ready: function(){

                  $(this.$.container_content).perfectScrollbar();

13c53ccd   Luigi Serra   cards updates
310
                  if(this.open == true) $(this.$.window).show();

2d8cf127   Luigi Serra   postit and google...
311
312
313
314
315
316
317
318
              },

  

              _onOpenClick: function() {

                  $(this.$.window).show();

              },

  

              _onCloseClick: function(){

                  $(this.$.window).hide();

13c53ccd   Luigi Serra   cards updates
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
              },

  

              _onAddPostitClick: function(){

                  this.$.addForm.style.display = "block";

              },

  

              _onCloseCreatePostitFormClick: function(){

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

              },

  

              _onAddNewPostitFormClick: function(){

                  //$(this.$.postit_container).append('<li><a href="#"><h2>' + this.$.newTitle.innerText + '</h2><p>' + this.$.newContent.innerText + '</p></a></li>');

                  this.fire('postit-container-controllet_create-new-postit', {title : this.$.newTitle.innerText, content: this.$.newContent.innerText, id: this.id});

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

                  this.$.newTitle.innerHTML   = "Title";

                  this.$.newContent.innerHTML = "Content";

  

d450fdaf   Luigi Serra   postits controlle...
336
337
338
339
340
341
              },

  

              unescapeString: function(string){

                  return string

                          .replace("&quot;", "\"", 'g')

                          .replace("&#039;", '\'', 'g');

2d8cf127   Luigi Serra   postit and google...
342
343
344
345
346
347
              }

  

          });

  

      </script>

  </dom-module>