create.view 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. @Title{Blog}@
  2. @CSS{
  3. #controls{
  4. list-style:none;
  5. padding:0;
  6. margin:0;
  7. }
  8. #controls li{
  9. display:inline;
  10. }
  11. }@
  12. @JavaScript{
  13. var buttonsPosOffset;
  14. function setTextAreaHeight(){
  15. $("textarea").height(window.innerHeight-$("h3:first-child").offset().top-buttonsPosOffset-50);
  16. //console.log(window.innerHeight-$("h3:first-child").offset().top-buttonsPosOffset-30);
  17. }
  18. $(function(){
  19. buttonsPosOffset=window.innerHeight-$("#buttons").offset().top;
  20. //console.log(buttonsPosOffset);
  21. setTextAreaHeight();
  22. $("#controls button").click(function(e){
  23. e.preventDefault();
  24. var tag=$(this).attr("tag");
  25. console.log(tag);
  26. console.log($("#draft"));
  27. });
  28. });
  29. $(window).resize(setTextAreaHeight);
  30. }@
  31. @ButtonsRight{
  32. <button onclick="window.location.href='/blog/manage'" title="Manage">
  33. <img src="/images/library.svg" alt="Library" />
  34. </button><br/>
  35. <button type="submit" form="blogForm" title="Save">
  36. <img src="/images/save.svg" alt="Save" />
  37. </button>
  38. }@
  39. @Body{
  40. <h3>Title</h3>
  41. <form action="" method="post" id="blogForm">
  42. <input name="title" style="width:100%" value="<?= htmlspecialchars($post->PostTitle) ?>" />
  43. <h3>Content</h3>
  44. <ul id="controls">
  45. <li><button tag="i">Italic</button></li>
  46. <li><button tag="h">Header</button></li>
  47. </ul>
  48. <textarea class="allowTabInput" name="draft" id="draft" style="width:100%; height:200px" ><?= htmlspecialchars($post->PostDraft) ?></textarea>
  49. </form>
  50. }@