mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 19:00:12 +00:00
add 'user-profile'
This commit is contained in:
48
profile/templates/profile/user_profile.html
Normal file
48
profile/templates/profile/user_profile.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends "profile/profile_base.html" %}
|
||||
{% load avatar_tags %}
|
||||
|
||||
{% block main_panel %}
|
||||
{% if not err_msg %}
|
||||
<div class="user-profile narrow-panel ovhd">
|
||||
<div class="pic fleft">
|
||||
{% avatar email 80 %}
|
||||
<button id="add">加为联系人</button>
|
||||
</div>
|
||||
|
||||
<div class="txt fright">
|
||||
{% if nickname %}
|
||||
<p>{{ nickname }}</p>
|
||||
{% endif %}
|
||||
|
||||
<p>{{ email }}</p>
|
||||
|
||||
{% if intro %}
|
||||
<p class="intro">{{ intro }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<form id="add-as-contact" class="hide" action="{{ SITE_ROOT }}contacts/add/" method="post">
|
||||
<input type="hidden" name="user_email" value="{{ request.user.username }}" id="id_user_email" />
|
||||
<label>邮箱:</label><br />
|
||||
<input id="id_contact_email" type="text" name="contact_email" maxlength="255" value="{{ email }}" /><br />
|
||||
<label>名字(可选):</label><br />
|
||||
<input id="id_contact_name" type="text" name="contact_name" maxlength="255" /><br />
|
||||
<label>备注(可选):</label><br />
|
||||
<input id="id_note" type="text" name="note" maxlength="255" /><br />
|
||||
<input type="submit" value="提交" class="submit" />
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-panel">
|
||||
<p class="error">{{ err_msg }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript">
|
||||
$('#add').click(function() {
|
||||
$('#add-as-contact').modal({appendTo: '#main'});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@@ -3,5 +3,6 @@ from django.conf.urls.defaults import *
|
||||
urlpatterns = patterns('profile.views',
|
||||
url(r'^list_user/$', 'list_userids', name="list_userids"),
|
||||
url(r'^$', 'edit_profile', name="edit_profile"),
|
||||
url(r'^user/$', 'user_profile', name="user_profile"),
|
||||
url(r'^logout/$', 'logout_relay', name="logout_relay"),
|
||||
)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
# encoding: utf-8
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
@@ -58,3 +59,35 @@ def edit_profile(request):
|
||||
'intro':profile.intro,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def user_profile(request):
|
||||
user = request.GET.get('user', '')
|
||||
|
||||
user_nickname = ''
|
||||
user_intro = ''
|
||||
err_msg = ''
|
||||
|
||||
if user:
|
||||
try:
|
||||
user_check = ccnet_rpc.get_emailuser(user)
|
||||
except:
|
||||
user_check = None
|
||||
|
||||
if user_check:
|
||||
profile = Profile.objects.filter(user=user)
|
||||
if profile:
|
||||
profile = profile[0]
|
||||
user_nickname = profile.nickname
|
||||
user_intro = profile.intro
|
||||
else:
|
||||
err_msg = '该用户不存在'
|
||||
else:
|
||||
err_msg = '该用户不存在'
|
||||
|
||||
return render_to_response('profile/user_profile.html', {
|
||||
'email': user,
|
||||
'nickname':user_nickname,
|
||||
'intro':user_intro,
|
||||
'err_msg':err_msg,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
Reference in New Issue
Block a user