aboutsummaryrefslogtreecommitdiff
path: root/mod/thewire/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/thewire/views')
-rw-r--r--mod/thewire/views/default/js/thewire.php86
-rw-r--r--mod/thewire/views/default/object/thewire.php5
-rw-r--r--mod/thewire/views/default/thewire/css.php98
-rw-r--r--mod/thewire/views/default/thewire/previous.php11
4 files changed, 104 insertions, 96 deletions
diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php
new file mode 100644
index 000000000..1eda90bee
--- /dev/null
+++ b/mod/thewire/views/default/js/thewire.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * The wire's JavaScript
+ */
+
+$site_url = elgg_get_site_url();
+
+?>
+
+elgg.provide('elgg.thewire');
+
+elgg.thewire.init = function() {
+ $("#thewire-textarea").live('keydown', function() {
+ elgg.thewire.textCounter(this, $("#thewire-characters-remaining span"), 140);
+ });
+ $("#thewire-textarea").live('keyup', function() {
+ elgg.thewire.textCounter(this, $("#thewire-characters-remaining span"), 140);
+ });
+
+ $(".thewire-previous").live('click', elgg.thewire.viewPrevious);
+}
+
+/**
+ * Update the number of characters left with every keystroke
+ *
+ * @param {Object} textarea
+ * @param {Object} status
+ * @param {integer} limit
+ * @return void
+ */
+elgg.thewire.textCounter = function(textarea, status, limit) {
+
+ var remaining_chars = limit - textarea.value.length;
+ status.html(remaining_chars);
+
+ if (remaining_chars < 0) {
+ status.parent().css("color", "#D40D12");
+ $("#thewire-submit-button").attr('disabled', 'disabled');
+ $("#thewire-submit-button").addClass('elgg-state-disabled');
+ } else {
+ status.parent().css("color", "");
+ $("#thewire-submit-button").removeAttr('disabled', 'disabled');
+ $("#thewire-submit-button").removeClass('elgg-state-disabled');
+ }
+}
+
+/**
+ * Display the previous wire post
+ *
+ * Makes Ajax call to load the html and handles changing the previous link
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.thewire.viewPrevious = function(event) {
+ var $link = $(this);
+ var postGuid = $link.attr("href").split("/").pop();
+ var $previousDiv = $("#thewire-previous-" + postGuid);
+
+ if ($link.html() == "<?php echo elgg_echo('thewire:hide'); ?>") {
+ $link.html("<?php echo elgg_echo('thewire:previous'); ?>");
+ $link.attr("title", "<?php echo elgg_echo('thewire:previous:help'); ?>");
+ $previousDiv.slideUp(400);
+ } else {
+ $link.html("<?php echo elgg_echo('thewire:hide'); ?>");
+ $link.attr("title", "<?php echo elgg_echo('thewire:hide:help'); ?>");
+
+ $.ajax({type: "GET",
+ url: "<?php echo $site_url . "ajax/view/thewire/previous"; ?>",
+ dataType: "html",
+ cache: false,
+ data: {guid: postGuid},
+ success: function(htmlData) {
+ if (htmlData.length > 0) {
+ $previousDiv.html(htmlData);
+ $previousDiv.slideDown(600);
+ }
+ }
+ });
+
+ }
+
+ event.preventDefault();
+}
+
+elgg.register_hook_handler('init', 'system', elgg.thewire.init); \ No newline at end of file
diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php
index bcc62f816..1c61d5886 100644
--- a/mod/thewire/views/default/object/thewire.php
+++ b/mod/thewire/views/default/object/thewire.php
@@ -53,3 +53,8 @@ $params = array(
$list_body = elgg_view('page/components/summary', $params);
echo elgg_view_image_block($owner_icon, $list_body);
+
+if ($post->reply) {
+ echo "<div class=\"thewire-parent hidden\" id=\"thewire-previous-{$post->guid}\">";
+ echo "</div>";
+}
diff --git a/mod/thewire/views/default/thewire/css.php b/mod/thewire/views/default/thewire/css.php
index afc3a16aa..d1ef31993 100644
--- a/mod/thewire/views/default/thewire/css.php
+++ b/mod/thewire/views/default/thewire/css.php
@@ -27,100 +27,6 @@ The Wire
text-align: right;
background: white;
}
-<?php
-return true;
-?>
-
-/* new wire post form */
-.new_wire_post {
- margin:10px 0 15px 0;
- padding-bottom:15px;
- border-bottom: 1px solid #dedede;
-}
-.new_wire_post input[type="submit"] {
- margin:3px 0 0 0;
- float:right;
-}
-.new_wire_post textarea {
- width: 719px;
- height: 52px;
- padding: 2px 5px 5px 5px;
- font-size: 120%;
- color:#333333;
-}
-.character_count {
- width: 642px;
- color:#666666;
-}
-.character_count input {
- color:#666666;
- border:none;
- font-size: 100%;
- font-weight: bold;
- padding:0 2px 0 0;
- margin:0;
- text-align: right;
- background: white;
-}
-.character_count input:focus {
- border:none;
- background:white;
-}
-
-
-/* wire posts listings */
-.wire_post {
- padding-bottom:10px;
- margin-bottom:5px;
- background-image: url(<?php echo elgg_get_site_url(); ?>mod/thewire/graphics/thewire_speech_bubble.gif);
- background-repeat: no-repeat;
- background-position: right bottom;
-}
-.members-list .wire_post { /* when displayed in lists of friends */
- margin-top:4px;
-}
-.wire_post_contents {
- background-color: #eee;
- margin:0;
- padding:5px;
- line-height: 1.2em;
- min-height: 34px;
- position: relative;
-}
-.wire_post_icon {
- float:left;
- margin-right:8px;
-}
-.wire_post_info {
- margin-top:-3px;
- float:left;
- width:620px;
- overflow: hidden;
-}
-.wire_post_options {
- float:right;
- width:65px;
-}
-.wire_post_options .elgg-button-action.reply.small {
- float:right;
-}
-.wire_post_options .elgg-button-delete {
- position: absolute;
- bottom:5px;
- right:5px;
-}
-
-
-/* latest wire post on profile page */
-.wire_post .elgg-button-action.update.small {
- float:right;
- padding:4px;
- position: absolute;
- bottom:5px;
- right:5px;
-}
-
-/* river wire entry */
-.river_item .reply_link {
- display:block;
+.thewire-parent {
+ margin-left: 40px;
}
diff --git a/mod/thewire/views/default/thewire/previous.php b/mod/thewire/views/default/thewire/previous.php
new file mode 100644
index 000000000..e1ca83e24
--- /dev/null
+++ b/mod/thewire/views/default/thewire/previous.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Serve up html for a post
+ */
+
+$guid = (int) get_input('guid');
+
+$parent = thewire_get_parent($guid);
+if ($parent) {
+ echo elgg_view_entity($parent);
+}