Commit a99f3231a61e588cd7ec8422a264962e82d678f6
Exists in
master
and in
10 other branches
Merge branch 'master' of https://gitlab.com/participa/proposal-app
Showing
5 changed files
with
27 additions
and
5 deletions
Show diff stats
index.html
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 | <div class="message"></div> |
111 | 111 | <div> |
112 | 112 | <div><label for="article_abstract">Descrição</label></div> |
113 | - <textarea id="article_abstract" name="article[abstract]" placeholder="Descrição"></textarea> | |
113 | + <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Descrição" maxlength="200"></textarea> | |
114 | 114 | </div> |
115 | 115 | <input id='content_type' name='content_type' value='ProposalsDiscussionPlugin::Proposal' type='hidden'> |
116 | 116 | <input type='submit' id='make-proposal-button' class='make-proposal-button' name='make-proposal-button' value='Enviar'> |
... | ... | @@ -143,7 +143,7 @@ |
143 | 143 | <div class="message"></div> |
144 | 144 | <div> |
145 | 145 | <div><label for="article_abstract">Descrição</label></div> |
146 | - <textarea id="article_abstract" name="article[abstract]" placeholder="Descrição"></textarea> | |
146 | + <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Descrição" maxlength="200"></textarea> | |
147 | 147 | </div> |
148 | 148 | <input id='content_type' name='content_type' value='ProposalsDiscussionPlugin::Story' type='hidden'> |
149 | 149 | <input type='submit' id='make-experience-button' class='make-experience-button' name='make-experience-button' value='Enviar'> |
... | ... | @@ -178,7 +178,7 @@ |
178 | 178 | </script> |
179 | 179 | |
180 | 180 | <script id='support-proposal-template' type='text/x-handlebars-template'> |
181 | - <div class='abstract'><p>"{{abstract}}"</p></div> | |
181 | + <div class='abstract'><p>"{{trimString abstract 200}}"</p></div> | |
182 | 182 | <div class="vote-actions"> |
183 | 183 | <a href="#" class="like dislike" data-vote-value="-1"></a> |
184 | 184 | <a href="#" class="like" data-vote-value="1"></a> |
... | ... | @@ -240,6 +240,7 @@ |
240 | 240 | <script src='js/handlebars-v3.0.1.js'></script> |
241 | 241 | <script src='js/handlebars-helpers.js'></script> |
242 | 242 | <script src='js/jquery.dotdotdot.min.js'></script> |
243 | + <script src='js/jquery.maxlength.min.js'></script> | |
243 | 244 | <script src='js/layout.js'></script> |
244 | 245 | |
245 | 246 | <script src='js/main.js'></script> | ... | ... |
js/handlebars-helpers.js
... | ... | @@ -68,6 +68,11 @@ Handlebars.registerHelper('select_proposal', function(proposals, category_slug, |
68 | 68 | return ret; |
69 | 69 | }); |
70 | 70 | |
71 | +Handlebars.registerHelper('trimString', function(passedString, endstring) { | |
72 | + var theString = passedString.substring(0, endstring); | |
73 | + return new Handlebars.SafeString(theString) | |
74 | +}); | |
75 | + | |
71 | 76 | function proposal_has_category(proposal, category_slug) { |
72 | 77 | for(var i=0; i<proposal.categories.length; i++) { |
73 | 78 | if(proposal.categories[i].slug == category_slug) | ... | ... |
... | ... | @@ -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 | +} | ... | ... |