Blame view

controllets/create-card-controllet/create-card-controllet.html 7.51 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
  <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">-->

c52e0307   Andrea Petta   refactoring
16
  <!--<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
              p {

b4190b56   Renato De Donato   myspace update
53
54
55
56
57
58
59
60
                  padding: 16px 0px 0px 8px;

                  margin: 0px;

              }

  

              #create_card_text {

                  width: 100%;

                  height: 100%;

                  background-color: #FFFFCC;

bf28e75e   Luigi Serra   selection control...
61
62
              }

  

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

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

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

                  text-align: center;

bf28e75e   Luigi Serra   selection control...
67
68
              }

  

28265108   Renato De Donato   new link-text con...
69
70
71
              #create_card_description {

                  font-style: italic;

                  color: #727272;

bf28e75e   Luigi Serra   selection control...
72
73
              }

  

28265108   Renato De Donato   new link-text con...
74
75
76
77
78
              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...
79
              }

bf28e75e   Luigi Serra   selection control...
80
  

28265108   Renato De Donato   new link-text con...
81
82
83
84
85
86
87
88
89
90
91
              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...
92
93
              }

  

28265108   Renato De Donato   new link-text con...
94
95
96
97
98
99
              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...
100
101
              }

  

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

                  background-color: #B6B6B6;

c76a9f85   Luigi Serra   card and controll...
104
              }

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

c76a9f85   Luigi Serra   card and controll...
106
  

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

bf28e75e   Luigi Serra   selection control...
108
  

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

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

bf28e75e   Luigi Serra   selection control...
111
  

efa1bdf3   Andrea Petta   refactoring
112
                  <paper-input value="{{cardTitle}}" maxlength="32" label="title"></paper-input>

bf28e75e   Luigi Serra   selection control...
113
  

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

  

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

bf28e75e   Luigi Serra   selection control...
117
  

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

bf28e75e   Luigi Serra   selection control...
119
  

28265108   Renato De Donato   new link-text con...
120
121
122
123
124
125
126
127
128
129
                      <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...
130
  

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

bf28e75e   Luigi Serra   selection control...
132
  

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

49cc918f   Luigi Serra   selection control...
134
  

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

49cc918f   Luigi Serra   selection control...
136
137
  

                  </template>

bf28e75e   Luigi Serra   selection control...
138
  

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

              </paper-material>

bf28e75e   Luigi Serra   selection control...
141
  

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

b4190b56   Renato De Donato   myspace update
143
  

28265108   Renato De Donato   new link-text con...
144
                  <div class="input_header">PREVIEW</div>

49cc918f   Luigi Serra   selection control...
145
  

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

49cc918f   Luigi Serra   selection control...
147
  

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

49cc918f   Luigi Serra   selection control...
149
  

28265108   Renato De Donato   new link-text con...
150
151
152
                  </template>

  

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

49cc918f   Luigi Serra   selection control...
153
  

b4190b56   Renato De Donato   myspace update
154
155
156
157
158
                      <div id="create_card_text">

                          <p id ="create_card_title">{{cardTitle}}</p>

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

                          <p>{{text}}</p>

                      </div>

49cc918f   Luigi Serra   selection control...
159
  

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

49cc918f   Luigi Serra   selection control...
161
  

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

bf28e75e   Luigi Serra   selection control...
163
164
165
166
167
  

          </div>

  

      </template>

  

bf28e75e   Luigi Serra   selection control...
168
169
170
171
172
173
      <script>

          Polymer({

              is: "create-card-controllet",

              properties: {

                  type:{

                      type: String,

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

49cc918f   Luigi Serra   selection control...
175
176
                  },

  

efa1bdf3   Andrea Petta   refactoring
177
                  cardTitle:{

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

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

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

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

                  description:{//comment

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

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

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

28265108   Renato De Donato   new link-text con...
186
187
  

                  text:{

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

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

037d8ec8   Luigi Serra   selection control...
190
191
                  },

  

28265108   Renato De Donato   new link-text con...
192
193
194
195
                  link:{

                      type: String,

                      value: "",

                      observer : '_load'

bf28e75e   Luigi Serra   selection control...
196
                  }

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

bf28e75e   Luigi Serra   selection control...
198
199
              },

  

28265108   Renato De Donato   new link-text con...
200
201
202
              ready : function() {

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

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

172c4387   Luigi Serra   controllets and b...
203
  

28265108   Renato De Donato   new link-text con...
204
205
                  var that = this;

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

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

  

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

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

bf28e75e   Luigi Serra   selection control...
210
211
              },

  

28265108   Renato De Donato   new link-text con...
212
213
214
215
216
217
218
219
220
221
222
223
              _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);

b4190b56   Renato De Donato   myspace update
224
                          this.link = value;

28265108   Renato De Donato   new link-text con...
225
226
227
                          this._resize();

                      }

                  }

037d8ec8   Luigi Serra   selection control...
228
229
              },

  

28265108   Renato De Donato   new link-text con...
230
231
232
              _checkType: function(type, check){

                  return (type == check);

              },

037d8ec8   Luigi Serra   selection control...
233
  

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

efa1bdf3   Andrea Petta   refactoring
235
                  this.fire('create-card-controllet_data', {data : this});

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

037d8ec8   Luigi Serra   selection control...
237
  

28265108   Renato De Donato   new link-text con...
238
239
240
              _resize : function(){

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

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

bf28e75e   Luigi Serra   selection control...
241
              }

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

bf28e75e   Luigi Serra   selection control...
243
244
245
246
          })

      </script>

  

  </dom-module>