Просмотр исходного кода

ensure to show full text search admin menu even if ELASTICSEARCH_URI is not set

Yuki Takei 8 лет назад
Родитель
Сommit
43d5ece4a2

+ 0 - 1
lib/locales/en-US/translation.json

@@ -76,7 +76,6 @@
 
   "Table of Contents": "Table of Contents",
 
-  "UserGroup management": "UserGroup management",
   "Public": "Public",
   "Anyone with the link": "Anyone with the link",
   "Specified users only": "Specified users only",

+ 1 - 0
lib/locales/ja/translation.json

@@ -82,6 +82,7 @@
   "Notification settings": "通知設定",
   "User management": "ユーザー管理",
   "UserGroup management": "グループ管理",
+  "Full Text Search management": "全文検索管理",
   "Basic settings": "基本設定",
   "Basic authentication": "Basic認証",
   "Guest users access": "ゲストユーザーのアクセス",

+ 0 - 5
lib/routes/admin.js

@@ -248,11 +248,6 @@ module.exports = function(crowi, app) {
 
   actions.search = {};
   actions.search.index = function(req, res) {
-    var search = crowi.getSearcher();
-    if (!search) {
-      return res.redirect('/admin');
-    }
-
     return res.render('admin/search', {
     });
   };

+ 44 - 39
lib/views/admin/search.html

@@ -1,59 +1,68 @@
 {% extends '../layout/admin.html' %}
 
-{% block html_title %}検索管理 · {{ path }}{% endblock %}
+{% block html_title %}{{ t('Full Text Search management') }} · {{ path }}{% endblock %}
 
 {% block content_header %}
 <div class="header-wrap">
   <header id="page-header">
-    <h1 class="title" id="">検索管理</h1>
+    <h1 class="title" id="">{{ t('Full Text Search management') }}</h1>
   </header>
 </div>
 {% endblock %}
 
 {% block content_main %}
 <div class="content-main">
+
   <div class="row">
     <div class="col-md-3">
       {% include './widget/menu.html' with {current: 'search'} %}
     </div>
     <div class="col-md-9">
 
-      {% set smessage = req.flash('successMessage') %}
-      {% if smessage.length %}
-      <div class="alert alert-success">
-        {% for e in smessage %}
-          {{ e }}<br>
-        {% endfor %}
-      </div>
-      {% endif %}
-
-      {% set emessage = req.flash('errorMessage') %}
-      {% if emessage.length %}
-      <div class="alert alert-danger">
-        {% for e in emessage %}
-        {{ e }}<br>
-        {% endfor %}
-      </div>
-      {% endif %}
-
-      <form action="/admin/search/build" method="post" class="form-horizontal" id="appSettingForm" role="form">
-      <fieldset>
-        <legend>Index Build</legend>
-        <div class="form-group">
-          <label for="" class="col-xs-3 control-label">Index Build</label>
-          <div class="col-xs-6">
-            <button type="submit" class="btn btn-inverse">Build Now</button>
-            <p class="help-block">
-              Force rebuild index.<br>
-              Click "Build Now" to delete and create mapping file and add all pages.<br>
-              This may take a while.
-            </p>
+      {% if !searchConfigured() %}
+        <div class="col-md-12">
+          <div class="alert alert-warning">
+            <strong><i class="icon-fw icon-exclamation"></i> Full Text Search is not configured</strong>
           </div>
+          <p>Check whether the env var <code>ELASTICSEARCH_URI</code> is set.</p>
         </div>
-      </fieldset>
-      <input type="hidden" name="_csrf" value="{{ csrf() }}">
-      </form>
+      {% else %}
+        {% set smessage = req.flash('successMessage') %}
+        {% if smessage.length %}
+        <div class="alert alert-success">
+          {% for e in smessage %}
+            {{ e }}<br>
+          {% endfor %}
+        </div>
+        {% endif %}
 
+        {% set emessage = req.flash('errorMessage') %}
+        {% if emessage.length %}
+        <div class="alert alert-danger">
+          {% for e in emessage %}
+          {{ e }}<br>
+          {% endfor %}
+        </div>
+        {% endif %}
+
+        <form action="/admin/search/build" method="post" class="form-horizontal" id="appSettingForm" role="form">
+          <fieldset>
+            <legend>Index Build</legend>
+            <div class="form-group">
+              <label for="" class="col-xs-3 control-label">Index Build</label>
+              <div class="col-xs-6">
+                <button type="submit" class="btn btn-inverse">Build Now</button>
+                <p class="help-block">
+                  Force rebuild index.<br>
+                  Click "Build Now" to delete and create mapping file and add all pages.<br>
+                  This may take a while.
+                </p>
+              </div>
+            </div>
+          </fieldset>
+          <input type="hidden" name="_csrf" value="{{ csrf() }}">
+        </form>
+      {% endif %}
     </div>
   </div>
 
@@ -62,7 +71,3 @@
 
 {% block content_footer %}
 {% endblock content_footer %}
-
-
-
-

+ 1 - 3
lib/views/admin/widget/menu.html

@@ -10,7 +10,5 @@
   <li class="{% if current == 'notification'%}active{% endif %}"><a href="/admin/notification"><i class="icon-fw icon-bell"></i> {{ t('Notification settings') }}</a></li>
   <li class="{% if current == 'user' || current == 'external-account' %}active{% endif %}"><a href="/admin/users"><i class="icon-fw icon-user"></i> {{ t('User management') }}</a></li>
   <li class="{% if current == 'user-group'%}active{% endif %}"><a href="/admin/user-groups"><i class="icon-fw icon-people"></i> {{ t('UserGroup management') }}</a></li>
-  {% if searchConfigured() %}
-  <li class="{% if current == 'search'%}active{% endif %}"><a href="/admin/search"><i class="icon-fw icon-magnifier"></i> 検索管理</a></li>
-  {% endif %}
+  <li class="{% if current == 'search'%}active{% endif %}"><a href="/admin/search"><i class="icon-fw icon-magnifier"></i> {{ t('Full Text Search management') }}</a></li>
 </ul>