allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [12/16] allura git commit: [#8230] Move new Checklists snippet to common place
Date Mon, 15 Oct 2018 16:02:36 GMT
[#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 <shalithasuranga@gmail.com>
Authored: Fri Oct 12 11:15:17 2018 +0530
Committer: Dave Brondsema <dbrondsema@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


Mime
View raw message