You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/10/15 16:02:25 UTC

[01/16] allura git commit: [#8230] revert change to checklist.js and create separate Checklist objects

Repository: allura
Updated Branches:
  refs/heads/master 181b82e6b -> fc4472710


[#8230] revert change to checklist.js and create separate Checklist objects


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

Branch: refs/heads/master
Commit: fc44727107b035658efd5290ed53f0c96d1c8eeb
Parents: c07970e
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Oct 15 15:40:20 2018 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/public/nf/js/allura-base.js | 29 ++++++++++++++------------
 Allura/allura/public/nf/js/checklist.js   |  2 +-
 2 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/fc447271/Allura/allura/public/nf/js/allura-base.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/allura-base.js b/Allura/allura/public/nf/js/allura-base.js
index ed62d8f..945d97e 100644
--- a/Allura/allura/public/nf/js/allura-base.js
+++ b/Allura/allura/public/nf/js/allura-base.js
@@ -235,19 +235,22 @@ $(function(){
 
 // Interactive checkboxes
 $(function(){
-    new Checklists(".active-md", function(checkbox, callback) {
-        var uri = $(checkbox).closest('.active-md').data('markdownlink');
-        $.get(uri + 'get_markdown', callback);
-    }, function(markdown, checkbox, callback) {
-        var uri = $(checkbox).closest('.active-md').data('markdownlink');
-        $.ajax({
-            type: 'post',
-            url: uri + 'update_markdown',
-            data: {
-                'text' : markdown,
-                '_session_id' : $.cookie('_session_id')
-            },
-            success: callback
+    $('.active-md').each(function() {
+        var $active_md = $(this);
+        new Checklists($active_md, function(checkbox, callback) {
+            var uri = $active_md.data('markdownlink');
+            $.get(uri + 'get_markdown', callback);
+        }, function(markdown, checkbox, callback) {
+            var uri = $active_md.data('markdownlink');
+            $.ajax({
+                type: 'post',
+                url: uri + 'update_markdown',
+                data: {
+                    'text' : markdown,
+                    '_session_id' : $.cookie('_session_id')
+                },
+                success: callback
+            });
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/allura/blob/fc447271/Allura/allura/public/nf/js/checklist.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/checklist.js b/Allura/allura/public/nf/js/checklist.js
index 32642f7..c1edac2 100644
--- a/Allura/allura/public/nf/js/checklist.js
+++ b/Allura/allura/public/nf/js/checklist.js
@@ -32,7 +32,7 @@ var Checklists = (function($) {
     Checklists.prototype.checkboxSelector = "> li > input:checkbox";
     Checklists.prototype.onChange = function(ev, self) {
         var checkbox = $(this).prop("disabled", true);
-        var index = $("ul" + self.checkboxSelector, $(this).closest('.active-md')).index(this);
+        var index = $("ul" + self.checkboxSelector, self.container).index(this);
         var reactivate = function() { checkbox.prop("disabled", false); };
         self.retriever(checkbox, function(markdown) {
             markdown = self.toggleCheckbox(index, markdown);


[11/16] allura git commit: [#8230] Update thread edit info when markdown changes

Posted by br...@apache.org.
[#8230] Update thread edit info when markdown changes


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

Branch: refs/heads/master
Commit: 0d652633e8e7620da55ca6ab72dcb2cbaef903a6
Parents: 4e4dae0
Author: Shalitha <sh...@gmail.com>
Authored: Wed Oct 10 21:43:19 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/0d652633/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index b188a75..6bdc289 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -349,6 +349,9 @@ class PostController(BaseController):
     def update_markdown(self, text=None, **kw):  
         if has_access(self.post, 'moderate'):
             self.post.text = text
+            self.post.edit_count = self.post.edit_count + 1
+            self.post.last_edit_date = datetime.utcnow()
+            self.post.last_edit_by_id = c.user._id
             self.post.commit()
             g.director.create_activity(c.user, 'modified', self.post,
                             target=self.post.thread.artifact or self.post.thread,


[16/16] allura git commit: [#8230] Clean up codes and revert permission check for comments

Posted by br...@apache.org.
[#8230] Clean up codes and revert permission check for comments


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

Branch: refs/heads/master
Commit: 521c68049a61fd5c58a0af3f043a335af5a31946
Parents: 77cceb0
Author: Shalitha <sh...@gmail.com>
Authored: Sat Oct 13 17:44:32 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py                    | 2 +-
 Allura/allura/templates/widgets/post_widget.html        | 2 +-
 ForgeTracker/forgetracker/templates/tracker/ticket.html | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/521c6804/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index c2fda01..6bdc289 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -347,7 +347,7 @@ class PostController(BaseController):
     @expose('json:')
     @require_post()
     def update_markdown(self, text=None, **kw):  
-        if has_access(self.post, 'edit'):
+        if has_access(self.post, 'moderate'):
             self.post.text = text
             self.post.edit_count = self.post.edit_count + 1
             self.post.last_edit_date = datetime.utcnow()

http://git-wip-us.apache.org/repos/asf/allura/blob/521c6804/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 058f701..4add9ff 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 %}
 
-            <div{% if h.has_access(value, 'edit') %} class="active-md" data-markdownlink="{{value.url()}}" {% endif %}>{{g.markdown.cached_convert(value, 'text')|safe}}</div>&nbsp;
+            <div{% if h.has_access(value, 'moderate') %} class="active-md" data-markdownlink="{{value.url()}}" {% endif %}>{{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>

http://git-wip-us.apache.org/repos/asf/allura/blob/521c6804/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index b46be48..666775f 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -149,7 +149,7 @@
   {{ c.vote_form.display(artifact=ticket) }}
 {% endif %}
 <div id="ticket_content">
-  <div{% if h.has_access(ticket, 'update') %} class="active-md" data-markdownlink=""{% endif %}}>{{g.markdown.cached_convert(ticket, 'description')|safe}}</div>
+  <div{% if h.has_access(ticket, 'update') %} class="active-md" data-markdownlink=""{% endif %}>{{g.markdown.cached_convert(ticket, 'description')|safe}}</div>
   {% if ticket.attachments %}
     <strong class="grid-18">{{ticket.attachments|length}} Attachments</strong>
     <div class="clear">


[08/16] allura git commit: [#8230] Add interactive checkbox support for ForgeTracker

Posted by br...@apache.org.
[#8230] Add interactive checkbox support for ForgeTracker


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

Branch: refs/heads/master
Commit: 6c1a6ee62bea28f401fde8757611d2ac8150d933
Parents: 3689f90
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Oct 10 13:27:28 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 .../forgetracker/templates/tracker/ticket.html  | 22 +++++++++++++++++-
 ForgeTracker/forgetracker/tracker_main.py       | 24 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/6c1a6ee6/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 2895829..b1cc974 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -149,7 +149,7 @@
   {{ c.vote_form.display(artifact=ticket) }}
 {% endif %}
 <div id="ticket_content">
-  {{g.markdown.cached_convert(ticket, 'description')|safe}}
+  <div class="active-md" data-markdownlink="">{{g.markdown.cached_convert(ticket, 'description')|safe}}</div>
   {% if ticket.attachments %}
     <strong class="grid-18">{{ticket.attachments|length}} Attachments</strong>
     <div class="clear">
@@ -252,6 +252,26 @@
         });
     </script>
   {% endif %}
+
+  {% if h.has_access(ticket, 'update') %}
+  <script>
+          new Checklists(".active-md", function(checkbox, callback) {
+          var uri = $(checkbox).closest('.active-md').data('markdownlink');
+          $.get(uri + 'get_markdown', callback);
+      }, function(markdown, checkbox, callback) {
+          var uri = $(checkbox).closest('.active-md').data('markdownlink');
+          $.ajax({
+              type: 'post',
+              url: uri + 'update_markdown',
+              data: {
+                  'text' : markdown,
+                  '_session_id' : $.cookie('_session_id')
+              },
+              success: callback
+          });
+      });
+  </script>
+  {% endif %}
 {% endblock %}
 
 {% block extra_css %}

http://git-wip-us.apache.org/repos/asf/allura/blob/6c1a6ee6/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 2ed6b2c..c065606 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1550,6 +1550,30 @@ class TicketController(BaseController, FeedController):
         c.app.globals.invalidate_bin_counts()
         redirect('.')
 
+    @without_trailing_slash
+    @expose('json:')
+    @require_post()
+    def update_markdown(self, text=None, **kw):  
+        if has_access(self.ticket, 'update'):
+            self.ticket.description = text
+            self.ticket.commit()
+            g.director.create_activity(c.user, 'modified', self.ticket,
+                            related_nodes=[c.project], tags=['ticket'])
+            g.spam_checker.check(text, artifact=self.ticket,
+                user=c.user, content_type='ticket')
+            return {
+                'status' : 'success'
+            }
+        else:
+            return {
+                'status' : 'no_permission'
+            }
+
+    @expose()
+    @without_trailing_slash
+    def get_markdown(self):
+        return self.ticket.description
+
     @expose('json:')
     @require_post()
     @validate(W.subscribe_form)


[13/16] allura git commit: [#8230] Add interactive markdown checkbox support for ForgeDiscussion

Posted by br...@apache.org.
[#8230] Add interactive markdown checkbox support for ForgeDiscussion


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

Branch: refs/heads/master
Commit: 84100613a3f7543c0d73d05650163290998662d1
Parents: 0d65263
Author: Shalitha <sh...@gmail.com>
Authored: Wed Oct 10 21:44:20 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 .../templates/discussionforums/thread.html      | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/84100613/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
index 90a2ff5..6af3679 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
@@ -41,3 +41,25 @@
 {% block content %}
   {{c.thread.display(value=thread, page=page, limit=limit, count=count)}}
 {% endblock %}
+
+{% block extra_js %}
+    {% if h.has_access(thread, 'moderate') %}
+        <script>
+                new Checklists(".active-md", function(checkbox, callback) {
+                var uri = $(checkbox).closest('.active-md').data('markdownlink');
+                $.get(uri + 'get_markdown', callback);
+            }, function(markdown, checkbox, callback) {
+                var uri = $(checkbox).closest('.active-md').data('markdownlink');
+                $.ajax({
+                    type: 'post',
+                    url: uri + 'update_markdown',
+                    data: {
+                        'text' : markdown,
+                        '_session_id' : $.cookie('_session_id')
+                    },
+                    success: callback
+                });
+            });
+        </script>
+    {% endif %}
+{% endblock %}


[12/16] allura git commit: [#8230] Move new Checklists snippet to common place

Posted by br...@apache.org.
[#8230] Move new Checklists snippet to common place


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

Branch: refs/heads/master
Commit: 17208f3376e96aee2af7f89a8700d09a66a7f421
Parents: 3c0041b
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Fri Oct 12 11:15:17 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/public/nf/js/allura-base.js       | 19 ++++++++++++++++
 .../allura/templates/widgets/post_widget.html   |  2 +-
 ForgeBlog/forgeblog/templates/blog/post.html    | 22 ------------------
 .../templates/blog_widgets/view_post.html       |  2 +-
 .../templates/discussionforums/thread.html      | 21 -----------------
 .../forgetracker/templates/tracker/ticket.html  | 22 +-----------------
 .../forgewiki/templates/wiki/page_view.html     | 24 +-------------------
 7 files changed, 23 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/Allura/allura/public/nf/js/allura-base.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/allura-base.js b/Allura/allura/public/nf/js/allura-base.js
index f7b8a3c..ed62d8f 100644
--- a/Allura/allura/public/nf/js/allura-base.js
+++ b/Allura/allura/public/nf/js/allura-base.js
@@ -232,3 +232,22 @@ $(function(){
         e.preventDefault();
     });
 });
+
+// Interactive checkboxes
+$(function(){
+    new Checklists(".active-md", function(checkbox, callback) {
+        var uri = $(checkbox).closest('.active-md').data('markdownlink');
+        $.get(uri + 'get_markdown', callback);
+    }, function(markdown, checkbox, callback) {
+        var uri = $(checkbox).closest('.active-md').data('markdownlink');
+        $.ajax({
+            type: 'post',
+            url: uri + 'update_markdown',
+            data: {
+                'text' : markdown,
+                '_session_id' : $.cookie('_session_id')
+            },
+            success: callback
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/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 36ef910..058f701 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 %}
 
-            <div class="active-md" data-markdownlink="{{value.url()}}">{{g.markdown.cached_convert(value, 'text')|safe}}</div>&nbsp;
+            <div{% if h.has_access(value, 'edit') %} class="active-md" data-markdownlink="{{value.url()}}" {% endif %}>{{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>

http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/ForgeBlog/forgeblog/templates/blog/post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog/post.html b/ForgeBlog/forgeblog/templates/blog/post.html
index e565de6..1b91176 100644
--- a/ForgeBlog/forgeblog/templates/blog/post.html
+++ b/ForgeBlog/forgeblog/templates/blog/post.html
@@ -44,25 +44,3 @@
     </div>
     {% endif %}
 {% endblock %}
-
-{% block extra_js %}
-    {% if h.has_access(post, 'edit') %}
-        <script>
-                new Checklists(".active-md", function(checkbox, callback) {
-                var uri = $(checkbox).closest('.active-md').data('markdownlink');
-                $.get(uri + 'get_markdown', callback);
-            }, function(markdown, checkbox, callback) {
-                var uri = $(checkbox).closest('.active-md').data('markdownlink');
-                $.ajax({
-                    type: 'post',
-                    url: uri + 'update_markdown',
-                    data: {
-                        'text' : markdown,
-                        '_session_id' : $.cookie('_session_id')
-                    },
-                    success: callback
-                });
-            });
-        </script>
-    {% endif %}
-{% endblock %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
index e428989..57cee5a 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
@@ -18,7 +18,7 @@
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
-<div class="active-md" data-markdownlink="">{{value.html_text|safe}}</div>
+<div{% if h.has_access(value, 'edit') %} class="active-md" data-markdownlink="" {% endif %}>{{value.html_text|safe}}</div>
 {{lib.related_artifacts(value)}}
 <em class="grid-19">
   Posted by {{lib.user_link(base_post.author(), avatar=True)}} {{lib.abbr_date(value.timestamp)}}

http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
index 7d53a14..82e2ee7 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
@@ -42,24 +42,3 @@
   {{c.thread.display(value=thread, page=page, limit=limit, count=count)}}
 {% endblock %}
 
-{% block extra_js %}
-    {% if h.has_access(thread, 'edit') %}
-        <script>
-                new Checklists(".active-md", function(checkbox, callback) {
-                var uri = $(checkbox).closest('.active-md').data('markdownlink');
-                $.get(uri + 'get_markdown', callback);
-            }, function(markdown, checkbox, callback) {
-                var uri = $(checkbox).closest('.active-md').data('markdownlink');
-                $.ajax({
-                    type: 'post',
-                    url: uri + 'update_markdown',
-                    data: {
-                        'text' : markdown,
-                        '_session_id' : $.cookie('_session_id')
-                    },
-                    success: callback
-                });
-            });
-        </script>
-    {% endif %}
-{% endblock %}

http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index b1cc974..b46be48 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -149,7 +149,7 @@
   {{ c.vote_form.display(artifact=ticket) }}
 {% endif %}
 <div id="ticket_content">
-  <div class="active-md" data-markdownlink="">{{g.markdown.cached_convert(ticket, 'description')|safe}}</div>
+  <div{% if h.has_access(ticket, 'update') %} class="active-md" data-markdownlink=""{% endif %}}>{{g.markdown.cached_convert(ticket, 'description')|safe}}</div>
   {% if ticket.attachments %}
     <strong class="grid-18">{{ticket.attachments|length}} Attachments</strong>
     <div class="clear">
@@ -252,26 +252,6 @@
         });
     </script>
   {% endif %}
-
-  {% if h.has_access(ticket, 'update') %}
-  <script>
-          new Checklists(".active-md", function(checkbox, callback) {
-          var uri = $(checkbox).closest('.active-md').data('markdownlink');
-          $.get(uri + 'get_markdown', callback);
-      }, function(markdown, checkbox, callback) {
-          var uri = $(checkbox).closest('.active-md').data('markdownlink');
-          $.ajax({
-              type: 'post',
-              url: uri + 'update_markdown',
-              data: {
-                  'text' : markdown,
-                  '_session_id' : $.cookie('_session_id')
-              },
-              success: callback
-          });
-      });
-  </script>
-  {% endif %}
 {% endblock %}
 
 {% block extra_css %}

http://git-wip-us.apache.org/repos/asf/allura/blob/17208f33/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index f1eda91..52954ca 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -71,7 +71,7 @@
 {% endblock %}
 
 {% block wiki_content %}
-<div class="active-md" data-markdownlink="">{{page.html_text}}</div>
+<div{% if h.has_access(page, 'edit') %} class="active-md" data-markdownlink="" {% endif %}>{{page.html_text}}</div>
 {% endblock %}
 
 {% block wiki_meta %}
@@ -119,25 +119,3 @@
   {% endif %}
   {{c.confirmation.display(content='')}}
 {% endblock %}
-
-{% block wiki_extra_js %}
-    {% if h.has_access(page, 'edit') %}
-        <script>
-                new Checklists(".active-md", function(checkbox, callback) {
-                var uri = $(checkbox).closest('.active-md').data('markdownlink');
-                $.get(uri + 'get_markdown', callback);
-            }, function(markdown, checkbox, callback) {
-                var uri = $(checkbox).closest('.active-md').data('markdownlink');
-                $.ajax({
-                    type: 'post',
-                    url: uri + 'update_markdown',
-                    data: {
-                        'text' : markdown,
-                        '_session_id' : $.cookie('_session_id')
-                    },
-                    success: callback
-                });
-            });
-        </script>
-    {% endif %}
-{% endblock %}
\ No newline at end of file


[14/16] allura git commit: [#8230] Add unit tests for get_markdown and update_markdown

Posted by br...@apache.org.
[#8230] Add unit tests for get_markdown and update_markdown


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

Branch: refs/heads/master
Commit: 77cceb058f10e79ed0f7d32c07f0dbe9ce6c7845
Parents: 17208f3
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Fri Oct 12 15:32:52 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_discuss.py  | 25 +++++++++++++++
 .../forgeblog/tests/functional/test_root.py     | 22 +++++++++++++
 .../forgetracker/tests/functional/test_root.py  | 21 +++++++++++++
 .../forgewiki/tests/functional/test_root.py     | 33 ++++++++++++++++++++
 4 files changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/77cceb05/Allura/allura/tests/functional/test_discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_discuss.py b/Allura/allura/tests/functional/test_discuss.py
index 5a31272..74a490c 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -191,6 +191,31 @@ class TestDiscuss(TestDiscussBase):
         assert M.Post.query.find().count() == 1
         assert M.Post.query.find({'deleted': False}).count() == 0
 
+    def test_comment_get_markdown(self):
+        r = self._make_post('This is a post')
+        post_id = str(
+            r.html.find('div', {'class': 'discussion-post'})['id'])
+        response = self.app.get(self._thread_link() + post_id + '/get_markdown')
+        assert 'This is a post' in response
+
+    def test_comment_update_markdown(self):
+        r = self._make_post('This is a post')
+        post_id = str(
+            r.html.find('div', {'class': 'discussion-post'})['id'])
+        update_link = str(self._thread_link() + post_id + '/update_markdown')
+        response = self.app.post(
+            update_link,
+            params={
+                'text': '- [x] checkbox'})
+        assert response.json['status'] == 'success'
+        # anon users can't edit markdown
+        response = self.app.post(
+            update_link,
+            params={
+                'text': '- [x] checkbox'},
+            extra_environ=dict(username='*anonymous'))
+        assert response.json['status'] == 'no_permission'
+
     def test_user_filter(self):
         r = self._make_post('Test post')
         post_link = str(

http://git-wip-us.apache.org/repos/asf/allura/blob/77cceb05/ForgeBlog/forgeblog/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_root.py b/ForgeBlog/forgeblog/tests/functional/test_root.py
index 4085744..972aa1a 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_root.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_root.py
@@ -161,6 +161,28 @@ class Test(TestController):
                                 extra_environ=dict(username='*anonymous'))
         assert 'Nothing' not in response
 
+    def test_post_get_markdown(self):
+        self._post()
+        d = self._blog_date()
+        response = self.app.get('/blog/%s/my-post/get_markdown' % d)
+        assert 'Nothing' in response
+
+    def test_post_update_markdown(self):
+        self._post()
+        d = self._blog_date()
+        response = self.app.post(
+            '/blog/%s/my-post/update_markdown' % d,
+            params={
+                'text': '- [x] checkbox'})
+        assert response.json['status'] == 'success'
+        # anon users can't edit markdown
+        response = self.app.post(
+            '/blog/%s/my-post/update_markdown' % d,
+            params={
+                'text': '- [x] checkbox'},
+            extra_environ=dict(username='*anonymous'))
+        assert response.json['status'] == 'no_permission'
+
     def test_post_attachments(self):
         # create
         upload = ('attachment', 'nums.txt', '123412341234')

http://git-wip-us.apache.org/repos/asf/allura/blob/77cceb05/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index adf39c3..f9a5317 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -307,6 +307,27 @@ class TestFunctionalController(TrackerTestController):
         assert_true(summary in ticket_view)
         opts = self.subscription_options(ticket_view)
         assert_equal(opts['subscribed'], False)
+        
+    def test_ticket_get_markdown(self):
+        self.new_ticket(summary='my ticket', description='my description')
+        response = self.app.get('/bugs/1/get_markdown')
+        assert 'my description' in response
+
+    def test_ticket_update_markdown(self):
+        self.new_ticket(summary='my ticket', description='my description')
+        response = self.app.get('/bugs/1/get_markdown')
+        response = self.app.post(
+            '/bugs/1/update_markdown',
+            params={
+                'text': '- [x] checkbox'})
+        assert response.json['status'] == 'success'
+        # anon users can't edit markdown
+        response = self.app.post(
+            '/bugs/1/update_markdown',
+            params={
+                'text': '- [x] checkbox'},
+            extra_environ=dict(username='*anonymous'))
+        assert response.json['status'] == 'no_permission'
 
     def test_labels(self):
         ticket_view = self.new_ticket(summary='summary', labels="test label").follow()

http://git-wip-us.apache.org/repos/asf/allura/blob/77cceb05/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 98533eb..8781406 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -400,6 +400,39 @@ class TestRootController(TestController):
         assert_equal(spam_checker.check.call_args[0][0], u'tést\nsometext')
         assert 'tést' in response
 
+    def test_page_get_markdown(self):
+        self.app.post(
+            '/wiki/tést/update',
+            params={
+                'title': 'tést',
+                'text': '- [ ] checkbox',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
+        response = self.app.get('/wiki/tést/get_markdown')
+        assert '- [ ] checkbox' in response
+
+
+    def test_page_update_markdown(self):
+        self.app.post(
+            '/wiki/tést/update',
+            params={
+                'title': 'tést',
+                'text': '- [ ] checkbox',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
+        response = self.app.post(
+            '/wiki/tést/update_markdown',
+            params={
+                'text': '- [x] checkbox'})
+        assert response.json['status'] == 'success'
+        # anon users can't edit markdown
+        response = self.app.post(
+            '/wiki/tést/update_markdown',
+            params={
+                'text': '- [x] checkbox'},
+            extra_environ=dict(username='*anonymous'))
+        assert response.json['status'] == 'no_permission'
+
     def test_page_label_unlabel(self):
         self.app.get('/wiki/tést/')
         response = self.app.post(


[09/16] allura git commit: [#8230] Fix checklist.js for multiple elements

Posted by br...@apache.org.
[#8230] Fix checklist.js for multiple elements


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

Branch: refs/heads/master
Commit: d8d575c6b4d6887d96ebf3f5f7b38005786952c4
Parents: 6c1a6ee
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Oct 10 15:44:40 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/public/nf/js/checklist.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/d8d575c6/Allura/allura/public/nf/js/checklist.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/checklist.js b/Allura/allura/public/nf/js/checklist.js
index c1edac2..32642f7 100644
--- a/Allura/allura/public/nf/js/checklist.js
+++ b/Allura/allura/public/nf/js/checklist.js
@@ -32,7 +32,7 @@ var Checklists = (function($) {
     Checklists.prototype.checkboxSelector = "> li > input:checkbox";
     Checklists.prototype.onChange = function(ev, self) {
         var checkbox = $(this).prop("disabled", true);
-        var index = $("ul" + self.checkboxSelector, self.container).index(this);
+        var index = $("ul" + self.checkboxSelector, $(this).closest('.active-md')).index(this);
         var reactivate = function() { checkbox.prop("disabled", false); };
         self.retriever(checkbox, function(markdown) {
             markdown = self.toggleCheckbox(index, markdown);


[15/16] allura git commit: [#8230] Add unit tests for ForgeGit get_markdown and update_markdown

Posted by br...@apache.org.
[#8230] Add unit tests for ForgeGit get_markdown and update_markdown


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

Branch: refs/heads/master
Commit: c07970e4e7492e62d4d9f8252f0c7d1cfc4af423
Parents: 81ac3b1
Author: Shalitha <sh...@gmail.com>
Authored: Sat Oct 13 21:00:45 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 .../tests/functional/test_controllers.py        | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c07970e4/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index fb4377d..4bcffce 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -800,6 +800,38 @@ class TestFork(_TestCase):
         r = self.app.get('/p/test/src-git/merge-requests').follow()
         assert '<a href="1/">changed summary</a>' in r
 
+    def test_merge_request_get_markdown(self):
+        self.app.post('/p/test2/code/do_request_merge',
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'summary',
+                              'description': 'description',
+                          })
+        response = self.app.get('/p/test/src-git/merge-requests/1/get_markdown')
+        assert 'description' in response
+
+    def test_merge_request_update_markdown(self):
+        self.app.post('/p/test2/code/do_request_merge',
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'summary',
+                              'description': 'description',
+                          })
+        response = self.app.post(
+            '/p/test/src-git/merge-requests/1/update_markdown',
+            params={
+                'text': '- [x] checkbox'})
+        assert response.json['status'] == 'success'
+        # anon users can't edit markdown
+        response = self.app.post(
+            '/p/test/src-git/merge-requests/1/update_markdown',
+            params={
+                'text': '- [x] checkbox'},
+            extra_environ=dict(username='*anonymous'))
+        assert response.json['status'] == 'no_permission'
+
     @patch.object(GM.Repository, 'merge_request_commits', autospec=True)
     def test_merge_request_commits_error(self, mr_commits):
         r, mr_num = self._request_merge()


[07/16] allura git commit: [#8230] Add interactive checkbox support for ForgeBlog

Posted by br...@apache.org.
[#8230] Add interactive checkbox support for ForgeBlog


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

Branch: refs/heads/master
Commit: 3689f90fbd671191c088b921156eae24259bddd5
Parents: bd9b080
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Oct 10 12:00:51 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 ForgeBlog/forgeblog/main.py                     | 22 ++++++++++++++++++++
 ForgeBlog/forgeblog/templates/blog/post.html    | 22 ++++++++++++++++++++
 .../templates/blog_widgets/view_post.html       |  2 +-
 3 files changed, 45 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3689f90f/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index bf4c3ec..db79cd3 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -426,6 +426,28 @@ class PostController(BaseController, FeedController):
         redirect('.')
 
     @without_trailing_slash
+    @expose('json:')
+    @require_post()
+    def update_markdown(self, text=None, **kw):  
+        if has_access(self.post, 'edit'):
+            self.post.text = text
+            self.post.commit()
+            g.spam_checker.check(text, artifact=self.post,
+                user=c.user, content_type='blog-post')
+            return {
+                'status' : 'success'
+            }
+        else:
+            return {
+                'status' : 'no_permission'
+            }
+
+    @expose()
+    @without_trailing_slash
+    def get_markdown(self):
+        return self.post.text
+
+    @without_trailing_slash
     @require_post()
     @expose()
     def revert(self, version, **kw):

http://git-wip-us.apache.org/repos/asf/allura/blob/3689f90f/ForgeBlog/forgeblog/templates/blog/post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog/post.html b/ForgeBlog/forgeblog/templates/blog/post.html
index 1b91176..e565de6 100644
--- a/ForgeBlog/forgeblog/templates/blog/post.html
+++ b/ForgeBlog/forgeblog/templates/blog/post.html
@@ -44,3 +44,25 @@
     </div>
     {% endif %}
 {% endblock %}
+
+{% block extra_js %}
+    {% if h.has_access(post, 'edit') %}
+        <script>
+                new Checklists(".active-md", function(checkbox, callback) {
+                var uri = $(checkbox).closest('.active-md').data('markdownlink');
+                $.get(uri + 'get_markdown', callback);
+            }, function(markdown, checkbox, callback) {
+                var uri = $(checkbox).closest('.active-md').data('markdownlink');
+                $.ajax({
+                    type: 'post',
+                    url: uri + 'update_markdown',
+                    data: {
+                        'text' : markdown,
+                        '_session_id' : $.cookie('_session_id')
+                    },
+                    success: callback
+                });
+            });
+        </script>
+    {% endif %}
+{% endblock %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/3689f90f/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
index 66b92c5..e428989 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
@@ -18,7 +18,7 @@
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
-{{value.html_text|safe}}
+<div class="active-md" data-markdownlink="">{{value.html_text|safe}}</div>
 {{lib.related_artifacts(value)}}
 <em class="grid-19">
   Posted by {{lib.user_link(base_post.author(), avatar=True)}} {{lib.abbr_date(value.timestamp)}}


[04/16] allura git commit: [#8230] Add interactive checklist support for ForgeWiki

Posted by br...@apache.org.
[#8230] Add interactive checklist support for ForgeWiki


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

Branch: refs/heads/master
Commit: 6084c2b77d0fbe6d60c732d09cad6475b448ab7e
Parents: 1c2b26d
Author: Shalitha <sh...@gmail.com>
Authored: Tue Oct 9 21:51:14 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 .../forgewiki/templates/wiki/page_view.html     | 24 +++++++++++++++++++-
 ForgeWiki/forgewiki/wiki_main.py                | 24 ++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/6084c2b7/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index b4d3f8a..f1eda91 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -71,7 +71,7 @@
 {% endblock %}
 
 {% block wiki_content %}
-{{page.html_text}}
+<div class="active-md" data-markdownlink="">{{page.html_text}}</div>
 {% endblock %}
 
 {% block wiki_meta %}
@@ -119,3 +119,25 @@
   {% endif %}
   {{c.confirmation.display(content='')}}
 {% endblock %}
+
+{% block wiki_extra_js %}
+    {% if h.has_access(page, 'edit') %}
+        <script>
+                new Checklists(".active-md", function(checkbox, callback) {
+                var uri = $(checkbox).closest('.active-md').data('markdownlink');
+                $.get(uri + 'get_markdown', callback);
+            }, function(markdown, checkbox, callback) {
+                var uri = $(checkbox).closest('.active-md').data('markdownlink');
+                $.ajax({
+                    type: 'post',
+                    url: uri + 'update_markdown',
+                    data: {
+                        'text' : markdown,
+                        '_session_id' : $.cookie('_session_id')
+                    },
+                    success: callback
+                });
+            });
+        </script>
+    {% endif %}
+{% endblock %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/6084c2b7/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index f7c1eca..64aaf8b 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -770,6 +770,30 @@ class PageController(BaseController, FeedController):
                  .encode('utf-8') + ('/' if not name_conflict else '/edit'))
 
     @without_trailing_slash
+    @expose('json:')
+    @require_post()
+    def update_markdown(self, text=None, **kw):  
+        if has_access(self.page, 'edit'):
+            self.page.text = text
+            self.page.commit()
+            g.spam_checker.check(text, artifact=self.page,
+                user=c.user, content_type='wiki')
+            g.director.create_activity(c.user, 'modified', self.page,
+                related_nodes=[c.project], tags=['wiki'])
+            return {
+                'status' : 'success'
+            }
+        else:
+            return {
+                'status' : 'no_permission'
+            }
+
+    @without_trailing_slash
+    @expose()
+    def get_markdown(self):  
+        return self.page.text
+
+    @without_trailing_slash
     @expose()
     @require_post()
     def attach(self, file_info=None, **kw):


[05/16] allura git commit: [#8230] Update LICENSE for checklist.js

Posted by br...@apache.org.
[#8230] Update LICENSE for checklist.js


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

Branch: refs/heads/master
Commit: bd9b080bbddf067fe9dfc81d4dd5050f652739fb
Parents: 6084c2b
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Wed Oct 10 10:32:03 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/LICENSE   | 4 ++++
 LICENSE          | 4 ++++
 rat-excludes.txt | 1 +
 3 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/bd9b080b/Allura/LICENSE
----------------------------------------------------------------------
diff --git a/Allura/LICENSE b/Allura/LICENSE
index be64a02..32a53c7 100644
--- a/Allura/LICENSE
+++ b/Allura/LICENSE
@@ -277,3 +277,7 @@ SimpleMDE markdown editor (https://github.com/NextStepWebs/simplemde-markdown-ed
 license. For details, see:
     allura/lib/widgets/resources/js/simplemde.min.js
     allura/lib/widgets/resources/css/simplemde.min.css
+
+Python markdown extension for checklists (https://github.com/FND/markdown-checklist) is available under the MIT
+license. For details, see:
+    allura/public/nf/js/checklist.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/bd9b080b/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index 3b25690..cf0da1d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -293,3 +293,7 @@ Build scripts from Sphinx (http://sphinx-doc.org/):
     Allura/docs/Makefile
     ForgeImporters/docs/make.bat
     ForgeImporters/docs/Makefile
+
+Python markdown extension for checklists (https://github.com/FND/markdown-checklist) is available under the MIT
+license. For details, see:
+    Allura/allura/public/nf/js/checklist.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/bd9b080b/rat-excludes.txt
----------------------------------------------------------------------
diff --git a/rat-excludes.txt b/rat-excludes.txt
index 7c12b63..f2b474f 100644
--- a/rat-excludes.txt
+++ b/rat-excludes.txt
@@ -75,4 +75,5 @@ requirements*
 solr_config/allura/core.properties
 # tmp can have tons of files from the broccoli build process
 tmp/**
+Allura/allura/public/nf/js/checklist.js
 


[03/16] allura git commit: [#8230] Change permission check to edit from moderate

Posted by br...@apache.org.
[#8230] Change permission check to edit from moderate


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

Branch: refs/heads/master
Commit: 3c0041b6a89fccd3d1b07b6aa3af8f4e75c5e96e
Parents: 8410061
Author: Shalitha Suranga <sh...@gmail.com>
Authored: Fri Oct 12 10:26:03 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py                               | 2 +-
 .../forgediscussion/templates/discussionforums/thread.html         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3c0041b6/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 6bdc289..c2fda01 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -347,7 +347,7 @@ class PostController(BaseController):
     @expose('json:')
     @require_post()
     def update_markdown(self, text=None, **kw):  
-        if has_access(self.post, 'moderate'):
+        if has_access(self.post, 'edit'):
             self.post.text = text
             self.post.edit_count = self.post.edit_count + 1
             self.post.last_edit_date = datetime.utcnow()

http://git-wip-us.apache.org/repos/asf/allura/blob/3c0041b6/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
index 6af3679..7d53a14 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
@@ -43,7 +43,7 @@
 {% endblock %}
 
 {% block extra_js %}
-    {% if h.has_access(thread, 'moderate') %}
+    {% if h.has_access(thread, 'edit') %}
         <script>
                 new Checklists(".active-md", function(checkbox, callback) {
                 var uri = $(checkbox).closest('.active-md').data('markdownlink');


[02/16] allura git commit: [#8230] Add interactive checkbox support for ForgeGit merge requests

Posted by br...@apache.org.
[#8230] Add interactive checkbox support for ForgeGit merge requests


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

Branch: refs/heads/master
Commit: 81ac3b16b29988a29213699f5ea5f9648f6711a6
Parents: 521c680
Author: Shalitha <sh...@gmail.com>
Authored: Sat Oct 13 20:30:35 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         | 22 ++++++++++++++++++++
 Allura/allura/templates/repo/merge_request.html |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/81ac3b16/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 72de27c..ce7faa7 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -480,6 +480,28 @@ class MergeRequestController(object):
                                        related_nodes=[c.project], tags=['merge-request'])
         self.refresh()
 
+    @without_trailing_slash
+    @expose('json:')
+    @require_post()
+    def update_markdown(self, text=None, **kw):  
+        if has_access(self.req, 'write'):
+            self.req.description = text
+            self.req.commit()
+            g.director.create_activity(c.user, 'updated', self.req,
+                                       related_nodes=[c.project], tags=['merge-request'])
+            return {
+                'status' : 'success'
+            }
+        else:
+            return {
+                'status' : 'no_permission'
+            }
+
+    @expose()
+    @without_trailing_slash
+    def get_markdown(self):
+        return self.req.description
+
     @expose()
     @require_post()
     @validate(mr_dispose_form)

http://git-wip-us.apache.org/repos/asf/allura/blob/81ac3b16/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index 2b8e70d..3bee892 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -65,7 +65,7 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
       {{lib.abbr_date(req.mod_date)}}
     </p>
 
-    <div>{{g.markdown.convert(req.description)}}</div>
+    <div{% if h.has_access(req, 'write') %} class="active-md" data-markdownlink="" {% endif %}>{{g.markdown.convert(req.description)}}</div>
 
     {% if error %}
       <div class='grid-19 error'>


[06/16] allura git commit: [#8230] Add checklist.js

Posted by br...@apache.org.
[#8230] Add checklist.js


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

Branch: refs/heads/master
Commit: 1c2b26d4b2b4db4dc4877b4bb189bf8b06b9f866
Parents: 181b82e
Author: Shalitha <sh...@gmail.com>
Authored: Tue Oct 9 21:50:33 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 Allura/allura/public/nf/js/checklist.js         | 56 ++++++++++++++++++++
 .../allura/templates/jinja_master/master.html   |  1 +
 2 files changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1c2b26d4/Allura/allura/public/nf/js/checklist.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/checklist.js b/Allura/allura/public/nf/js/checklist.js
new file mode 100644
index 0000000..c1edac2
--- /dev/null
+++ b/Allura/allura/public/nf/js/checklist.js
@@ -0,0 +1,56 @@
+/*jslint white: true, vars: true */
+/*global Checklists, jQuery */
+
+var Checklists = (function($) {
+
+    "use strict";
+    
+    // makes Markdown checklists interactive
+    // `container` is either a DOM element, jQuery collection or selector containing
+    // the Markdown content
+    // `retriever` is a function being passed the respective checkbox and a
+    // callback - the latter is epxected to be called with the container's raw
+    // Markdown source
+    // `storer` is a function being passed the updated Markdown content, the
+    // respective checkbox and a callback
+    // both functions' are invoked with the respective `Checklists` instance as
+    // execution context (i.e. `this`)
+    function Checklists(container, retriever, storer) {
+        this.container = container.jquery ? container : $(container);
+        this.retriever = retriever;
+        this.storer = storer;
+    
+        var checklists = $(".checklist", container);
+        checklists.find(this.checkboxSelector).prop("disabled", false);
+        var self = this;
+        checklists.on("change", this.checkboxSelector, function() {
+            var args = Array.prototype.slice.call(arguments);
+            args.push(self);
+            self.onChange.apply(this, args);
+        });
+    }
+    Checklists.prototype.checkboxSelector = "> li > input:checkbox";
+    Checklists.prototype.onChange = function(ev, self) {
+        var checkbox = $(this).prop("disabled", true);
+        var index = $("ul" + self.checkboxSelector, self.container).index(this);
+        var reactivate = function() { checkbox.prop("disabled", false); };
+        self.retriever(checkbox, function(markdown) {
+            markdown = self.toggleCheckbox(index, markdown);
+            self.storer(markdown, checkbox, reactivate);
+        });
+    };
+    Checklists.prototype.toggleCheckbox = function(index, markdown) {
+        var pattern = /^([*-]) \[([ Xx])\]/mg; // XXX: duplicates server-side logic!?
+        var count = 0;
+        return markdown.replace(pattern, function(match, prefix, marker) {
+            if(count === index) {
+                marker = marker === " " ? "x" : " ";
+            }
+            count++;
+            return prefix + " [" + marker + "]";
+        });
+    };
+    
+    return Checklists;
+    
+    }(jQuery));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2b26d4/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 649699c..e16a5bc 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -29,6 +29,7 @@
 {% do g.register_forge_js('js/twemoji.min.js') %}
 {% do g.register_forge_js('js/pb.transformie.min.js') %}
 {% do g.register_forge_js('js/allura-base.js') %}
+{% do g.register_forge_js('js/checklist.js') %}
 {% do g.register_forge_css('css/forge/hilite.css') %}
 {% do g.register_forge_css('css/forge/tooltipster.css') %}
 {% do g.register_forge_css('css/font-awesome.min.css', compress=False) %}


[10/16] allura git commit: [#8230] Add interactive checkbox support for general threads

Posted by br...@apache.org.
[#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 <sh...@gmail.com>
Authored: Wed Oct 10 15:46:09 2018 +0530
Committer: Dave Brondsema <db...@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>