diff --git a/plugins/community_hub/public/javascripts/community_hub.js b/plugins/community_hub/public/javascripts/community_hub.js
index da37bfa..e67b937 100644
--- a/plugins/community_hub/public/javascripts/community_hub.js
+++ b/plugins/community_hub/public/javascripts/community_hub.js
@@ -89,144 +89,181 @@ function new_mediation(button) {
}
-function promote_user(user_id) {
-
- var hub_id = jQuery(".hub").attr('id');
-
- jQuery.ajax({
- url: '/plugin/community_hub/public/promote_user',
- type: 'get',
- dataType: 'json',
- data: { user: user_id, hub: hub_id },
- success: function(data) {
- },
- error: function(ajax, stat, errorThrown) {
- console.log(stat);
- }
- });
+function promote_user(mediation, user_id) {
+
+ if (confirm(DEFAULT_PROMOTE_QUESTION)) {
+
+ var hub_id = jQuery(".hub").attr('id');
+
+ jQuery.ajax({
+ url: '/plugin/community_hub/public/promote_user',
+ type: 'get',
+ dataType: 'json',
+ data: { user: user_id, hub: hub_id },
+ success: function(data) {
+ jQuery(".promote a").filter("#" + mediation).replaceWith( '' );
+ },
+ error: function(ajax, stat, errorThrown) {
+ console.log(stat);
+ }
+ });
+
+ }
}
function pin_message(post_id) {
- var hub_id = jQuery(".hub").attr('id');
-
- jQuery.ajax({
- url: '/plugin/community_hub/public/pin_message',
- type: 'get',
- dataType: 'json',
- data: { message: post_id, hub: hub_id },
- success: function(data) {
- },
- error: function(ajax, stat, errorThrown) {
- console.log(stat);
- }
- });
+ if (confirm(DEFAULT_PIN_QUESTION)) {
+
+ var hub_id = jQuery(".hub").attr('id');
+
+ jQuery.ajax({
+ url: '/plugin/community_hub/public/pin_message',
+ type: 'get',
+ dataType: 'json',
+ data: { message: post_id, hub: hub_id },
+ success: function(data) {
+ jQuery(".pin a").filter("#" + post_id).replaceWith( '
' );
+ },
+ error: function(ajax, stat, errorThrown) {
+ console.log(stat);
+ }
+ });
+
+ }
}
function update_mediation_comments(mediation) {
- var hub_id = jQuery(".hub").attr('id');
- if (jQuery("#mediation-comment-list-" + mediation + " li").first().length == 0) {
- var latest_post_id = 0;
- }
- else {
- var latest_post_id = jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").last().attr('id');
- }
+ if (jQuery("#mediation-section.show").size() != 0) {
- jQuery.ajax({
- url: '/plugin/community_hub/public/newer_mediation_comment',
- type: 'get',
- data: { latest_post: latest_post_id, mediation: mediation },
- success: function(data) {
- if (data.trim().length > 0) {
- jQuery("#mediation-comment-list-" + mediation + "").append(data);
- jQuery("#mediation-comment-total-" + mediation).html(jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").size());
- }
- },
- error: function(ajax, stat, errorThrown) {
- console.log(stat);
+ var hub_id = jQuery(".hub").attr('id');
+
+ if (jQuery("#mediation-comment-list-" + mediation + " li").first().length == 0) {
+ var latest_post_id = 0;
+ }
+ else {
+ var latest_post_id = jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").last().attr('id');
}
- });
+
+ jQuery.ajax({
+ url: '/plugin/community_hub/public/newer_mediation_comment',
+ type: 'get',
+ data: { latest_post: latest_post_id, mediation: mediation },
+ success: function(data) {
+ if (data.trim().length > 0) {
+ jQuery("#mediation-comment-list-" + mediation + "").append(data);
+ jQuery("#mediation-comment-total-" + mediation).html(jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").size());
+ }
+ },
+ error: function(ajax, stat, errorThrown) {
+ console.log(stat);
+ }
+ });
+
+ }
setTimeout(function() { update_mediation_comments(mediation); }, 5000);
}
function update_mediations() {
- var hub_id = jQuery(".hub").attr('id');
- if (jQuery("#mediation-posts li").first().length == 0) {
- var latest_post_id = 0;
- }
- else {
- var latest_post_id = jQuery("#mediation-posts li").first().attr('id');
- }
+ if (jQuery("#mediation-section.show").size() != 0) {
- //console.log(latest_post_id);
+ var hub_id = jQuery(".hub").attr('id');
- jQuery.ajax({
- url: '/plugin/community_hub/public/newer_articles',
- type: 'get',
- data: { latest_post: latest_post_id, hub: hub_id },
- success: function(data) {
- if (data.trim().length > 0) {
- jQuery("#mediation-posts").prepend(data);
- }
- },
- error: function(ajax, stat, errorThrown) {
- console.log(stat);
+ if (jQuery("#mediation-posts li").first().length == 0) {
+ var latest_post_id = 0;
}
- });
+ else {
+ var latest_post_id = jQuery("#mediation-posts li").first().attr('id');
+ }
+
+ jQuery.ajax({
+ url: '/plugin/community_hub/public/newer_articles',
+ type: 'get',
+ data: { latest_post: latest_post_id, hub: hub_id },
+ success: function(data) {
+ if (data.trim().length > 0) {
+ jQuery("#mediation-posts").prepend(data);
+ }
+ },
+ error: function(ajax, stat, errorThrown) {
+ console.log(stat);
+ }
+ });
- setTimeout(update_mediations, 7000);
+ }
+
+ setTimeout(update_mediations, 7000);
}
function update_live_stream() {
- var hub_id = jQuery(".hub").attr('id');
- if (jQuery("#live-posts li").first().length == 0) {
- var latest_post_id = 0;
- }
- else {
- var latest_post_id = jQuery("#live-posts li").first().attr('id');
- }
+ if (jQuery("#live-section.show").size() != 0) {
- //console.log(latest_post_id);
-
- jQuery.ajax({
- url: '/plugin/community_hub/public/newer_comments',
- type: 'get',
- data: { latest_post: latest_post_id, hub: hub_id },
- success: function(data) {
- if (data.trim().length > 0) {
- jQuery("#live-posts").prepend(data);
- if (jQuery("#auto_scrolling").attr('checked')) {
- jQuery("#live-posts").scrollTop(0);
- }
- else {
- jQuery("#live-posts").scrollTop(live_scroll_position);
+ var hub_id = jQuery(".hub").attr('id');
+
+ if (jQuery("#live-posts li").first().length == 0) {
+ var latest_post_id = 0;
+ }
+ else {
+ var latest_post_id = jQuery("#live-posts li").first().attr('id');
+ }
+
+ jQuery.ajax({
+ url: '/plugin/community_hub/public/newer_comments',
+ type: 'get',
+ data: { latest_post: latest_post_id, hub: hub_id },
+ success: function(data) {
+ if (data.trim().length > 0) {
+ jQuery("#live-posts").prepend(data);
+ if (jQuery("#auto_scrolling").attr('checked')) {
+ jQuery("#live-posts").scrollTop(0);
+ }
+ else {
+ jQuery("#live-posts").scrollTop(live_scroll_position);
+ }
}
+ },
+ error: function(ajax, stat, errorThrown) {
+ console.log(stat);
}
- },
- error: function(ajax, stat, errorThrown) {
- console.log(stat);
- }
- });
+ });
- setTimeout(update_live_stream, 5000);
+ }
+
+ //setTimeout(update_live_stream, 5000);
+}
+
+function hub_left_tab_click() {
+ jQuery("#mediation-section").removeClass('show');
+ jQuery("#mediation-section").addClass('hide');
+ jQuery("#live-section").removeClass('hide');
+ jQuery("#live-section").addClass('show');
}
+function hub_right_tab_click() {
+ jQuery("#live-section").removeClass('show');
+ jQuery("#live-section").addClass('hide');
+ jQuery("#mediation-section").removeClass('hide');
+ jQuery("#mediation-section").addClass('show');
+}
jQuery(document).ready(function() {
jQuery("#live-posts").scroll(function() {
live_scroll_position = jQuery("#live-posts").scrollTop();
});
+ jQuery(".hub #left-tab").click(hub_left_tab_click);
+ jQuery(".hub #right-tab").click(hub_right_tab_click);
+
setTimeout(update_live_stream, 5000);
setTimeout(update_mediations, 7000);
});
diff --git a/plugins/community_hub/public/style.css b/plugins/community_hub/public/style.css
index 0289359..aa896e7 100644
--- a/plugins/community_hub/public/style.css
+++ b/plugins/community_hub/public/style.css
@@ -1,3 +1,76 @@
+div.content-tab.show {
+ display: block;
+}
+
+div.content-tab.hide {
+ display: none;
+}
+
+#banner-embed-container {
+ width: 49%;
+ float: right;
+}
+
+#input-panel {
+ height: 350px;
+ padding-top: 10px;
+ height: 350px;
+}
+
+.hub #left-tab {
+ /*border: 0px solid lightGray;*/
+ border: 1px solid red;
+ display: inline-block;
+ float: left;
+ width: 49%;
+ margin-bottom: 2em;
+ cursor: pointer;
+}
+
+.hub #right-tab {
+ border: 1px solid green;
+ display: inline-block;
+ clear: right;
+ float: none;
+ margin-left: 1%;
+ width: 50%;
+ margin-bottom: 2em;
+ cursor: pointer;
+}
+
+.hub #content-tab {
+}
+
+.hub #left-tab .on-air {
+ background-color: #d40000;
+ border-radius: 10px 10px 10px 10px;
+ color: white;
+ display: inline-block;
+ font-size: 16px;
+ font-weight: bold;
+ padding: 0 0.5em;
+ text-align: center;
+ text-transform: uppercase;
+ vertical-align: top;
+ width: 20%;
+
+}
+
+.hub #left-tab .off-air {
+ background-color: gray;
+ border-radius: 10px 10px 10px 10px;
+ color: black;
+ display: inline-block;
+ font-size: 16px;
+ font-weight: bold;
+ padding: 0 0.5em;
+ text-align: center;
+ text-transform: uppercase;
+ vertical-align: top;
+ width: 20%;
+}
+
+
#hub-loading {
/*margin-top: 18px;*/
float: right;
@@ -85,7 +158,7 @@ clear: both;
.hub .mediation-bar {
display: inline-block;
margin: 10px 0 10px 104px;
- width: 70%;
+ width: 83%;
}
.hub .mediation-bar ul {}
@@ -107,7 +180,7 @@ clear: both;
.hub .mediation-bar ul li.pin{
height: 25px;
- margin-right: 10px;
+ /*margin-right: 10px;*/
}
.hub .remove{}
@@ -185,6 +258,7 @@ clear: both;
border-style: solid;
border-color: lightGray;
padding-top: 10px;
+/*border: 1px solid red;*/
}
@@ -268,9 +342,13 @@ clear: both;
padding-right: 1em;
}
.hub .form {
- clear: left;
- float: left;
- width: 49%;
+ /*clear: left;*/
+ /*float: left;*/
+ width: 47%;
+ display: inline-block;
+ height: 323px;
+ padding: 10px;
+ border: 1px solid #c0c0c0;
}
.hub div.settings {
@@ -292,11 +370,12 @@ clear: both;
}
.hub div.banner {
- width: 50%;
- height: 100px;
+ /*width: 50%;*/
+ height: 70px;
background-color: #6d6d6d;
- float: right;
+ /*float: right;*/
text-align: center;
+ padding-top: 30px;
}
.hub div.banner span {
@@ -304,17 +383,17 @@ clear: both;
font-family: Arial Black, arial, sans-serif;
font-size: large;
font-weight: normal;
- margin-top: 35px;
+ /*margin-top: 35px;*/
display: block;
}
.hub div.embed {
margin-top: 10px;
padding: 8px;
- width: 48%;
- height: 216px;
+ /*width: 48%;*/
+ /*height: 216px;*/
border: 1px solid #c0c0c0;
- float: right;
+ /*float: right;*/
}
.hub div.embed textarea.code {
@@ -387,8 +466,8 @@ textarea#message_body {
height: 16px;
display: inline-block;
float: right;
- margin-top: 17px;
- margin-right: 270px;
+ margin-top: -24px;
+ margin-right: 260px;
}
.hub .loading-mediation-comment {
@@ -396,8 +475,8 @@ textarea#message_body {
height: 16px;
display: inline-block;
float: right;
- margin-top: 16px;
- margin-right: 260px;
+ margin-top: -25px;
+ margin-right: 555px;
}
.loading-signal-done {
diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml b/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml
index 57058e2..10ed429 100644
--- a/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml
+++ b/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml
@@ -13,12 +13,12 @@