Commits

0re0  committed fa029ff

Fixed markdown rendering; mock footer

  • Participants
  • Parent commits 5eb1e2d

Comments (0)

Files changed (3)

File testproject/jlog/templates/json-templates/index.html

   {.repeated section @}
   <h2>Title: {title|html}</h2>
   <h3>Written by: {author.first_name|html} {author.last_name|html}; {published_date}</h3>
-  <p class="markdown">{content|raw}</p>
+  <p class="markdown needs_rendering">{content|raw}</p>
   <p><a href="/blog/{slug|htmltag}" class="deeplink">Permalink</a></p>
   {.or}
   <h2>ERROR: &ldquo;@&rdquo; not working</h2>

File testproject/static/css/style.css

     Author: Jay Yu <qoo2004@gmail.com
     ========================================================================== */
 #container {font-size:125%; margin-left:auto;margin-right:auto;}
+#footer { width:100%; text-align:center; }
+.hidden .needs_rendering { display:none; }
 
 
 
 
 @media only screen and (min-width: 480px) {
   /* Style adjustments for viewports 480px and over go here */
-  #container {font-size:100%; margin-left:1em;margin-right:1em;}
+  #container {font-size:100%; margin-left:0.5em;margin-right:0.5em;}
  
 }
 
 @media only screen and (min-width: 768px) {
   /* Style adjustments for viewports 768px and over go here */
-  #container {font-size:100%; margin-left:1em;margin-right:1em;}
+  #container {font-size:110%; margin-left:1em;margin-right:1em;}
 
 }
 

File testproject/templates/base.html

 
 <body>
   <div id="container"></div>
-
+  <div id="footer">
+    <p>Powered by <a href="http://www.linode.com/?r=29330d57ace67dec2c87e94cd2db3365b460a7e6" rel="nofollow">Linode</a> | 
+      <a href="https://www.djangoproject.com/" rel="nofollow">Django</a> | 
+      <a href="http://code.google.com/p/json-template/" rel="nofollow">JSON-Template</a> | 
+      <a href="http://html5boilerplate.com/" rel="nofollow">HTML5 Boilerplate</a> | 
+      <a href="http://documentcloud.github.com/backbone/" rel="nofollow">Backbone.js</a> | 
+      <a href="http://code.google.com/p/pagedown/" rel="nofollow">Pagedown</a> | 
+      <a href="http://www.jquery.com/" rel="nofollow">jQuery</a> | 
+      <a href="https://github.com/balupton/history.js" rel="nofollow">History.js</a> | 
+      <a href="http://dyn.com/" rel="nofollow">DynDns</a>
+  </div>
 
   <!-- JavaScript at the bottom for fast page loading -->
   <script>
   Modernizr.load({
     load: STATIC_URL + 'js/libs/Markdown.Converter.js',
     complete: function() {
-      Modernizr.load(STATIC_URL + 'js/libs/Markdown.Sanitizer.js');
+      Modernizr.load({
+        load: STATIC_URL + 'js/libs/Markdown.Sanitizer.js',
+        complete: function() {
+          jlog.render_markdown();
+        }
+      });
     }
   });
   
         Modernizr.load(STATIC_URL + 'js/libs/jquery-1.6.2.min.js');
       }
       if ( !window.jQuery ) {
-        alert('Failed to load jQuery. Sorry.');
+        alert('This site requires jQuery. Sorry.');
       } else {
         /* Loads all jQuery-dependant stuff here */
         /* scripts concatenated and minified via ant build script */
         Modernizr.load(STATIC_URL + 'js/plugins.js');
         //Modernizr.load(STATIC_URL + 'js/script.js');
         Modernizr.load(STATIC_URL + 'js/libs/jquery.history.js');
-
         /* Initalise page after everything's ready */
         jlog.init();
       }
       post_init: Initialised stuff after JSON Template is loaded
       */
       $(".deeplink").click(function(event) {
+        /*
+        Hook up History.js
+        */
         event.preventDefault();
         var History = window.History;
         var State = History.getState();
         History.log('History.js: state after:', State.data, State.title, State.url);
       });
       
-      $(".markdown").each(function(index, element) {
-        var converter = Markdown.getSanitizingConverter();
-        alert(converter);
-        console.log('Got converter');
-        element.html(converter.makeHtml(element.html()));
-      })
+      jlog.render_markdown();
+    },
+    
+    render_markdown: function() {
+      if (window.Markdown) {
+        $(".markdown.needs_rendering").each(function(i) {
+          var converter = Markdown.getSanitizingConverter();
+          var e = $(this);
+          var md = e.html();
+          //console.log('Markdown contents: ', md);
+          e.html(converter.makeHtml(md));
+          e.removeClass('needs_rendering').show();
+        });
+      }
     }
   }