newissue.template 1005 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{#if key}}
  2. <form id="form">
  3. <div>
  4. <input type="text" name="title" class="fill-width" placeholder="Title"/>
  5. </div>
  6. <div>
  7. <textarea type="text" name="description" class="fill-width" placeholder="Description"/></textarea>
  8. </div>
  9. <div>
  10. <button value="Cancel" class="danger">Cancel</button>
  11. <button value="Create" onclick="$(this).parent().submit();">Create</button>
  12. </div>
  13. </form>
  14. <script>
  15. $(document).ready(function(){
  16. $('form#form').submit(function(){
  17. var data = $(this).serializeObject(),
  18. State = History.getState();
  19. for(var i in State.data){
  20. data[i] = State.data;
  21. }
  22. data.type = 'action';
  23. data.id = 'issue';
  24. apiCall(data,function(d){
  25. if(!d.error){
  26. back();
  27. }else{
  28. $('#loading').hide();
  29. }
  30. return false;
  31. });
  32. return false;
  33. }).find('.danger').click(function(){
  34. back();
  35. return false;
  36. });
  37. });
  38. </script>
  39. {{else}}
  40. <script>
  41. $(document).ready(function(){
  42. back();
  43. });
  44. </script>
  45. {{/if}}