Blame view

controllets/animated-button-container-controllet/animated-button-container-controllet.html 8.77 KB
f748e9cf   Luigi Serra   new controllet an...
1
2
3
4
5
6
  

  <link rel="import" href="../../bower_components/polymer/polymer.html">

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

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

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

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

67b280f4   Luigi Serra   search feature
7
  <link rel="import" href="../../bower_components/paper-toolbar/paper-toolbar.html">

f748e9cf   Luigi Serra   new controllet an...
8
9
10
11
12
  <link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animations.html">

  

  <link rel="import" href="../../controllets/items-list-controllet/item-list-controllet.html">

67b280f4   Luigi Serra   search feature
13
  <link rel="import" href="../../controllets/search-panel-controllet/search-panel-controllet.html">

f748e9cf   Luigi Serra   new controllet an...
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
  

  <dom-module id="animated-button-container-controllet">

  

      <style>

  

          :host {

          @apply(--layout-horizontal);

          @apply(--layout-center-center);

          }

          #pages{

              position: absolute;

              top: -38px;

              left: 113px;

          }

  

          .window {

              width: 30vw;

              height: 50vh;

              background: #e8e8e8;

              position: absolute;

              top: 64px;

              left: 0px;

              z-index: 1000;

          }

  

          .hidden{

              display: none;

          }

  

          #close{

              position: absolute;

67b280f4   Luigi Serra   search feature
45
              top: 8px;

f748e9cf   Luigi Serra   new controllet an...
46
              left: 28.5vw;

8a0bbd62   Luigi Serra   updates
47
48
49
50
              --iron-icon-height: 20px;

              --iron-icon-width: 20px;

              width: 24px;

              height: 24px;

67b280f4   Luigi Serra   search feature
51
              --paper-fab-background:#9e9e9e;

f748e9cf   Luigi Serra   new controllet an...
52
53
54
55
              z-index: 1001;

          }

  

          #open{

8a0bbd62   Luigi Serra   updates
56
57
              --paper-fab-background:transparent;

              background: transparent;

f748e9cf   Luigi Serra   new controllet an...
58
59
60
          }

  

          #selected_item{

6c8b91ab   Luigi Serra   updates
61
              /*margin-left: 25px;*/

8a0bbd62   Luigi Serra   updates
62
              margin-top: -5px;

f748e9cf   Luigi Serra   new controllet an...
63
64
65
66
67
68
69
70
71
72
              padding: 0;

              ms-transform: scale(0.60);

              -moz-transform: scale(0.60);

              -o-transform: scale(0.60);

              -webkit-transform: scale(0.60);

              transform: scale(0.60);

              -ms-transform-origin: 0 0;

              -moz-transform-origin: 0 0;

              -o-transform-origin: 0 0;

              -webkit-transform-origin: 0 0;

31d9a4f6   Luigi Serra   updates
73
              transform-origin: 0 0;

6c8b91ab   Luigi Serra   updates
74
75
              /*max-height: 64px;

              max-width: 64px;*/

f748e9cf   Luigi Serra   new controllet an...
76
77
78
79
          }

  

          #container_content{

              z-index: 1000;

31d9a4f6   Luigi Serra   updates
80
81
              position: relative;

              overflow: auto;

f748e9cf   Luigi Serra   new controllet an...
82
          }

67b280f4   Luigi Serra   search feature
83
          #toolbar{

8a0bbd62   Luigi Serra   updates
84
              background: #2196F3;

67b280f4   Luigi Serra   search feature
85
86
87
88
              height: 45px;

          }

  

          search-panel-controllet{

11455f01   Luigi Serra   updates
89
90
              position: absolute;

              top: 0px;

ca7442b9   Luigi Serra   updates
91
              left: 0px;

67b280f4   Luigi Serra   search feature
92
93
          }

  

