소스 검색

bugfix units/tags filter not working

Daniel Sheffield 1 년 전
부모
커밋
4076f6a8cc
3개의 변경된 파일11개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 2
      app/rest/include-exclude.tpl
  2. 2 2
      app/rest/pyapi.py
  3. 7 1
      app/rest/select.tpl

+ 2 - 2
app/rest/include-exclude.tpl

@@ -5,10 +5,10 @@
       <h3>{{name.title()}}</h3>
     </div>
   </div>
-  <% include('app/rest/select', id=f"{name}-include", name=name, options=_include["options"], hint="Include") %>
+  <% include('app/rest/select', id=f"{name}-include", name=name, options=_include["options"], hint="Include", multiple=True) %>
   <%
   if defined("_exclude"):
-    include('app/rest/select', id=f"{name}-exclude", name=name, options=_exclude["options"], hint="Exclude")
+    include('app/rest/select', id=f"{name}-exclude", name=name, options=_exclude["options"], hint="Exclude", multiple=True)
   end
   %>
 </div>

+ 2 - 2
app/rest/pyapi.py

@@ -160,7 +160,7 @@ def get_form(action, method, filter_data, data):
             } for k in keys
         },
         tags={
-            "name": "tags",
+            "name": "tag",
             "_include": {
                 "options": sorted(map(lambda x: {
                     "selected": x[0],
@@ -172,7 +172,7 @@ def get_form(action, method, filter_data, data):
             }
         },
         units={
-            "name": "units",
+            "name": "unit",
             "options": sorted(map(lambda x: {
                 "selected": x[0],
                 "value": x[1],

+ 7 - 1
app/rest/select.tpl

@@ -4,7 +4,13 @@
     include('app/rest/label', id=id, label=label)
   end
 %>
-<select id="{{id}}" name="{{name}}" size=10 multiple  style="width: 98%; margin: 1em">
+<select
+  id="{{id}}"
+  name="{{name}}"
+  size=10
+  {{"multiple" if defined("multiple") and multiple else ""}}
+  style="width: 98%; margin: 1em"
+  >
   <%
     if defined("hint"):
       include('app/rest/option', value=hint, disabled=True)