green?
This commit is contained in:
parent
3ed50cab94
commit
545611fffa
25 changed files with 100 additions and 66 deletions
2
Gemfile
2
Gemfile
|
|
@ -102,7 +102,7 @@ end
|
|||
|
||||
group :test do
|
||||
gem 'mysql2', '0.2.6'
|
||||
gem 'pg'
|
||||
#gem 'pg'
|
||||
gem 'factory_girl_rails'
|
||||
gem 'fixture_builder', '0.2.2'
|
||||
gem 'selenium-webdriver', '2.4'
|
||||
|
|
|
|||
|
|
@ -319,7 +319,6 @@ GEM
|
|||
oa-openid (= 0.2.6)
|
||||
open4 (1.1.0)
|
||||
orm_adapter (0.0.5)
|
||||
pg (0.11.0)
|
||||
polyglot (0.3.2)
|
||||
pyu-ruby-sasl (0.0.3.3)
|
||||
rack (1.2.3)
|
||||
|
|
@ -499,7 +498,6 @@ DEPENDENCIES
|
|||
oauth2-provider (= 0.0.16)
|
||||
ohai (= 0.5.8)
|
||||
omniauth (= 0.2.6)
|
||||
pg
|
||||
rails (= 3.0.9)
|
||||
rails-i18n
|
||||
rcov
|
||||
|
|
|
|||
|
|
@ -3,3 +3,8 @@ WebSocketReceiver.processComment("<%= @comment.post.guid %>",
|
|||
"<%= escape_javascript(render(:partial => 'comments/comment', :locals => { :comment => @comment, :person => current_user.person}))%>",
|
||||
false);
|
||||
|
||||
Diaspora.page
|
||||
.stream
|
||||
.streamElements["<%= @comment.post.guid %>"]
|
||||
.commentStream
|
||||
.instantiateCommentWidgets();
|
||||
|
|
@ -4,4 +4,4 @@ $(".stream_element", "#conversation_inbox").removeClass('selected');
|
|||
$(".stream_element[data-guid='<%= @conversation.id %>']", "#conversation_inbox").addClass('selected');
|
||||
$(".stream_element[data-guid='<%= @conversation.id %>']", "#conversation_inbox").find(".unread_message_count").remove()
|
||||
|
||||
Diaspora.Page.timeAgo.updateTimeAgo();
|
||||
Diaspora.page.timeAgo.updateTimeAgo();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ javascripts:
|
|||
- public/javascripts/widgets/stream-element.js
|
||||
- public/javascripts/widgets/comment-stream.js
|
||||
- public/javascripts/widgets/comment-toggler.js
|
||||
- public/javascripts/widgets/comment-form.js
|
||||
- public/javascripts/widgets/comment.js
|
||||
- public/javascripts/widgets/likes.js
|
||||
- public/javascripts/widgets/hovercard.js
|
||||
|
|
@ -50,6 +51,7 @@ javascripts:
|
|||
- public/javascripts/view.js
|
||||
- public/javascripts/stream.js
|
||||
- public/javascripts/content-updater.js
|
||||
- public/javascripts/aspects-dropdown.js
|
||||
- public/javascripts/contact-edit.js
|
||||
- public/javascripts/contact-list.js
|
||||
- public/javascripts/aspect-sorting.js
|
||||
|
|
|
|||
|
|
@ -394,7 +394,8 @@ ActiveRecord::Schema.define(:version => 20110818212541) do
|
|||
t.string "language"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "invitation_token", :limit => 60
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "invitation_token", :limit => 20
|
||||
t.datetime "invitation_sent_at"
|
||||
t.string "reset_password_token"
|
||||
t.string "remember_token"
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ var AspectFilters = {
|
|||
|
||||
// reinit listeners on stream
|
||||
photozone.html(photos_html);
|
||||
Diaspora.Page.publish("stream/reloaded");
|
||||
Diaspora.page.publish("stream/reloaded");
|
||||
|
||||
// fade contents back in
|
||||
AspectFilters.fadeIn();
|
||||
|
|
|
|||
|
|
@ -9,25 +9,24 @@ var AspectsDropdown = {
|
|||
|
||||
if (number == 0) {
|
||||
button.removeClass(inAspectClass);
|
||||
replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero");
|
||||
replacement = Diaspora.I18n.t("aspect_dropdown.toggle.zero");
|
||||
}else if (number == 1) {
|
||||
button.addClass(inAspectClass);
|
||||
replacement = dropdown.find(".selected").first().text();
|
||||
}else if (number < 3) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
|
||||
replacement = Diaspora.I18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
|
||||
}else if (number > 3) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.many', { count: number.toString()})
|
||||
replacement = Diaspora.I18n.t('aspect_dropdown.toggle.many', { count: number.toString()})
|
||||
}else {
|
||||
//the above one are a tautology, but I want to have them here once for once we figure out a neat way i18n them
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
|
||||
replacement = Diaspora.I18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
|
||||
}
|
||||
|
||||
button.html(replacement + ' ▼');
|
||||
},
|
||||
|
||||
toggleCheckbox:
|
||||
function(check){
|
||||
toggleCheckbox: function(check) {
|
||||
check.toggleClass('selected');
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,19 +24,17 @@ var ContactEdit = {
|
|||
|
||||
if (number == 0) {
|
||||
button.removeClass("in_aspects");
|
||||
replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero");
|
||||
replacement = Diaspora.I18n.t("aspect_dropdown.toggle.zero");
|
||||
}else if (number == 1) {
|
||||
button.addClass("in_aspects");
|
||||
replacement = dropdown.find(".selected").first().text();
|
||||
}else if (number < 3) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
|
||||
replacement = Diaspora.I18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
|
||||
}else if (number > 3) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.many', { count: number.toString()})
|
||||
replacement = Diaspora.I18n.t('aspect_dropdown.toggle.many', { count: number.toString()})
|
||||
}else {
|
||||
//the above one are a tautology, but I want to have them here once for once we figure out a neat way i18n them
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
|
||||
}
|
||||
else {
|
||||
replacement = Diaspora.I18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
|
||||
ContactEdit.toggleAspectMembership(li, evt);
|
||||
}
|
||||
},
|
||||
|
|
@ -61,6 +59,18 @@ var ContactEdit = {
|
|||
}
|
||||
},
|
||||
|
||||
processClick: function(li, evt){
|
||||
var dropdown = li.closest('.dropdown');
|
||||
li.addClass('loading');
|
||||
if (dropdown.hasClass('inviter')) {
|
||||
ContactEdit.inviteFriend(li, evt);
|
||||
dropdown.html('sending, please wait...');
|
||||
}
|
||||
else {
|
||||
ContactEdit.toggleAspectMembership(li, evt);
|
||||
}
|
||||
},
|
||||
|
||||
toggleAspectMembership: function(li, evt) {
|
||||
var button = li.find('.button');
|
||||
if(button.hasClass('disabled') || li.hasClass('newItem')){ return; }
|
||||
|
|
@ -73,7 +83,8 @@ var ContactEdit = {
|
|||
"person_id": li.parent().data("person_id"),
|
||||
"_method": (selected) ? "DELETE" : "POST"
|
||||
}, function(aspectMembership) {
|
||||
ContactEdit.toggleCheckbox(checkbox);
|
||||
li.removeClass("loading");
|
||||
ContactEdit.toggleCheckbox(li);
|
||||
ContactEdit.updateNumber(li.closest(".dropdown_list"), li.parent().data("person_id"), aspectMembership.aspect_ids.length);
|
||||
|
||||
Diaspora.page.publish("aspectDropdown/updated", [li.parent().data("person_id"), li.parents(".dropdown").parent(".right").html()]);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@
|
|||
|
||||
|
||||
$(function() {
|
||||
if(typeof Diaspora.Pages[Diaspora.Page] === "undefined") { throw new Error("Page " + Diaspora.Page + " does not exist"); }
|
||||
if (typeof Diaspora.Pages[Diaspora.Page] === "undefined") {
|
||||
Diaspora.page = Diaspora.EventBroker.extend(Diaspora.BaseWidget);
|
||||
return;
|
||||
}
|
||||
|
||||
var Page = Diaspora.Pages[Diaspora.Page];
|
||||
$.extend(Page.prototype, Diaspora.EventBroker.extend(Diaspora.BaseWidget));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ $(document).ready(function(){
|
|||
|
||||
$('a.conversation').live('click', function(){
|
||||
$.getScript(this.href, function() {
|
||||
Diaspora.Page.directionDetector.updateBinds();
|
||||
Diaspora.page.directionDetector.updateBinds();
|
||||
});
|
||||
history.pushState(null, "", this.href);
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ $(document).ready(function(){
|
|||
$(window).bind("popstate", function(){
|
||||
if (location.href.match(/conversations\/\d+/) !== null) {
|
||||
$.getScript(location.href, function() {
|
||||
Diaspora.Page.directionDetector.updateBinds();
|
||||
Diaspora.page.directionDetector.updateBinds();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Diaspora.Pages.AspectsIndex = function() {
|
|||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, document) {
|
||||
self.stream = self.instantiate("Stream", document.find("#main_stream"));
|
||||
self.stream = self.instantiate("Stream", document.find("#aspect_stream_container"));
|
||||
self.header = self.instantiate("Header", document.find("header"));
|
||||
|
||||
self.hoverCard = self.instantiate("HoverCard", document.find("#hovercard"));
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@ Diaspora.Pages.ConversationsIndex = function() {
|
|||
|
||||
this.subscribe("page/ready", function(evt, body) {
|
||||
self.header = self.instantiate("Header", body.find("header"));
|
||||
self.directionDetector = self.instantiate("DirectionDetector");
|
||||
});
|
||||
};
|
||||
7
public/javascripts/pages/users-edit.js
Normal file
7
public/javascripts/pages/users-edit.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Diaspora.Pages.UsersEdit = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, body) {
|
||||
self.header = self.instantiate("Header", body.find("header"));
|
||||
});
|
||||
};
|
||||
|
|
@ -3,20 +3,17 @@
|
|||
var self = this;
|
||||
|
||||
this.subscribe("widget/ready", function(evt, commentFormElement) {
|
||||
$.extend({
|
||||
commentFormElement: commentFormElement
|
||||
$.extend(self, {
|
||||
commentFormElement: commentFormElement,
|
||||
commentInput: commentFormElement.find("textarea")
|
||||
});
|
||||
|
||||
self.commentFormElement.submit(self.submitComment);
|
||||
self.commentInput.focus(self.showCommentForm);
|
||||
});
|
||||
|
||||
this.submitComment = function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
$.post(self.commentFormElement.attr("action"), self.commentFormElement.serialize(), function() {
|
||||
|
||||
});
|
||||
}
|
||||
this.showCommentForm = function() {
|
||||
self.commentFormElement.addClass("open");
|
||||
};
|
||||
};
|
||||
|
||||
Diaspora.Widgets.CommentForm = CommentForm;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@
|
|||
$.extend(self, {
|
||||
commentStream: commentStream,
|
||||
commentToggler: self.instantiate("CommentToggler", commentStream),
|
||||
commentForm: self.instantiate("CommentForm", commentStream.find(".new_comment_form")),
|
||||
comments: []
|
||||
comments: {}
|
||||
});
|
||||
|
||||
self.commentStream.delegate(".new_comment", "ajax:failure", function() {
|
||||
|
|
@ -41,10 +40,10 @@
|
|||
});
|
||||
|
||||
this.instantiateCommentWidgets = function() {
|
||||
self.comments = [];
|
||||
self.comments = {};
|
||||
|
||||
$.each(self.commentStream.find("li.comment"), function(index, element) {
|
||||
self.comments.push(self.instantiate("Comment", $(element)));
|
||||
$.each(self.commentStream.find("li.comment"), function() {
|
||||
self.comments[this.id] = self.instantiate("Comment", $(this));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
this.reInitialize = function() {
|
||||
$("#main_stream").infinitescroll("destroy");
|
||||
self.trigger("widget/ready");
|
||||
self.publish("widget/ready");
|
||||
};
|
||||
|
||||
this.globalSubscribe("stream/reloaded", self.reInitialize, this);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
url: "/notifications/" + notification.id,
|
||||
type: "PUT",
|
||||
success: function() {
|
||||
Diaspora.Page.notifications.decrementCount();
|
||||
Diaspora.page.header.notifications.decrementCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
self.postGuid = element.attr("id");
|
||||
|
||||
$.extend(self, {
|
||||
commentForm: self.instantiate("CommentForm", element.find("form.new_comment")),
|
||||
commentStream: self.instantiate("CommentStream", element.find("ul.comments")),
|
||||
embedder: self.instantiate("Embedder", element.find("div.content")),
|
||||
likes: self.instantiate("Likes", element.find("div.likes_container")),
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
(function() {
|
||||
var Stream = function() {
|
||||
var self = this;
|
||||
this.streamElements = [];
|
||||
|
||||
this.subscribe("widget/ready", function(evt, element) {
|
||||
$.each(element.find(".stream_element"), function(index, element) {
|
||||
self.addPost($(element));
|
||||
this.subscribe("widget/ready", function(evt, stream) {
|
||||
$.extend(self, {
|
||||
stream: $(stream),
|
||||
streamElements: {}
|
||||
});
|
||||
|
||||
$.each(self.stream.find(".stream_element"), function() {
|
||||
self.addPost($(this));
|
||||
});
|
||||
});
|
||||
|
||||
this.globalSubscribe("stream/reloaded", function() {
|
||||
self.publish("widget/ready", self.stream);
|
||||
});
|
||||
|
||||
this.globalSubscribe("stream/post/added", function(evt, post) {
|
||||
|
|
@ -14,9 +22,7 @@
|
|||
});
|
||||
|
||||
this.addPost = function(post) {
|
||||
self.streamElements.push(
|
||||
self.instantiate("StreamElement", post)
|
||||
);
|
||||
self.streamElements[post.attr("id")] = self.instantiate("StreamElement", post);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
});
|
||||
|
||||
self.menuElement.click(self.toggleDropdown);
|
||||
self.menuElement.find("li a").slice(1, 3).click(function(evt) { evt.stopPropagation(); });
|
||||
self.menuElement.find("li a").slice(1).click(function(evt) { evt.stopPropagation(); });
|
||||
$(document.body).click(self.hideDropdown);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@ describe("Diaspora.Alert", function() {
|
|||
beforeEach(function() {
|
||||
spec.loadFixture("aspects_index");
|
||||
|
||||
Diaspora.page = new Diaspora.Pages.TestPage();
|
||||
Diaspora.page.directionDetector = Diaspora.BaseWidget.instantiate("DirectionDetector");
|
||||
|
||||
$(document).trigger("close.facebox");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
|
||||
Diaspora.Pages.TestPage = function() { };
|
||||
Diaspora.Page = "TestPage";
|
||||
|
||||
describe("Diaspora", function() {
|
||||
describe("EventBroker", function() {
|
||||
describe("extend", function() {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,20 @@ beforeEach(function() {
|
|||
// NOTE Commented (as well as in afterEach) to keep the listeners from rails.js alive.
|
||||
//spec.clearLiveEventBindings();
|
||||
jasmine.Clock.useMock();
|
||||
|
||||
|
||||
Diaspora.Pages.TestPage = function() {
|
||||
var self = this;
|
||||
this.subscribe("page/ready", function() {
|
||||
self.timeAgo = self.instantiate("TimeAgo", "abbr.timeago");
|
||||
self.directionDetector = self.instantiate("DirectionDetector");
|
||||
});
|
||||
};
|
||||
var Page = Diaspora.Pages["TestPage"];
|
||||
$.extend(Page.prototype, Diaspora.EventBroker.extend(Diaspora.BaseWidget));
|
||||
|
||||
Diaspora.page = new Page();
|
||||
Diaspora.page.publish("page/ready", [$(document.body)])
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
@ -85,3 +99,4 @@ spec.retrieveFixture = function(fixtureName) {
|
|||
|
||||
spec.loadFixtureCount = 0;
|
||||
spec.cachedFixtures = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ describe("Stream", function() {
|
|||
jasmine.Clock.useMock();
|
||||
spec.loadFixture('aspects_index_with_posts');
|
||||
Diaspora.I18n.locale = { };
|
||||
|
||||
Diaspora.page = new Diaspora.Pages.TestPage();
|
||||
Diaspora.page.timeAgo = Diaspora.BaseWidget.instantiate("TimeAgo");
|
||||
Diaspora.page.directionDetector = Diaspora.BaseWidget.instantiate("DirectionDetector");
|
||||
});
|
||||
|
||||
describe("collapseText", function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue