Commit 53178346b07234be1eb41417805ccd88d9470d0a
Exists in
master
and in
6 other branches
Merge branch 'master' of gitlab.com:participa/proposal-app
Showing
3 changed files
with
18 additions
and
11 deletions
Show diff stats
index.html
... | ... | @@ -297,7 +297,7 @@ |
297 | 297 | </div> |
298 | 298 | <div class="social"> |
299 | 299 | <span>Compartilhe esta proposta</span> |
300 | - {{#social_share parent.title abstract "#/programas/{{parent.id}}/propostas/{{id}}"}}{{/social_share}} | |
300 | + {{{social_share parent.title abstract (proposal_url parent.id id)}}} | |
301 | 301 | </div> |
302 | 302 | </script> |
303 | 303 | |
... | ... | @@ -384,10 +384,10 @@ |
384 | 384 | |
385 | 385 | <script id="social-share" type="text/x-handlebars-template"> |
386 | 386 | <ul> |
387 | - <li><a href="#/programas/{{parent.id}}/propostas/{{id}}" class="fb-share icon icon-facebook" data-caption="{{parent.title}}" data-description="{{stripTags abstract}}">Compartilhar no Facebook</a></li> | |
388 | - <li><a href="https://twitter.com/intent/tweet?text={{stripTags abstract}}" class="tw-share icon icon-twitter popup">Compartilhar no Twitter</a></li> | |
389 | - <li><a href="https://plus.google.com/share?url=http://dialoga.gov.br" class="gp-share icon icon-gplus popup">Compartilhar no Google Plus</a></li> | |
390 | - <li><a class="ws-share disabled icon icon-whatsapp">Compartilhar no WhatsApp</a></li> | |
387 | + <li><a href="{{url}}" class="fb-share icon icon-facebook" data-caption="{{title}}" data-description="{{stripTags description}}">Compartilhar no Facebook</a></li> | |
388 | + <li><a href="https://twitter.com/intent/tweet?url={{encodeURI url}}&text={{stripTags description}}" class="tw-share icon icon-twitter popup">Compartilhar no Twitter</a></li> | |
389 | + <li><a href="https://plus.google.com/share?url={{encodeURI url}}" class="gp-share icon icon-gplus popup">Compartilhar no Google Plus</a></li> | |
390 | + <li><a href="whatsapp://send?text={{stripTags description}}" class="ws-share icon icon-whatsapp">Compartilhar no WhatsApp</a></li> | |
391 | 391 | </ul> |
392 | 392 | </script> |
393 | 393 | ... | ... |
js/handlebars-helpers.js
... | ... | @@ -96,7 +96,19 @@ define(['handlebars'], function(Handlebars){ |
96 | 96 | |
97 | 97 | Handlebars.registerHelper('social_share', function(title, description, url) { |
98 | 98 | var template = Handlebars.compile($('#social-share').html()); |
99 | - return template(); | |
99 | + if(url==='#') { | |
100 | + url = ''; | |
101 | + } | |
102 | + url = 'http:'+Url.addBaseUrl(url); | |
103 | + return template({title: title, description: description, url: url}); | |
104 | + }); | |
105 | + | |
106 | + Handlebars.registerHelper('proposal_url', function(parent_id, id) { | |
107 | + return "#/programas/"+parent_id+"/propostas/"+id; | |
108 | + }); | |
109 | + | |
110 | + Handlebars.registerHelper('encodeURI', function(uri) { | |
111 | + return encodeURIComponent(uri); | |
100 | 112 | }); |
101 | 113 | |
102 | 114 | function proposal_has_category(proposal, category_slug) { | ... | ... |
js/main.js
... | ... | @@ -675,11 +675,6 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
675 | 675 | |
676 | 676 | $(document).on('click', '.social .fb-share', function(e) { |
677 | 677 | var link = $(this).attr('href'); |
678 | - if(link==='#' || link ==='') { | |
679 | - link = window.location.href; | |
680 | - } else { | |
681 | - link = 'http:'+Url.addBaseUrl(link); | |
682 | - } | |
683 | 678 | FB.ui({ |
684 | 679 | method: 'feed', |
685 | 680 | link: link, | ... | ... |