Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielgrippi <danielgrippi@gmail.com>2012-01-01 08:25:44 +0400
committerDennis Collinson <dennis.collective@gmail.com>2012-01-08 02:23:27 +0400
commit1e20ca0cf5888d538a6b3be605038e3107fe68fb (patch)
treec24aaf27a956c6ffece620930ca0a86d8934e7df
parent85b5974fa9380a0ed355b4d12e2a47d5af277289 (diff)
remove old js files, specs; remove stream references in page js initializers
-rw-r--r--public/javascripts/pages/comment-stream-index.js8
-rw-r--r--public/javascripts/pages/like-stream-index.js7
-rw-r--r--public/javascripts/pages/multis-index.js1
-rw-r--r--public/javascripts/pages/people-show.js1
-rw-r--r--public/javascripts/pages/posts-index.js5
-rw-r--r--public/javascripts/pages/posts-show.js7
-rw-r--r--public/javascripts/pages/tag-followings-index.js2
-rw-r--r--public/javascripts/stream.js30
-rw-r--r--public/javascripts/view.js2
-rw-r--r--public/javascripts/web-socket-receiver.js39
-rw-r--r--public/javascripts/widgets/comment-form.js22
-rw-r--r--public/javascripts/widgets/comment-stream.js65
-rw-r--r--public/javascripts/widgets/comment.js23
-rw-r--r--public/javascripts/widgets/stream-element.js29
-rw-r--r--spec/controllers/jasmine_fixtures/stream_spec.rb18
-rw-r--r--spec/javascripts/web-socket-receiver-spec.js21
-rw-r--r--spec/javascripts/widgets/comment-stream-spec.js95
-rw-r--r--spec/javascripts/widgets/stream-element-spec.js28
18 files changed, 15 insertions, 388 deletions
diff --git a/public/javascripts/pages/comment-stream-index.js b/public/javascripts/pages/comment-stream-index.js
deleted file mode 100644
index df368289b..000000000
--- a/public/javascripts/pages/comment-stream-index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Diaspora.Pages.CommentStreamIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
-};
-
diff --git a/public/javascripts/pages/like-stream-index.js b/public/javascripts/pages/like-stream-index.js
deleted file mode 100644
index 382f11000..000000000
--- a/public/javascripts/pages/like-stream-index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Diaspora.Pages.LikeStreamIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
-};
diff --git a/public/javascripts/pages/multis-index.js b/public/javascripts/pages/multis-index.js
index 84ec296b0..5bbb25321 100644
--- a/public/javascripts/pages/multis-index.js
+++ b/public/javascripts/pages/multis-index.js
@@ -3,6 +3,5 @@ Diaspora.Pages.MultisIndex = function() {
this.subscribe("page/ready", function(evt, document) {
self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- self.stream = self.instantiate("Stream", document.find("#aspect_stream_container"));
});
};
diff --git a/public/javascripts/pages/people-show.js b/public/javascripts/pages/people-show.js
index 6607d89b2..0d9954629 100644
--- a/public/javascripts/pages/people-show.js
+++ b/public/javascripts/pages/people-show.js
@@ -1,3 +1,2 @@
Diaspora.Pages.PeopleShow = function() {
- var self = this;
};
diff --git a/public/javascripts/pages/posts-index.js b/public/javascripts/pages/posts-index.js
index c6e1b3165..8266b92c9 100644
--- a/public/javascripts/pages/posts-index.js
+++ b/public/javascripts/pages/posts-index.js
@@ -1,7 +1,2 @@
Diaspora.Pages.PostsIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
};
diff --git a/public/javascripts/pages/posts-show.js b/public/javascripts/pages/posts-show.js
index 7ec693718..a9cf6c51e 100644
--- a/public/javascripts/pages/posts-show.js
+++ b/public/javascripts/pages/posts-show.js
@@ -1,7 +1,2 @@
Diaspora.Pages.PostsShow = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, body) {
- self.stream = self.instantiate("Stream", body.find("#main_stream"));
- });
-}; \ No newline at end of file
+};
diff --git a/public/javascripts/pages/tag-followings-index.js b/public/javascripts/pages/tag-followings-index.js
index 3eaf10d27..71dc24aa8 100644
--- a/public/javascripts/pages/tag-followings-index.js
+++ b/public/javascripts/pages/tag-followings-index.js
@@ -3,7 +3,5 @@ Diaspora.Pages.TagFollowingsIndex = function() {
this.subscribe("page/ready", function(evt, document) {
self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
-
- self.stream = self.instantiate("Stream", document.find("#aspect_stream_container"));
});
};
diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js
index f919c86b8..8283a6614 100644
--- a/public/javascripts/stream.js
+++ b/public/javascripts/stream.js
@@ -8,36 +8,6 @@ var Stream = {
initialize: function() {
Diaspora.page.directionDetector.updateBinds();
- Stream.setUpAudioLinks();
- },
-
- initializeLives: function(){
- // reshare button action
- $(".reshare_button", this.selector).live("click", function(evt) {
- evt.preventDefault();
- var button = $(this),
- box = button.siblings(".reshare_box");
-
- if (box.length > 0) {
- button.toggleClass("active");
- box.toggle();
- }
- });
- },
-
- setUpAudioLinks: function() {
- $(".stream a[target='_blank']").each(function(r){
- var link = $(this);
- if(this.href.match(/\.mp3$|\.ogg$/)) {
- $("<audio/>", {
- preload: "none",
- src: this.href,
- controls: "controls"
- }).appendTo(link.parent());
-
- link.remove();
- }
- });
}
};
diff --git a/public/javascripts/view.js b/public/javascripts/view.js
index 8165e0409..5c568d463 100644
--- a/public/javascripts/view.js
+++ b/public/javascripts/view.js
@@ -63,8 +63,6 @@ var View = {
'extraSpace': 5
});
}
-// Diaspora.Page.subscribe("stream/scrolled", startAutoResize)
-// Diaspora.Page.subscribe("stream/reloaded", startAutoResize)
/* photo exporting in the works */
$("#photo-export-button").bind("click", function(evt){
diff --git a/public/javascripts/web-socket-receiver.js b/public/javascripts/web-socket-receiver.js
deleted file mode 100644
index 90a5b30e7..000000000
--- a/public/javascripts/web-socket-receiver.js
+++ /dev/null
@@ -1,39 +0,0 @@
-var WSR = WebSocketReceiver = {
- initialize: function(url) {
- WSR.socket = new WebSocket(url);
-
- WSR.socket.onmessage = WSR.onMessage;
- WSR.socket.onopen = function() {
- WSR.socket.send(location.pathname);
- };
- },
-
- onMessage: function(evt) {
- var message = $.parseJSON(evt.data);
-
- if(message["class"].match(/^notifications/)) {
- Diaspora.page.header.notifications.showNotification(message);
- }
- else {
- console.log("new content");
- }
- },
-
- onPageForAspects: function(aspectIds) {
- var streamIds = $("#main_stream").attr("data-guids"),
- found = false;
-
- $.each(aspectIds, function(index, value) {
- if(WebSocketReceiver.onStreamForAspect(value, streamIds)) {
- found = true;
- return false;
- }
- });
-
- return found;
- },
-
- onStreamForAspect: function(aspectId, streamIds) {
- return (streamIds.search(aspectId) != -1);
- }
-};
diff --git a/public/javascripts/widgets/comment-form.js b/public/javascripts/widgets/comment-form.js
deleted file mode 100644
index 81914124d..000000000
--- a/public/javascripts/widgets/comment-form.js
+++ /dev/null
@@ -1,22 +0,0 @@
-(function() {
- var CommentForm = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, commentFormElement) {
- $.extend(self, {
- commentFormElement: commentFormElement,
- commentInput: commentFormElement.find("textarea")
- });
-
- self.commentInput.autoResize();
- self.commentInput.focus(self.showCommentForm);
- });
-
- this.showCommentForm = function() {
- self.commentFormElement.parent().removeClass("hidden");
- self.commentFormElement.addClass("open");
- };
- };
-
- Diaspora.Widgets.CommentForm = CommentForm;
-})(); \ No newline at end of file
diff --git a/public/javascripts/widgets/comment-stream.js b/public/javascripts/widgets/comment-stream.js
deleted file mode 100644
index 76d20eaec..000000000
--- a/public/javascripts/widgets/comment-stream.js
+++ /dev/null
@@ -1,65 +0,0 @@
-(function() {
- var CommentStream = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, commentStream) {
- $.extend(self, {
- commentsList: commentStream.find("ul.comments"),
- commentToggler: commentStream.find(".toggle_post_comments"),
- comments: {}
- });
-
- self.commentsList.delegate(".new_comment", "ajax:failure", function() {
- Diaspora.Alert.show(Diaspora.I18n.t("failed_to_post_message"));
- });
-
- self.commentToggler.toggle(self.showComments, self.hideComments);
-
- self.instantiateCommentWidgets();
- });
-
- this.instantiateCommentWidgets = function() {
- self.comments = {};
-
- self.commentsList.find("li.comment").each(function() {
- self.publish("comment/added", [$("#" + this.id)]);
- });
- };
-
- this.showComments = function(evt) {
- evt.preventDefault();
-
- if(self.commentsList.hasClass("loaded")) {
- self.commentToggler.html(Diaspora.I18n.t("comments.hide"));
- self.commentsList.removeClass("hidden");
- }
- else {
- $("<img/>", { alt: "loading", src: "/images/ajax-loader.gif"}).appendTo(self.commentToggler);
-
- $.get(self.commentToggler.attr("href"), function(data) {
- self.commentToggler.html(Diaspora.I18n.t("comments.hide"));
-
- self.commentsList
- .html(data)
- .addClass("loaded")
- .removeClass("hidden");
-
- self.instantiateCommentWidgets();
- });
- }
- };
-
- this.hideComments = function(evt) {
- evt.preventDefault();
-
- self.commentToggler.html(Diaspora.I18n.t("comments.show"));
- self.commentsList.addClass("hidden");
- };
-
- this.subscribe("comment/added", function(evt, comment) {
- self.comments[comment.attr("id")] = self.instantiate("Comment", comment);
- });
- };
-
- Diaspora.Widgets.CommentStream = CommentStream;
-})(); \ No newline at end of file
diff --git a/public/javascripts/widgets/comment.js b/public/javascripts/widgets/comment.js
index 862b5cfbf..6ad643d64 100644
--- a/public/javascripts/widgets/comment.js
+++ b/public/javascripts/widgets/comment.js
@@ -5,40 +5,17 @@
this.subscribe("widget/ready", function(evt, comment) {
$.extend(self, {
comment: comment,
- deleteCommentLink: comment.find("a.comment_delete"),
- likes: self.instantiate("Likes", comment.find(".likes_container")),
timeAgo: self.instantiate("TimeAgo", comment.find("abbr.timeago")),
content: comment.find(".content span .collapsible")
});
- self.deleteCommentLink.click(self.removeComment);
- self.deleteCommentLink.twipsy({ trigger: "hover" });
-
self.content.expander({
slicePoint: 200,
widow: 18,
expandText: Diaspora.I18n.t("show_more"),
userCollapse: false
});
-
- self.globalSubscribe("likes/" + self.comment.attr('id') + "/updated", function(){
- self.likes = self.instantiate("Likes", self.comment.find(".likes_container"));
- });
});
-
- this.removeComment = function(evt) {
- evt.preventDefault();
-
- if(confirm(Diaspora.I18n.t("confirm_dialog"))) {
- $.post(self.deleteCommentLink.attr("href"), {
- _method: "delete"
- }, function() {
- self.comment.hide("blind", { direction: "vertical" }, 300, function() {
- self.comment.remove();
- });
- });
- }
- };
};
Diaspora.Widgets.Comment = Comment;
diff --git a/public/javascripts/widgets/stream-element.js b/public/javascripts/widgets/stream-element.js
index 19305bb64..3b9f64d1f 100644
--- a/public/javascripts/widgets/stream-element.js
+++ b/public/javascripts/widgets/stream-element.js
@@ -5,19 +5,9 @@
this.subscribe("widget/ready", function(evt, element) {
if( Diaspora.backboneEnabled() ){ return }
- self.postGuid = element.attr("id");
-
$.extend(self, {
- commentForm: self.instantiate("CommentForm", element.find("form.new_comment")),
- commentStream: self.instantiate("CommentStream", element.find(".comment_stream")),
- likes: self.instantiate("Likes", element.find(".likes.on_post .likes_container:first")),
- lightBox: self.instantiate("Lightbox", element),
timeAgo: self.instantiate("TimeAgo", element.find(".timeago a abbr.timeago")),
-
content: element.find(".content .collapsible"),
- hidePostLoader: element.find("img.hide_loader"),
- hidePostUndo: element.find("a.stream_element_hide_undo"),
- post: element
});
// collapse long posts
@@ -27,25 +17,6 @@
expandText: Diaspora.I18n.t("show_more"),
userCollapse: false
});
-
- self.globalSubscribe("likes/" + self.postGuid + "/updated", function() {
- self.likes = self.instantiate("Likes", self.post.find(".likes_container:first"));
- });
-
- self.deletePostLink.click(function(evt) {
- evt.preventDefault();
-
- self.hidePostLoader.ajaxStart( function() {
- self.deletePostLink.addClass("hidden");
- $(this).removeClass('hidden');
- } );
- });
-
- self.hidePostUndo.click(function(evt) {
- evt.preventDefault();
-
- self.hidePostLoader.toggleClass("hidden");
- });
});
};
diff --git a/spec/controllers/jasmine_fixtures/stream_spec.rb b/spec/controllers/jasmine_fixtures/stream_spec.rb
index ff9a2a16a..7fb93a6b6 100644
--- a/spec/controllers/jasmine_fixtures/stream_spec.rb
+++ b/spec/controllers/jasmine_fixtures/stream_spec.rb
@@ -11,14 +11,24 @@ describe MultisController do
end
it 'generates the multi_stream_json fixture', :fixture => true do
- alice.post(:status_message, :text => "hella infos yo!", :to => alice.aspects.first.id)
- alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all')
- post_to_be_liked = alice.post(:status_message, :text => "you're gonna love this.'", :to => alice.aspects.first.id)
+ posts = []
- alice.like(1, :target => post_to_be_liked)
+ posts << alice.post(:status_message, :text => "hella infos yo!", :to => alice.aspects.first.id)
+ posts << alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all')
+ posts << alice.post(:status_message, :text => "you're gonna love this.'", :to => alice.aspects.first.id)
+ alice.like(1, :target => posts.last)
+
+ time = Time.now
+ posts.each do |p|
+ time += 1.day
+ p.stub(:created_at).and_return(time)
+ end
get :index, :format => :json
response.should be_success
+
+ pp response.body
+
save_fixture(response.body, "multi_stream_json")
end
end
diff --git a/spec/javascripts/web-socket-receiver-spec.js b/spec/javascripts/web-socket-receiver-spec.js
deleted file mode 100644
index f158ae56e..000000000
--- a/spec/javascripts/web-socket-receiver-spec.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-describe("WebSocketReceiver", function() {
- /* WSR should publish events that widgets hook into
- * e.g. socket/message/CLASS
- * WSR should pass the message's data as an argument to the event.
- * downsides:
- * - need to standardize notifications
- */
-
- describe("onMessage", function() {
-
- });
-
- it("sets a shortcut", function() {
- expect(WSR).toEqual(WebSocketReceiver);
- });
-});
diff --git a/spec/javascripts/widgets/comment-stream-spec.js b/spec/javascripts/widgets/comment-stream-spec.js
deleted file mode 100644
index 3f369ff69..000000000
--- a/spec/javascripts/widgets/comment-stream-spec.js
+++ /dev/null
@@ -1,95 +0,0 @@
-describe("Diaspora.Widgets.CommentStream", function() {
- var commentStream;
- var ajaxCommentResponse;
-
- beforeEach(function() {
- ajaxCommentResponse = spec.readFixture("ajax_comments_on_post");
- spec.loadFixture("aspects_index_post_with_comments");
-
- jasmine.Clock.useMock();
- jasmine.Ajax.useMock();
-
- Diaspora.I18n.locale = { };
-
- commentStream = Diaspora.BaseWidget.instantiate("CommentStream", $(".stream_element:first .comment_stream"));
- });
-
- describe("toggling comments", function() {
- it("toggles class hidden on the comments ul", function () {
- expect($("ul.comments:first")).not.toHaveClass("hidden");
-
- commentStream.showComments($.Event());
-
- mostRecentAjaxRequest().response({
- responseHeaders: {
- "Content-type": "text/html"
- },
- responseText: ajaxCommentResponse,
- status: 200
- });
-
- jasmine.Clock.tick(200);
-
- expect($("ul.comments:first")).not.toHaveClass("hidden");
-
- commentStream.hideComments($.Event());
-
- jasmine.Clock.tick(200);
-
- expect($("ul.comments:first")).toHaveClass("hidden");
- });
-
- it("changes the text on the show comments link", function() {
- Diaspora.I18n.loadLocale({'comments' : {
- 'show': 'show comments translation',
- 'hide': 'hide comments translation'
- }}, 'en');
-
- var link = $("a.toggle_post_comments:first");
-
- commentStream.showComments($.Event());
-
- mostRecentAjaxRequest().response({
- responseHeaders: {
- "Content-type": "text/html"
- },
- responseText: ajaxCommentResponse,
- status: 200
- });
-
- jasmine.Clock.tick(200);
-
- expect(link.text()).toEqual("hide comments translation");
-
- commentStream.hideComments($.Event());
-
- jasmine.Clock.tick(200);
-
- expect(link.text()).toEqual("show comments translation");
- });
-
- it("only requests the comments when the loaded class is not present", function() {
- spyOn($, "ajax").andCallThrough();
-
- expect(commentStream.commentsList).not.toHaveClass("loaded");
-
- commentStream.showComments($.Event());
-
- mostRecentAjaxRequest().response({
- responseHeaders: {
- "Content-type": "text/html"
- },
- responseText: ajaxCommentResponse,
- status: 200
- });
-
- expect($.ajax.callCount).toEqual(1);
- expect(commentStream.commentsList).toHaveClass("loaded");
-
- commentStream.showComments($.Event());
-
- expect($.ajax.callCount).toEqual(1);
- expect(commentStream.commentsList).toHaveClass("loaded");
- });
- });
-}); \ No newline at end of file
diff --git a/spec/javascripts/widgets/stream-element-spec.js b/spec/javascripts/widgets/stream-element-spec.js
deleted file mode 100644
index 98d7ea940..000000000
--- a/spec/javascripts/widgets/stream-element-spec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-describe("Diaspora.Widgets.StreamElement", function() {
- var streamElement;
-
- beforeEach(function() {
- jasmine.Clock.useMock();
- spec.loadFixture("aspects_index_only_posts");
- streamElement = Diaspora.BaseWidget.instantiate("StreamElement", $(".stream_element").first());
- });
-
- describe("hidePost", function() {
- it("makes sure that ajax spinner appears when hiding a post", function() {
- expect(streamElement.deletePostLink).not.toHaveClass("hidden");
- expect(streamElement.hidePostLoader).toHaveClass("hidden");
- spyOn($, "ajax");
- streamElement.deletePostLink.click();
- streamElement.hidePostLoader.triggerHandler('ajaxStart');
- jasmine.Clock.tick(200);
- expect($.ajax).toHaveBeenCalled();
- expect(streamElement.deletePostLink).toHaveClass("hidden");
- expect(streamElement.hidePostLoader).not.toHaveClass("hidden");
- });
- });
-});