fixed many things and added search
This commit is contained in:
parent
c6220b1dc1
commit
cbc6755791
10 changed files with 128 additions and 75 deletions
|
@ -22,6 +22,14 @@ function(HostApp, Core, Paths, URI) {
|
|||
}
|
||||
|
||||
Conversation.prototype = Object.create(Core.prototype);
|
||||
|
||||
Conversation.prototype.show = function() {
|
||||
Core.prototype.show.call(this, this.body);
|
||||
}
|
||||
|
||||
Conversation.prototype.hide = function() {
|
||||
Core.prototype.hide.call(this, this.body);
|
||||
}
|
||||
|
||||
|
||||
Conversation.addStatus = function(status) {
|
||||
|
|
|
@ -2,10 +2,11 @@ define([
|
|||
"helper/HostApp",
|
||||
"controller/Timeline",
|
||||
"lib/URI",
|
||||
"helper/Paths"
|
||||
"helper/Paths",
|
||||
"helper/Core"
|
||||
],
|
||||
|
||||
function(HostApp, Timeline, URI, Paths) {
|
||||
function(HostApp, Timeline, URI, Paths, Core) {
|
||||
|
||||
|
||||
function Mentions() {
|
||||
|
@ -23,6 +24,14 @@ function(HostApp, Timeline, URI, Paths) {
|
|||
|
||||
Mentions.prototype = Object.create(Timeline.prototype);
|
||||
|
||||
Mentions.prototype.show = function() {
|
||||
Core.prototype.show.call(this, this.body);
|
||||
}
|
||||
|
||||
Mentions.prototype.hide = function() {
|
||||
Core.prototype.hide.call(this, this.body);
|
||||
}
|
||||
|
||||
|
||||
Mentions.prototype.newStatus = function(statuses) {
|
||||
|
||||
|
|
|
@ -20,19 +20,20 @@ function(HostApp, Core, Paths, URI) {
|
|||
this.initProfileTemplate();
|
||||
this.hide();
|
||||
|
||||
this.showProfileForEntity(); // Load users profile on start
|
||||
var _this = this;
|
||||
setTimeout(function() { _this.showProfileForEntity() }, 5000); // Load users profile on start
|
||||
}
|
||||
|
||||
Profile.prototype = Object.create(Core.prototype);
|
||||
|
||||
|
||||
Profile.prototype.show = function() {
|
||||
$(this.container).show();
|
||||
Core.prototype.show.call(this, this.container);
|
||||
}
|
||||
|
||||
Profile.prototype.hide = function() {
|
||||
$(this.container).hide();
|
||||
};
|
||||
Core.prototype.hide.call(this, this.container);
|
||||
}
|
||||
|
||||
Profile.prototype.showList = function(list) {
|
||||
$(this.body).hide();
|
||||
|
@ -247,18 +248,23 @@ function(HostApp, Core, Paths, URI) {
|
|||
}
|
||||
|
||||
Profile.prototype.getFollowing = function() {
|
||||
var url = Paths.mkApiRootPath("/followings") + "/" + encodeURIComponent(this.entity);
|
||||
var _this = this;
|
||||
Paths.getURL(url, "GET", function(resp) {
|
||||
if (resp.status >= 200 && resp.status < 400) {
|
||||
var following = JSON.parse(resp.responseText);
|
||||
_this.following_id = following.id
|
||||
_this.setFollowingButton(true);
|
||||
} else {
|
||||
_this.setFollowingButton(false);
|
||||
_this.following_id = null;
|
||||
}
|
||||
})
|
||||
if(this.entity != HostApp.stringForKey("entity")) {
|
||||
var url = Paths.mkApiRootPath("/followings") + "/" + encodeURIComponent(this.entity);
|
||||
var _this = this;
|
||||
Paths.getURL(url, "GET", function(resp) {
|
||||
if (resp.status >= 200 && resp.status < 400) {
|
||||
var following = JSON.parse(resp.responseText);
|
||||
_this.following_id = following.id
|
||||
_this.setFollowingButton(true);
|
||||
} else {
|
||||
_this.setFollowingButton(false);
|
||||
_this.following_id = null;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.setFollowingButton(false);
|
||||
this.following_id = null;
|
||||
}
|
||||
}
|
||||
|
||||
Profile.prototype.showProfile = function(profile) {
|
||||
|
@ -320,21 +326,25 @@ function(HostApp, Core, Paths, URI) {
|
|||
_this.populate(_this.profile_template.followed, resp.responseText);
|
||||
}, null, false);
|
||||
|
||||
Paths.getURL(URI(root_url + "/followers/" + encodeURIComponent(HostApp.stringForKey("entity"))).toString(), "GET", function(resp) {
|
||||
if (resp.status == 200) {
|
||||
_this.relationships.following_you = true;
|
||||
}
|
||||
_this.setRelationships();
|
||||
if (this.entity != HostApp.stringForKey("entity")) {
|
||||
Paths.getURL(URI(root_url + "/followers/" + encodeURIComponent(HostApp.stringForKey("entity"))).toString(), "GET", function(resp) {
|
||||
if (resp.status == 200) {
|
||||
_this.relationships.following_you = true;
|
||||
}
|
||||
_this.setRelationships();
|
||||
|
||||
}, null, false);
|
||||
}, null, false);
|
||||
|
||||
Paths.getURL(URI(Paths.mkApiRootPath("/followings/" + encodeURIComponent(this.entity))), "GET", function(resp) {
|
||||
if (resp.status == 200) {
|
||||
_this.relationships.followed_by_you = true;
|
||||
}
|
||||
_this.setRelationships();
|
||||
|
||||
});
|
||||
Paths.getURL(URI(Paths.mkApiRootPath("/followings/" + encodeURIComponent(this.entity))), "GET", function(resp) {
|
||||
if (resp.status == 200) {
|
||||
_this.relationships.followed_by_you = true;
|
||||
}
|
||||
_this.setRelationships();
|
||||
});
|
||||
|
||||
} else {
|
||||
this.setRelationships();
|
||||
}
|
||||
|
||||
var url = URI(root_url + "/posts/count");
|
||||
var post_types = [
|
||||
|
|
|
@ -18,13 +18,13 @@ function(HostApp, Paths, Cache) {
|
|||
|
||||
this.menu = {};
|
||||
|
||||
this.menu.user = this.createItem("User", function() { _this.onEntity() }, "img/sidebar/user.png", "img/sidebar/user.png");
|
||||
this.menu.timeline = this.createItem("Timeline", function() { _this.onTimeline() }, "img/sidebar/timeline.png", "img/sidebar/timeline_active.png", true);
|
||||
this.menu.mentions = this.createItem("Mentions", function() { _this.onMentions() }, "img/sidebar/mentions.png", "img/sidebar/mentions_active.png");
|
||||
this.menu.user = this.createItem("User", function() { _this.onEntity(); return false; }, "img/sidebar/user.png", "img/sidebar/user.png");
|
||||
this.menu.timeline = this.createItem("Timeline", function() { _this.onTimeline(); return false; }, "img/sidebar/timeline.png", "img/sidebar/timeline_active.png", true);
|
||||
this.menu.mentions = this.createItem("Mentions", function() { _this.onMentions(); return false; }, "img/sidebar/mentions.png", "img/sidebar/mentions_active.png");
|
||||
|
||||
this.menu.conversation = this.createItem("Conversation", function() { _this.onConversation() }, "img/sidebar/conversation.png", "img/sidebar/conversation_active.png");
|
||||
this.menu.entityProfile = this.createItem("Profile", function() { _this.onEntityProfile() }, "img/sidebar/profile.png", "img/sidebar/profile_active.png");
|
||||
this.menu.search = this.createItem("Search", function() { _this.onSearch() }, "img/sidebar/search.png", "img/sidebar/search_active.png")
|
||||
this.menu.conversation = this.createItem("Conversation", function() { _this.onConversation(); return false; }, "img/sidebar/conversation.png", "img/sidebar/conversation_active.png");
|
||||
this.menu.entityProfile = this.createItem("Profile", function() { _this.onEntityProfile(); return false; }, "img/sidebar/profile.png", "img/sidebar/profile_active.png");
|
||||
this.menu.search = this.createItem("Search", function() { _this.onSearch(); return false; }, "img/sidebar/search.png", "img/sidebar/search_active.png")
|
||||
|
||||
this.body.appendChild(this.menu.user);
|
||||
this.body.appendChild(this.menu.timeline);
|
||||
|
@ -174,7 +174,7 @@ function(HostApp, Paths, Cache) {
|
|||
}
|
||||
|
||||
Sidebar.prototype.onSearch = function() {
|
||||
debug("Search not implemented yet")
|
||||
this.showContentFor(bungloo.search, this.menu.search);
|
||||
}
|
||||
|
||||
return Sidebar;
|
||||
|
|
|
@ -14,7 +14,7 @@ function(Core, Paths, HostApp, URI) {
|
|||
this.action = "timeline";
|
||||
this.reload_blocked = false;
|
||||
|
||||
this.max_length = 20;
|
||||
this.max_length = 200;
|
||||
this.timeout = 10 * 1000; // every 10 seconds
|
||||
this.since_id = null;
|
||||
this.since_id_entity = null;
|
||||
|
@ -31,6 +31,14 @@ function(Core, Paths, HostApp, URI) {
|
|||
}
|
||||
|
||||
Timeline.prototype = Object.create(Core.prototype);
|
||||
|
||||
Timeline.prototype.show = function() {
|
||||
Core.prototype.show.call(this, this.body);
|
||||
}
|
||||
|
||||
Timeline.prototype.hide = function() {
|
||||
Core.prototype.hide.call(this, this.body);
|
||||
}
|
||||
|
||||
|
||||
Timeline.prototype.newStatus = function(statuses) {
|
||||
|
|
Reference in a new issue