Lessons - UI changes.
authorLukasz Anwajler <lukasz@anwajler.com>
Thu, 27 Jan 2011 11:54:56 +0000 (05:54 -0600)
committerLukasz Anwajler <lukasz@anwajler.com>
Thu, 27 Jan 2011 11:54:56 +0000 (05:54 -0600)
wolnelektury/static/css/master.css
wolnelektury/static/js/catalogue.js
wolnelektury/templates/lessons/document_detail.html
wolnelektury/templates/lessons/document_list.html

index 15e48c7..1ea2366 100644 (file)
@@ -1012,7 +1012,7 @@ div.shown-tags p, div.all-tags p {
     border-radius: 3px;
 /*    font-size: 1.2em;*/
     font-weight: bold;
-    width: 370px;
+    width: 330px;
     margin-bottom: 0.25em;
     display: block;
 }
@@ -1021,8 +1021,13 @@ div.shown-tags p, div.all-tags p {
   padding-left: 30px;
   list-style: disc;
 }
+
+#document-list li {
+  padding: 5px;
+}
+
 #document-list li li a {
-  width: 340px;
+  width: 300px;
 }
 
 #document-list li a:hover, #document-list li a.active {
@@ -1048,6 +1053,11 @@ div.shown-tags p, div.all-tags p {
     padding: 0
 }
 
+#document-list .download-doc {
+    display: none;
+    color: #EE2124;
+}
+
 /* ====================== */
 /* = One percent banner = */
 /* ====================== */
@@ -1085,10 +1095,15 @@ div.shown-tags p, div.all-tags p {
     color: #FFF;
     text-decoration: none;
 }
+
 #createNewShelf {
-display: none;
+    display: none;
 }
 
 .widget-code {
     overflow: hidden;
 }
+
+#presentation-frame {
+    border: 0px none white;
+}
index afcacef..d9de589 100644 (file)
@@ -505,7 +505,9 @@ function serverTime() {
         });
 
         $('.audiobook-list').hide();
-        $("#"+$(".audiotabs .active").html().toLowerCase()+"-files").show();
+        if($(".audiotabs .active").length > 0) {
+            $("#"+$(".audiotabs .active").html().toLowerCase()+"-files").show();
+        }
         
         /* this will be useful for javascript html player
         var medias = $('.audiobook-list a');
index d0186ae..e554548 100644 (file)
@@ -1,22 +1,8 @@
-{% extends 'base.html' %}
-{% load i18n %}
-
-{% block title %}{{ object.title }} w WolneLektury.pl{% endblock %}
-
-{% block body %}
-    <h1>{{ object.title }}</h1>
-    <form action="{% url search %}" method="GET" accept-charset="utf-8" id="search-form">
-        <p>{{ form.q }} <input type="submit" value="{% trans "Search" %}" /> <strong>{% trans "or" %}</strong> <a href="{% url lessons_document_list %}">{% trans "return to list of materials" %}</a></p>
-    </form>
-
-    <div id="document-detail">
-        <p class="download"><a href="{{ object.file.url }}">{% trans "Download" %}</a> {% if object.author %}({% trans "author" %}: {{ object.author }}){% endif %}</p>
-        {% if object.slideshare_id %}
-        <object style="margin:0px" width="480" height="400">
-            <param name="movie" value="http://static.slidesharecdn.com/swf/{{ object.slideshare_player }}?doc={{ object.slideshare_id }}&rel=0&stripped_title={{ object.name|slugify }}" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/{{ object.slideshare_player }}?doc={{ object.slideshare_id }}&rel=0&stripped_title={{ object.name|slugify }}" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="400"></embed></object>
-        {% endif %}
-        {% if object.description %}
-            <p>{{ object.description|urlize|linebreaks }}</p>
-        {% endif %}
-    </div>
-{% endblock body %}
\ No newline at end of file
+{% if not object.html %}
+    {% if object.slideshare_id %}
+                    <object style="margin:0px" width="480" height="400">
+                        <param name="movie" value="http://static.slidesharecdn.com/swf/{{ object.slideshare_player }}?doc={{ object.slideshare_id }}&rel=0&stripped_title={{ object.name|slugify }}" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/{{ object.slideshare_player }}?doc={{ object.slideshare_id }}&rel=0&stripped_title={{ object.name|slugify }}" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="400"></embed></object>
+    {% endif %}                                 
+{% else %}
+   {{ object.html|safe }}
+{% endif %}              
index 00d161f..d61618e 100644 (file)
@@ -9,41 +9,17 @@
 {% block extrahead %}
     <script type="text/javascript" charset="utf-8">
         $(function() {
-            $('#document-list a[data-hash]').click(function() {
-                if (!$(this).hasClass('active')) {
-                    $('#document-list a[data-hash]').removeClass('active');
-                    $(this).addClass('active');
-                    document.location.hash = $(this).attr('data-hash');
-                }
-                return false;
+            $("#document-list a").click(function(e){
+                  e.preventDefault();
+                  if($("#presentation-frame").length == 0){
+                    $("<iframe id='presentation-frame' width='600' height='500' border='0' src=''>").appendTo($("#document-detail"));
+                  }
+                  $("#presentation-frame").attr("src", this.href);
+                  $('#document-list li').css('border', 'none');
+                  $(this).closest('li').css('border', '1px solid green');
+                  $('.download-doc').hide();
+                  $(this).next('.download-doc').show();
             });
-
-            var lastHash = null;
-
-            function checkHash() {
-                if (document.location.hash != lastHash) {
-                    lastHash = document.location.hash;
-                    var documentLink = $('#document-list a[data-hash=' + document.location.hash + ']');
-                    if (!documentLink.hasClass('active')) {
-                        $('#document-list a').removeClass('active');
-                        documentLink.addClass('active');
-                    };
-
-                    if ($('#document-detail').attr('data-hash') != lastHash) {
-                        $('#document-detail')
-                            .attr('data-hash', lastHash)
-                            .load(documentLink.attr('href'));
-                    };
-                } else if (!document.location.hash) {
-                    $first = $('#document-list a:first');
-                    $first.addClass('active');
-                    location.replace($first.attr('data-hash'));
-                }
-
-                setTimeout(checkHash, 500);
-            };
-
-            checkHash();
         });
     </script>
 {% endblock extrahead %}
@@ -52,7 +28,6 @@
     <form action="{% url search %}" method="GET" accept-charset="utf-8" id="search-form">
         <p>{{ form.q }} <input type="submit" value="{% trans "Search" %}" /> <strong>{% trans "or" %}</strong> <a href="{% url main_page %}">{% trans "return to main page" %}</a></p>
     </form>
-
     <div id="document-list">
         {% chunk "document-list" %}
     </div>