/kai/templates/articles/new.mako

https://bitbucket.org/bbangert/kai/ · Mako · 31 lines · 31 code · 0 blank · 0 comment · 3 complexity · 8eaf77cf0b83d40fe50db1baae930ffb MD5 · raw file

  1. <%!
  2. from kai.model.forms import new_article_form
  3. %>
  4. <div class="yui-b content">
  5. <p>${h.link_to('< Back to all blog entries', url=url('articles'))}</p>
  6. <h1>${_('Add new blog posting')}</h1>
  7. <div style="display: none;" id="comment_preview">&nbsp;</div>
  8. ${new_article_form.display(action=url('articles')) | n}
  9. </div>
  10. <%def name="title()">${parent.title()} - ${'Blog'} - ${c.article.title}</%def>
  11. <%inherit file="/layout.mako" />
  12. <%def name="javascript()">
  13. ${parent.javascript()}
  14. <script>
  15. $(document).ready(function() {
  16. $('#Preview').click(function() {
  17. var content = $('#body')[0].value;
  18. var preview_url = '${url('preview_comment')}';
  19. $.ajax({
  20. data: {content:content},
  21. type: "POST",
  22. url: preview_url,
  23. success: function(data, textStatus) {
  24. $('#comment_preview').html(data).slideDown();
  25. }
  26. });
  27. return false;
  28. });
  29. });
  30. </script>
  31. </%def>