/src/main/resources/static/my-post-receive-repository-hook.soy

https://bitbucket.org/HeadOnAPlate/slyoldfox_notifier · Closure Template · 122 lines · 105 code · 1 blank · 16 comment · 9 complexity · 72c1c08e953e10fe8a6bab12c278a1d3 MD5 · raw file

  1. {namespace be.foreach.stash.hook.mypostreceiverepositoryhook}
  2. /**
  3. * @param? config
  4. * @param? errors
  5. */
  6. {template .view}
  7. /**
  8. * General settings
  9. */
  10. <h3>General</h3>
  11. {call aui.form.textField}
  12. {param id: 'branchFilter' /}
  13. {param value: $config ? $config['branchFilter'] : null /}
  14. {param labelContent: 'Exclude branches containing' /}
  15. {param descriptionText: 'If a branch contains this text, it is not notified (separated by ; for multiple filters)' /}
  16. {param errorTexts: $errors ? $errors['branchFilter'] : null /}
  17. {/call}
  18. {call aui.form.checkboxField}
  19. {param name: 'notificationTypes' /}
  20. {param legendContent: 'Notification type(s)' /}
  21. {param errorTexts: $errors ? $errors['notificationTypesError'] : null /}
  22. {param isRequired: 'true' /}
  23. {param fields : [
  24. [ 'id': 'mailNotification', 'value': 'true', 'labelText': 'Mail', 'isChecked': $config['mailToAddress'] or ($errors and $errors['mailToAddress'])],
  25. [ 'id': 'slackNotification', 'value': 'true', 'labelText': 'Slack', 'isChecked': $config['slackWebHookUrl'] or ($errors and $errors['slackWebHookUrl'])]
  26. ] /}
  27. {/call}
  28. /**
  29. * Mail settings
  30. */
  31. <div id="mailSection" class="hidden">
  32. <h3>Mail</h3>
  33. {call aui.form.textField}
  34. {param id: 'mailToAddress' /}
  35. {param value: $config ? $config['mailToAddress'] : null /}
  36. {param labelContent: 'Mail to' /}
  37. {param descriptionText: 'Whom to send emails to (separated by ; for multiple addresses)' /}
  38. {param errorTexts: $errors ? $errors['mailToAddress'] : null /}
  39. {param isRequired: 'true' /}
  40. {/call}
  41. {call aui.form.radioField}
  42. {param name: 'mailOverrideFrom' /}
  43. {param legendContent : 'Override "From"?' /}
  44. {param fields : [
  45. [ 'id': 'override-from-yes', 'value': 'true', 'labelText': 'Yes', 'isChecked': $config['mailOverrideFrom'] == 'true' ],
  46. [ 'id': 'override-from-nok', 'value': 'false', 'labelText': 'No', 'isChecked': $config['mailOverrideFrom'] != 'true' ]
  47. ] /}
  48. {/call}
  49. {call aui.form.textareaField}
  50. {param id: 'mailFromTemplate' /}
  51. {param value: $config ? $config['mailFromTemplate'] : null /}
  52. {param labelContent}
  53. <a href="https://bitbucket.org/slyoldfox/notifier/src/b160edc865961baed7861b1b7dc5b1bfe1587fb5/src/main/resources/templates/notifyemailfrom.vm" target="_blank">Example</a>
  54. {/param}
  55. {param descriptionText: 'The velocity template that generates the "From"' /}
  56. {param errorTexts: $errors ? $errors['mailFromTemplate'] : null /}
  57. {/call}
  58. {call aui.form.radioField}
  59. {param name: 'mailOverrideSubject' /}
  60. {param legendContent : 'Override "Subject"?' /}
  61. {param fields : [
  62. [ 'id': 'override-subject-yes', 'value': 'true', 'labelText': 'Yes', 'isChecked': $config['mailOverrideSubject'] == 'true' ],
  63. [ 'id': 'override-subject-nok', 'value': 'false', 'labelText': 'No', 'isChecked': $config['mailOverrideSubject'] != 'true' ]
  64. ] /}
  65. {/call}
  66. {call aui.form.textareaField}
  67. {param id: 'mailSubjectTemplate' /}
  68. {param value: $config ? $config['mailSubjectTemplate'] : null /}
  69. {param labelContent}
  70. <a href="https://bitbucket.org/slyoldfox/notifier/src/b160edc865961baed7861b1b7dc5b1bfe1587fb5/src/main/resources/templates/notifyemailsubject.vm" target="_blank">Example</a>
  71. {/param}
  72. {param descriptionText: 'The velocity template that generates the "Subject"' /}
  73. {param errorTexts: $errors ? $errors['mailSubjectTemplate'] : null /}
  74. {/call}
  75. {call aui.form.radioField}
  76. {param name: 'mailOverrideBody' /}
  77. {param legendContent : 'Override "Body"?' /}
  78. {param fields : [
  79. [ 'id': 'override-body-yes', 'value': 'true', 'labelText': 'Yes', 'isChecked': $config['mailOverrideBody'] == 'true' ],
  80. [ 'id': 'override-body-nok', 'value': 'false', 'labelText': 'No', 'isChecked': $config['mailOverrideBody'] != 'true' ]
  81. ] /}
  82. {/call}
  83. {call aui.form.textareaField}
  84. {param id: 'mailBodyTemplate' /}
  85. {param value: $config ? $config['mailBodyTemplate'] : null /}
  86. {param labelContent}
  87. <a href="https://bitbucket.org/slyoldfox/notifier/src/b160edc865961baed7861b1b7dc5b1bfe1587fb5/src/main/resources/templates/notifyemail.vm" target="_blank">Example</a>
  88. {/param}
  89. {param descriptionText: 'The velocity template that generates the mail body' /}
  90. {param errorTexts: $errors ? $errors['mailBodyTemplate'] : null /}
  91. {/call}
  92. </div>
  93. /**
  94. * Slack settings
  95. */
  96. <div id="slackSection" class="hidden">
  97. <h3>Slack settings</h3>
  98. {call aui.form.textField}
  99. {param id: 'slackWebHookUrl' /}
  100. {param value: $config ? $config['slackWebHookUrl'] : null /}
  101. {param labelContent: 'Slack Webhook URL' /}
  102. {param descriptionText: 'The Slack web hook Integration URL' /}
  103. {param errorTexts: $errors ? $errors['slackWebHookUrl'] : null /}
  104. {param isRequired: 'true' /}
  105. {/call}
  106. {call aui.form.textField}
  107. {param id: 'slackChannels' /}
  108. {param value: $config ? $config['slackChannels'] : null /}
  109. {param labelContent: 'Slack channels' /}
  110. {param descriptionText: 'Which channels or people to direct message on Slack (separated by ; for multiple #channels/@users)' /}
  111. {param errorTexts: $errors ? $errors['slackChannels'] : null /}
  112. {param isRequired: 'true' /}
  113. {/call}
  114. </div>
  115. /**
  116. * Other
  117. */
  118. <script type="text/javascript">
  119. require('notifier/notifier').onReady();
  120. </script>
  121. {/template}