initial profile changes
parent
970030c644
commit
d0fded8054
|
@ -32,7 +32,9 @@ h4, h5, h6 { font-size: 16px; line-height: 20px; margin-bottom: 10px; }
|
|||
.aside, .quiet { font-weight: normal; color: #999; }
|
||||
.error, .errornote, .errorlist li { color: #EB3800; }
|
||||
.errornote { margin-bottom: 15px; }
|
||||
.edit,
|
||||
a { color: #444; }
|
||||
.edit,
|
||||
a:hover { color: #111; }
|
||||
table { margin-bottom: 15px; }
|
||||
p { margin-bottom: 15px; }
|
||||
|
@ -223,6 +225,10 @@ p.build-success { font-size: .8em; color: #108830; margin: 0 0 3px; }
|
|||
p.build-failure { font-size: .8em; color: #dc1020; margin: 0 0 3px; }
|
||||
p.build-missing { font-size: .8em; color: #9d9a55; margin: 0 0 3px; }
|
||||
|
||||
.navigable .profile_image { position:relative; left:-8px; top:-1px; width:184px; overflow:hidden; }
|
||||
.navigable .profile_image img { border-radius:5px; }
|
||||
|
||||
.profile #content { padding-top:8px; }
|
||||
/* build page */
|
||||
|
||||
#build_list select { width: 10em; }
|
||||
|
@ -282,7 +288,7 @@ p.build-missing { font-size: .8em; color: #9d9a55; margin: 0 0 3px; }
|
|||
.navigable > ul > li.active { background:#DAE1E5; }
|
||||
.navigable > ul > li.active:after { content:"•"; position:absolute; right:8px; top:6px; font-size:1.2em; color:#465158; }
|
||||
|
||||
.navigable > ul > li:hover { background:#E8ECEF; }
|
||||
.navigable > ul > li > a:hover { background:#E8ECEF; }
|
||||
.navigable > div { width:600px; float: left; padding-top:4px; }
|
||||
|
||||
/* autocomplete */
|
||||
|
@ -316,3 +322,23 @@ p.build-missing { font-size: .8em; color: #9d9a55; margin: 0 0 3px; }
|
|||
.empty { padding: 30px; background: #E6E6E6; background: rgba(0, 0, 0, 0.1); border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; margin-bottom: 60px; }
|
||||
.clearfix:after, .wrapper:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; overflow: hidden; }
|
||||
.clearfix, .wrapper { display: block; }
|
||||
|
||||
|
||||
|
||||
|
||||
.edit { cursor: pointer; -webkit-user-select: none; overflow:hidden; position:relative; }
|
||||
.edit { background:url(../images/edit.png) no-repeat; display:block; width:16px; height:16px; background-size:100% 100%; }
|
||||
.edit > span {text-indent:-9999em; text-direction:ltr; display:block; }
|
||||
body .edit-toggle { display: none; }
|
||||
|
||||
.edit-input { display: none; }
|
||||
|
||||
.edit-toggle + .editable .edit-input { display: none; }
|
||||
.edit-toggle + .editable .edit-target { display: auto; }
|
||||
.edit-toggle:checked + .editable .edit-input { display: inline; }
|
||||
.edit-toggle:checked + .editable .edit-target { display: none; }
|
||||
|
||||
.navigable ul .edit { position:absolute; bottom:8px; right:8px; opacity:0; -webkit-transition:opacity 0.2s ease-in-out; text-transform:uppercase; text-decoration: underline; }
|
||||
.navigable ul li:hover .edit { opacity:1; }
|
||||
|
||||
.navigable ul input[type=text] { width: 164px; }
|
||||
|
|
|
@ -18,6 +18,11 @@ class UserProfile (models.Model):
|
|||
def __unicode__(self):
|
||||
return ugettext("%(username)s's profile") % {'username': self.user.username}
|
||||
|
||||
def get_form(self):
|
||||
from .forms import UserProfileForm
|
||||
|
||||
return UserProfileForm(instance=self)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return ('profiles_profile_detail', (), {'username': self.user.username})
|
||||
get_absolute_url = models.permalink(get_absolute_url)
|
||||
|
|
|
@ -3,11 +3,24 @@
|
|||
{% for project in project_list %}
|
||||
<li class="module-item">
|
||||
<a class="module-item-title" href="{{ project.get_absolute_url }}">{{ project.name }}</a>
|
||||
|
||||
{% with project.users.all as users %}
|
||||
|
||||
{% if users|length > 1 %}
|
||||
(
|
||||
{% for user in project.users.all %}
|
||||
{% if omit and user.pk != omit.pk %}
|
||||
<a href="{{ user.get_absolute_url }}" class="quiet">{{ user }}</a>{% if not forloop.last %}, {% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
)
|
||||
{% else %}
|
||||
{% if omit and users.0.pk == omit.pk %}{% else %}
|
||||
(<a href="{{ user.get_absolute_url }}" class="quiet">{{ user }}</a>{% if not forloop.last %}, {% endif %})
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<span class="right-menu quiet">{% blocktrans with date=project.modified_date|timesince %}{{ date }} ago{% endblocktrans %}</span>
|
||||
<ul class="module-item-menu">
|
||||
{% if project.has_good_build %}
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
|
||||
{% block title %}{% blocktrans with profile.user as user %}{{ user }}'s profile{% endblocktrans %}{% endblock %}
|
||||
|
||||
{% block content-header %}
|
||||
<div style="float: left;">
|
||||
{% gravatar profile.user.email 30 %}
|
||||
</div>
|
||||
<h1>{% blocktrans with profile.user as user %}{{ user }}'s profile{% endblocktrans %}</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block body_class %}profile{% endblock %}
|
||||
|
||||
{% block dashboard_bar %}
|
||||
{% if request.user == profile.user %}
|
||||
|
@ -23,25 +17,61 @@
|
|||
|
||||
|
||||
{% block content %}
|
||||
{% if profile.homepage %}
|
||||
<h3>{% trans "Homepage" %}</h3>
|
||||
<p><a href="{{ profile.homepage }}">{{ profile.homepage }}</a></p>
|
||||
{% with profile.get_form as form %}
|
||||
|
||||
{% if profile.user.pk == user.pk %}
|
||||
<form id="edit_form" method="POST" action="{% url profiles_profile_edit %}">
|
||||
{% endif %}
|
||||
|
||||
{% if person %}
|
||||
{% if tag %}
|
||||
<h3>{% blocktrans with person.username as username and tag.name as tag %}Projects by {{ username }} tagged with {{ tag }}{% endblocktrans %}</h3>
|
||||
{% else %}
|
||||
<h3>{% blocktrans with person.username as username %}Projects by {{ username }}{% endblocktrans %}</h3>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if tag %}
|
||||
<h3>{% blocktrans with tag.name as tag %}Projects tagged with {{ tag }}{% endblocktrans %}</h3>
|
||||
{% else %}
|
||||
<h3>{% trans "Projects" %}</h3>
|
||||
{% endif %}
|
||||
<div class="navigable">
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<div class="profile_image">
|
||||
{% gravatar profile.user.email 184 %}
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div>
|
||||
{% if profile.user.pk == user.pk %}
|
||||
<label for="edit_name" class="edit"><span>{% trans "Edit" %}</span></label>
|
||||
{% endif %}
|
||||
|
||||
<input type="checkbox" id="edit_name" class="edit-toggle" />
|
||||
<h3 {% if profile.user.pk == user.pk %}class="editable"{% endif %}>
|
||||
<span class="edit-target">{{ profile.user.first_name }}</span>
|
||||
<span class="edit-input">{{ form.first_name }}</span>
|
||||
<span class="edit-target">{{ profile.user.last_name }}</span>
|
||||
<span class="edit-input">{{ form.last_name }}</span>
|
||||
<small class="quiet">({{ profile.user }})</small>
|
||||
</h3>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
{% if profile.homepage or profile.user.pk == user.pk %}
|
||||
<li>
|
||||
<div>
|
||||
{% if profile.user.pk == user.pk %}
|
||||
<label for="edit_homepage" class="edit"><span>{% trans "Edit" %}</span></label>
|
||||
{% endif %}
|
||||
|
||||
<input type="checkbox" id="edit_homepage" class="edit-toggle" />
|
||||
<p {% if profile.user.pk == user.pk %}class="editable"{% endif %}>
|
||||
<a class="edit-target" href="{{ profile.homepage }}" rel="nofollow">{{ profile.homepage }}</a>
|
||||
<span class="edit-input">{{ form.homepage }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if profile.user.pk == user.pk %}
|
||||
<li>
|
||||
<span style="float:left; margin-right:4px; ">{{ form.allow_email }}</span><small>{{ form.allow_email.help_text }}</small>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
{% with profile.user.projects.live as project_list %}
|
||||
<!-- BEGIN projects list -->
|
||||
<div class="module">
|
||||
|
@ -51,7 +81,7 @@
|
|||
<div class="module-list-wrapper">
|
||||
|
||||
<ul>
|
||||
{% include "core/project_list_detailed.html" %}
|
||||
{% include "core/project_list_detailed.html" with omit=profile.user %}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -61,5 +91,38 @@
|
|||
</div>
|
||||
<!-- END projects list -->
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var checkboxen = document.getElementsByClassName('edit-toggle')
|
||||
, form = document.getElementById('edit_form')
|
||||
|
||||
document.body.addEventListener('click', function(ev) {
|
||||
setTimeout(function() {
|
||||
ev.target.parentNode.querySelector('.editable input').focus()
|
||||
}, 0)
|
||||
}, false)
|
||||
|
||||
document.body.addEventListener('keyup', function(ev) {
|
||||
if(ev.keyCode == 27) for(var i = 0, len = checkboxen.length; i < len; ++i) {
|
||||
checkboxen[i].checked = false
|
||||
} else if(ev.keyCode == 13 && form) {
|
||||
form.submit()
|
||||
}
|
||||
}, false)
|
||||
})()
|
||||
</script>
|
||||
|
||||
{% if profile.user.pk == user.pk %}
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="submit" style="display:none" />
|
||||
<noscript>
|
||||
<input type="submit" value="submit" />
|
||||
|
||||
</noscript>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue