Browse Source

Nav pill header for home/mentions/messages

The previous gui looked too sloppy
master
The Dod 11 years ago
parent
commit
6cd46b6ec1
  1. 2
      swizzler.py
  2. 98
      templates/messages.html
  3. 8
      templates/sidebar.html
  4. 123
      templates/standard.html

2
swizzler.py

@ -56,7 +56,7 @@ class SwizzlerApp(object): @@ -56,7 +56,7 @@ class SwizzlerApp(object):
result['user_prefix'] = userprefix
result['users'] = twister.get_users_by_partial_name(userprefix[1:],conf['num_messages'])
else:
result['trending'] = format_trending(twister,conf['num_messages'])
result['trending'] = format_trending(twister,3*conf['num_messages']) # no avatar = about 1/3 height :)
return stache.render(stache.load_template('search'),result)
@cherrypy.expose

98
templates/messages.html

@ -14,60 +14,68 @@ @@ -14,60 +14,68 @@
<div class="container">
<div class="row">
<div id="main" class="col-md-8">
<div class="row">
<div id="header" class="col-md-12 well">
{{#subject}}
<div class="media">
{{#subject}}
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-envelope"></span> Direct messages: {{fullname}}
{{#remoteuser}}<span class="glyphicon glyphicon-transfer"></span> {{fullname}}{{/remoteuser}}
</h3>
</div>
<div class="panel-body">
<div class="media avatars32">
<a class="pull-left thumbnail" href="{{site_root}}/user/{{username}}">
<img class="media-object avatar" src="{{#avatar}}{{.}}{{/avatar}}{{^avatar}}/assets/img/twister-64.jpg{{/avatar}}" alt="{{fullname}}">
<img class="media-object avatar" src="{{avatar}}" alt="{{fullname}}">
</a>
<div class="media-body">
<h3 class="media-heading">
<a class="label label-primary" href="{{site_root}}/messages/{{username}}{{#remoteuser}}/{{username}}{{/remoteuser}}"
title="@{{username}}'s messages{{#remoteuser}} with {{username}}{{/remoteuser}}"
><span class="glyphicon glyphicon-envelope"></span>
{{fullname}}'s direct messages
{{#remoteuser}}with {{fullname}}{{/remoteuser}}</a>
</h3>
<h4>
<a class="label label-primary" href="{{site_root}}/home/{{username}}" title="@{{username}}'s home"><span class="glyphicon glyphicon-home"></span> Home</a>
<a class="label label-primary" href="{{site_root}}/home/{{username}}/mentions" title="mentions of @{{username}}"><span class="glyphicon glyphicon-bell"></span> Mentions</a>
<a class="label label-info" href="{{site_root}}/user/{{username}}" title="@{{username}}'s profile"><span class="glyphicon glyphicon-user"></span> Profile</a>
</h4>
<ul class="nav nav-pills">
<li{{#is_feed}} class="active"{{/is_feed}}>
<a href="{{site_root}}/home/{{username}}"
title="@{{username}}'s home"><span class="glyphicon glyphicon-home"></span>Home</a>
</li>
<li{{#is_mentions}} class="active"{{/is_mentions}}>
<a href="{{site_root}}/home/{{username}}/mentions"
title="mentions of @{{username}}"><span class="glyphicon glyphicon-bell"></span>Mentions</a>
</li>
<li {{^remoteuser}}class="active"{{/remoteuser}}>
<a href="{{site_root}}/messages/{{username}}"
title="direct messages from/to @{{username}}"><span class="glyphicon glyphicon-envelope"></span>Messages</a>
</li>
</ul>
</div>
</div>
{{/subject}}
</div>
</div>
</div>
{{/subject}}
<div class="row">
<div id="messages" class="col-md-12">
{{#any_threads}}
<ul class="list-group media-list">
{{#threads}}
{{^remoteuser}}
<a class="label label-primary" href="{{site_root}}/messages/{{subject.username}}/{{username}}"
title="See more messages to/from @{{username}}">@{{username}} <span class="glyphicon glyphicon-arrow-right"></span></a>
{{/remoteuser}}
{{#remoteuser}}
{{#subject}}
<a class="label label-primary" href="{{site_root}}/messages/{{subject.username}}"
title="Back to @{{username}}'s direct message summary"><span class="glyphicon glyphicon-arrow-left"></span> Back</a>
{{/subject}}
{{/remoteuser}}
<ul class="list-group media-list">
{{#messages}}
{{> message}}
{{/messages}}
</ul>
{{/threads}}
</ul>
{{/any_threads}}
{{^threads}}
<h4><small>Nothing. Nada. Rien de rien. &#128557;</small></h4>
{{/threads}}
{{#any_threads}}
<ul class="list-group media-list">
{{#threads}}
{{^remoteuser}}
<a class="label label-primary" href="{{site_root}}/messages/{{subject.username}}/{{username}}"
title="See more messages to/from @{{username}}">@{{username}} <span class="glyphicon glyphicon-arrow-right"></span></a>
{{/remoteuser}}
{{#remoteuser}}
{{#subject}}
<a class="label label-primary" href="{{site_root}}/messages/{{subject.username}}"
title="Back to @{{username}}'s direct message summary"><span class="glyphicon glyphicon-arrow-left"></span> Back</a>
{{/subject}}
{{/remoteuser}}
<ul class="list-group media-list">
{{#messages}}
{{> message}}
{{/messages}}
</ul>
{{/threads}}
</ul>
{{/any_threads}}
{{^threads}}
<h4><small>Nothing. Nada. Rien de rien. &#128557;</small></h4>
{{/threads}}
</div>
</div>
</div><!-- /.row -->
</div>
<div id="sidebar" class="col-md-4">
{{> sidebar}}

8
templates/sidebar.html

@ -35,16 +35,16 @@ @@ -35,16 +35,16 @@
<form method=get action="{{site_root}}/tag" class="form-horizontal" role="search">
<div class="form-group">
<label class="col-xs-4 text-right" for="#tag">Tag <span class="glyphicon glyphicon-tag"></span></label>
<div class="col-xs-8">
<label class="col-sm-4" for="#tag"><span class="badge pull-right">Tag <span class="glyphicon glyphicon-tag"></span></span></label>
<div class="col-sm-8">
<input id="tag" name="tag" type="text" class="form-control input-sm" placeholder="#twister"{{#user_prefix}} value="{{.}}"{{/user_prefix}}>
</div>
</div>
</form>
<form target="searchresult" tag="searchresult" method=get action="{{site_root}}/search_embed" class="form-horizontal" role="search">
<div class="form-group">
<label class="col-xs-4 text-right" for="#userprefix">Usernam... <span class="glyphicon glyphicon-user"></span></label>
<div class="col-xs-8">
<label class="col-sm-4" for="#userprefix"><span class="badge pull-right">Userna... <span class="glyphicon glyphicon-user"></span></span></label>
<div class="col-sm-8">
<input id="userprefix" name="userprefix" type="text" class="form-control input-sm" placeholder="@twi"{{#user_prefix}} value="{{.}}"{{/user_prefix}}>
</div>
</div>

123
templates/standard.html

@ -14,73 +14,68 @@ @@ -14,73 +14,68 @@
<div class="container">
<div class="row">
<div id="main" class="col-md-8">
<div class="row">
{{#is_home}}
<div class="panel panel-primary">
<div class="panel-heading">
{{#username}}
<h3 class="panel-title">
{{#is_feed}}
<a class="label label-primary" href="{{site_root}}/home/{{username}}" title="@{{username}}'s home"><span class="glyphicon glyphicon-home"></span>
{{fullname}}'s home</a>
{{/is_feed}}
{{#is_mentions}}
<a class="label label-primary" href="{{site_root}}/home/{{username}}/mentions" title="mentions of @{{username}}"><span class="glyphicon glyphicon-bell"></span>
Mentions of {{fullname}}</a>
{{/is_mentions}}
{{#is_messages}}
<a class="label label-primary" href="{{site_root}}/messages/{{username}}" title="direct messages to/from @{{username}}"><span class="glyphicon glyphicon-envelope"></span>
{{fullname}}</a>
{{/is_messages}}
</h3>
{{/username}}
{{^username}}
{{/username}}
</div>
<div class="panel-body">
<h4>
{{^is_feed}}
<a class="label label-primary" href="{{site_root}}/home/{{username}}" title="@{{username}}'s home"><span class="glyphicon glyphicon-home"></span>Home</a>
{{/is_feed}}
{{^is_mentions}}
<a class="label label-primary" href="{{site_root}}/home/{{username}}/mentions" title="mentions of @{{username}}"><span class="glyphicon glyphicon-bell"></span>Mentions</a>
{{/is_mentions}}
{{^is_messages}}
<a class="label label-primary" href="{{site_root}}/messages/{{username}}" title="direct messages from/to @{{username}}"><span class="glyphicon glyphicon-envelope"></span>Messages</a>
{{/is_messages}}
<a class="label label-info" href="{{site_root}}{{#username}}/user/{{.}}{{/username}}" title="@{{username}}'s profile"><span class="glyphicon glyphicon-user"></span>Profile</a>
</h4>
</div>
{{#is_home}}{{#subject}}
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
{{#is_feed}}<span class="glyphicon glyphicon-home"></span> Home: {{fullname}}{{/is_feed}}
{{#is_mentions}}<span class="glyphicon glyphicon-bell"></span> Mentions of {{fullname}}{{/is_mentions}}
</h3>
</div>
{{/is_home}}
{{^is_home}}
<div id="header" class="col-md-12 well">
{{#subject}}
<div class="media">
<a class="pull-left thumbnail" href="{{#username}}/user/{{.}}{{/username}}{{^username}}#{{/username}}">
<img class="media-object avatar" src="{{#avatar}}{{.}}{{/avatar}}{{^avatar}}/assets/img/twister-64.jpg{{/avatar}}" alt="{{fullname}}">
</a>
<div class="media-body">
{{#is_user}}
<h4 class="media-heading">
{{#location}}<span class="pull-right small">{{.}}</span>{{/location}}
<a class="label label-primary" href="{{site_root}}/user/{{username}}"><span class="glyphicon glyphicon-user"></span>
{{fullname}}</a>
{{#url}}<small><a target="_blank" href="{{.}}">{{.}}</a></small>{{/url}}</h4>
{{{bio}}}
{{/is_user}}
{{#is_tag}}
<h2 class="media-heading">
<small><span class="glyphicon glyphicon-tag"></span> Latest twists containing the tag:</small><br>
#{{fullname}}
</h2>
{{/is_tag}}
</div>
<div class="panel-body">
<div class="media avatars32">
<a class="pull-left thumbnail" href="{{site_root}}/user/{{username}}"
title="@{{username}}'s profile">
<img class="media-object avatar" src="{{avatar}}" alt="{{fullname}}">
</a>
<div class="media-body">
<ul class="nav nav-pills">
<li{{#is_feed}} class="active"{{/is_feed}}>
<a href="{{site_root}}/home/{{username}}"
title="@{{username}}'s home"><span class="glyphicon glyphicon-home"></span>Home</a>
</li>
<li{{#is_mentions}} class="active"{{/is_mentions}}>
<a href="{{site_root}}/home/{{username}}/mentions"
title="mentions of @{{username}}"><span class="glyphicon glyphicon-bell"></span>Mentions</a>
</li>
<li>
<a href="{{site_root}}/messages/{{username}}"
title="direct messages from/to @{{username}}"><span class="glyphicon glyphicon-envelope"></span>Messages</a>
</li>
</ul>
</div>
{{/subject}}
</div>
</div>
{{/is_home}}
</div><!-- /.row -->
</div>
{{/subject}}{{/is_home}}
{{^is_home}}
<div id="header" class="col-md-12 well">
{{#subject}}
<div class="media">
<a class="pull-left thumbnail" href="{{site_root}}{{#username}}/user/{{.}}{{/username}}{{^username}}#{{/username}}"
{{#username}}title="@{{usermame}}'s profile"{{/username}}>
<img class="media-object avatar" src="{{#avatar}}{{.}}{{/avatar}}{{^avatar}}/assets/img/twister-64.jpg{{/avatar}}" alt="{{fullname}}">
</a>
<div class="media-body">
{{#is_user}}
<h4 class="media-heading">
{{#location}}<span class="pull-right small">{{.}}</span>{{/location}}
<a class="label label-primary" href="{{site_root}}/user/{{username}}"><span class="glyphicon glyphicon-user"></span>
{{fullname}}</a>
{{#url}}<small><a target="_blank" href="{{.}}">{{.}}</a></small>{{/url}}</h4>
{{{bio}}}
{{/is_user}}
{{#is_tag}}
<h2 class="media-heading">
<small><span class="glyphicon glyphicon-tag"></span> Latest twists containing the tag:</small><br>
#{{fullname}}
</h2>
{{/is_tag}}
</div>
</div>
{{/subject}}
</div>
{{/is_home}}
<div class="row">
<div id="messages" class="col-md-12">
{{#any_messages}}<ul class="list-group media-list">{{#messages}}{{> message}}{{/messages}}</ul>{{/any_messages}}

Loading…
Cancel
Save