#4180 Fix showing an input box if the minimum score for PR is set to 0
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

@@ -13,7 +13,21 @@ 

      {% elif not config.get('DOC_APP_URL') and key in ['project_documentation'] %}

      {% elif not config.get('WEBHOOK') and key in ['Web-hooks'] %}

      {% else %}

-       {% if repo.settings[key] in [True, False, 'y'] %}

+       {% if key in ['Web-hooks'] %}

+         <div class="form-inline">

+           <label for="{{ key }}">{{ key | replace('_', ' ') | capitalize }} :</label>

+           <textarea width="4em" class="form-control" id="{{ key }}" type="text" {% if repo.settings[key]

+             %}value="{{ repo.settings[key] }}"{% endif %} name="{{ key }}"

+             title="Web-hook URLs, one per line"

+             placeholder="Web-hook URLs, one per line">{{ repo.settings[key] }}</textarea>

+         </div>

+       {% elif key in ['Minimum_score_to_merge_pull-request'] %}

+         <div class="form-inline">

+           <label for="{{ key }}">{{ key | replace('_', ' ') | capitalize }} :</label>

+           <input width="4em" class="form-control" id="{{ key }}" type="text"

+                 value="{{ repo.settings[key] }}" name="{{ key }}" />

+         </div>

+       {% elif repo.settings[key] in [True, False, 'y'] %}

          <div>

            <label class="c-input c-checkbox">

              <input id="{{ key }}" type="checkbox" value="y" name="{{ key }}" {%
@@ -22,14 +36,6 @@ 

              {{ key | replace('_', ' ') | capitalize }}

            </label>

          </div>

-       {% elif key in ['Web-hooks'] %}

-         <div class="form-inline">

-           <label for="{{ key }}">{{ key | replace('_', ' ') | capitalize }} :</label>

-           <textarea width="4em" class="form-control" id="{{ key }}" type="text" {% if repo.settings[key]

-             %}value="{{ repo.settings[key] }}"{% endif %} name="{{ key }}"

-             title="Web-hook URLs, one per line"

-             placeholder="Web-hook URLs, one per line">{{ repo.settings[key] }}</textarea>

-         </div>

        {% else %}

          <div class="form-inline">

            <label for="{{ key }}">{{ key | replace('_', ' ') | capitalize }} :</label>

Up until now this was changed to a checkbox in these situations, now
it remains an input/text field allowing to change it back to something
else.

Fixes https://pagure.io/pagure/issue/4019

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

rebased onto f1011c2

5 years ago

Pull-Request has been merged by pingou

5 years ago