Blame view

controllets/create-card-controllet/create-card-controllet.html 7.34 KB
28265108   Renato De Donato   new link-text con...
1
2
  <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'>

bf28e75e   Luigi Serra   selection control...
3
  

28265108   Renato De Donato   new link-text con...
4
5
6
7
8
9
10
11
12
13
14
15
16
  <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-input/paper-input.html">

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

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

  

  <!--per la lingua inportare nell' HEADER-->

  <!--<link rel="localization" href="locales/{ln}.l20n">-->

  <!--<script defer src="/dist/compat/web/l20n.js"></script>-->

  <!--<card_Info "BASE INFO">-->

  <!--<card_Text "TEXT">-->

  <!--<card_Link "LINK">-->

  <!--<card_Preview "PREVIEW">-->

49cc918f   Luigi Serra   selection control...
17
  

bf28e75e   Luigi Serra   selection control...
18
19
20
  <dom-module id="create-card-controllet">

  

      <template>

28265108   Renato De Donato   new link-text con...
21
22
23
24
25
  

          <style is="custom-style">

              #create_card_container {

                  display: flex;

                  height: 100%;

49cc918f   Luigi Serra   selection control...
26
                  width: 100%;

bf28e75e   Luigi Serra   selection control...
27
  

28265108   Renato De Donato   new link-text con...
28
29
                  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;

                  font-size: 16px;

bf28e75e   Luigi Serra   selection control...
30
31
              }

  

28265108   Renato De Donato   new link-text con...
32
33
34
35
              #create_card_info {

                  height: calc(100% - 16px);

                  width: 50%;

                  margin: 8px 16px 8px 8px;

bf28e75e   Luigi Serra   selection control...
36
37
              }

  

28265108   Renato De Donato   new link-text con...
38
39
40
41
              #create_card_content {

                  height: calc(100% - 16px);

                  width: 50%;

                  margin: 8px 8px 8px 16px;

bf28e75e   Luigi Serra   selection control...
42
43
              }

  

28265108   Renato De Donato   new link-text con...
44
45
46
47
              .input_header {

                  height: 32px;

                  padding-top: 16px;

                  background-color: #B6B6B6;

bf28e75e   Luigi Serra   selection control...
48
                  text-align: center;

28265108   Renato De Donato   new link-text con...
49
                  font-weight: 700;

bf28e75e   Luigi Serra   selection control...
50
51
              }

  

28265108   Renato De Donato   new link-text con...
52
53
              p {

                  margin: 16px 8px 0px 8px;

bf28e75e   Luigi Serra   selection control...
54
55
              }

  

28265108   Renato De Donato   new link-text con...
56
              #create_card_title {

bf28e75e   Luigi Serra   selection control...
57
                  font-weight: bold;

28265108   Renato De Donato   new link-text con...
58
59
                  color: #2196F3;

                  text-align: center;

bf28e75e   Luigi Serra   selection control...
60
61
              }

  

28265108   Renato De Donato   new link-text con...
62
63
64
65
              #create_card_description {

                  font-style: italic;

                  color: #727272;

                  text-align: center;

bf28e75e   Luigi Serra   selection control...
66
67
              }

  

28265108   Renato De Donato   new link-text con...
68
69
              #create_card_text {

  

bf28e75e   Luigi Serra   selection control...
70
71
              }

  

28265108   Renato De Donato   new link-text con...
72
73
74
75
76
              paper-input, paper-textarea {

                  height: 48px;

                  width: calc(100% - 16px);

                  margin: 0px 0px 8px 8px;

                  --paper-input-container-focus-color: #2196F3;

49cc918f   Luigi Serra   selection control...
77
              }

bf28e75e   Luigi Serra   selection control...
78
  

28265108   Renato De Donato   new link-text con...
79
80
81
82
83
84
85
86
87
88
89
              paper-button {

                  position: absolute;

                  bottom: 16px;

                  right: 11px;

  

                  height: 48px;

                  width: 172px;

                  background-color: #00BCD4;

                  color: white;

                  font-weight: 700;

                  padding: 16px;

7c6897cd   Luigi Serra   controllets and b...
90
91
              }

  

