diff options
author | Leif Johansson <leifj@sunet.se> | 2012-10-08 09:55:31 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2012-10-08 09:55:31 +0200 |
commit | e5e29806cf16d3dff7cb74f9e1acd4159570d4c9 (patch) | |
tree | 251dbdd189d08ddd15ca15c2f0c84c5c15caad38 | |
parent | 9cfed215ee696efdb4ec4a7987910d6f5c9e416a (diff) |
toggle open/close for accordions based on location.hash
-rw-r--r-- | templates/apps/room/list.html | 5 | ||||
-rw-r--r-- | templates/apps/room/recordings.html | 11 | ||||
-rw-r--r-- | templates/base.html | 5 |
3 files changed, 12 insertions, 9 deletions
diff --git a/templates/apps/room/list.html b/templates/apps/room/list.html index 4e83466..52263b7 100644 --- a/templates/apps/room/list.html +++ b/templates/apps/room/list.html @@ -3,7 +3,6 @@ {% load roomurl %} {% load tagging_tags %} {% block widgets %} - $(".collapse").collapse({'parent': '#rooms'}); $(".occupation").click(function(e) { $(this).find(".occupation-info").first().load("/api/room/"+$(this).parents('.accordion-body').attr('id')+"/occupation") }); @@ -28,8 +27,8 @@ <div id="rooms" class="accordion"> {% for r in rooms %} <div class="room accordion-group"> - <div class="accordion-heading"><a href="#{{r.id}}" class="accordion-toggle" data-toggle="collapse" data-parent="#rooms">{{r.name}}</a></div> - <div id="{{r.id}}" class="accordion-body collapse in"> + <div class="accordion-heading"><a href="#{{r.id}}" class="accordion-toggle" data-toggle="collapse" data-target="#{{r.id}}" data-parent="#rooms">{{r.name}}</a></div> + <div id="{{r.id}}" class="accordion-body collapse"> <div class="accordion-inner"> {% tags_for_object r as tags %} <p><a target="_connect" href="{{r|roomurl}}">{{r|roomurl}}</a></p> diff --git a/templates/apps/room/recordings.html b/templates/apps/room/recordings.html index 8e95b09..8921b4d 100644 --- a/templates/apps/room/recordings.html +++ b/templates/apps/room/recordings.html @@ -1,10 +1,9 @@ {% extends "base.html" %} - {% load datehumanize %} {% load roomurl %} {% load tagging_tags %} {% block widgets %} -$(".collapse").collapse({'parent': '#recordings'}); +//$(".collapse").collapse({'parent': '#recordings'}); {% endblock %} {% block meta %} <link rel="alternate" type="application/rss+xml" title="{{title}} recordings (RSS 2.0)" href="/room/{{room.id}}/recordings.rss" /> @@ -18,8 +17,8 @@ $(".collapse").collapse({'parent': '#recordings'}); <div id="recordings" class="accordion"> {% for r in recordings %} <div class="recording accordion-group"> - <div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse" href="#{{r.sco_id}}">{{r.name}}</a></div> - <div id="{{r.sco_id}}" class="accordion-body collapse in"> + <div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse" data-target="#{{r.sco_id}}" data-parent="#recordings" href="#{{r.sco_id}}">{{r.name}}</a></div> + <div id="{{r.sco_id}}" class="accordion-body collapse"> <div class="accordion-inner"> <p><a target="_connect" href="{{r.url}}">{{r.url}}</a></p> <div class="well">{% if r.description %}{{r.description|safe}}{% else %}<em>No description available...</em>{% endif %}</div> @@ -41,6 +40,6 @@ $(".collapse").collapse({'parent': '#recordings'}); <a class="btn" href="/room#{{room.id}}">Back to '{{room.name}}'</a> {% endblock %} {% block validators %} -<a href="http://feed1.w3.org/check.cgi?url={% baseurl %}/room/{{room.id}}/recordings.atom"><img src="{{STATIC_URL}}/img/valid-atom.png" alt="[Valid Atom 1.0]" title="Validate my Atom 1.0 feed" /></a> -<a href="http://feed1.w3.org/check.cgi?url={% baseurl %}/room/{{room.id}}/recordings.rss"><img src="{{STATIC_URL}}/img/valid-rss-rogers.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a> +<a href="http://feed1.w3.org/check.cgi?url=/room/{{room.id}}/recordings.atom"><img src="{{STATIC_URL}}/img/valid-atom.png" alt="[Valid Atom 1.0]" title="Validate my Atom 1.0 feed" /></a> +<a href="http://feed1.w3.org/check.cgi?url=/room/{{room.id}}/recordings.rss"><img src="{{STATIC_URL}}/img/valid-rss-rogers.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a> {% endblock %}
\ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 4bd9d80..5353fdd 100644 --- a/templates/base.html +++ b/templates/base.html @@ -106,5 +106,10 @@ </div> </div> </div> + <script type="text/javascript"> + $(function() { + location.hash && $(location.hash + '.collapse').collapse('show'); + }); + </script> </body> </html> |