Commit 67e3c824ae24ef555eeff22a2d01b2a52355bb59

Authored by Victor Costa
1 parent 3ed27192

proposals_discussion: small fixes

public/proposals_list.js
1   -function initTwitterButton() {
2   - !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
3   -}
4   -
5 1 jQuery(document).ready(function($) {
6 2 initTwitterButton();
7   - $('.proposals').on('mouseenter', '.proposal', function() {
8   - twttr.widgets.load();
9   - $('.proposal .social').hide();
10   - $(this).find('.social').show("fast");
  3 + initFacebookButton();
  4 + $('#content').on('mouseenter', '.proposal', function() {
  5 + loadSocialButtons();
  6 + $('.proposal .actions').hide();
  7 + $(this).find('.actions').show("fast");
11 8 }).on('mouseleave', '.proposal', function() {
12   - $(this).find('.social').hide("fast");
  9 + $(this).find('.actions').hide("fast");
13 10 });
14 11  
15 12 function proposalsScroll() {
... ... @@ -31,11 +28,19 @@ jQuery(document).ready(function($) {
31 28 $('.topics').masonry();
32 29 });
33 30  
34   -
35   -(function(d, s, id) {
36   - var js, fjs = d.getElementsByTagName(s)[0];
37   - if (d.getElementById(id)) return;
38   - js = d.createElement(s); js.id = id;
39   - js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.0";
40   - fjs.parentNode.insertBefore(js, fjs);
41   -}(document, 'script', 'facebook-jssdk'));
  31 +function loadSocialButtons() {
  32 + twttr.widgets.load();
  33 + try{FB.XFBML.parse();}catch(ex){}
  34 +}
  35 +function initFacebookButton() {
  36 + (function(d, s, id) {
  37 + var js, fjs = d.getElementsByTagName(s)[0];
  38 + if (d.getElementById(id)) return;
  39 + js = d.createElement(s); js.id = id;
  40 + js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.0";
  41 + fjs.parentNode.insertBefore(js, fjs);
  42 + }(document, 'script', 'facebook-jssdk'));
  43 +}
  44 +function initTwitterButton() {
  45 + !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
  46 +}
... ...
public/style.css
... ... @@ -56,6 +56,9 @@
56 56 width: 100%;
57 57 display: inline-block;
58 58 }
  59 +#article .proposal .private.actions a:visited, #article .proposal .private.actions a {
  60 + display: inline;
  61 +}
59 62  
60 63 .proposal .content {
61 64 width: 84%;
... ... @@ -166,18 +169,34 @@ form .proposals-discussion-plugin .body textarea {
166 169 #article-header > h1 {
167 170 display: none;
168 171 }
169   -.proposal .content .social {
  172 +.proposal .content .actions {
170 173 position: absolute;
171 174 top: -18px;
172 175 display: none;
  176 + margin: 1px 0 0 0;
173 177 }
174 178  
175 179 #content .tag_cloud a {
176 180 text-decoration: none;
177 181 }
178 182  
179   -#content .statistics {
180   - display: inline-block;
  183 +#content .summary {
  184 + float: left;
  185 + margin-left: 12px;
  186 +}
  187 +#content .summary .label {
  188 + font-weight: bold;
  189 + color: rgb(95, 95, 95);
  190 + font-size: 13px;
  191 + line-height: 27px;
  192 +}
  193 +#content .summary .content {
  194 + color: rgb(175, 175, 175);
  195 + font-size: 14px;
  196 + font-weight: bold;
  197 +}
  198 +#content .statistics h5 {
  199 + color: rgb(95, 95, 95);
181 200 }
182 201 #content .tag_cloud {
183 202 float: right;
... ... @@ -187,7 +206,15 @@ form .proposals-discussion-plugin .body textarea {
187 206 min-height: 50px;
188 207 }
189 208  
190   -.graph #proposals-time {
  209 +.article-body-proposals-discussion-plugin_topic .graph {
  210 + float: left;
  211 +}
  212 +.article-body-proposals-discussion-plugin_topic .graph #proposals-time {
191 213 height: 150px;
192 214 width: 300px;
193 215 }
  216 +
  217 +.article-body-proposals-discussion-plugin_topic .topic.actions {
  218 + clear: both;
  219 + padding-top: 10px;
  220 +}
... ...
views/content_viewer/_proposal_card.html.erb
... ... @@ -10,9 +10,17 @@
10 10 <div class="title">
11 11 <%= link_to proposal_card.name, proposal_card.view_url %>
12 12 </div>
13   - <div class="social">
14   - <%= render :partial => 'content_viewer/social', :locals => {:proposal => proposal_card} %>
15   - </div>
  13 + <% if proposal_card.published? %>
  14 + <div class="public actions">
  15 + <%= render :partial => 'content_viewer/social', :locals => {:proposal => proposal_card} %>
  16 + </div>
  17 + <% else %>
  18 + <div class="private actions">
  19 + <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'publish_proposal', :proposal_id => proposal_card.id}), :class => 'button with-text icon-suggest' do %>
  20 + <strong><%= _("Publish") %></strong>
  21 + <% end %>
  22 + </div>
  23 + <% end %>
