Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social frontend #501

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bookie/static/images/twitter-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions bookie/templates/accounts/index.mako
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ ${account_nav()}

${password_reset(user, reset=False)}

<div class="form">
<div class="heading">Social Profiles</div>
<table>
% if connections:
% for connection in connections:
% if connection.type == 'TwitterConnection':
<tr>
<td style="border: 0px; width: 120px"><img src="/static/images/twitter-icon.png" style="padding: 0 5px;">Twitter</td>
<td style="border: 0px;">Connected as:
<a href="http://twitter.com/${connection.twitter_username}"> @${connection.twitter_username}
</td>
</tr>
% endif
% endfor
% endif
</table>
<a href="/oauth/twitter_connect">Add Twitter Profile</a>
</div>

<div class="form">
<div class="heading"><img src="/static/images/logo.128.svg" style="height: 16px; padding: 0 5px;" alt="Bookie Extensions"/>Extensions</div>
<p>We have browser extensions that work with Bookie for:</p>
Expand Down
4 changes: 4 additions & 0 deletions bookie/views/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pyramid.view import view_config

from bookie.lib.access import ReqAuthorize
from bookie.models.social import SocialMgr
from bookie.models.auth import UserMgr

LOG = logging.getLogger(__name__)
Expand All @@ -19,8 +20,11 @@ def account(request):
# if auth fails, it'll raise an HTTPForbidden exception
with ReqAuthorize(request):
user = UserMgr.get(username=request.user.username)
connections = SocialMgr.get_all_connections(
username=request.user.username).all()

return {
'user': user,
'username': user.username,
'connections': connections,
}