MozReview: Review Page Redesign: Add review templates for future 'mozreview-review-content' modification (Bug 1309964). r=glob
authorDavid Walsh <dwalsh@mozilla.com>
Tue, 01 Nov 2016 14:12:06 -0500
changeset 61 05b49b352b259595aa46972712393a2e4140cce5
parent 60 e8ee0bfac509a066ecae1ca4913a2244adc89d02
child 62 2291f770282457d64adde63ef949ca3063466a22
push id35
push userbjones@mozilla.com
push dateMon, 09 Jan 2017 16:24:23 +0000
reviewersglob
bugs1309964
MozReview: Review Page Redesign: Add review templates for future 'mozreview-review-content' modification (Bug 1309964). r=glob MozReview-Commit-ID: L0DGWw17mPW
reviewboard/reviewboard/reviews/ui/base.py
reviewboard/reviewboard/reviews/views.py
reviewboard/reviewboard/templates/reviews/review_detail_mozreview.html
reviewboard/reviewboard/templates/reviews/ui/base_mozreview.html
--- a/reviewboard/reviewboard/reviews/ui/base.py
+++ b/reviewboard/reviewboard/reviews/ui/base.py
@@ -129,17 +129,17 @@ class ReviewUI(object):
         else:
             if self.review_request.repository_id:
                 diffset_count = DiffSet.objects.filter(
                     history__pk=self.review_request.diffset_history_id).count()
             else:
                 diffset_count = 0
 
             context.update({
-                'base_template': 'reviews/ui/base.html',
+                'base_template': 'reviews/ui/base_mozreview.html',
                 'has_diffs': (draft and draft.diffset) or diffset_count > 0,
                 'review': self.review_request.get_pending_review(request.user),
                 'review_ui_inline': False,
             })
         try:
             context.update(self.get_extra_context(request))
         except Exception as e:
             logging.error('Error when calling get_extra_context for '
--- a/reviewboard/reviewboard/reviews/views.py
+++ b/reviewboard/reviewboard/reviews/views.py
@@ -323,17 +323,17 @@ def _get_latest_file_attachments(file_at
     ]
 
 
 @check_login_required
 @check_local_site_access
 def review_detail(request,
                   review_request_id,
                   local_site=None,
-                  template_name="reviews/review_detail.html"):
+                  template_name="reviews/review_detail_mozreview.html"):
     """
     Main view for review requests. This covers the review request information
     and all the reviews on it.
     """
     # If there's a local_site passed in the URL, we want to look up the review
     # request based on the local_id instead of the pk. This allows each
     # local_site configured to have its own review request ID namespace
     # starting from 1.
