From 5eba73832a5802c24666a4987e4b2fa589f1f010 Mon Sep 17 00:00:00 2001 From: llj Date: Tue, 4 Sep 2012 16:13:06 +0800 Subject: [PATCH] [user_profile]extracted user_profile popup code and included them in grp_info,org_info,public_home --- contacts/views.py | 8 +- group/templates/group/group_info.html | 98 +------------------ media/css/seahub.css | 11 +-- .../templates/organizations/org_info.html | 12 ++- templates/public_home.html | 15 ++- templates/repo.html | 4 +- templates/snippets/user_profile_html.html | 40 ++++++++ templates/snippets/user_profile_js.html | 50 ++++++++++ 8 files changed, 124 insertions(+), 114 deletions(-) create mode 100644 templates/snippets/user_profile_html.html create mode 100644 templates/snippets/user_profile_js.html diff --git a/contacts/views.py b/contacts/views.py index 69b10e5a56..b8b37a3c98 100644 --- a/contacts/views.py +++ b/contacts/views.py @@ -63,12 +63,6 @@ def contact_add(request): if request.method != 'POST': raise Http404 - group_id = request.GET.get('group_id', '0') - try: - group_id_int = int(group_id) - except ValueError: - return render_error('小组ID必须为整数') - form = ContactAddForm(request.POST) if form.is_valid(): contact_email = form.cleaned_data['contact_email'] @@ -83,7 +77,7 @@ def contact_add(request): messages.success(request, u"您已成功添加 %s 为联系人" % contact_email) else: messages.error(request, '操作失败') - return HttpResponseRedirect(reverse("group_info", args=(group_id,))) + return HttpResponseRedirect(request.META['HTTP_REFERER']) @login_required def contact_edit(request): diff --git a/group/templates/group/group_info.html b/group/templates/group/group_info.html index d056a43c18..0860663d5b 100644 --- a/group/templates/group/group_info.html +++ b/group/templates/group/group_info.html @@ -20,7 +20,7 @@

管理员

@@ -28,7 +28,7 @@ {% if common_members %} {% else %} @@ -148,53 +148,13 @@ -
- - +{% include "snippets/user_profile_html.html" %} {% include "snippets/repo_create_form.html" %} {% endblock %} {% block extra_script %} - +{% include 'snippets/user_profile_js.html' %} {% endblock %} diff --git a/media/css/seahub.css b/media/css/seahub.css index 7cc5a49474..f601c87a24 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -742,19 +742,16 @@ ul.with-bg li { width:5em; color:#666; } -.group-member { +.member { _height:21px; } -.group-member .avatar, -.org-member .avatar { +.member .avatar { border-radius: 2px; -moz-border-radius: 2px; margin-right: 5px; } -.group-member .avatar, -.group-member-name, -.org-member .avatar, -.org-member-name { +.member .avatar, +.member .name { vertical-align:middle; } #user-profile { diff --git a/organizations/templates/organizations/org_info.html b/organizations/templates/organizations/org_info.html index add9ae2eec..2bd13b35fd 100644 --- a/organizations/templates/organizations/org_info.html +++ b/organizations/templates/organizations/org_info.html @@ -5,12 +5,20 @@ {% block nav_org_class %}class="cur"{% endblock %} {% block main_panel %} +{% if messages %} + +{% endif %} +

团体成员

{% if org_users %} {% else %} @@ -64,10 +72,12 @@ {% include "snippets/repo_share_form.html" %} {% include "snippets/repo_create_form.html" %} +{% include "snippets/user_profile_html.html" %} {% endblock %} {% block extra_script %} +{% include "snippets/user_profile_js.html" %} {% endblock %} diff --git a/templates/repo.html b/templates/repo.html index 222c0d5452..08ed326e31 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -13,7 +13,7 @@ {% endif %} {% endblock %} -{% block right_panel %} +{% block main_panel %} {% if messages %} {% autoescape off %} {% endautoescape %} {% endif %} -{% endblock %} -{% block main_panel %} {% if view_history %}

{{repo.props.name}} 历史浏览({{ current_commit.props.ctime|tsstr_sec }})

{% else %} diff --git a/templates/snippets/user_profile_html.html b/templates/snippets/user_profile_html.html new file mode 100644 index 0000000000..60e9db1bba --- /dev/null +++ b/templates/snippets/user_profile_html.html @@ -0,0 +1,40 @@ + + diff --git a/templates/snippets/user_profile_js.html b/templates/snippets/user_profile_js.html new file mode 100644 index 0000000000..07a6e93d08 --- /dev/null +++ b/templates/snippets/user_profile_js.html @@ -0,0 +1,50 @@ + +