| {% macro render_field(field, after="") %} |
| <div class="row"> |
| {{ field.label }}{{ field(**kwargs)|safe }} |
| {% if after %} {{ after }}{% endif %} |
| {% if field.errors %} |
| <ul class="errors"> |
| {% for error in field.errors %} |
| <li>{{ error }}</li> |
| {% endfor %} |
| </ul> |
| {% endif %} |
| </div> |
| {% endmacro %} |
| |
| {% macro render_bootstrap_field(field, field_description="", formclass="") %} |
| <fieldset class="form-group {% if field.errors %}has-error{% endif %} {% if formclass %}issue-metadata-form{% endif %}"> |
| {% set formclasses = "form-control"%} |
| {% if field.errors %} {% set formclasses = formclasses + " form-control-error" %} {% endif %} |
| {% if field.type == "SelectField" %} {% set formclasses = formclasses + " c-select" %} {% endif %} |
| |
| {% if field.type == 'BooleanField' %} |
| {% set formclasses = formclasses + " checkbox-inline" %} |
| <label class="c-input c-checkbox"> |
| {{ field(type='checkbox', **kwargs) }} |
| <span class="c-indicator"></span> |
| <strong>{{ field.label }}</strong> |
| </label> |
| <br /> |
| {% if field_description %} |
| <small class="text-muted">{{ field_description }}</small> |
| {% endif %} |
| {% else %} |
| <strong>{{ field.label }}</strong> |
| {{ field(class_=formclasses)|safe }} |
| <div> |
| {% if field_description %} |
| <small class="text-muted">{{field_description}}</small> |
| {% endif %} |
| {% if field.errors %} |
| <span class="pull-xs-right text-danger"> |
| <small> |
| {% for error in field.errors %} |
| {{ error }} |
| {% endfor %} |
| </small> |
| </span> |
| {% endif %} |
| </div> |
| {% endif %} |
| </fieldset> |
| {% endmacro %} |
| |
| (class_="c-select") |
| |
| {% macro render_field_invert(field, after="") %} |
| <div class="row"> |
| {{ field(**kwargs)|safe }}{{ field.label }} |
| {% if after %} {{ after }}{% endif %} |
| {% if field.errors %} |
| <ul class="errors"> |
| {% for error in field.errors %} |
| <li>{{ error }}</li> |
| {% endfor %} |
| </ul> |
| {% endif %} |
| </div> |
| {% endmacro %} |
| |
| {% macro render_field_in_row(field, after="") %} |
| <tr> |
| <td style="padding-right:2em">{{ field.label }}</td> |
| <td>{{ field(class="form-control")|safe }}</td> |
| {% if after %} <td>{{ after }}</td>{% endif %} |
| {% if field.errors %} |
| {% for error in field.errors %} |
| <td class="errors">{{ error }}</td> |
| {% endfor %} |
| {% endif %} |
| </tr> |
| {% endmacro %} |
| |
| {% macro render_field_in_cell(field, after="") %} |
| <td>{{ field.label }}</td> |
| <td>{{ field(**kwargs)|safe }}</td> |
| {% if after %} <td>{{ after }}</td>{% endif %} |
| {% if field.errors %} |
| {% for error in field.errors %} |
| <td class="errors">{{ error }}</td> |
| {% endfor %} |
| {% endif %} |
| {% endmacro %} |
| |
| |
| {% macro render_field_in_list(field) %} |
| <li>{{ field.label }}</li> |
| <li>{{ field(**kwargs)|safe }}</li> |
| {% if field.errors %} |
| {% for error in field.errors %} |
| <li class="errors">{{ error }}</li> |
| {% endfor %} |
| {% endif %} |
| {% endmacro %} |
| |
| |
| {% macro show_comment(comment, id, repo, username, issueid, form) %} |
| <div class="card mb-3 clearfix"> |
| <div id="comment-{{ id }}" class="card-header"> |
| {{ comment.user.default_email | avatar(16) | safe }} |
| <a href="{{ url_for('ui_ns.view_user', username=comment.user.user)}}" |
| title="{{ comment.user.html_title }}"> |
| {{ comment.user.user }} |
| </a> |
| <a class="headerlink float-right" title="Permalink to this headline" |
| href="#comment-{{ id }}"> |
| <span title="{{ |
| comment.date_created | format_datetime |
| }}">{{ comment.date_created | humanize}}</span> |
| </a> |
| </div> |
| <div class="card-body"> |
| <section class="issue_comment"> |
| <div> |
| <span class="edit_date" title="{{ |
| comment.edited_on | format_datetime if comment.edited_on |
| }}"> |
| </span> |
| <span class="comment_text comment_body"> |
| {%- if id == 0 -%} |
| {{ comment.content | markdown | noJS | safe }} |
| {%- else -%} |
| {{ comment.comment | markdown | noJS | safe }} |
| {%- endif -%} |
| </span> |
| </div> |
| </section> |
| <div class="issue_actions mt-2"> |
| {% if comment.edited_on %} |
| <small class="text-muted">Edited {{ comment.edited_on | humanize }} by {{ comment.editor.username }} </small> |
| {% endif %} |
| <div class="issue_action icon float-right pb-1"> |
| <div class="btn-group" role="group" aria-label="Basic example"> |
| {% if id != 0 and g.fas_user %} |
| <a class="reply btn btn-outline-secondary btn-sm" data-toggle="tooltip" |
| title="Reply to this comment - lose formatting"> |
| <span class="fa fa-share-square-o text-muted" title="Reply to this comment"></span> |
| </a> |
| {% endif %} |
| {% if id != 0 and g.fas_user and (g.repo_committer or ( |
| comment.parent.status in [True, 'Open'] |
| and g.fas_user.username == comment.user.username)) %} |
| <a class="btn btn-outline-secondary btn-sm edit_btn" href="{{ |
| '%s/comment/%s/edit' % (request.base_url, comment.id) }}" |
| data-comment="{{ comment.id }}" data-objid="{{ issueid }}"> |
| <i class="fa fa-pencil" title="Edit comment"></i> |
| </a> |
| {% endif %} |
| {% if id != 0 and g.fas_user and (g.repo_committer or ( |
| comment.parent.status in [True, 'Open'] |
| and g.fas_user.username == comment.user.username)) %} |
| <button class="btn btn-outline-secondary btn-sm" type="submit" |
| name="drop_comment" value="{{ comment.id }}" |
| onclick="return confirm('Do you really want to remove this comment?');" |
| title="Remove comment"> |
| <i class="fa fa-trash"></i> |
| </button> |
| {% endif %} |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| {% endmacro %} |
| |
| |
| {% macro show_initial_comment(comment, username, repo, issueid, form) %} |
| <div class="clearfix p-b-3"> |
| <section class="issue_comment" id="comment-0"> |
| <div class="comment_body"> |
| {{ comment.content | markdown | noJS | safe }} |
| </div> |
| </section> |
| <div class="issue_action icon pull-xs-right"> |
| <div class="btn-group" role="group"> |
| {% if g.fas_user %} |
| <a class="btn btn-outline-secondary btn-sm reply" |
| title="Reply to the initial comment - lose formatting"> |
| <i class="fa fa-share-square-o"></i> |
| </a> |
| {% endif %} |
| {% if g.repo_committer or ( |
| g.fas_user and g.fas_user.username == comment.user.username) %} |
| <a class="btn btn-primary btn-sm" href="{{ |
| url_for('ui_ns.edit_issue', |
| repo=repo.name, |
| username=username, |
| namespace=repo.namespace, |
| issueid=issueid) |
| }}" title="Edit this issue"> |
| <i class="fa fa-pencil"></i></a> |
| {% endif %} |
| {% if g.repo_committer %} |
| <button class="btn btn-danger btn-sm" type="submit" id="closeticket" |
| title="Delete this ticket"> |
| <i class="fa fa-trash"></i> |
| </button> |
| {% endif %} |
| </div> |
| </div> |
| </div> |
| {% endmacro %} |
| |
| {% macro show_attachments(attachments) %} |
| <div class="card clearfix"> |
| <div id="attachments" class="card-header"> |
| <b>Attachments</b> |
| </div> |
| |
| <div class="card-block"> |
| <section class="issue_comment"> |
| <div> |
| <span class="comment_text comment_body attachment_list"> |
| {% for attachment in attachments %} |
| {# |
| attachment[0] = link |
| attachment[1] = file name |
| attachment[2] = display name |
| attachment[3] = date |
| attachment[4] = comment id |
| #} |
| <span> |
| <a href="{{ attachment[0] }}">{{ attachment[2] }}</a> - <small><i>{{ attachment[3] }} |
| {% if attachment[4] is not none %} |
| <a href="#comment-{{ attachment[4] }}">Comment</a></i> |
| {% else %} |
| From Issue description</i> |
| {% endif %} |
| <a href="{{ attachment[0] }}?raw=1" download="{{ attachment[1] }}" |
| style="float: right;background-color:slategray" class="label label-default">Download</a> |
| <br> |
| </small> |
| </span> |
| {% endfor %} |
| </span> |
| </div> |
| </section> |
| </div> |
| </div> |
| {% endmacro %} |