new file mode 100644
--- /dev/null
+++ b/reviewboard/reviewboard/templates/reviews/review_detail_mozreview.html
@@ -0,0 +1,125 @@
+{% extends "reviews/reviewable_base_mozreview.html" %}
+{% load i18n djblets_deco djblets_js rb_extensions reviewtags staticfiles tz %}
+
+{% block title %}{{review_request_details.summary}} | {% trans "Review Request" %}{% endblock %}
+
+{% block css %}
+{{block.super}}
+
+{%  if siteconfig_settings.diffviewer_show_trailing_whitespace %}
+<style type="text/css">
+  .ew { background: #ee3434; }
+</style>
+{%  endif %}
+{% endblock css %}
+
+{% block content %}
+<div id="review_request">
+ <div id="review_request_banners"></div>
+{% display_review_request_trophies review_request %}
+{%  box "review-request" %}
+ <div class="review-request-header">
+  <ul class="actions page-tabs">
+   <li class="active"><a href="{{review_request.get_absolute_url}}">{% trans "Reviews" %}</a></li>
+{%   if has_diffs %}
+   <li><a href="{% url 'view-diff' review_request.display_id %}#index_header">{% trans "Diff" %}</a></li>
+{%   endif %}
+  </ul>
+
+  <div class="actions-container">
+   <ul class="actions actions-left">
+{%   if request.user.is_authenticated and review_request.status == 'P' %}
+    <li>{% star review_request %}</li>
+    <li class="has-menu">
+     <a class="menu-title" id="hide-review-request-link" href="#"><span class="rb-icon rb-icon-archive-off"></span></a>
+     <ul class="menu" id="hide-review-request-menu" style="display: none;"></ul>
+    </li>
+{%   endif %}
+   </ul>
+   <ul class="actions actions-right-container">
+    <li class="has-menu">
+     <a href="#" class="mobile-actions-menu-label"><span class="fa fa-ellipsis-h fa-lg"></span></a>
+     <ul class="actions actions-right">
+{%   review_request_action_hooks %}
+{%   review_request_dropdown_action_hooks %}
+{%   include "reviews/review_request_actions_secondary.html" %}
+{%   if has_diffs %}
+      <li><a href="diff/raw/">{% trans "Download Diff" %}</a></li>
+{%   endif %}
+{%   include "reviews/review_request_actions_primary.html" %}
+     </ul>
+    </li>
+   </ul>
+  </div>
+ </div>
+
+ <div class="main">
+{%   include "reviews/review_request_box.html" %}
+ </div>
+{%  endbox "review-request" %}
+</div>
+
+<div id="reviews">
+ <ul id="view_controls">
+{%  if entries %}
+  <li>
+   <a href="#" id="expand-all">
+    <span class="fa fa-plus"></span>
+    <span>{% trans "Expand All" %}</span>
+   </a>
+  </li>
+  <li>
+   <a href="#" id="collapse-all">
+    <span class="fa fa-minus"></span>
+    <span>{% trans "Collapse All" %}</span>
+   </a>
+  </li>
+{%  endif %}
+ </ul>
+
+{%  for entry in entries %}
+{%   if entry.review %}
+{%    include "reviews/boxes/review.html" %}
+{%   elif entry.changedesc %}
+{%    include "reviews/boxes/change.html" %}
+{%   endif %}
+{%  endfor %}
+{% endblock content %}
+</div>
+
+{% block scripts-post %}
+{{block.super}}
+
+<script>
+    RB.PageManager.setPage(new RB.ReviewRequestPageView({
+{%  localtime off %}
+        lastActivityTimestamp: {{last_activity_time|json_dumps}},
+{%  endlocaltime %}
+{%  include "reviews/reviewable_page_data.js" %}
+    }));
+
+    RB.PageManager.beforeRender(function(page) {
+{%  for entry in entries %}
+{%   if entry.review %}
+{%    for comment in entry.comments.diff_comments %}
+        page.queueLoadDiff(
+            "{{comment.id}}",
+{%     if comment.interfilediff %}
+            "{{comment.filediff.id}}-{{comment.interfilediff.id}}"
+{%     else %}
+            "{{comment.filediff.id}}"
+{%     endif %}
+        );
+{%    endfor %}
+{%   endif %}
+{%  endfor %}
+    });
+
+{%  if request.GET.reply_id and request.GET.reply_type %}
+    RB.PageManager.ready(function(page) {
+        page.openCommentEditor("{{request.GET.reply_type}}",
+                               {{request.GET.reply_id}});
+    });
+{%  endif %}
+</script>
+{% endblock scripts-post %}
new file mode 100644
--- /dev/null
+++ b/reviewboard/reviewboard/templates/reviews/ui/base_mozreview.html
@@ -0,0 +1,70 @@
+{% extends "reviews/reviewable_base_mozreview.html" %}
+{% load djblets_deco djblets_js djblets_utils i18n reviewtags tz %}
+
+{% block title %}
+ {{review_ui.name}}{% if caption %}: {{caption}}{% endif %}
+{% endblock %}
+
+{% block css %}
+{{block.super}}
+{%  block review_ui_css %}{% endblock %}
+{% endblock %}
+
+{% block content %}
+{%  definevar "review_ui_box_content" %}{% block review_ui_box_content %}{% endblock %}{% enddefinevar %}
+
+<div id="review_request" class="review-ui-box{% if review_ui_box_content %} has-review-ui-box-content{% endif %}">
+{%  include "reviews/trophy_box.html" %}
+ <div id="review_request_banners"></div>
+
+{%  box "review-request" %}
+ <div class="review-request-header">
+  <ul class="actions page-tabs">
+   <li><a href="{{review_request.get_absolute_url}}">{% trans "Reviews" %}</a></li>
+   <li class="active"><a href=".">{% trans "File" %}</a></li>
+{%   if has_diffs %}
+   <li><a href="{% url 'view-diff' review_request.display_id %}#index_header">{% trans "Diff" %}</a></li>
+{%   endif %}
+  </ul>
+
+  <div class="actions-container">
+   {% star review_request %}
+   <ul class="actions actions-right-container">
+    <li class="has-menu">
+     <a href="#" class="mobile-actions-menu-label"><span class="fa fa-ellipsis-h fa-lg"></span></a>
+     <ul class="actions actions-right">
+{%   include "reviews/review_request_actions_secondary.html" %}
+{%   if has_diffs %}
+      <li><a href="{% url 'raw-diff' review_request.display_id %}">{% trans "Download Diff" %}</a></li>
+{%   endif %}
+{%   include "reviews/review_request_actions_primary.html" %}
+     </ul>
+    </li>
+   </ul>
+  </div>
+ </div>
+ <div class="content review-ui-box-content">
+  {{review_ui_box_content}}
+ </div>
+{%  endbox %}
+</div>
+
+<div class="review-ui-standalone">
+{%  block review_ui_content %}{% endblock %}
+</div>
+{% endblock %}
+
+{% block scripts-post %}
+{{block.super}}
+
+<script>
+    RB.PageManager.setPage(new RB.ReviewablePageView({
+{%  localtime off %}
+        lastActivityTimestamp: {{last_activity_time|json_dumps}},
+{%  endlocaltime %}
+{%  include "reviews/reviewable_page_data.js" %}
+    }));
+</script>
+
+{%  block review_ui_scripts %}{% endblock %}
+{% endblock %}