changeset 5662:b60e58094fb7

comments: change comment formatting to plain text instead of rst There might be value in enabling rich markup (especially if it is markdown instead of rst) ... or it might be a waste of time. We might revisit that later. But either way: Changing to plain text makes it more feasible to do markup of hashes and issues - for now that is more important than rtf.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 20 Jan 2016 01:47:11 +0100
parents b97ba9b23796
children 4a9184804089
files kallithea/controllers/changeset.py kallithea/lib/helpers.py kallithea/model/notification.py kallithea/public/css/style.css kallithea/templates/admin/notifications/show_notification.html kallithea/templates/changeset/changeset_file_comment.html kallithea/templates/pullrequests/pullrequest_show.html
diffstat 7 files changed, 12 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/changeset.py	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/controllers/changeset.py	Wed Jan 20 01:47:11 2016 +0100
@@ -412,7 +412,7 @@
             raise HTTPBadRequest()
         text = request.POST.get('text')
         if text:
-            return h.rst_w_mentions(text)
+            return h.render_w_mentions(text)
         return ''
 
     @LoginRequired()
--- a/kallithea/lib/helpers.py	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/lib/helpers.py	Wed Jan 20 01:47:11 2016 +0100
@@ -1398,7 +1398,7 @@
                    MarkupRenderer.rst_with_mentions(source))
 
 
-def mentions_replace(match_obj):
+def _mentions_replace(match_obj):
     return '<b>@%s</b>' % match_obj.group(1)
 
 
@@ -1413,7 +1413,7 @@
     # this sequence of html-ifications seems to be safe and non-conflicting
     # if the issues regexp is sane
     s = _urlify_text(s)
-    s = MENTIONS_REGEX.sub(mentions_replace, s)
+    s = MENTIONS_REGEX.sub(_mentions_replace, s)
     return literal('<code style="white-space:pre-wrap">%s</code>' % s)
 
 
--- a/kallithea/model/notification.py	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/model/notification.py	Wed Jan 20 01:47:11 2016 +0100
@@ -123,7 +123,7 @@
             ## this is passed into template
             html_kwargs = {
                       'subject': subject,
-                      'body': h.rst_w_mentions(body),
+                      'body': h.render_w_mentions(body),
                       'when': h.fmt_date(notif.created_on),
                       'user': notif.created_by_user.username,
                       }
--- a/kallithea/public/css/style.css	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/public/css/style.css	Wed Jan 20 01:47:11 2016 +0100
@@ -4131,9 +4131,7 @@
 
 .comments .comment .text {
     background-color: #FAFAFA;
-}
-.comment .text div.rst-block p {
-    margin: 0.5em 0px !important;
+    margin: 6px;
 }
 
 .comments-number {
@@ -4294,13 +4292,6 @@
     padding: 0 20px;
 }
 
-.inline-comments div.rst-block {
-    clear: both;
-    overflow: hidden;
-    margin: 0;
-    padding: 0 20px 0px;
-}
-
 .inline-comments .comment .comment-wrapp {
     max-width: 978px;
     border: 1px solid #ddd;
@@ -4338,6 +4329,7 @@
 
 .inline-comments .comment .text {
     background-color: #FAFAFA;
+    margin: 6px;
 }
 
 .inline-comments .comments-number {
--- a/kallithea/templates/admin/notifications/show_notification.html	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/templates/admin/notifications/show_notification.html	Wed Jan 20 01:47:11 2016 +0100
@@ -37,7 +37,7 @@
         <div class="notification-body">
         <div class="notification-subject">${h.literal(c.notification.subject)}</div>
         %if c.notification.body:
-            ${h.rst_w_mentions(c.notification.body)}
+            ${h.render_w_mentions(c.notification.body)}
         %endif
         </div>
       </div>
--- a/kallithea/templates/changeset/changeset_file_comment.html	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/templates/changeset/changeset_file_comment.html	Wed Jan 20 01:47:11 2016 +0100
@@ -32,7 +32,7 @@
       </div>
       <div class="text">
         %if co.status_change:
-           <div class="rst-block automatic-comment">
+           <div class="automatic-comment">
              <p>
                <span title="${_('Changeset status')}" class="changeset-status-lbl">${_("Status change")}: ${co.status_change[0].status_lbl}</span>
                <span class="changeset-status-ico"><i class="icon-circle changeset-status-${co.status_change[0].status}"></i></span>
@@ -40,7 +40,7 @@
            </div>
         %endif
         %if co.text:
-          ${h.rst_w_mentions(co.text)|n}
+          ${h.render_w_mentions(co.text)|n}
         %endif
       </div>
     </div>
@@ -57,12 +57,7 @@
     ${h.form('#', class_='inline-form')}
       <div id="edit-container_{1}" class="clearfix">
         <div class="comment-help">${_('Commenting on line {1}.')}
-          ${(_('Comments parsed using %s syntax with %s support.') % (
-                 ('<a href="%s">RST</a>' % h.url('rst_help')),
-                   ('<span style="color:#577632" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to notify another user'))
-               )
-            )|n
-           }
+          <span style="color:#577632" class="tooltip">${_('Comments are in plain text. Use @username inside this text to notify another user.')|n}</span>
         </div>
         <div class="mentions-container" id="mentions_container_{1}"></div>
         <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea>
@@ -145,9 +140,7 @@
       ${h.form(post_url, id="main_form")}
         <div id="edit-container" class="clearfix">
             <div class="comment-help">
-                ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
-                  '<span style="color:#577632" class="tooltip" title="%s">@mention</span>' %
-                  _('Use @username inside this text to notify another user.')))|n}
+              <span style="color:#577632" class="tooltip">${_('Comments are in plain text. Use @username inside this text to send notification to another local user.')|n}</span>
             </div>
             <div class="mentions-container" id="mentions_container"></div>
             ${h.textarea('text', class_="comment-block-ta")}
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jul 04 14:12:07 2014 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Wed Jan 20 01:47:11 2016 +0100
@@ -43,7 +43,7 @@
             %endif
           </div>
           <div class="input">
-            <div style="white-space:pre-wrap; line-height: 14px">${h.urlify_commit(c.pull_request.description, c.pull_request.org_repo.repo_name)}</div>
+            <code style="white-space:pre-wrap; line-height: 14px">${h.urlify_commit(c.pull_request.description, c.pull_request.org_repo.repo_name)}</code>
           </div>
         </div>