From 67e3c824ae24ef555eeff22a2d01b2a52355bb59 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 26 Aug 2014 09:42:13 -0300 Subject: [PATCH] proposals_discussion: small fixes --- public/proposals_list.js | 39 ++++++++++++++++++++++----------------- public/style.css | 35 +++++++++++++++++++++++++++++++---- views/content_viewer/_proposal_card.html.erb | 14 +++++++++++--- views/content_viewer/_social.html.erb | 6 ++---- views/content_viewer/topic.html.erb | 78 +++++++++++++++++++++++++++++++++++++++--------------------------------------- 5 files changed, 105 insertions(+), 67 deletions(-) diff --git a/public/proposals_list.js b/public/proposals_list.js index 7f798fc..ff28bc0 100644 --- a/public/proposals_list.js +++ b/public/proposals_list.js @@ -1,15 +1,12 @@ -function initTwitterButton() { - !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'); -} - jQuery(document).ready(function($) { initTwitterButton(); - $('.proposals').on('mouseenter', '.proposal', function() { - twttr.widgets.load(); - $('.proposal .social').hide(); - $(this).find('.social').show("fast"); + initFacebookButton(); + $('#content').on('mouseenter', '.proposal', function() { + loadSocialButtons(); + $('.proposal .actions').hide(); + $(this).find('.actions').show("fast"); }).on('mouseleave', '.proposal', function() { - $(this).find('.social').hide("fast"); + $(this).find('.actions').hide("fast"); }); function proposalsScroll() { @@ -31,11 +28,19 @@ jQuery(document).ready(function($) { $('.topics').masonry(); }); - -(function(d, s, id) { - var js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) return; - js = d.createElement(s); js.id = id; - js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.0"; - fjs.parentNode.insertBefore(js, fjs); -}(document, 'script', 'facebook-jssdk')); +function loadSocialButtons() { + twttr.widgets.load(); + try{FB.XFBML.parse();}catch(ex){} +} +function initFacebookButton() { + (function(d, s, id) { + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) return; + js = d.createElement(s); js.id = id; + js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.0"; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'facebook-jssdk')); +} +function initTwitterButton() { + !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'); +} diff --git a/public/style.css b/public/style.css index 2197c8f..22c48c4 100644 --- a/public/style.css +++ b/public/style.css @@ -56,6 +56,9 @@ width: 100%; display: inline-block; } +#article .proposal .private.actions a:visited, #article .proposal .private.actions a { + display: inline; +} .proposal .content { width: 84%; @@ -166,18 +169,34 @@ form .proposals-discussion-plugin .body textarea { #article-header > h1 { display: none; } -.proposal .content .social { +.proposal .content .actions { position: absolute; top: -18px; display: none; + margin: 1px 0 0 0; } #content .tag_cloud a { text-decoration: none; } -#content .statistics { - display: inline-block; +#content .summary { + float: left; + margin-left: 12px; +} +#content .summary .label { + font-weight: bold; + color: rgb(95, 95, 95); + font-size: 13px; + line-height: 27px; +} +#content .summary .content { + color: rgb(175, 175, 175); + font-size: 14px; + font-weight: bold; +} +#content .statistics h5 { + color: rgb(95, 95, 95); } #content .tag_cloud { float: right; @@ -187,7 +206,15 @@ form .proposals-discussion-plugin .body textarea { min-height: 50px; } -.graph #proposals-time { +.article-body-proposals-discussion-plugin_topic .graph { + float: left; +} +.article-body-proposals-discussion-plugin_topic .graph #proposals-time { height: 150px; width: 300px; } + +.article-body-proposals-discussion-plugin_topic .topic.actions { + clear: both; + padding-top: 10px; +} diff --git a/views/content_viewer/_proposal_card.html.erb b/views/content_viewer/_proposal_card.html.erb index b71b7b8..7327c51 100644 --- a/views/content_viewer/_proposal_card.html.erb +++ b/views/content_viewer/_proposal_card.html.erb @@ -10,9 +10,17 @@
<%= link_to proposal_card.name, proposal_card.view_url %>
-
- <%= render :partial => 'content_viewer/social', :locals => {:proposal => proposal_card} %> -
+ <% if proposal_card.published? %> +
+ <%= render :partial => 'content_viewer/social', :locals => {:proposal => proposal_card} %> +
+ <% else %> +
+ <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'publish_proposal', :proposal_id => proposal_card.id}), :class => 'button with-text icon-suggest' do %> + <%= _("Publish") %> + <% end %> +
+ <% end %>
<%= link_to strip_tags(proposal_card.abstract), proposal_card.view_url %>
diff --git a/views/content_viewer/_social.html.erb b/views/content_viewer/_social.html.erb index d38fff4..3a5d27f 100644 --- a/views/content_viewer/_social.html.erb +++ b/views/content_viewer/_social.html.erb @@ -1,5 +1,3 @@ -<% if proposal.published? %> - + -
-<% end %> +
diff --git a/views/content_viewer/topic.html.erb b/views/content_viewer/topic.html.erb index f4d1860..29f62df 100644 --- a/views/content_viewer/topic.html.erb +++ b/views/content_viewer/topic.html.erb @@ -14,49 +14,49 @@ <% unless list_view %> -

<%= topic.discussion.title %>

-
-
- <%= _('Number of Proposals: ') %> - <%= topic.proposals.count %> -
-
- <%= _('Number of Participants: ') %> - <%= topic.proposals_authors.count %> -
-
- <%= _('Number of Comments: ') %> - <%= topic.proposals_comments.count %> +

<%= topic.discussion.title %>

+ +
+
<%= _('Statistics') %>
+ +
+
+
+ <%= javascript_include_tag 'plugins/proposals_discussion/proposals_graph.js' %> + + +
+
+ <%= _('Number of Proposals: ') %> + <%= topic.proposals.count %> +
+
+ <%= _('Number of Participants: ') %> + <%= topic.proposals_authors.count %> +
+
+ <%= _('Number of Comments: ') %> + <%= topic.proposals_comments.count %> +
+
+ <%= _('Most active: ') %> + + <% topic.most_active_participants.each do |author| %> + <%= link_to profile_image(author, :icon), author.url, :title => author.name %> + <% end %> + +
+
-
- <%= _('Most active: ') %> - - <% topic.most_active_participants.each do |author| %> - <%= link_to profile_image(author, :icon), author.url, :title => author.name %> - <% end %> - +
+ <%= tag_cloud(topic.proposal_tags, :tag, {:action => :tag, :controller => 'search'}, :max_size => 18, :min_size => 10) %>
-
-
- <%= tag_cloud(topic.proposal_tags, :tag, {:action => :tag, :controller => 'search'}, :max_size => 18, :min_size => 10) %> -
-<% cache_timeout(topic.cache_key, 1.hours) do %> -
-
+
+ <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id}), :class => 'button with-text icon-add' do %> + <%= _("Send your proposal") %> + <% end %>
- <%= javascript_include_tag 'plugins/proposals_discussion/proposals_graph.js' %> - -<% end %> - -<% end %> - -<% unless list_view %> -
- <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id}), :class => 'button with-text icon-add' do %> - <%= _("Send your proposal") %> - <% end %> -
<% end %> <%= render :partial => 'content_viewer/proposals_list', :locals => {:holder => topic} %> -- libgit2 0.21.2