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 2016/08/01 19:12:49 UTC

allura git commit: Move post widget's image lightbox setup from template to resources section, so it doesn't run once per post on the page (and thus make duplicate lightboxes and takes more clicks to make the lightbox go away

Repository: allura
Updated Branches:
  refs/heads/master 73ac85df3 -> cd3b40477


Move post widget's image lightbox setup from template to resources section, so it doesn't run once per post on the page (and thus make duplicate lightboxes and takes more clicks to make the lightbox go away


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

Branch: refs/heads/master
Commit: cd3b40477bff6e6c143b42c3dc8d855432976bbf
Parents: 73ac85d
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Aug 1 15:12:42 2016 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Aug 1 15:12:42 2016 -0400

----------------------------------------------------------------------
 Allura/allura/lib/widgets/discuss.py            | 18 ++++++++++++
 .../allura/templates/widgets/post_widget.html   | 30 --------------------
 2 files changed, 18 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/cd3b4047/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 99c0400..a527dd9 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -300,6 +300,11 @@ class Post(HierWidget):
         for w in self.widgets.itervalues():
             for r in w.resources():
                 yield r
+        yield ew.CSSScript('''
+        div.moderate {
+            color:grey;
+        }
+        ''')
         yield ew.JSLink('js/jquery.lightbox_me.js')
         yield ew.JSScript('''
         (function () {
@@ -415,6 +420,19 @@ class Post(HierWidget):
                     });
                 }
             });
+
+            //lightbox_me script to create lightbox of attached images
+            $('.lightbox').click(function(e) {
+                var image_source = $(this).data("src");
+                var image = $('#lightbox').find('img:first');
+                image.attr("src", image_source);
+
+                $('#lightbox').lightbox_me({
+                    centered: true
+                });
+
+                e.preventDefault();
+            });
         }());
         ''')
 

http://git-wip-us.apache.org/repos/asf/allura/blob/cd3b4047/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 ec1876b..e387c4b 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -176,33 +176,3 @@
   </div>
 
 </div>
-
-{% block extra_css %}
-<style type="text/css">
-    div.moderate {
-        color:grey;
-    }
-</style>
-{% endblock %}
-
-{% block extra_js %}
-<script type="text/javascript">
-
-    $(document).ready( function(){
-        //lightbox_me script to create lightbox of attached images
-        $('.lightbox').click(function(e) {
-            var image_source = $(this).data("src");
-            var image = $('#lightbox').find('img:first');
-            image.attr("src", image_source);
-
-            $('#lightbox').lightbox_me({
-                centered: true
-            });
-
-            e.preventDefault();
-        });
-    });
-
-</script>
-
-{% endblock %}
\ No newline at end of file