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 | <html lang="pt-br"> | 2 | <html lang="pt-br"> |
| 2 | <head> | 3 | <head> |
| 3 | <meta charset="utf-8" /> | 4 | <meta charset="utf-8" /> |
| @@ -5,6 +6,7 @@ | @@ -5,6 +6,7 @@ | ||
| 5 | 6 | ||
| 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 7 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 7 | <meta name="viewport" content="width=device-width, initial-scale=1"> | 8 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 9 | + <meta property="og:title" content="Dialoga Brasil" /> | ||
| 8 | 10 | ||
| 9 | <script type="text/javascript"> | 11 | <script type="text/javascript"> |
| 10 | /** | 12 | /** |
| @@ -74,6 +76,16 @@ | @@ -74,6 +76,16 @@ | ||
| 74 | 76 | ||
| 75 | </head> | 77 | </head> |
| 76 | <body> | 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 | <div class="container"> | 89 | <div class="container"> |
| 78 | <div id="proposal-result"></div> | 90 | <div id="proposal-result"></div> |
| 79 | </div> | 91 | </div> |
| @@ -83,6 +95,9 @@ | @@ -83,6 +95,9 @@ | ||
| 83 | <header> | 95 | <header> |
| 84 | <h1><a href="#">{{article.title}}</a></h1> | 96 | <h1><a href="#">{{article.title}}</a></h1> |
| 85 | <a id="display-contrast" href="#">Alto Contraste</a> | 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 | </header> | 101 | </header> |
| 87 | 102 | ||
| 88 | <div id="content"> | 103 | <div id="content"> |
| @@ -153,6 +168,9 @@ | @@ -153,6 +168,9 @@ | ||
| 153 | {{/each}} | 168 | {{/each}} |
| 154 | </ul> | 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 | <div class="proposal-header"> | 174 | <div class="proposal-header"> |
| 157 | <div class="abstract"> | 175 | <div class="abstract"> |
| 158 | <img src="{{../host}}{{image.url}}" alt="Imagem de apresentação do programa."/> | 176 | <img src="{{../host}}{{image.url}}" alt="Imagem de apresentação do programa."/> |
| @@ -263,6 +281,9 @@ | @@ -263,6 +281,9 @@ | ||
| 263 | <a href="#" class="skip">Pular</a> | 281 | <a href="#" class="skip">Pular</a> |
| 264 | <a href="#" class="vote-result">Resultados</a> | 282 | <a href="#" class="vote-result">Resultados</a> |
| 265 | </div> | 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 | </script> | 287 | </script> |
| 267 | 288 | ||
| 268 | <script id="results" type="text/x-handlebars-template"> | 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,6 +58,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | var article = data.articles[0]; | 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 | $randomProposal.html(supportProposalTemplate(article)); | 63 | $randomProposal.html(supportProposalTemplate(article)); |
| 62 | $body.off('click', '.vote-actions .skip'); | 64 | $body.off('click', '.vote-actions .skip'); |
| 63 | $body.on('click', '.vote-actions .skip', function(e) { | 65 | $body.on('click', '.vote-actions .skip', function(e) { |
| @@ -641,6 +643,23 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -641,6 +643,23 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
| 641 | e.preventDefault(); | 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 | $(document).on('click', '.new-user', function(e) { | 663 | $(document).on('click', '.new-user', function(e) { |
| 645 | var loginForm = $(this).parents('#login-form'); | 664 | var loginForm = $(this).parents('#login-form'); |
| 646 | loginForm.hide(); | 665 | loginForm.hide(); |