Varun Sharma has proposed merging lp:~sharmavarun/postorius/postorius into 
lp:postorius.

Requested reviews:
  Mailman Coders (mailman-coders)

For more details, see:
https://code.launchpad.net/~sharmavarun/postorius/postorius/+merge/157694

added profile settins to my settings
-- 
https://code.launchpad.net/~sharmavarun/postorius/postorius/+merge/157694
Your team Mailman Coders is requested to review the proposed merge of 
lp:~sharmavarun/postorius/postorius into lp:postorius.
=== added file 'src/postorius/static/postorius/js/user_profile.js'
--- src/postorius/static/postorius/js/user_profile.js	1970-01-01 00:00:00 +0000
+++ src/postorius/static/postorius/js/user_profile.js	2013-04-08 16:37:34 +0000
@@ -0,0 +1,9 @@
+$(document).ready(function(){
+    $('.autosave').change(function(){
+        column_id = this.id;
+        column_value = this.value;
+        $.getJSON('/postorius/accounts/profile/edit',{'column_id':column_id,'column_value':column_value},function(result){
+        });
+    });
+
+});

=== modified file 'src/postorius/templates/postorius/base.html'
--- src/postorius/templates/postorius/base.html	2013-03-19 22:54:34 +0000
+++ src/postorius/templates/postorius/base.html	2013-04-08 16:37:34 +0000
@@ -14,6 +14,8 @@
 	<link rel="stylesheet" href="{% static 'postorius/css/bootstrap.css' %}">
 	<link rel="stylesheet" href="{% static 'postorius/css/style.css' %}">
 
+    <script src="{% static 'postorius/js/libs/jquery-1.8.3.min.js' %}" type="text/javascript"></script>
+    <script src="{% static 'postorius/js/user_profile.js' %}" type="text/javascript"></script>
 </head>
 <body class="{% block body_class %}{% endblock %}">
 

=== modified file 'src/postorius/templates/postorius/user_profile.html'
--- src/postorius/templates/postorius/user_profile.html	2012-12-15 21:19:58 +0000
+++ src/postorius/templates/postorius/user_profile.html	2013-04-08 16:37:34 +0000
@@ -1,7 +1,6 @@
 {% extends extend_template %}
 {% load url from future %}
 {% load i18n %}
-
 {% block main %}
     {% include 'postorius/menu/user_nav.html' %}
     <h1>User Profile <span>- {{ user }}</span></h1>
@@ -14,27 +13,27 @@
     		</tr>
     		<tr>
     			<td>{% trans 'User name' %}</td>
-    			<td>{{ user.username}}</td>
+    			<td><input id="username" class="autosave" type="text" value="{{ mm_user.username}}"/></td>
     		</tr>
     		<tr>
     			<th>{% trans 'First name' %}</th>
-    			<td>&nbsp;</td>
+    			<td><input id="first_name" class="autosave" type="text" value="{{ mm_user.first_name}}"/></td>
     		</tr>
     		<tr>
     			<th>{% trans 'Last name' %}</th>
-    			<td>&nbsp;</td>
+    			<td><input id="last_name" class="autosave" type="text" value="{{ mm_user.last_name}}" /></td>
     		</tr>
     		<tr>
     			<th>{% trans 'IRC handle' %}</th>
-    			<td>&nbsp;</td>
+    			<td><input id="irc_handle" class="autosave" type="text" value="{{ mm_user.irc_handle}}" readonly /></td>
     		</tr>
     		<tr>
     			<th>{% trans 'Website' %}</th>
-    			<td>&nbsp;</td>
+    			<td><input id="website" class="autosave" type="text" value="{{ mm_user.website}}" readonly /></td>
     		</tr>
     		<tr>
     			<th>{% trans 'Twitter' %}</th>
-    			<td>&nbsp;</td>
+    			<td><input id="twitter_id" class="autosave" type="text" value="{{ mm_user.twitter_id}}" readonly /></td>
     		</tr>
     	</tbody>
     </table>

=== modified file 'src/postorius/urls.py'
--- src/postorius/urls.py	2013-03-29 22:04:06 +0000
+++ src/postorius/urls.py	2013-04-08 16:37:34 +0000
@@ -31,6 +31,7 @@
     url(r'^accounts/login/$', 'user_login', name='user_login'),
     url(r'^accounts/logout/$', 'user_logout', name='user_logout'),
     url(r'^accounts/profile/$', 'user_profile', name='user_profile'),
+    url(r'^accounts/profile/edit$', 'edit_profile', name='edit_profile'),
     url(r'^tasks/$', 'user_tasks', name='user_tasks'),
     url(r'^accounts/subscriptions/$', UserSubscriptionsView.as_view(),
         name='user_subscriptions'),

=== modified file 'src/postorius/views/user.py'
--- src/postorius/views/user.py	2013-03-29 22:04:06 +0000
+++ src/postorius/views/user.py	2013-04-08 16:37:34 +0000
@@ -257,16 +257,42 @@
 
 @login_required()
 def user_profile(request, user_email=None):
+    print dir(request.user)
     if not request.user.is_authenticated():
         return redirect('user_login')
-    #try:
-    #    the_user = User.objects.get(email=user_email)
-    #except MailmanApiError:
-    #    return utils.render_api_error(request)
+    try:
+        the_user = User.objects.get(email=request.user.email)
+    except MailmanApiError:
+        return utils.render_api_error(request)
     return render_to_response('postorius/user_profile.html',
-                              # {'mm_user': the_user},
+                               {'mm_user': the_user},
                               context_instance=RequestContext(request))
 
+@login_required
+def edit_profile(request):
+    column_id = str(request.GET['column_id'])
+    column_value = str(request.GET['column_value'])
+    the_user = User.objects.get(email=request.user.email)
+    if column_id == 'first_name':
+        the_user.first_name = column_value
+        the_user.save()
+    elif column_id == 'last_name':
+        the_user.last_name = column_value
+        the_user.save()
+    return HttpResponse('1')
+#    if column_id == 'irc_handle':
+#        the_user.irc_handle = column_value
+#        the_user.save()
+#    if column_id == 'website':
+#        the_user.website = column_value
+#        the_user.save()
+#    if column_id == 'twitter_id':
+#        the_user.twitter_id = column_value
+#        the_user.save()
+#
+
+
+
 
 @login_required
 def user_tasks(request):

_______________________________________________
Mailman-coders mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-coders

Reply via email to