28265108   Renato De Donato   new link-text con...
92
93
94
95
96
97
              paper-button:hover {

                  background-color: #00AABF;

  

                  box-shadow: 0px 8px 12px #888;

                  -webkit-box-shadow: 0px 8px 12px #888;

                  -moz-box-shadow: 0px 8px 12px #888;

7c6897cd   Luigi Serra   controllets and b...
98
99
              }

  

28265108   Renato De Donato   new link-text con...
100
101
              paper-button[disabled] {

                  background-color: #B6B6B6;

c76a9f85   Luigi Serra   card and controll...
102
              }

28265108   Renato De Donato   new link-text con...
103
          </style>

c76a9f85   Luigi Serra   card and controll...
104
  

28265108   Renato De Donato   new link-text con...
105
          <div id="create_card_container">

bf28e75e   Luigi Serra   selection control...
106
  

28265108   Renato De Donato   new link-text con...
107
108
              <paper-material id="create_card_info" elevation="5">

                  <div class="input_header">BASE INFO</div>

bf28e75e   Luigi Serra   selection control...
109
  

28265108   Renato De Donato   new link-text con...
110
                  <paper-input value="{{title}}" maxlength="32" label="title"></paper-input>

bf28e75e   Luigi Serra   selection control...
111
  

28265108   Renato De Donato   new link-text con...
112
113
114
                  <paper-input value="{{description}}" maxlength="100" label="description"></paper-input>

  

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

bf28e75e   Luigi Serra   selection control...
115
  

28265108   Renato De Donato   new link-text con...
116
                      <div class="input_header" style="margin-top: 16px;">LINK</div>

bf28e75e   Luigi Serra   selection control...
117
  

28265108   Renato De Donato   new link-text con...
118
119
120
121
122
123
124
125
126
127
                      <paper-input

                              id="create_card_link"

                              value="{{link}}"

                              label="link"

                              auto-validate

                              pattern="^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$"

                              error-message="Invalid link">

                      </paper-input>

  

                  </template>

bf28e75e   Luigi Serra   selection control...
128
  

28265108   Renato De Donato   new link-text con...
129
                  <template is="dom-if" if="{{_checkType(type, 'text')}}">

bf28e75e   Luigi Serra   selection control...
130
  

28265108   Renato De Donato   new link-text con...
131
                      <div class="input_header" style="margin-top: 16px;">TEXT</div>

49cc918f   Luigi Serra   selection control...
132
  

28265108   Renato De Donato   new link-text con...
133
                      <paper-textarea value="{{text}}" label="text"></paper-textarea>

49cc918f   Luigi Serra   selection control...
134
135
  

                  </template>

bf28e75e   Luigi Serra   selection control...
136
  

28265108   Renato De Donato   new link-text con...
137
138
                  <paper-button id="add_button" raised on-click="_addCard">SAVE</paper-button>

              </paper-material>

bf28e75e   Luigi Serra   selection control...
139
  

28265108   Renato De Donato   new link-text con...
140
141
              <paper-material id="create_card_content" elevation="5">

                  <div class="input_header">PREVIEW</div>

49cc918f   Luigi Serra   selection control...
142
  

28265108   Renato De Donato   new link-text con...
143
                  <template is="dom-if" if="{{_checkType(type, 'link')}}">

49cc918f   Luigi Serra   selection control...
144
  

28265108   Renato De Donato   new link-text con...
145
                      <iframe id="create_card_iframe"></iframe>

49cc918f   Luigi Serra   selection control...
146
  

28265108   Renato De Donato   new link-text con...
147
148
149
                  </template>

  

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

49cc918f   Luigi Serra   selection control...
150
  

28265108   Renato De Donato   new link-text con...
151
152
153
                      <p id ="create_card_title">{{title}}</p>

                      <p id ="create_card_description">{{description}}</p>

                      <p id ="create_card_text">{{text}}</p>

