From 063ec08b930ef78949255760c971b100172489c6 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Nov 12 2018 11:22:00 +0000 Subject: Add a Date type to the custom fields This adds a date entry to the pulldown menu in custom fields clicking on it while modifying metadata of issues allows to pick a date. Fixes: https://pagure.io/pagure/issue/3410 Signed-off-by: Karsten Hopp --- diff --git a/pagure/lib/query.py b/pagure/lib/query.py index a35bfc8..a84a3ad 100644 --- a/pagure/lib/query.py +++ b/pagure/lib/query.py @@ -4763,7 +4763,7 @@ def save_report(session, repo, name, url, username): def set_custom_key_fields(session, project, fields, types, data, notify=None): """ Set or update the custom key fields of a project with the values - provided. "data" is currently only used for lists + provided. "data" is currently only used for lists and dates """ current_keys = {} @@ -4771,12 +4771,14 @@ def set_custom_key_fields(session, project, fields, types, data, notify=None): current_keys[key.name] = key for idx, key in enumerate(fields): - if types[idx] != "list": - # Only Lists use data, strip it otherwise - data[idx] = None - else: + if types[idx] == "list": if data[idx]: data[idx] = [item.strip() for item in data[idx].split(",")] + elif types[idx] == "date": + if data[idx]: + data[idx] = data[idx].strip() + else: + data[idx] = None if notify and notify[idx] == "on": notify_flag = True diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 474a75d..688bbd8 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -50,6 +50,7 @@ {% else %}
- +
- +
- +
@@ -738,7 +738,7 @@ value="{{ field.name }}" class="form-control"/>
- @@ -751,11 +751,19 @@ +
- + {% if field.key_type == 'list' %} + + {% else %} + + {% endif %}
+ +