diff --git a/index.html b/index.html index 3986ec5..e536a81 100644 --- a/index.html +++ b/index.html @@ -121,6 +121,7 @@
Ainda não existe nenhuma proposta para este programa.
+
Conte sua experiência
@@ -172,6 +173,26 @@ + Resultado +
+ + + diff --git a/js/main.js b/js/main.js index 12a0ca6..a22d8ae 100644 --- a/js/main.js +++ b/js/main.js @@ -6,6 +6,7 @@ var template = Handlebars.compile(templateSource); var supportProposalTemplate = Handlebars.compile(document.getElementById('support-proposal-template').innerHTML); var loginTemplate = Handlebars.compile(document.getElementById('login').innerHTML); +var resultsTemplate = Handlebars.compile(document.getElementById('results').innerHTML); // The div/container that we are going to display the results in var resultsPlaceholder = document.getElementById('proposal-result'); @@ -157,6 +158,22 @@ function loadRandomProposal(topic_id, private_token) { }); e.preventDefault(); }); + $(document.body).off('click', '.vote-actions .result'); + $(document.body).on('click', '.vote-actions .result', function(e) { + $('.results-container').toggle(); + if($('.results-container').is(":visible")) { + var url = host + '/api/v1/articles/' + topic_id + '/children' + '?private_token=' + private_token + '&limit=10&fields=id,name,abstract,votes_for,votes_against&content_type=ProposalsDiscussionPlugin::Proposal'; + $.getJSON(url).done(function( data ) { + $('.results-container').html(resultsTemplate(data)); + }); + $('.experience-proposal-container').hide(); + $('.talk-proposal-container').hide(); + } else { + $('.experience-proposal-container').show(); + $('.talk-proposal-container').show(); + } + e.preventDefault(); + }); }); } diff --git a/sass/_proposal_detail.scss b/sass/_proposal_detail.scss index 8e752a0..f5bc9fa 100644 --- a/sass/_proposal_detail.scss +++ b/sass/_proposal_detail.scss @@ -75,6 +75,44 @@ } } } + .results-container { + th, td { + border: 1px solid rgb(223, 223, 223); + } + .results-content { + border: 1px solid #00a9bd; + } + table { + border-collapse: collapse; + margin-top: 20px; + + .abstract-text { + width: 80%; + } + .votes-for { + width: 10%; + text-align: center; + } + .votes-against { + @extend .votes-for; + } + .header { + font-weight: bold; + text-align: center; + } + + .truncate { + display: table; + table-layout: fixed; + width: 100%; + } + .truncated { + overflow-x: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } @each $category, $color in $categories { .#{$category}{ @@ -246,6 +284,9 @@ padding: 20px; display: block; } + .result { + @extend .skip + } } } .experience-proposal-container{ -- libgit2 0.21.2