Commit 71b7f7a9cedc369c41d526cfc5c207f8d649d6ca
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'AI3220_proposals' into rails3_stable
Conflicts: plugins/proposals_discussion/public/proposals_graph.js plugins/proposals_discussion/public/style.css plugins/proposals_discussion/views/content_viewer/topic.html.erb
Showing
6 changed files
with
109 additions
and
77 deletions
Show diff stats
plugins/proposals_discussion/public/proposals_graph.js
... | ... | @@ -2,14 +2,8 @@ function load_proposals_graph(data, comments_data, proposals_label, comments_lab |
2 | 2 | |
3 | 3 | jQuery(document).ready(function($) { |
4 | 4 | container = $('#proposals-time')[0]; |
5 | - console.log(comments_data); | |
6 | 5 | |
7 | - var | |
8 | - d1 = [], d2 = [], | |
9 | - start = new Date("2009/01/01 01:00").getTime(), | |
10 | - options, | |
11 | - graph, | |
12 | - i, x, o; | |
6 | + var d1 = [], d2 = [], o; | |
13 | 7 | |
14 | 8 | data = jQuery.parseJSON(data); |
15 | 9 | for (var key in data) { |
... | ... | @@ -21,7 +15,7 @@ jQuery(document).ready(function($) { |
21 | 15 | d2.push([new Date(key).getTime(), comments_data[key]]); |
22 | 16 | } |
23 | 17 | |
24 | - options = { | |
18 | + var options = { | |
25 | 19 | xaxis : { |
26 | 20 | mode : 'time', |
27 | 21 | labelsAngle : 45, |
... | ... | @@ -33,7 +27,6 @@ jQuery(document).ready(function($) { |
33 | 27 | HtmlText : false, |
34 | 28 | }; |
35 | 29 | |
36 | - // Draw graph with default options, overwriting with passed options | |
37 | 30 | function drawGraph (opts) { |
38 | 31 | // Clone the options, so the 'options' variable always keeps intact. |
39 | 32 | o = Flotr._.extend(Flotr._.clone(options), opts || {}); |
... | ... | @@ -48,7 +41,7 @@ jQuery(document).ready(function($) { |
48 | 41 | ); |
49 | 42 | } |
50 | 43 | |
51 | - graph = drawGraph(); | |
44 | + var graph = drawGraph(); | |
52 | 45 | |
53 | 46 | Flotr.EventAdapter.observe(container, 'flotr:select', function(area){ |
54 | 47 | // Draw selected area | ... | ... |
plugins/proposals_discussion/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 | +} | ... | ... |
plugins/proposals_discussion/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,17 +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; |
175 | + display: none; | |
176 | + margin: 1px 0 0 0; | |
172 | 177 | } |
173 | 178 | |
174 | 179 | #content .tag_cloud a { |
175 | 180 | text-decoration: none; |
176 | 181 | } |
177 | 182 | |
178 | -#content .statistics { | |
179 | - 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); | |
180 | 200 | } |
181 | 201 | #content .tag_cloud { |
182 | 202 | float: right; |
... | ... | @@ -186,7 +206,15 @@ form .proposals-discussion-plugin .body textarea { |
186 | 206 | min-height: 50px; |
187 | 207 | } |
188 | 208 | |
189 | -.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 { | |
190 | 213 | height: 150px; |
191 | 214 | width: 300px; |
192 | 215 | } |
216 | + | |
217 | +.article-body-proposals-discussion-plugin_topic .topic.actions { | |
218 | + clear: both; | |
219 | + padding-top: 10px; | |
220 | +} | ... | ... |
plugins/proposals_discussion/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> | ... | ... |
plugins/proposals_discussion/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> | ... | ... |
plugins/proposals_discussion/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} %> | ... | ... |