allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [10/16] allura git commit: [#8230] Add interactive checkbox support for general threads
Date Mon, 15 Oct 2018 16:02:34 GMT
[#8230] Add interactive checkbox support for general threads


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/4e4dae07
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/4e4dae07
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/4e4dae07

Branch: refs/heads/master
Commit: 4e4dae079def2568db3232151e7634258b2e120d
Parents: d8d575c
Author: Shalitha Suranga <shalithasuranga@gmail.com>
Authored: Wed Oct 10 15:46:09 2018 +0530
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py            | 28 ++++++++++++++++++--
 .../allura/templates/widgets/post_widget.html   |  2 +-
 2 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4e4dae07/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index bd561f7..b188a75 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -20,7 +20,7 @@ from datetime import datetime
 import logging
 
 from tg import expose, redirect, validate, request, flash, response
-from tg.decorators import with_trailing_slash, before_render, before_validate
+from tg.decorators import with_trailing_slash, without_trailing_slash, before_render, before_validate
 from decorator import decorator
 
 from pylons import tmpl_context as c, app_globals as g
@@ -35,7 +35,7 @@ from base import BaseController
 from allura.lib import utils
 from allura.lib import helpers as h
 from allura.lib.decorators import require_post, memorable_forget
-from allura.lib.security import require_access
+from allura.lib.security import has_access, require_access
 
 from allura.lib.widgets import discuss as DW
 from allura.lib.widgets import form_fields as ffw
@@ -343,6 +343,30 @@ class PostController(BaseController):
             return dict(discussion=self.post.discussion,
                         post=post)
 
+    @without_trailing_slash
+    @expose('json:')
+    @require_post()
+    def update_markdown(self, text=None, **kw):  
+        if has_access(self.post, 'moderate'):
+            self.post.text = text
+            self.post.commit()
+            g.director.create_activity(c.user, 'modified', self.post,
+                            target=self.post.thread.artifact or self.post.thread,
+                            related_nodes=[self.post.app_config.project],
+                            tags=['comment'])
+            return {
+                'status' : 'success'
+            }
+        else:
+            return {
+                'status' : 'no_permission'
+            }
+
+    @expose()
+    @without_trailing_slash
+    def get_markdown(self):
+        return self.post.text
+
     def error_handler(self, *args, **kwargs):
         redirect(request.referer)
 

http://git-wip-us.apache.org/repos/asf/allura/blob/4e4dae07/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index 4439821..36ef910 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -78,7 +78,7 @@
                 <b>{{value.subject or '(no subject)'}}<br/></b>
             {% endif %}
 
-            {{g.markdown.cached_convert(value, 'text')|safe}}&nbsp;
+            <div class="active-md" data-markdownlink="{{value.url()}}">{{g.markdown.cached_convert(value,
'text')|safe}}</div>&nbsp;
             {{lib.related_artifacts(value)}}
             {% if value.edit_count %}
                 <br><small>Last edit: {{value.last_edit_by().display_name}} {{h.ago(value.last_edit_date)}}</small>


Mime
View raw message