issue.template 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <h2>
  2. {{title}} <a style="font-size:small;color:gray;text-decoration:none;" href="#~{{user.name}}">{{user.name}}</a>
  3. </h2>
  4. <div style="font-size:large;">
  5. Description: {{description}}
  6. </div>
  7. <div>
  8. Priority:
  9. <select name="priority">
  10. <option style="background-color:white;">
  11. (none)
  12. </option>
  13. {{#each priorities}}
  14. <option style="background-color:{{color}};" value="{{id}}">
  15. {{name}}
  16. </option>
  17. {{/each}}
  18. </select>
  19. </div>
  20. <div>
  21. Status:
  22. <select name="status">
  23. <option style="background-color:white;">
  24. (none)
  25. </option>
  26. {{#each statuses}}
  27. <option value="{{id}}">
  28. {{name}}
  29. </option>
  30. {{/each}}
  31. </select>
  32. </div>
  33. <span style="font-size:small;">
  34. Comments
  35. </span>
  36. <ul>
  37. {{#each comments}}
  38. <li>
  39. <a style="font-size:small;color:gray;text-decoration:none;" href="#~{{name}}">
  40. {{name}}
  41. </a>
  42. <time style="font-size:smaller;" class="timeago">
  43. {{timestamp}}
  44. </time>
  45. <div>
  46. {{message}}
  47. </div>
  48. </li>
  49. {{/each}}
  50. </ul>
  51. <a class="comment">
  52. {
  53. "text": "comment",
  54. "id": {{id}},
  55. "type": "issue",
  56. "title": "Comment"
  57. }
  58. </a>
  59. <script>
  60. (function(){
  61. var status = false,
  62. priority = false;
  63. $('select[name=status]').change(function(){
  64. var t = $(this);
  65. if(status != t.val()){
  66. apiCall({
  67. type: 'action',
  68. id: 'issue',
  69. action: 'status',
  70. status: t.val(),
  71. issue: {{id}}
  72. },function(d){
  73. if(!d.error){
  74. status = t.val();
  75. }else{
  76. alert(d.error);
  77. }
  78. });
  79. }
  80. }).children('option').each(function(){
  81. if($(this).text().trim() == '{{status}}'){
  82. $(this).prop('selected',true);
  83. status = $(this).val();
  84. $(this).parent().css(
  85. 'background-color',
  86. this.style.backgroundColor
  87. );
  88. }
  89. });
  90. $('select[name=priority]').change(function(){
  91. var t = $(this);
  92. t.css(
  93. 'background-color',
  94. t.children('option:selected').get(0).style.backgroundColor
  95. );
  96. if(priority != t.val()){
  97. apiCall({
  98. type: 'action',
  99. id: 'issue',
  100. action: 'priority',
  101. priority: t.val(),
  102. issue: {{id}}
  103. },function(d){
  104. if(!d.error){
  105. priority = t.val();
  106. }else{
  107. alert(d.error);
  108. }
  109. });
  110. }
  111. }).children('option').each(function(){
  112. if($(this).text().trim() == '{{priority}}'){
  113. $(this).prop('selected',true);
  114. priority = $(this).val();
  115. $(this).parent().css(
  116. 'background-color',
  117. this.style.backgroundColor
  118. );
  119. }
  120. });
  121. })();
  122. </script>