Commit a43674418b005c017c1b2430d1508c1b7b759661

Authored by Victor Costa
1 parent e647b0d2

Change api endpoit to suggest proposals

Showing 2 changed files with 5 additions and 4 deletions   Show diff stats
index.html
... ... @@ -170,13 +170,13 @@
170 170 <div class="info">Ela se tornará pública em até 24 horas após o envio e poderá ser apoiada por outros participantes.</div>
171 171 <div class="send-proposal-button send-button"><a href="#"><span>Envie Sua Proposta</span></a></div>
172 172 <div class="login-container hide">Login</div>
173   - <form class="make-proposal-form save-article-form hide" id="make-proposal-form-{{id}}">
  173 + <form class="make-proposal-form save-article-form hide" id="make-proposal-form-{{id}}" action="/api/v1/articles/{{id}}/children/suggest">
174 174 <div class="message hide"></div>
175 175 <div>
176 176 <div><label for="article_abstract">Descrição</label></div>
177 177 <textarea id="article_abstract" class="countdown" name="article[abstract]" placeholder="Descrição" maxlength="200"></textarea>
178 178 </div>
179   - <input type="hidden" id="content_type" name="content_type" value="ProposalsDiscussionPlugin::Proposal">
  179 + <input type="hidden" id="type" name="article[type]" value="ProposalsDiscussionPlugin::Proposal">
180 180 <input type="submit" id="make-proposal-button" name="make-proposal-button" class="make-proposal-button" value="Enviar">
181 181 </form>
182 182 <div class="success-proposal-sent success-sent hide send-button">
... ... @@ -203,7 +203,7 @@
203 203 <p>Esta história pode nos ajudar a melhorar a nossa ação e não será divulgada.</p>
204 204 <div class="send-experience-button send-button"><a href="#"><span>Envie Sua Experiência</span></a></div>
205 205 <div class="login-container hide">Login</div>
206   - <form class="make-experience-form save-article-form hide" id="make-experience-form-{{id}}">
  206 + <form class="make-experience-form save-article-form hide" id="make-experience-form-{{id}}" action="/api/v1/articles/{{id}}/children">
207 207 <div class="message hide"></div>
208 208 <div>
209 209 <div>
... ...
js/main.js
... ... @@ -167,7 +167,7 @@ define([&#39;handlebars&#39;], function(Handlebars){
167 167 message.text('');
168 168 $.ajax({
169 169 type: 'post',
170   - url: host + '/api/v1/articles/' + proposal_id + '/children',
  170 + url: host + $form.attr('action'),
171 171 data: $('#'+this.id).serialize() + '&private_token=' + private_token + '&fields=id&article[name]=article_' + guid()
172 172 })
173 173 .done(function( /*data*/ ) {
... ... @@ -338,6 +338,7 @@ define([&#39;handlebars&#39;], function(Handlebars){
338 338 .toString(16)
339 339 .substring(1);
340 340 }
  341 + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
341 342 }
342 343  
343 344 function display_category_tab(){
... ...