16 24 <div class="abstract">
17 25 <%= link_to strip_tags(proposal_card.abstract), proposal_card.view_url %>
18 26 </div>
... ...
views/content_viewer/_social.html.erb
1   -<% if proposal.published? %>
2   - <a href="https://twitter.com/share" class="twitter-share-button" data-url="<%= url_for proposal.view_url %>" data-text="<%= proposal.title %>" data-count="none"></a>
  1 +<a href="https://twitter.com/share" class="twitter-share-button" data-url="<%= url_for proposal.view_url %>" data-text="<%= proposal.title %>" data-count="none"></a>
3 2  
4   - <div class="fb-share-button" data-href="<%= url_for proposal.view_url %>" data-layout="box-count"></div>
5   -<% end %>
  3 +<div class="fb-share-button" data-href="<%= url_for proposal.view_url %>" data-layout="box-count"></div>
... ...
views/content_viewer/topic.html.erb
... ... @@ -14,49 +14,49 @@
14 14 </div>
15 15  
16 16 <% unless list_view %>
17   -<h4><%= topic.discussion.title %></h4>
18   -<div class="statistics">
19   - <div class="proposals-count">
20   - <span class="label"><%= _('Number of Proposals: ') %></span>
21   - <span class="content"><%= topic.proposals.count %></span>
22   - </div>
23   - <div class="participants-count">
24   - <span class="label"><%= _('Number of Participants: ') %></span>
25   - <span class="content"><%= topic.proposals_authors.count %></span>
26   - </div>
27   - <div class="comments-count">
28   - <span class="label"><%= _('Number of Comments: ') %></span>
29   - <span class="content"><%= topic.proposals_comments.count %></span>
  17 + <h4><%= topic.discussion.title %></h4>
  18 +
  19 + <div class="statistics">
  20 + <h5><%= _('Statistics') %></h5>
  21 +
  22 + <div class="graph">
  23 + <div id="proposals-time"></div>
  24 + </div>
  25 + <%= javascript_include_tag 'plugins/proposals_discussion/proposals_graph.js' %>
  26 + <script>load_proposals_graph('<%= topic.proposals_per_day.to_json %>', '<%= topic.comments_per_day.to_json %>', '<%= _('Proposals') %>', '<%= _('Comments') %>')</script>
  27 +
  28 + <div class="summary">
  29 + <div class="proposals-count">
  30 + <span class="label"><%= _('Number of Proposals: ') %></span>
  31 + <span class="content"><%= topic.proposals.count %></span>
  32 + </div>
  33 + <div class="participants-count">
  34 + <span class="label"><%= _('Number of Participants: ') %></span>
  35 + <span class="content"><%= topic.proposals_authors.count %></span>
  36 + </div>
  37 + <div class="comments-count">
  38 + <span class="label"><%= _('Number of Comments: ') %></span>
  39 + <span class="content"><%= topic.proposals_comments.count %></span>
  40 + </div>
  41 + <div class="active-participants">
  42 + <span class="label"><%= _('Most active: ') %></span>
  43 + <span class="content">
  44 + <% topic.most_active_participants.each do |author| %>
  45 + <%= link_to profile_image(author, :icon), author.url, :title => author.name %>
  46 + <% end %>
  47 + </span>
  48 + </div>
  49 + </div>
30 50 </div>
31   - <div class="active-participants">
32   - <span class="label"><%= _('Most active: ') %></span>
33   - <span class="content">
34   - <% topic.most_active_participants.each do |author| %>
35   - <%= link_to profile_image(author, :icon), author.url, :title => author.name %>
36   - <% end %>
37   - </span>
  51 + <div class="tag_cloud">
  52 + <%= tag_cloud(topic.proposal_tags, :tag, {:action => :tag, :controller => 'search'}, :max_size => 18, :min_size => 10) %>
38 53 </div>
39   -</div>
40   -<div class="tag_cloud">
41   - <%= tag_cloud(topic.proposal_tags, :tag, {:action => :tag, :controller => 'search'}, :max_size => 18, :min_size => 10) %>
42   -</div>
43 54  
44   -<% cache_timeout(topic.cache_key, 1.hours) do %>
45   - <div class="graph">
46   - <div id="proposals-time"></div>
  55 + <div class="topic actions">
  56 + <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id}), :class => 'button with-text icon-add' do %>
  57 + <strong><%= _("Send your proposal") %></strong>
  58 + <% end %>
47 59 </div>
48   - <%= javascript_include_tag 'plugins/proposals_discussion/proposals_graph.js' %>
49   - <script>load_proposals_graph('<%= topic.proposals_per_day.to_json %>', '<%= topic.comments_per_day.to_json %>', '<%= _('Proposals') %>', '<%= _('Comments') %>')</script>
50   -<% end %>
51   -
52   -<% end %>
53   -
54   -<% unless list_view %>
55   -<div class="actions">
56   - <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id}), :class => 'button with-text icon-add' do %>
57   - <strong><%= _("Send your proposal") %></strong>
58   - <% end %>
59   -</div>
60 60 <% end %>
61 61  
62 62 <%= render :partial => 'content_viewer/proposals_list', :locals => {:holder => topic} %>
... ...