changeset 2625:fc19979a8421 beta

Added views for new ajax functions, got somehow lost in previos commit
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 16 Jul 2012 23:41:54 +0200
parents 19daa8d761dc
children 4abce2c11c5f
files rhodecode/controllers/admin/settings.py
diffstat 1 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/settings.py	Mon Jul 16 23:19:34 2012 +0200
+++ b/rhodecode/controllers/admin/settings.py	Mon Jul 16 23:41:54 2012 +0200
@@ -43,7 +43,7 @@
 from rhodecode.lib.utils import repo2db_mapper, invalidate_cache, \
     set_rhodecode_config, repo_name_slug
 from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \
-    RhodeCodeSetting
+    RhodeCodeSetting, PullRequest, PullRequestReviewers
 from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \
     ApplicationUiSettingsForm
 from rhodecode.model.scm import ScmModel
@@ -51,6 +51,8 @@
 from rhodecode.model.db import User
 from rhodecode.model.notification import EmailNotificationModel
 from rhodecode.model.meta import Session
+from pylons.decorators import jsonify
+from rhodecode.model.pull_request import PullRequestModel
 
 log = logging.getLogger(__name__)
 
@@ -369,11 +371,6 @@
             Session.commit()
         except formencode.Invalid, errors:
             c.user = User.get(self.rhodecode_user.user_id)
-            all_repos = self.sa.query(Repository)\
-                .filter(Repository.user_id == c.user.user_id)\
-                .order_by(func.lower(Repository.repo_name))\
-                .all()
-            c.user_repos = ScmModel().get_repos(all_repos)
 
             c.form = htmlfill.render(
                 render('admin/users/user_edit_my_account_form.html'),
@@ -389,6 +386,26 @@
 
         return redirect(url('my_account'))
 
+    def my_account_my_repos(self):
+        all_repos = self.sa.query(Repository)\
+            .filter(Repository.user_id == self.rhodecode_user.user_id)\
+            .order_by(func.lower(Repository.repo_name))\
+            .all()
+        c.user_repos = ScmModel().get_repos(all_repos)
+        return render('admin/users/user_edit_my_account_repos.html')
+
+    def my_account_my_pullrequests(self):
+        c.my_pull_requests = PullRequest.query()\
+                                .filter(PullRequest.user_id==
+                                        self.rhodecode_user.user_id)\
+                                .all()
+        c.participate_in_pull_requests = \
+            [x.pull_request for x in PullRequestReviewers.query()\
+                                    .filter(PullRequestReviewers.user_id==
+                                            self.rhodecode_user.user_id)\
+                                    .all()]
+        return render('admin/users/user_edit_my_account_pullrequests.html')
+
     @NotAnonymous()
     @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
     def create_repository(self):