Commit c6c46c29767031f9121dee179602c435aa8dd909
1 parent
c690081a
Exists in
master
and in
4 other branches
Set textarea of 'make-proposal-form' as required
Showing
2 changed files
with
10 additions
and
3 deletions
Show diff stats
index.html
@@ -273,8 +273,8 @@ | @@ -273,8 +273,8 @@ | ||
273 | <form class="make-proposal-form save-article-form require-login hide" id="make-proposal-form-{{id}}" action="{{proposal_action ../article . }}" method="post"> | 273 | <form class="make-proposal-form save-article-form require-login hide" id="make-proposal-form-{{id}}" action="{{proposal_action ../article . }}" method="post"> |
274 | <div class="message hide"></div> | 274 | <div class="message hide"></div> |
275 | <div> | 275 | <div> |
276 | - <div><label for="article_abstract">Descrição</label></div> | ||
277 | - <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Descrição" maxlength="200" required></textarea> | 276 | + <div><label for="article_abstract">Descrição <span title="Campo obrigatório.">(*)</span></label></div> |
277 | + <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Escreva sua proposta aqui." maxlength="200" required></textarea> | ||
278 | </div> | 278 | </div> |
279 | <input type="hidden" id="type" name="article[type]" value="ProposalsDiscussionPlugin::Proposal"> | 279 | <input type="hidden" id="type" name="article[type]" value="ProposalsDiscussionPlugin::Proposal"> |
280 | <input type="hidden" id="content_type" name="content_type" value="ProposalsDiscussionPlugin::Proposal"> | 280 | <input type="hidden" id="content_type" name="content_type" value="ProposalsDiscussionPlugin::Proposal"> |
js/main.js
@@ -1292,9 +1292,16 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -1292,9 +1292,16 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
1292 | // var proposal_id = this.id.split('-').pop(); | 1292 | // var proposal_id = this.id.split('-').pop(); |
1293 | // var form = this; | 1293 | // var form = this; |
1294 | var $form = $(this); | 1294 | var $form = $(this); |
1295 | + var $description = $form.find('#article_abstract'); | ||
1296 | + var $message = $form.find('.message'); | ||
1295 | 1297 | ||
1298 | + // validation | ||
1299 | + if( $description.text().length === 0 ){ | ||
1300 | + $message.text('O campo "descrição" é obrigatório.'); | ||
1301 | + return false; | ||
1302 | + } | ||
1303 | + | ||
1296 | // reset messages | 1304 | // reset messages |
1297 | - var $message = $form.find('.message'); | ||
1298 | $message.hide(); | 1305 | $message.hide(); |
1299 | $message.text(''); | 1306 | $message.text(''); |
1300 | 1307 |