[geany/www.geany.org] 591acb: Fix news app usage when used without JavaScript

Enrico Tröger git-noreply at xxxxx
Wed May 1 12:33:25 UTC 2019


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Wed, 01 May 2019 12:33:25 UTC
Commit:      591acb4543007149baad74338f8646a11fb1c664
             https://github.com/geany/www.geany.org/commit/591acb4543007149baad74338f8646a11fb1c664

Log Message:
-----------
Fix news app usage when used without JavaScript


Modified Paths:
--------------
    news/templates/news/list.html
    news/templates/news/list_embedded.html

Modified: news/templates/news/list.html
11 lines changed, 9 insertions(+), 2 deletions(-)
===================================================================
@@ -33,7 +33,8 @@ <h4 class="panel-title">
                 </a>
             </h4>
         </div>
-        <div id="collapse{{ forloop.counter }}" class="panel-collapse collapse{% if forloop.counter0 == 0 %} in{% endif %}">
+        {# Expand all items in case JavaScript is deactivated on the client, otherwise they are collapsed later via JS #}
+        <div id="collapse{{ forloop.counter }}" class="panel-collapse collapse in">
             <div class="panel-body list-group">
 
                 {% for newspost in by_year.list %}
@@ -61,7 +62,6 @@ <h4>
 {% endfor %}
 </div>
 
-
 {% endblock %}
 
 
@@ -79,6 +79,13 @@ <h4>
         }).on('hide.bs.collapse', function(){
             $(this).parent().find(".glyphicon").removeClass("glyphicon-minus").addClass("glyphicon-plus");
         });
+
+        // Collapse all items except the first one
+        $("[id^=collapse]").each(function(index, element) {
+            if (index > 0) {
+                $(this).collapse('hide');
+            }
+        });
     });
 </script>
 {% endblock %}


Modified: news/templates/news/list_embedded.html
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -4,7 +4,7 @@
 {% for newspost in recent_news_posts %}
     <li class="list-group-item">
         <span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>
-        <a href="#" data-toggle="modal" data-target="#news-modal" id="news-post-{{ newspost.slug }}">
+        <a href="{{ newspost.get_absolute_url }}" data-toggle="modal" data-target="#news-modal" id="news-post-{{ newspost.slug }}">
             {{ newspost.title }}
         </a>
         <span class="small">- {{ newspost.publish_date|date:"F Y" }}</span>



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list