{% from "_helpers.html" import render_field, render_form_errors %} {# This file contains forms for the "New Build" action General Form Helpers: (contain everything except build source) - copr_build_form_begin - copr_build_form_end Specific Forms: (contain only build source) - copr_build_form_url - copr_build_form_upload One Button Forms: - copr_build_repeat_form - copr_build_cancel_form - copr_build_delete_form How to create a Specific Form: 1. include copr_build_form_begin 2. render all the fields that specify the build source 3. include copr_build_form_end #} {##### GENERAL FORM HELPERS #####} {% macro copr_build_form_begin(form, view, copr, build=None) %} {{ render_form_errors(form, [form._mock_chroots_error]) }} {% if not build %}
{% else %} {% endif %}
{% for group_set, chs in form.chroots_sets.items() %}{% for ch in chs %}
{% endfor %}{% endfor %}
{% endmacro %} {% macro copr_build_form_end(form, view, copr) %} {{ form.csrf_token }} {% if g.user.proven %} {{ render_field(form.memory_reqs) }} {{ render_field(form.timeout) }} {% else %} {# once we pass the hidden attribute, the field will just be hidden, it seems #} {{ render_field(form.memory_reqs, hidden = True) }} {{ render_field(form.timeout, hidden = True) }} {% endif %}
{{ form.enable_net(checked=copr.build_enable_net) }} Enable internet access during this build

You agree to build only allowed content in Copr. Check if your license is allowed.

{% endmacro %} {##### SPECIFIC FORMS #####} {% macro copr_build_form_url(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }} {{ render_field(form.pkgs, label='URLs of packages to build', rows = 10, cols = 50) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_upload(form, view, copr) %} {{ copr_build_form_begin(form, view, copr) }}
{{ form.pkgs }}
{{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_form_rebuild(form, view, copr, build) %} {{ copr_build_form_begin(form, view, copr, build) }} {{ copr_build_form_end(form, view, copr) }} {% endmacro %} {% macro copr_build_cancel_form(build, page) %} {% if build.cancelable %}
{% endif %} {% endmacro %} {% macro copr_build_repeat_form(build, page) %} {% if build.repeatable %}
{% endif %} {% endmacro %} {% macro copr_build_delete_form(build, page) %} {% if build.deletable %}
{% endif %} {% endmacro %}