global-notification-detail.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. {% extends '../layout/admin.html' %}
  2. {% block html_title %}{{ customTitle(t('Notification settings')) }}{% endblock %}
  3. {% block content_header %}
  4. <div class="header-wrap">
  5. <header id="page-header">
  6. <h1 class="title" id="">{{ t('Notification settings') }}</h1>
  7. </header>
  8. </div>
  9. {% endblock %}
  10. {% block content_main %}
  11. <div class="content-main">
  12. {% set smessage = req.flash('successMessage') %}
  13. {% if smessage.length %}
  14. <div class="alert alert-success">
  15. {{ smessage }}
  16. </div>
  17. {% endif %}
  18. {% set emessage = req.flash('errorMessage') %}
  19. {% if emessage.length %}
  20. <div class="alert alert-danger">
  21. {{ emessage }}
  22. </div>
  23. {% endif %}
  24. <div class="row">
  25. <div class="col-md-3">
  26. {% include './widget/menu.html' with {current: 'notification'} %}
  27. </div>
  28. <div class="col-md-9">
  29. <a href="/admin/notification#global-notification" class="btn btn-default">
  30. <i class="icon-fw ti-arrow-left" aria-hidden="true"></i>
  31. {{ t('notification_setting.back_to_list') }}
  32. </a>
  33. {% if setting %}
  34. {% set actionPath = '/admin/global-notification/' + setting.id + '/update' %}
  35. {% else %}
  36. {% set actionPath = '/admin/global-notification/new' %}
  37. {% endif %}
  38. <div class="row">
  39. <div class="m-t-20 form-box col-md-12">
  40. <legend>{{ t('notification_setting.notification_detail') }}</legend>
  41. <form action="{{ actionPath }}" method="post" class="form-horizontal" role="form">
  42. <fieldset class="col-sm-4">
  43. <div class="form-group">
  44. <h3 for="triggerPath">{{ t('notification_setting.trigger_path') }} <small>{{ t('notification_setting.trigger_path_help', '<code>*</code>') }}</small></h3>
  45. <input class="form-control" type="text" name="notificationGlobal[triggerPath]" value="{{ setting.triggerPath || '' }}" required>
  46. </div>
  47. <div class="form-group form-inline">
  48. <h3>{{ t('notification_setting.notify_to') }}</h3>
  49. <div class="radio radio-primary">
  50. <input type="radio" id="mail" name="notificationGlobal[notifyToType]" value="mail" {% if setting.__t == 'mail' %}checked{% endif %} checked>
  51. <label for="mail">
  52. <p class="font-weight-bold">Email</p>
  53. </label>
  54. </div>
  55. <div class="radio radio-primary">
  56. <input type="radio" id="slack" name="notificationGlobal[notifyToType]" value="slack" {% if setting.__t == 'slack' %}checked{% endif %} disabled>
  57. <label for="slack">
  58. <p class="font-weight-bold">Slack</p>
  59. </label>
  60. </div>
  61. </div>
  62. <!-- <div class="form-group notify-to-option {% if setting.__t != 'mail' %}d-none{% endif %}" id="mail-input"> -->
  63. <div class="form-group notify-to-option" id="mail-input">
  64. <input class="form-control" type="text" name="notificationGlobal[toEmail]" value="{{ setting.toEmail || '' }}">
  65. <p class="help">
  66. <b>Hint: </b>
  67. <a href="https://ifttt.com/create" target="_blank">{{ t('notification_setting.email.ifttt_link') }} <i class="icon-share-alt"></i></a>
  68. </p>
  69. </div>
  70. <div class="form-group notify-to-option {% if setting.__t != 'slack' %}d-none{% endif %}" id="slack-input">
  71. <input class="form-control" type="text" name="notificationGlobal[slackChannels]" value="{{ setting.slackChannels || '' }}" disabled>
  72. </div>
  73. </fieldset>
  74. <fieldset class="col-sm-offset-1 col-sm-5">
  75. <div class="form-group">
  76. <h3>{{ t('notification_setting.trigger_events') }}</h3>
  77. <div class="checkbox checkbox-inverse">
  78. <input type="checkbox" id="trigger-event-pageCreate" name="notificationGlobal[triggerEvent:pageCreate]" value="pageCreate"
  79. {% if setting && (setting.triggerEvents.indexOf('pageCreate') != -1) %}checked{% endif %} />
  80. <label for="trigger-event-pageCreate">
  81. <span class="label label-success"><i class="icon-doc"></i> CREATE</span> - {{ t('notification_setting.event_pageCreate') }}
  82. </label>
  83. </div>
  84. <div class="checkbox checkbox-inverse">
  85. <input type="checkbox" id="trigger-event-pageEdit" name="notificationGlobal[triggerEvent:pageEdit]" value="pageEdit"
  86. {% if setting && (setting.triggerEvents.indexOf('pageEdit') != -1) %}checked{% endif %} />
  87. <label for="trigger-event-pageEdit">
  88. <span class="label label-warning"><i class="icon-pencil"></i> EDIT</span> - {{ t('notification_setting.event_pageEdit') }}
  89. </label>
  90. </div>
  91. <div class="checkbox checkbox-inverse">
  92. <input type="checkbox" id="trigger-event-pageMove" name="notificationGlobal[triggerEvent:pageMove]" value="pageMove"
  93. {% if setting && (setting.triggerEvents.indexOf('pageMove') != -1) %}checked{% endif %} />
  94. <label for="trigger-event-pageMove">
  95. <span class="label label-warning"><i class="icon-action-redo"></i> MOVE</span> - {{ t('notification_setting.event_pageMove') }}
  96. </label>
  97. </div>
  98. <div class="checkbox checkbox-inverse">
  99. <input type="checkbox" id="trigger-event-pageDelete" name="notificationGlobal[triggerEvent:pageDelete]" value="pageDelete"
  100. {% if setting && (setting.triggerEvents.indexOf('pageDelete') != -1) %}checked{% endif %} />
  101. <label for="trigger-event-pageDelete">
  102. <span class="label label-danger"><i class="icon-fire"></i> DELETE</span> - {{ t('notification_setting.event_pageDelete') }}
  103. </label>
  104. </div>
  105. <div class="checkbox checkbox-inverse">
  106. <input type="checkbox" id="trigger-event-pageLike" name="notificationGlobal[triggerEvent:pageLike]" value="pageLike"
  107. {% if setting && (setting.triggerEvents.indexOf('pageLike') != -1) %}checked{% endif %} />
  108. <label for="trigger-event-pageLike">
  109. <span class="label label-info"><i class="icon-like"></i> LIKE</span> - {{ t('notification_setting.event_pageLike') }}
  110. </label>
  111. </div>
  112. <div class="checkbox checkbox-inverse">
  113. <input type="checkbox" id="trigger-event-comment" name="notificationGlobal[triggerEvent:comment]" value="comment"
  114. {% if setting && (setting.triggerEvents.indexOf('comment') != -1) %}checked{% endif %} />
  115. <label for="trigger-event-comment">
  116. <span class="label label-default"><i class="icon-fw icon-bubble"></i> POST</span> - {{ t('notification_setting.event_comment') }}
  117. </label>
  118. </div>
  119. </div>
  120. </fieldset>
  121. <div class="col-sm-offset-5 col-sm-12 m-t-20">
  122. <input type="hidden" name="notificationGlobal[id]" value="{{ setting.id }}">
  123. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  124. <button type="submit" class="btn btn-primary">
  125. {% if setting %}
  126. {{ t('Update') }}
  127. {% else %}
  128. {{ t('Create') }}
  129. {% endif %}
  130. </button>
  131. </div>
  132. </form>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <script>
  139. $('input[name="notificationGlobal[notifyToType]"]').change(function() {
  140. var val = $(this).val();
  141. $('.notify-to-option').addClass('d-none');
  142. $('#' + val + '-input').removeClass('d-none');
  143. });
  144. $('button#global-notificatin-delete').submit(function() {
  145. alert(123)
  146. });
  147. </script>
  148. {% endblock content_main %}
  149. {% block content_footer %}
  150. {% endblock content_footer %}