Sotaro KARASAWA 10 лет назад
Родитель
Сommit
0419746f2e
2 измененных файлов с 15 добавлено и 1 удалено
  1. 8 0
      lib/util/swigFunctions.js
  2. 7 1
      lib/views/_form.html

+ 8 - 0
lib/util/swigFunctions.js

@@ -15,6 +15,14 @@ module.exports = function(crowi, app, locals) {
     return config.crowi['google:clientId'] && config.crowi['google:clientSecret'];
   };
 
+  locals.slackConfigured = function() {
+    var config = crowi.getConfig()
+    if (Config.hasSlackToken(config)) {
+      return true;
+    }
+    return false;
+  };
+
   locals.isUploadable = function() {
     var config = crowi.getConfig()
     return Config.isUploadable(config);

+ 7 - 1
lib/views/_form.html

@@ -21,6 +21,7 @@
       </button>#}
 
       <div class="pull-right form-inline page-form-setting">
+        {% if slackConfigured() %}
         <span class="input-group extended-setting">
           <span class="input-group-addon">
             <label>
@@ -29,9 +30,14 @@
             </label>
           </span>
           <input class="form-control" type="text" name="pageForm[notify][slack][channel]" value="{{ page.extented.slack|default('') }}" placeholder="slack-channel-name"
-            data-toggle="popover" title="Popover title" data-content="カンマ区切りで複数チャンネルに通知することができます。チャンネル名は保存され、次回以降デフォルトでチェックは外れた状態になっています。通知するにはチェックを入れてください。" data-trigger="focus" data-placement="top"
+            data-toggle="popover"
+            title="Slack通知"
+            data-content="通知するにはチェックを入れてください。カンマ区切りで複数チャンネルに通知することができます。"
+            data-trigger="focus"
+            data-placement="top"
           >
         </span>
+        {% endif %}
 
         {% if forceGrant %}
         <input type="hidden" name="pageForm[grant]" value="{{ forceGrant }}">