Commit 5fe845d59c227527d925d4443af12dfbb7fb1072

Authored by Victor Costa
1 parent d46c4af2

Remove title attribute from article form

Showing 2 changed files with 11 additions and 9 deletions   Show diff stats
index.html
... ... @@ -91,10 +91,6 @@
91 91 <div class="login-container hide">Login</div>
92 92 <form class='make-proposal-form save-article-form hide' id='make-proposal-form-{{id}}'>
93 93 <div class="message"></div>
94   - <div class="name">
95   - <div><label>Título</label></div>
96   - <input id="article_name" name="article[name]" type="text" placeholder="Título">
97   - </div>
98 94 <div>
99 95 <div><label>Descrição</label></div>
100 96 <textarea id="article_abstract" name="article[abstract]" placeholder="Descrição"></textarea>
... ... @@ -126,10 +122,6 @@
126 122 <div class="login-container hide">Login</div>
127 123 <form class='make-experience-form save-article-form hide' id='make-experience-form-{{id}}'>
128 124 <div class="message"></div>
129   - <div class="name">
130   - <div><label>Título</label></div>
131   - <input id="article_name" name="article[name]" type="text" placeholder="Título">
132   - </div>
133 125 <div>
134 126 <div><label>Descrição</label></div>
135 127 <textarea id="article_abstract" name="article[abstract]" placeholder="Descrição"></textarea>
... ...
js/main.js
... ... @@ -113,7 +113,7 @@ $.getJSON(noosferoAPI)
113 113 $.ajax({
114 114 type: 'post',
115 115 url: host + '/api/v1/articles/' + proposal_id + '/children',
116   - data: $('#'+this.id).serialize() + "&private_token="+private_token+"&fields=id"
  116 + data: $('#'+this.id).serialize() + "&private_token="+private_token+"&fields=id&article[name]=article_"+guid()
117 117 })
118 118 .done(function( data ) {
119 119 form.reset();
... ... @@ -204,3 +204,13 @@ jQuery(document).ready(function($) {
204 204 e.preventDefault();
205 205 });
206 206 });
  207 +
  208 +function guid() {
  209 + function s4() {
  210 + return Math.floor((1 + Math.random()) * 0x10000)
  211 + .toString(16)
  212 + .substring(1);
  213 + }
  214 + return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
  215 + s4() + '-' + s4() + s4() + s4();
  216 +}
... ...