49cc918f   Luigi Serra   selection control...
154
  

28265108   Renato De Donato   new link-text con...
155
                  </template>

49cc918f   Luigi Serra   selection control...
156
  

28265108   Renato De Donato   new link-text con...
157
              </paper-material>

bf28e75e   Luigi Serra   selection control...
158
159
160
161
162
  

          </div>

  

      </template>

  

bf28e75e   Luigi Serra   selection control...
163
164
165
166
167
168
      <script>

          Polymer({

              is: "create-card-controllet",

              properties: {

                  type:{

                      type: String,

28265108   Renato De Donato   new link-text con...
169
                      value: undefined//text or link

49cc918f   Luigi Serra   selection control...
170
171
                  },

  

28265108   Renato De Donato   new link-text con...
172
                  title:{//cardTitle

49cc918f   Luigi Serra   selection control...
173
                      type: String,

28265108   Renato De Donato   new link-text con...
174
                      value: ""

037d8ec8   Luigi Serra   selection control...
175
                  },

28265108   Renato De Donato   new link-text con...
176
177
  

                  description:{//comment

49cc918f   Luigi Serra   selection control...
178
                      type: String,

28265108   Renato De Donato   new link-text con...
179
                      value: ""

49cc918f   Luigi Serra   selection control...
180
                  },

28265108   Renato De Donato   new link-text con...
181
182
  

                  text:{

49cc918f   Luigi Serra   selection control...
183
                      type: String,

28265108   Renato De Donato   new link-text con...
184
                      value: ""

037d8ec8   Luigi Serra   selection control...
185
186
                  },

  

28265108   Renato De Donato   new link-text con...
187
188
189
190
                  link:{

                      type: String,

                      value: "",

                      observer : '_load'

bf28e75e   Luigi Serra   selection control...
191
                  }

28265108   Renato De Donato   new link-text con...
192
  

bf28e75e   Luigi Serra   selection control...
193
194
              },

  

28265108   Renato De Donato   new link-text con...
195
196
197
              ready : function() {

                  $(this.$.create_card_info).perfectScrollbar();

                  $(this.$.create_card_content).perfectScrollbar();

172c4387   Luigi Serra   controllets and b...
198
  

28265108   Renato De Donato   new link-text con...
199
200
                  var that = this;

                  window.addEventListener("resize", function() { that._resize(); });

bf28e75e   Luigi Serra   selection control...
201
202
              },

  

28265108   Renato De Donato   new link-text con...
203
204
              attached : function() {

                  this.async(function(){this._load();},100);

bf28e75e   Luigi Serra   selection control...
205
206
              },

  

28265108   Renato De Donato   new link-text con...
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
              _load : function() {

                  var link = this.$$("#create_card_link");

                  var iframe = this.$$("#create_card_iframe");

  

                  if(link){

                      var value = link.value;

  

                      if (value.indexOf("http") != 0)

                          value = "http://" + value;

  

                      if(!link.invalid && value.length > 16) {

                          iframe.setAttribute("src", value);

                          this._resize();

                      }

                  }

037d8ec8   Luigi Serra   selection control...
222
223
              },

  

28265108   Renato De Donato   new link-text con...
224
225
226
              _checkType: function(type, check){

                  return (type == check);

              },

037d8ec8   Luigi Serra   selection control...
227
  

28265108   Renato De Donato   new link-text con...
228
229
230
              _addCard: function(){

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

              },

037d8ec8   Luigi Serra   selection control...
231
  

28265108   Renato De Donato   new link-text con...
232
233
234
              _resize : function(){

                  var h = $("#create_card_info").height() -64;

                  $("#create_card_iframe").height(h);

bf28e75e   Luigi Serra   selection control...
235
              }

28265108   Renato De Donato   new link-text con...
236
  

bf28e75e   Luigi Serra   selection control...
237
238
239
240
          })

      </script>

  

  </dom-module>