def public_cloud(user): tags = User.get_tags_for_user(user.id) return render_template('public_cloud.html', user=user, public=user.public_cloud(), tags={_[0]: _[1] for _ in tags})
def view_friend(user, payload): friend = User.get_by_id(payload['id']) tags = api_user_friend_tags(user, payload) liked_by_me = user.is_liking(friend) return render_template('view_friend.html', friend=friend, tags=tags, liked=liked_by_me)
def view_index(user, payload): all_friends = [_ for _ in user.get_friends() if _['id'] != '0'] if len(all_friends) >= 3: selected_friends = random.sample(all_friends, 3) else: selected_friends = all_friends return render_template('view_index.html', user=user.to_dict(), friends=selected_friends)
def view_manage(user, payload): tag_with_taggers = api_user_my_tags(user, payload) tags_order_by_votes = [{ 'name': _[0], 'votes': len(_[1]) } for _ in api_user_my_tags(user, payload).items()] tags_order_by_votes.sort(key=lambda _: _['votes'], reverse=True) tags_order_by_time = [{ 'name': _[0], 'created_time': display_time(_[1]) } for _ in user.get_tags_order_by_time()] return render_template('view_manage.html', user=user.to_dict(), tag_with_taggers=tag_with_taggers, tags_order_by_votes=tags_order_by_votes, tags_order_by_time=tags_order_by_time)
def view_settings(user, payload): return render_template('view_settings.html', user=user.to_dict())
def view_me(user, payload): tags = api_user_my_tags(user, payload) return render_template('view_me.html', user=user.to_dict(), tags=tags)
def view_tag(user, payload): taggees = api_tag_get_taggees(user, payload) return render_template('view_tag.html', tag=payload['name'], taggees=taggees)
def view_friends(user, payload): friends = user.get_friends() return render_template('view_friends.html', friends=friends)