Commit 2bb8d680857884b2fdacd0a316f7591b67e2455b

Authored by Francisco Marcelo de Araújo Lima Júnior
1 parent 0505a73e
Exists in master

#community dashboard - fixes

public/javascripts/community_hub.js
@@ -31,7 +31,7 @@ function new_mediation_comment(button, mediation) { @@ -31,7 +31,7 @@ function new_mediation_comment(button, mediation) {
31 jQuery.post(form.attr("action"), form.serialize(), function(data) { 31 jQuery.post(form.attr("action"), form.serialize(), function(data) {
32 jQuery(".loading-mediation-comment").filter("#" + mediation).removeClass("loading-signal-processing"); 32 jQuery(".loading-mediation-comment").filter("#" + mediation).removeClass("loading-signal-processing");
33 if (data.ok) { 33 if (data.ok) {
34 - jQuery(".hub .form #message_body").val(''); 34 + jQuery("#mediation-comment-form-" + mediation + " textarea").val('');
35 jQuery(".loading-mediation-comment").filter("#" + mediation).addClass("loading-signal-done"); 35 jQuery(".loading-mediation-comment").filter("#" + mediation).addClass("loading-signal-done");
36 setTimeout(function(){ 36 setTimeout(function(){
37 clearLoadingMediationCommentSignal(mediation); 37 clearLoadingMediationCommentSignal(mediation);
@@ -117,7 +117,7 @@ function pin_message(post_id) { @@ -117,7 +117,7 @@ function pin_message(post_id) {
117 type: 'get', 117 type: 'get',
118 dataType: 'json', 118 dataType: 'json',
119 data: { message: post_id, hub: hub_id }, 119 data: { message: post_id, hub: hub_id },
120 - success: function(data) { 120 + success: function(data) {
121 }, 121 },
122 error: function(ajax, stat, errorThrown) { 122 error: function(ajax, stat, errorThrown) {
123 console.log(stat); 123 console.log(stat);
@@ -137,8 +137,6 @@ function update_mediation_comments(mediation) { @@ -137,8 +137,6 @@ function update_mediation_comments(mediation) {
137 var latest_post_id = jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").last().attr('id'); 137 var latest_post_id = jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").last().attr('id');
138 } 138 }
139 139
140 - //console.log(latest_post_id);  
141 -  
142 jQuery.ajax({ 140 jQuery.ajax({
143 url: '/plugin/community_hub/public/newer_mediation_comment', 141 url: '/plugin/community_hub/public/newer_mediation_comment',
144 type: 'get', 142 type: 'get',
@@ -146,6 +144,7 @@ function update_mediation_comments(mediation) { @@ -146,6 +144,7 @@ function update_mediation_comments(mediation) {
146 success: function(data) { 144 success: function(data) {
147 if (data.trim().length > 0) { 145 if (data.trim().length > 0) {
148 jQuery("#mediation-comment-list-" + mediation + "").append(data); 146 jQuery("#mediation-comment-list-" + mediation + "").append(data);
  147 + jQuery("#mediation-comment-total-" + mediation).html(jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").size());
149 } 148 }
150 }, 149 },
151 error: function(ajax, stat, errorThrown) { 150 error: function(ajax, stat, errorThrown) {
public/style.css
@@ -153,6 +153,19 @@ clear: both; @@ -153,6 +153,19 @@ clear: both;
153 margin-bottom: 2px; 153 margin-bottom: 2px;
154 } 154 }
155 155
  156 +.hub .mediation-comment-form {
  157 + margin-left: 70px;
  158 + margin-top: 10px;
  159 +}
  160 +
  161 +.hub input.button.with-text.icon-add.submit{
  162 + display: block;
  163 +}
  164 +
  165 +.hub ul#mediation-posts .post {
  166 + padding-bottom: 10px;
  167 +}
  168 +
156 /**/ 169 /**/
157 170
158 .hub .live { 171 .hub .live {
@@ -397,3 +410,5 @@ textarea#message_body { @@ -397,3 +410,5 @@ textarea#message_body {
397 .loading-signal-processing { 410 .loading-signal-processing {
398 background-image: url(/plugins/community_hub/icons/hub-samarelo.gif); 411 background-image: url(/plugins/community_hub/icons/hub-samarelo.gif);
399 } 412 }
  413 +
  414 +
views/community_hub_plugin_public/_mediation.rhtml
@@ -6,12 +6,12 @@ @@ -6,12 +6,12 @@
6 <li class="time"><%= post_time(mediation.created_at) %></li> 6 <li class="time"><%= post_time(mediation.created_at) %></li>
7 <li class="avatar"><%= image_tag(profile_icon(mediation.author, :minor)) %></li> 7 <li class="avatar"><%= image_tag(profile_icon(mediation.author, :minor)) %></li>
8 <li class="message"><span class="author"><%= mediation.author_name %>:</span> <%= mediation.body %></li> 8 <li class="message"><span class="author"><%= mediation.author_name %>:</span> <%= mediation.body %></li>
9 - 9 +
10 <% if mediator?(hub) %> 10 <% if mediator?(hub) %>
11 <li class="mediation-bar"> 11 <li class="mediation-bar">
12 12
13 <ul> 13 <ul>
14 - 14 +
15 <li class="promote"> 15 <li class="promote">
16 <% if !promoted?(hub, mediation.author.id) %> 16 <% if !promoted?(hub, mediation.author.id) %>
17 <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.author.id %>); return false;"> 17 <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.author.id %>); return false;">
@@ -38,16 +38,16 @@ @@ -38,16 +38,16 @@
38 <% total_mediation_comments = mediation.comments.count %> 38 <% total_mediation_comments = mediation.comments.count %>
39 39
40 <span class="comment-count"> 40 <span class="comment-count">
41 - <%= link_to(_( "#{total_mediation_comments} Comments" ) , '#',  
42 - :class => 'display-comment-form',  
43 - :id => 'top-post-comment-button', 41 + <%= link_to(_( "<span id='mediation-comment-total-#{mediation.id}'>#{total_mediation_comments}</span> Comments" ) , '#',
  42 + :class => 'display-comment-form',
  43 + :id => 'top-post-comment-button',
44 :onclick => "toogle_mediation_comments(#{mediation.id}); return false;") %> 44 :onclick => "toogle_mediation_comments(#{mediation.id}); return false;") %>
45 </span> 45 </span>
46 46
47 <script type="text/javascript"> 47 <script type="text/javascript">
48 setTimeout(function() { update_mediation_comments('<%= mediation.id %>')}, 5000); 48 setTimeout(function() { update_mediation_comments('<%= mediation.id %>')}, 5000);
49 </script> 49 </script>
50 - 50 +
51 <ul id="mediation-comment-list-<%=mediation.id%>" class="mediation-comment-list" style="display:none;"> 51 <ul id="mediation-comment-list-<%=mediation.id%>" class="mediation-comment-list" style="display:none;">
52 <% if mediation.accept_comments? && mediation.comments.count > 0 %> 52 <% if mediation.accept_comments? && mediation.comments.count > 0 %>
53 <%= render :partial => 'community_hub_plugin_public/mediation_comment', :collection => mediation.comments %> 53 <%= render :partial => 'community_hub_plugin_public/mediation_comment', :collection => mediation.comments %>
@@ -60,15 +60,15 @@ @@ -60,15 +60,15 @@
60 :locals => { 60 :locals => {
61 :hub => hub, 61 :hub => hub,
62 :mediation => mediation, 62 :mediation => mediation,
63 - :comment => Comment.new, 63 + :comment => Comment.new,
64 :url => { 64 :url => {
65 - :controller => :comment, 65 + :controller => :comment,
66 :action => :create 66 :action => :create
67 - },  
68 - :display_link => true, 67 + },
  68 + :display_link => true,
69 :cancel_triggers_hide => true 69 :cancel_triggers_hide => true
70 } %> 70 } %>
71 </div> 71 </div>
72 <% end %> 72 <% end %>
73 73
74 -</li>  
75 \ No newline at end of file 74 \ No newline at end of file
  75 +</li>