visual update: main menu, timeline, etc

This commit is contained in:
tmshv committed 2014-11-24 03:04:55 +03:00
1 parent 65ec12a328
commit 3f4b07e6c9
8 files changed
+60 -21

No files matched your search

+22 -4
View File
@@ -2,8 +2,24 @@
* Created by tmshv on 23/11/14.
*/
function personByInstagram(list, instagram){
list = list.filter(function (member) {
try {
return member.contacts.instagram === instagram;
} catch (error) {
return false;
}
});
if(list.length){
return list[0].id;
}else{
return null;
}
}
module.exports = function(app) {
app.directive("timeline", function () {
app.directive("timeline", function (team) {
return {
templateUrl: "/views/timeline.html",
scope: {
@@ -18,14 +34,16 @@ module.exports = function(app) {
api.feed.post()
.success(function (list) {
$scope.feed = list.map(function (post) {
var author_id = personByInstagram(team.team, post.data.user.username);
var name = author_id ? team.short(author_id) : post.data.user.username;
return {
date: post.publishDate,
image: post.data.images.standard_resolution.url,
url: post.data.link,
username: post.data.user.username,
username: name,
userpic: post.data.user.profile_picture,
text: post.data.caption.text
}
text: post.data.caption.text.replace(/#[\w_]+/, "")
};
});
});
}