Commit 5177e544c85aeef1c6cc8d50df389a191057f046
Exists in
master
and in
6 other branches
Merge branch 'social_share'
Showing
3 changed files
with
43 additions
and
0 deletions
Show diff stats
index.html
| 1 | +<!DOCTYPE html> | |
| 1 | 2 | <html lang="pt-br"> |
| 2 | 3 | <head> |
| 3 | 4 | <meta charset="utf-8" /> |
| ... | ... | @@ -5,6 +6,7 @@ |
| 5 | 6 | |
| 6 | 7 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 7 | 8 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 9 | + <meta property="og:title" content="Dialoga Brasil" /> | |
| 8 | 10 | |
| 9 | 11 | <script type="text/javascript"> |
| 10 | 12 | /** |
| ... | ... | @@ -74,6 +76,16 @@ |
| 74 | 76 | |
| 75 | 77 | </head> |
| 76 | 78 | <body> |
| 79 | + <div id="fb-root"></div> | |
| 80 | + <script>(function(d, s, id) { | |
| 81 | + var js, fjs = d.getElementsByTagName(s)[0]; | |
| 82 | + if (d.getElementById(id)) return; | |
| 83 | + js = d.createElement(s); js.id = id; | |
| 84 | + js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.3&appId=301018783382906"; | |
| 85 | + fjs.parentNode.insertBefore(js, fjs); | |
| 86 | + }(document, 'script', 'facebook-jssdk'));</script> | |
| 87 | + | |
| 88 | + | |
| 77 | 89 | <div class="container"> |
| 78 | 90 | <div id="proposal-result"></div> |
| 79 | 91 | </div> |
| ... | ... | @@ -83,6 +95,9 @@ |
| 83 | 95 | <header> |
| 84 | 96 | <h1><a href="#">{{article.title}}</a></h1> |
| 85 | 97 | <a id="display-contrast" href="#">Alto Contraste</a> |
| 98 | + <div class="social"> | |
| 99 | + <a href="#" class="fb-share" data-description="Aqui suas ideias viram propostas e você ajuda a melhorar as ações do governo">Compartilhar</a> | |
| 100 | + </div> | |
| 86 | 101 | </header> |
| 87 | 102 | |
| 88 | 103 | <div id="content"> |
| ... | ... | @@ -153,6 +168,9 @@ |
| 153 | 168 | {{/each}} |
| 154 | 169 | </ul> |
| 155 | 170 | |
| 171 | + <div class="social"> | |
| 172 | + <a href="#" class="fb-share" data-caption="{{title}}" data-description="{{stripTags abstract}}">Compartilhar</a> | |
| 173 | + </div> | |
| 156 | 174 | <div class="proposal-header"> |
| 157 | 175 | <div class="abstract"> |
| 158 | 176 | <img src="{{../host}}{{image.url}}" alt="Imagem de apresentação do programa."/> |
| ... | ... | @@ -263,6 +281,9 @@ |
| 263 | 281 | <a href="#" class="skip">Pular</a> |
| 264 | 282 | <a href="#" class="vote-result">Resultados</a> |
| 265 | 283 | </div> |
| 284 | + <div class="social"> | |
| 285 | + <a href="#/programas/{{parent.id}}/propostas/{{id}}" class="fb-share" data-caption="{{parent.title}}" data-description="{{stripTags abstract}}">Compartilhar</a> | |
| 286 | + </div> | |
| 266 | 287 | </script> |
| 267 | 288 | |
| 268 | 289 | <script id="results" type="text/x-handlebars-template"> | ... | ... |
js/main.js
| ... | ... | @@ -58,6 +58,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | var article = data.articles[0]; |
| 61 | + var parentTitle = $('#proposal-item-'+topic_id).find('.proposal-header .title').text(); | |
| 62 | + article.parent = {id: topic_id, title: parentTitle}; | |
| 61 | 63 | $randomProposal.html(supportProposalTemplate(article)); |
| 62 | 64 | $body.off('click', '.vote-actions .skip'); |
| 63 | 65 | $body.on('click', '.vote-actions .skip', function(e) { |
| ... | ... | @@ -641,6 +643,23 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 641 | 643 | e.preventDefault(); |
| 642 | 644 | }); |
| 643 | 645 | |
| 646 | + $(document).on('click', '.social .fb-share', function(e) { | |
| 647 | + var link = $(this).attr('href'); | |
| 648 | + if(link==='#' || link ==='') { | |
| 649 | + link = window.location.href; | |
| 650 | + } else { | |
| 651 | + link = 'http:'+Url.addBaseUrl(link); | |
| 652 | + } | |
| 653 | + FB.ui({ | |
| 654 | + method: 'feed', | |
| 655 | + link: link, | |
| 656 | + name: $(this).data('name') || 'Dialoga Brasil', | |
| 657 | + caption: $(this).data('caption') || 'dialoga.gov.br', | |
| 658 | + description: $(this).data('description'), | |
| 659 | + }, function(response){}); | |
| 660 | + e.preventDefault(); | |
| 661 | + }); | |
| 662 | + | |
| 644 | 663 | $(document).on('click', '.new-user', function(e) { |
| 645 | 664 | var loginForm = $(this).parents('#login-form'); |
| 646 | 665 | loginForm.hide(); | ... | ... |