Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: appengine/monorail/project/projectsummary.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/project/projectexport.py ('k') | appengine/monorail/project/projectupdates.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/project/projectsummary.py
diff --git a/appengine/monorail/project/projectsummary.py b/appengine/monorail/project/projectsummary.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e9a2669298437ae1f33717b9622fe712679a60b
--- /dev/null
+++ b/appengine/monorail/project/projectsummary.py
@@ -0,0 +1,68 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""A class to display the project summary page."""
+
+import logging
+
+from framework import framework_bizobj
+from framework import permissions
+from framework import servlet
+from project import project_views
+
+from third_party import markdown
+
+
+class ProjectSummary(servlet.Servlet):
+ """Page to show brief project description and process documentation."""
+
+ _PAGE_TEMPLATE = 'project/project-summary-page.ezt'
+ _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_PROCESS
+
+ def GatherPageData(self, mr):
+ """Build up a dictionary of data values to use when rendering the page."""
+
+ with self.profiler.Phase('getting project star count'):
+ num_stars = self.services.project_star.CountItemStars(
+ mr.cnxn, mr.project_id)
+ plural = '' if num_stars == 1 else 's'
+
+ page_data = {
+ 'admin_tab_mode': self.PROCESS_TAB_SUMMARY,
+ 'formatted_project_description':
+ markdown.Markdown(mr.project.description),
+ 'access_level': project_views.ProjectAccessView(mr.project.access),
+ 'num_stars': num_stars,
+ 'plural': plural,
+ 'home_page': mr.project.home_page,
+ }
+
+ return page_data
+
+ def GatherHelpData(self, mr, _page_data):
+ """Return a dict of values to drive on-page user help.
+
+ Args:
+ mr: common information parsed from the HTTP request.
+ _page_data: Dictionary of base and page template data.
+
+ Returns:
+ A dict of values to drive on-page user help, to be added to page_data.
+ """
+ cue = None
+ dismissed = mr.auth.user_pb.dismissed_cues
+ project = mr.project
+
+ # Cue cards for project owners.
+ if self.CheckPerm(mr, permissions.EDIT_PROJECT):
+ if ('document_team_duties' not in dismissed
+ and len(framework_bizobj.AllProjectMembers(project)) > 1
+ and not self.services.project.GetProjectCommitments(
+ mr.cnxn, mr.project_id).commitments):
+ cue = 'document_team_duties'
+
+ return {
+ 'cue': cue,
+ }
« no previous file with comments | « appengine/monorail/project/projectexport.py ('k') | appengine/monorail/project/projectupdates.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698