Commit 66b93e261b4a0600ee5f37666c2fce58a210da93

Authored by Victor Costa
1 parent c4dc7f55

Set textarea max length

Conflicts:

	index.html
index.html
... ... @@ -109,7 +109,7 @@
109 109 <div class="message"></div>
110 110 <div>
111 111 <div><label for="article_abstract">Descrição</label></div>
112   - <textarea id="article_abstract" name="article[abstract]" placeholder="Descrição"></textarea>
  112 + <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Descrição" maxlength="200"></textarea>
113 113 </div>
114 114 <input id='content_type' name='content_type' value='ProposalsDiscussionPlugin::Proposal' type='hidden'>
115 115 <input type='submit' id='make-proposal-button' class='make-proposal-button' name='make-proposal-button' value='Enviar'>
... ... @@ -142,7 +142,7 @@
142 142 <div class="message"></div>
143 143 <div>
144 144 <div><label for="article_abstract">Descrição</label></div>
145   - <textarea id="article_abstract" name="article[abstract]" placeholder="Descrição"></textarea>
  145 + <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Descrição" maxlength="200"></textarea>
146 146 </div>
147 147 <input id='content_type' name='content_type' value='ProposalsDiscussionPlugin::Story' type='hidden'>
148 148 <input type='submit' id='make-experience-button' class='make-experience-button' name='make-experience-button' value='Enviar'>
... ... @@ -239,6 +239,7 @@
239 239 <script src='js/handlebars-v3.0.1.js'></script>
240 240 <script src='js/handlebars-helpers.js'></script>
241 241 <script src='js/jquery.dotdotdot.min.js'></script>
  242 + <script src='js/jquery.maxlength.min.js'></script>
242 243 <script src='js/layout.js'></script>
243 244  
244 245 <script src='js/main.js'></script>
... ...
js/jquery.maxlength.min.js 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +/*
  2 + * jQuery Maxlength
  3 + * http://pioul.fr/jquery-maxlength
  4 + *
  5 + * Copyright 2013, Philippe Masset
  6 + * Dual licensed under the MIT or GPL Version 2 licenses
  7 + */
  8 +(function(a){a.fn.maxlength=function(b){var c=a(this);return c.each(function(){b=a.extend({},{counterContainer:!1,text:"%left characters left"},b);var c=a(this),d={options:b,field:c,counter:a('<div class="maxlength"></div>'),maxLength:parseInt(c.attr("maxlength"),10),lastLength:null,updateCounter:function(){var b=this.field.val().length,c=this.options.text.replace(/\B%(length|maxlength|left)\b/g,a.proxy(function(a,c){return"length"==c?b:"maxlength"==c?this.maxLength:this.maxLength-b},this));this.counter.html(c),b!=this.lastLength&&this.updateLength(b)},updateLength:function(a){this.field.trigger("update.maxlength",[this.field,this.lastLength,a,this.maxLength,this.maxLength-a]),this.lastLength=a}};d.maxLength&&(d.field.data("maxlength",d).bind({"keyup change":function(){a(this).data("maxlength").updateCounter()},"cut paste drop":function(){setTimeout(a.proxy(function(){a(this).data("maxlength").updateCounter()},this),1)}}),b.counterContainer?b.counterContainer.append(d.counter):d.field.after(d.counter),d.updateCounter())}),c}})(jQuery);
0 9 \ No newline at end of file
... ...
js/main.js
... ... @@ -38,6 +38,7 @@ $.getJSON(noosferoAPI)
38 38 data['private_token'] = private_token;
39 39 resultsPlaceholder.innerHTML = template(data);
40 40 $('.login-container').html(loginTemplate());
  41 + $('.countdown').maxlength({text: '%left caracteres restantes'});
41 42  
42 43 url = $(location).attr('href').split('#').pop();
43 44 if(url.match(/proposal-item-[0-9]+/)){
... ...
sass/_proposal_detail.scss
... ... @@ -237,7 +237,7 @@
237 237 border-color: $color;
238 238 }
239 239 textarea#article_abstract {
240   - height: 205px;
  240 + height: 15%;
241 241 }
242 242 .container-button a, input[type=submit], .success-proposal-sent a {
243 243 font-weight: bolder;
... ... @@ -520,6 +520,13 @@
520 520  
521 521 }
522 522 }
  523 + .save-article-form {
  524 + .maxlength {
  525 + text-align: right;
  526 + margin-right: 36px;
  527 + font-size: 12px;
  528 + }
  529 + }
523 530 }
524 531  
525 532 // @media only screen and (max-device-width: 480px) {
... ... @@ -656,4 +663,4 @@
656 663 min-height: 0 !important;
657 664 }
658 665 }
659   -}
660 666 \ No newline at end of file
  667 +}
... ...