8a0bbd62   Luigi Serra   updates
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
          .button-container{

              color: #fff;

              box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);

  

              position: relative;

          }

  

          .button-container:hover{

              color: #fff;

              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;

              cursor: pointer;

          }

  

          .button-container::before{

              position: absolute;

              content: '';

              top: 0;

              left: 0;

              width: 100%;

              height: 100%;

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

          }

  

  

          .button-container:hover::before{

              background-color: rgba(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;

          }

67b280f4   Luigi Serra   search feature
131
  

f748e9cf   Luigi Serra   new controllet an...
132
133
134
135
136
137
138
139
  

      </style>

  

      <template>

          <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">

              <neon-animatable><div id="hidden"></div></neon-animatable>

              <neon-animatable>

                  <paper-material elevation="3" id="window" class="window">

67b280f4   Luigi Serra   search feature
140
                      <paper-toolbar id="toolbar">

31d9a4f6   Luigi Serra   updates
141
                          <search-panel-controllet id="search_from_animated_button_container"></search-panel-controllet>

772d3de9   Luigi Serra   updates
142
                          <paper-fab id="close" mini icon="close" on-click="_onCloseClick"></paper-fab>

67b280f4   Luigi Serra   search feature
143
                      </paper-toolbar>

f748e9cf   Luigi Serra   new controllet an...
144
145
146
147
148
                     <div id="container_content"><content></content></div>

                  </paper-material>

              </neon-animatable>

          </neon-animated-pages>

  

d7a7f8a4   Luigi Serra   updates
149
          <div class="horizontal layout">

8a0bbd62   Luigi Serra   updates
150
151
152
153
              <!--<paper-fab mini icon="{{icon}}" id="open" on-click="_onOpenClick"></paper-fab>-->

             <span class="button-container" id="open" on-click="_onOpenClick">

                <iron-icon id="button" icon="{{icon}}"></iron-icon>

             </span>

67b280f4   Luigi Serra   search feature
154
             <div id="selected_item"></div>

f748e9cf   Luigi Serra   new controllet an...
155
156
157
158
          </div>

  

      </template>

  

31d9a4f6   Luigi Serra   updates
159
160
      <script type="text/javascript" src="../shared_js/perfect-scrollbar/js/perfect-scrollbar.jquery.js"></script>

  

67b280f4   Luigi Serra   search feature
161
      <script>

f748e9cf   Luigi Serra   new controllet an...
162
  

67b280f4   Luigi Serra   search feature
163
          Polymer({

f748e9cf   Luigi Serra   new controllet an...
164
  

67b280f4   Luigi Serra   search feature
165
              is: 'animated-button-container-controllet',

f748e9cf   Luigi Serra   new controllet an...
166
  

67b280f4   Luigi Serra   search feature
167
              listeners:{

31d9a4f6   Luigi Serra   updates
168
                  'animated-button-container-controllet_element-selected' : '_elementSelected',

67b280f4   Luigi Serra   search feature
169
170
                  'search-panel-controllet_content-changed' : '_handleSearch'

              },

f748e9cf   Luigi Serra   new controllet an...
171
  

67b280f4   Luigi Serra   search feature
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
              properties: {

                  selected : {

                      type  : Number,

                      value : 0

                  },

                  height:{

                      type: String,

                      value: "30vh"

                  },

                  width:{

                      type: String,

                      value: "30vh"

                  },

                  entryAnimation : {

                      type  : String,

                      value : ""

                  },

31d9a4f6   Luigi Serra   updates
189
190
191
192
193
194
                  icon:{

                      type: String,

                      value: "assessment"

                  },

                  iconHeight:{

                      type: String,

d7a7f8a4   Luigi Serra   updates
195
                      value: "36"

31d9a4f6   Luigi Serra   updates
196
197
198
                  },

                  iconWidth:{

                      type: String,

d7a7f8a4   Luigi Serra   updates
199
                      value: "36"

31d9a4f6   Luigi Serra   updates
200
                  },

8a0bbd62   Luigi Serra   updates
201
202
203
204
205
                  backgroundButtonColor:{

                      type: String,

                      value: undefined

  

                  },

67b280f4   Luigi Serra   search feature
206
207
208
                  exitAnimation  : {

                      type  : String,

                      value : ""

31d9a4f6   Luigi Serra   updates
209
210
211
212
                  },

                  searchFunction: {

                      type: String,

                      notify: true

67b280f4   Luigi Serra   search feature
213
214
                  }

              },

f748e9cf   Luigi Serra   new controllet an...
215
  

67b280f4   Luigi Serra   search feature
216
217
218
219
              ready: function(){

                  this.$.window.style.height = this.height + "vh";

                  this.$.window.style.width  = (this.width - 0.5) + "vw";

                  this.$.close.style.left    = (this.width - 3.5) + "vw";

31d9a4f6   Luigi Serra   updates
220
221
222
223
  

                  this.$.container_content.style.height = (this.height - (22 * 0.65)) + "vh";

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

  

8a0bbd62   Luigi Serra   updates
224
225
226
227
228
                  this.$.open.style.height           = this.iconHeight + "px";

                  this.$.open.style.width            = this.iconWidth  + "px";

                  this.$.open.style.backgroundColor  = this.backgroundButtonColor;

                  this.$.button.style.width          = this.iconWidth  + "px";

                  this.$.button.style.height         = this.iconHeight + "px";

f748e9cf   Luigi Serra   new controllet an...
229
              },

67b280f4   Luigi Serra   search feature
230
231
232
233
234
  

              _onOpenClick: function() {

                  this.entryAnimation = 'fade-in-animation';

                  this.exitAnimation  = 'fade-out-animation';

                  this.selected = 1;

f748e9cf   Luigi Serra   new controllet an...
235
              },

67b280f4   Luigi Serra   search feature
236
237
238
239
240
  

              _onCloseClick: function(){

                  /*this.entryAnimation = 'fade-out-animation';

                  this.exitAnimation  = 'fade-in-animation';*/

                  this.selected = 0;

f748e9cf   Luigi Serra   new controllet an...
241
              },

67b280f4   Luigi Serra   search feature
242
243
244
245
  

              _elementSelected: function(e){

                  this.$.selected_item.innerHTML = "";

                  this.$.selected_item.appendChild(e.detail.selectedElement);

f748e9cf   Luigi Serra   new controllet an...
246
              },

67b280f4   Luigi Serra   search feature
247
              _handleSearch: function(e){

31d9a4f6   Luigi Serra   updates
248
249
250
251
252
253
254
255
                  if(this.$.container_content.children[0]._handleSearch != undefined) {

                      this.$.container_content.children[0]._handleSearch(e);

                  }else{

                      if(this.searchFunction != undefined){

                          this.searchFunction = new Function('e','return '+ this.searchFunction);

                          this.searchFunction(e);

                      }

                  }

f748e9cf   Luigi Serra   new controllet an...
256
              }

f748e9cf   Luigi Serra   new controllet an...
257
  

67b280f4   Luigi Serra   search feature
258
          });

f748e9cf   Luigi Serra   new controllet an...
259
  

67b280f4   Luigi Serra   search feature
260
261
      </script>

  </dom-module>