From: zuber Date: Sat, 24 Oct 2009 19:53:28 +0000 (+0200) Subject: Dodanie opisu zmian do interfejsu zarządzania pull requestami. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/21e60dff855cacb585e159850e2de899d4622e5d?ds=sidebyside;hp=--cc Dodanie opisu zmian do interfejsu zarządzania pull requestami. --- 21e60dff855cacb585e159850e2de899d4622e5d diff --git a/apps/api/handlers/library_handlers.py b/apps/api/handlers/library_handlers.py index 0a45a0b1..31981b4c 100755 --- a/apps/api/handlers/library_handlers.py +++ b/apps/api/handlers/library_handlers.py @@ -31,6 +31,10 @@ import api.response as response from api.utils import validate_form, hglibrary, natural_order from api.models import PartCache, PullRequest +from pygments import highlight +from pygments.lexers import DiffLexer +from pygments.formatters import HtmlFormatter + # import settings @@ -205,19 +209,23 @@ class DiffHandler(BaseHandler): allowed_methods = ('GET',) @hglibrary - def read(self, request, source_revision, target_revision, lib): - '''Return diff between source_revision and target_revision)''' - source_document = lib.document_for_revision(source_revision) - target_document = lib.document_for_revision(target_revision) - print source_document, - print target_document + def read(self, request, docid, lib): + '''Return diff between source_revision and target_revision)''' + revision = request.GET.get('revision') + if not revision: + return '' + source_document = lib.document(docid) + target_document = lib.document_for_revision(revision) + print source_document, target_document + diff = difflib.unified_diff( source_document.data('xml').splitlines(True), target_document.data('xml').splitlines(True), 'source', 'target') - return ''.join(list(diff)) + s = ''.join(list(diff)) + return highlight(s, DiffLexer(), HtmlFormatter(cssclass="pastie")) # diff --git a/apps/api/handlers/text_handler.py b/apps/api/handlers/text_handler.py index 31f958da..c4a4d0b3 100644 --- a/apps/api/handlers/text_handler.py +++ b/apps/api/handlers/text_handler.py @@ -44,7 +44,7 @@ class DocumentTextHandler(BaseHandler): user = form.cleaned_data['user'] or request.user.username format = form.cleaned_data['format'] - document = lib.document_for_rev(revision) + document = lib.document_for_revision(revision) if document.id != docid: return response.BadRequest().django_response({ diff --git a/apps/api/urls.py b/apps/api/urls.py index 0ed64591..52b0ccc5 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -76,7 +76,7 @@ urlpatterns = patterns('', url(urlpath(r'documents', DOC, 'revision', format=False), document_merge, {'emitter_format': 'json'}, name="docmerge_view"), - url(r'diffs/(?Platest|[0-9a-fA-F]+)/(?Platest|[0-9a-fA-F]+)/$', + url(r'documents/(?P[^/]+)/diff$', diff_resource, {'emitter_format': 'raw'}, name="diff_resource"), diff --git a/platforma/static/css/managment.css b/platforma/static/css/managment.css index 3777bcfc..5e1c5411 100644 --- a/platforma/static/css/managment.css +++ b/platforma/static/css/managment.css @@ -9,18 +9,41 @@ table.request-report margin-right: auto; } -.request-report td, .request-report th { - vertical-align: top; - border-right: 1px solid black; - border-bottom: 1px solid black; +.pull-request { + padding: 20px 20px 10px 20px; + border-bottom: 1px dotted #CCC; +} + +.pull-request h2 { + padding: 0; + margin: 0; + font-size: 22px; +} + +.pull-request .request-info { + color: #999; + list-style: none; + margin: 0; + padding: 0; +} + +.pull-request .request-info li { + float: left; + padding-right: 20px; +} + +.pull-request p.comment { + clear: left; + padding: 20px 0; +} - padding: 0.4em 1em; - margin: 0em; +.pull-request p { + margin: 0; + padding: 0; } -.request-report th { - background-color: black; - color: white; +.awesome.button { + margin-right: 10px; } .request-report .status-N { @@ -33,4 +56,8 @@ table.request-report .request-report .status-A { background-color: gray; -} \ No newline at end of file +} + +.pull-request .diff { + white-space: pre; +} diff --git a/platforma/templates/base.html b/platforma/templates/base.html index 06fbc628..590825a1 100644 --- a/platforma/templates/base.html +++ b/platforma/templates/base.html @@ -5,6 +5,7 @@ {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} + {% block extrahead %} diff --git a/platforma/templates/manager/pull_request.html b/platforma/templates/manager/pull_request.html index 3b19c3bd..9b235514 100644 --- a/platforma/templates/manager/pull_request.html +++ b/platforma/templates/manager/pull_request.html @@ -1,7 +1,10 @@ {% extends 'base.html' %} +{% block bodyid %}management{% endblock %} + {% block extrahead %} + {% endblock %} {% block maincontent %} - - - - - {% if objects %} {% for pullreq in objects %} - - - - - - - - - +
+

{{ pullreq.document }}

+
    +
  • commiter: {{ pullreq.comitter }}
  • +
  • revision: {{ pullreq.source_revision }}
  • +
  • status: {{ pullreq.status }}
  • +
  • data: {{ pullreq.timestamp }}
  • +
+

{{ pullreq.comment }}

+

+ + + Zobacz +

+
{% endfor %} {% else %} - + {# #} {% endif %} -
UtwórUżytkownikKomentarzStanZgłoszonoAkcje
{{ pullreq.document }}{{ pullreq.comitter }}{{ pullreq.comment }} {{ pullreq.status }}{{ pullreq.timestamp }} - - Zobacz -
Brak żądań
Brak żądań
+{# #} {% endblock %}