User profile tab.

master
Nick Sergeant 2012-06-19 22:11:53 -04:00
parent f99d0303a4
commit 7644a17fa3
10 changed files with 145 additions and 2148 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -154,6 +154,7 @@ header.main {
}
nav.public {
float: left;
width: 435px;
ul {
margin: 0;
@ -193,6 +194,10 @@ header.main {
margin-left: 5px;
}
}
&.add-snipt {
float: right;
margin-right: 13px;
}
}
}
}
@ -201,14 +206,91 @@ header.main {
float: right;
height: 65px;
margin: 0;
position: relative;
width: 189px;
a.mini-profile {
display: block;
padding: 14px 13px 11px 13px;
span.avatar {
background-repeat: no-repeat;
border: 1px solid #3A5E67;
display: inline-block;
height: 35px;
width: 35px;
@include border-radius();
}
span.username {
color: #FFF;
display: inline-block;
font: 500 14px $Helvetica;
margin-left: 8px;
max-width: 88px;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: 14px;
}
i {
display: inline-block;
opacity: .3;
margin-left: 8px;
vertical-align: 12px;
}
&:hover {
background: rgba(#5C8086, .2);
text-decoration: none;
i {
background-position: -313px -119px;
}
}
}
ul {
background: transparent url('/media/images/aside-nav-open-bottom-bg.gif') top left repeat;
display: none;
left: 0;
margin: 0;
padding: 10px 0;
position: absolute;
top: 65px;
width: 189px;
@include multi-border-radius(0, 0, 10px, 10px);
li {
list-style-type: none;
a {
color: #B0D7DD;
display: block;
font: bold 12px $Helvetica;
padding: 7px 0 7px 37px;
&:hover {
background: rgba(#103A42, .5);
text-decoration: none;
}
i {
margin-right: 9px;
opacity: .3;
}
}
}
}
&.open {
a.mini-profile {
background: transparent url('/media/images/aside-nav-open-top-bg.gif') top left repeat-x;
opacity: 1;
span.avatar {
border-color: #92B6BD;
}
i {
background-position: -288px -120px;
}
}
ul {
display: block;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,8 @@
this.$body = $(this.el);
this.$html = $('html');
this.$html_body = this.$body.add(this.$html);
this.$aside_nav = $('aside.nav', this.$body);
this.$aside_nav_ul = $('ul', this.$aside_nav);
this.$search_form = $('form.search', this.$body);
this.$search_query = $('input#search-query', this.$body);
this.$search_page_query = $('input.search-query', this.$body);
@ -57,6 +59,8 @@
var SniptListView = Snipt.SniptListView;
this.snipt_list = new SniptListView({ 'snipts': this.$snipts });
var that = this;
this.$body.click(function() {
if (!window.ui_halted && !window.from_modal && window.$selected) {
window.$selected.trigger('deselect');
@ -64,6 +68,11 @@
if (window.from_modal) {
window.from_modal = false;
}
that.$aside_nav.removeClass('open');
});
this.$aside_nav_ul.click(function(e) {
e.stopPropagation();
});
$search_queries = this.$search_queries;
@ -86,7 +95,8 @@
window.ui_halted = false;
},
events: {
'showKeyboardShortcuts': 'showKeyboardShortcuts'
'showKeyboardShortcuts': 'showKeyboardShortcuts',
'click a.mini-profile': 'toggleMiniProfile'
},
keyboardShortcuts: function() {
@ -149,6 +159,10 @@
showKeyboardShortcuts: function() {
this.$keyboard_shortcuts.modal('toggle');
},
toggleMiniProfile: function(e) {
this.$aside_nav.toggleClass('open');
return false;
},
inFieldLabels: function () {
$('div.infield label', this.$body).inFieldLabels({
fadeDuration: 200

View File

@ -102,19 +102,42 @@
<li>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snipts</a>
</li>
<li>
<a href="/logout/?next={{ request.path }}">Log out</a>
<li class="add-snipt">
<button class="btn btn-info btn-large" id="add-snipt">
Add {% if request.user.username == 'blog' %}Post{% else %}Snipt{% endif %}
<i class="icon-search icon-plus icon-white"></i>
</button>
</li>
{% if request.user.username == 'blog' %}
<li><button class="btn btn-info btn-large" id="add-snipt">Add Post <i class="icon-search icon-plus icon-white"></i></button></li>
{% else %}
<li><button class="btn btn-info btn-large" id="add-snipt">Add Snipt <i class="icon-search icon-plus icon-white"></i></button></li>
{% endif %}
{% endif %}
</ul>
</nav>
{% if request.user.is_authenticated and has_snipts %}
<aside class="nav"></aside>
{% if request.user.is_authenticated %}
<aside class="nav">
<a href="#" class="mini-profile">
<span class="avatar" style="background-image: url('https://secure.gravatar.com/avatar/{{ user.email|md5 }}?s=35');"></span>
<span class="username">{{ request.user.username }}</span>
<i class="icon-cog icon-white"></i>
</a>
<ul>
<li>
<a href="/{{ request.user.username }}/">
<i class="icon-user icon-white"></i>
View profile</a>
</li>
<li>
<a href="/password/change/">
<i class="icon-wrench icon-white"></i>
Change password
</a>
</li>
<li>
<a href="/logout/?next={{ request.path }}">
<i class="icon-off icon-white"></i>
Log out
</a>
</li>
</ul>
</aside>
{% endif %}
</div>
</header>
@ -301,10 +324,6 @@
s.parentNode.insertBefore(t, s);
})();
</script>
{% else %}
<script type="text/javascript">
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')
</script>
{% endif %}
{% if request.user.is_authenticated %}