Procházet zdrojové kódy

Fix warning and notice and hide skill tag filter if there is no tags configured

José Loguercio před 8 roky
rodič
revize
8853e37c49
2 změnil soubory, kde provedl 21 přidání a 15 odebrání
  1. 5 2
      main/admin/skill_list.php
  2. 16 13
      main/template/default/skill/list.tpl

+ 5 - 2
main/admin/skill_list.php

@@ -150,8 +150,11 @@ switch ($action) {
         $extraField = new ExtraField('skill');
         $arrayVals = $extraField->get_handler_field_info_by_tags('tags');
         $tags = [];
-        foreach ($arrayVals['options'] as $value) {
-            $tags[] = $value;
+
+        if (isset($arrayVals['options'])) {
+            foreach ($arrayVals['options'] as $value) {
+                $tags[] = $value;
+            }
         }
 
         /* View */

+ 16 - 13
main/template/default/skill/list.tpl

@@ -1,20 +1,23 @@
 <legend>
     <h1>{{ "ManageSkills" | get_lang }}</h1>
 </legend>
-<div class="row">
-    <div class="col-md-3" >
-        <select id="tag-filter" class="form-control">
-            <option value="0">{{ 'PleaseSelectAChoice' | get_lang }}</option>
-            {% for tag in tags %}
-                <option value="{{ tag.id }}">{{ tag.tag }}</option>
-            {% endfor %}
-        </select>
-    </div>
-    <div class="col-md-3">
-        <a id="filter-button" class="btn btn-default">{{ 'FilterByTags' | get_lang }}</a>
+
+{% if tags %}
+    <div class="row">
+        <div class="col-md-3" >
+            <select id="tag-filter" class="form-control">
+                <option value="0">{{ 'PleaseSelectAChoice' | get_lang }}</option>
+                {% for tag in tags %}
+                    <option value="{{ tag.id }}">{{ tag.tag }}</option>
+                {% endfor %}
+            </select>
+        </div>
+        <div class="col-md-3">
+            <a id="filter-button" class="btn btn-default">{{ 'FilterByTags' | get_lang }}</a>
+        </div>
     </div>
-</div>
-<br />
+    <br />
+{% endif %}
 <div class="table table-responsive">
     <table class="table table-hover table-striped">
         <thead>