Skip to content

Commit

Permalink
User profiles now work a little nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Sep 26, 2012
1 parent da73293 commit 8c92daa
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 127 deletions.
141 changes: 75 additions & 66 deletions ckan/public/base/less/profile.less
@@ -1,69 +1,78 @@
.profile-info {
.clearfix();
.border-radius(3px 3px 0 0);
border-bottom: 1px solid #ddd;
#gradient > .vertical(#fff, #f3f3f3);
}

.js .profile-info {
margin-bottom: 0;
}

.module > .profile-info {
position: relative;
padding-top: 25px;
padding-bottom: 25px;
}

.profile-info .media {
.makeColumn(5);
display: table; // Lets us align the text to the bottom.
margin-left: 0;
}

.profile-info .image {
max-height: initial;
}

.profile-info .description {
display: table-cell;
vertical-align: bottom;
}

.profile-info .heading {
font-size: 18px;
.profile {
header {
position: relative;
border-bottom: 1px solid @moduleHeadingBorderColor;
height: 30px;
.border-radius(3px 3px 0 0);
#gradient > .vertical(@moduleHeadingBackgroundColorStart, @moduleHeadingBackgroundColorEnd);
.nav-tabs {
position: absolute;
left: 20px;
bottom: -1px;
margin-bottom: 0;
i {
margin-right: 10px;
font-size: 14px;
}
a:hover {
background-color: @moduleBackgroundColor;
}
}
}
.tab-heading {
display: none;
}
.empty,
.dataset-list {
margin-bottom: 20px;
}
}

.profile-info .description :last-child {
margin-bottom: 0;
}

.profile-info .listing {
.makeColumn(3);
float: right;
font-size: 12px;
}

.profile-info .listing {
.makeColumn(3);
float: right;
}

.profile-info .nav-tabs {
position: absolute;
right: 0;
bottom: -1px;
margin-bottom: 0;
}

.profile .module-content {
padding-bottom: 20px;
}

.module-activity {
margin-top: 5px;
}

.js .tab-content .tab-heading {
display: none;
.profile-info {
.module-content {
padding: 15px;
}
.avatar {
border: 1px solid #DDD;
padding: 5px;
.border-radius(2px);
img,
a {
display: block;
}
}
h1.heading {
margin: 10px 0 5px 0;
font-size: 21px;
}
.info {
margin-top: 15px;
padding-top: 10px;
border-top: 1px dotted #DDD;
dl dd {
margin-top: 3px;
margin-left: 0;
}
}
.nums {
.clearfix;
margin-top: 15px;
padding-top: 10px;
padding-bottom: 0;
border-top: 1px dotted #DDD;
dl {
float: left;
width: 33%;
margin: 5px 0 0 0;
dt {
font-weight: 300;
}
dd {
font-size: 30px;
font-weight: 700;
line-height: 1.2;
margin-left: 0;
}
}
}
}
128 changes: 67 additions & 61 deletions ckan/templates/user/read.html
Expand Up @@ -13,72 +13,21 @@

{% block actions_content %}
{% if c.is_myself %}
{# FIXME dashboard disabled #}
{# <li>{% link_for _('Dashboard'), controller='user', action='dashboard', class_='btn', icon='dashboard' %}</li> #}
{% endif %}
{% if h.check_access('user_update', user) %}
<li>{% link_for _('Edit'), controller='user', action='edit', id=user.name, class_='btn', icon='cog' %}</li>
{% endif %}
<li>{% link_for _('Dashboard'), controller='user', action='dashboard', class_='btn', icon='dashboard' %}</li>
{% endif %}
{% if h.check_access('user_update', user) %}
<li>{% link_for _('Edit'), controller='user', action='edit', id=user.name, class_='btn', icon='cog' %}</li>
{% endif %}
{% endblock %}

{% block primary_content %}
<article class="module profile">
<section class="module-content profile-info">
<header class="media">
<span class="media-image">{{ h.linked_gravatar(user.email_hash, 150) }}</span>
<div class="description">
<h1 class="heading">{{ user.fullname or _('No full name provided') }}</h1>
{% if c.about_formatted %}
{{ c.about_formatted }}
{% else %}
<p class="empty">
{% if c.is_myself %}
{% trans %}You have not provided a biography.{% endtrans %}
{% else %}
{% trans %}This user has no biography.{% endtrans %}
{% endif %}
</p>
{% endif %}
</div>
</header>
<ul class="listing unstyled">
<li>
{% if user.name.startswith('http://') or user.name.startswith('https://') %}
<b class="key">{{ _('Open ID') }}:</b>
{{ user.name|urlize(25) }}{# Be great if this just showed the domain #}
{% else %}
<b class="key">{{ _('Username') }}:</b>
<span class="value">{{ user.name }}</span>
{% endif %}
</li>
{% if c.is_myself %}
<li>
<b class="key">{{ _('Email') }}:</b>
<span class="value">{{ user.email }}</span>
</li>
{% endif %}
<li>
<b class="key">{{ _('Member Since') }}:</b>
<span class="value">{{ h.render_datetime(user.created) }}</span>
</li>
{% if c.is_myself %}
<li>
<b class="key">{{ _('API Key') }}:</b>
<span class="value">{{ user.apikey }}</span>
</li>
{% endif %}
<li>
<b class="key">{{ _('Datasets') }}:</b>
<span class="value">{{ user.number_administered_packages }}</span>
<b class="key inline">{{ _('Edits') }}:</b>
<span class="value">{{ user.number_of_edits }}</span>
</li>
</ul>
<header class="module-content">
<ul class="nav nav-tabs">
<li class="active"><a href="#datasets" data-toggle="tab">{{ _('Datasets') }}</a></li>
<li><a href="#activity" data-toggle="tab">{{ _('Activity Stream') }}</a></li>
<li class="active"><a href="#datasets" data-toggle="tab"><i class="icon-sitemap"></i>{{ _('Datasets') }}</a></li>
<li><a href="#activity" data-toggle="tab"><i class="icon-time"></i>{{ _('Activity Stream') }}</a></li>
</ul>
</section>
</header>
<section id="datasets" class="module-content tab-content active clearfix">
<h2 class="tab-heading">{{ _('Datasets') }}</h2>
{% if user.datasets %}
Expand Down Expand Up @@ -106,5 +55,62 @@ <h2 class="tab-heading">{{ _('Activity Stream') }}</h2>
{% endblock %}

{% block secondary_content %}
{% snippet 'user/snippets/user_search.html' %}
<div class="module profile-info">
<section class="module-content">
<div class="avatar">{{ h.linked_gravatar(user.email_hash, 180) }}</div>
<h1 class="heading">{{ user.fullname or _('No full name provided') }}</h1>
{% if c.about_formatted %}
{{ c.about_formatted }}
{% else %}
<p class="empty">
{% if c.is_myself %}
{% trans %}You have not provided a biography.{% endtrans %}
{% else %}
{% trans %}This user has no biography.{% endtrans %}
{% endif %}
</p>
{% endif %}
<div class="nums">
<dl>
<dt>{{ _('Followers') }}</dt>
<dd>{{ c.num_followers }}</dd>
</dl>
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ user.number_administered_packages }}</dd>
</dl>
<dl>
<dt>{{ _('Edits') }}</dt>
<dd>{{ user.number_of_edits }}</dd>
</dl>
</div>
<div class="info">
<dl>
{% if user.name.startswith('http://') or user.name.startswith('https://') %}
<dt>{{ _('Open ID') }}</dt>
<dd>{{ user.name|urlize(25) }}{# Be great if this just showed the domain #}</dd>
{% else %}
<dt>{{ _('Username') }}</dt>
<dd>{{ user.name }}</dd>
{% endif %}
</dl>
{% if c.is_myself %}
<dl>
<dt>{{ _('Email') }} <span class="label" title="{{ _('This means only you can see this') }}">{{ _('Private') }}</span></dt>
<dd>{{ user.email }}</dd>
</dl>
{% endif %}
<dl>
<dt>{{ _('Member Since') }}</dt>
<dd>{{ h.render_datetime(user.created) }}</dd>
</dl>
{% if c.is_myself %}
<dl>
<dt class="key">{{ _('API Key') }} <span class="label" title="{{ _('This means only you can see this') }}">{{ _('Private') }}</span></dt>
<dd class="value">{{ user.apikey }}</dd>
</dl>
{% endif %}
</div>
</section>
</div>
{% endblock %}

0 comments on commit 8c92daa

Please sign in to comment.