xiaq avatar xiaq committed 6b640b5

split ticket.html into ticket/{base,submit,modify}.html

Comments (0)

Files changed (5)

MoinMoin/items/ticket.py

     itemtype = ITEMTYPE_TICKET
     display_name = L_('Ticket')
     description = L_('Ticket item')
-    modify_template = 'ticket.html'
+    submit_template = 'ticket/submit.html'
+    modify_template = 'ticket/modify.html'
 
     def do_show(self, revid):
         if revid != CURRENT:
         # XXX When creating new item, suppress the "foo doesn't exist. Create it?" dummy content
         data_rendered = None if is_new else Markup(self.content._render_data())
 
-        return render_template(self.modify_template,
+        return render_template(self.submit_template if is_new else self.modify_template,
                                is_new=is_new,
                                closed=closed,
                                item_name=self.name,

MoinMoin/templates/ticket.html

-{% import "forms.html" as forms %}
-{% extends theme("layout.html") %}
-
-{% if is_new %}
-    {% set title = _("Creating new ticket: '%(item_name)s'", item_name=item_name) %}
-{% else %}
-    {% set title = _("Ticket: '%(item_name)s'", item_name=item_name) %}
-{% endif %}
-
-{% block head %}
-    {{ super() }}
-    <link media="all" rel="stylesheet" href="{{ url_for('static', filename='css/ticket.css') }}" />
-{% endblock %}
-
-{% block content %}
-<h1>
-    {{ title }}
-    {% if closed %}
-        {# TODO style .moin-ticket-closed #}
-        <span class="moin-ticket-closed">{{ _("(Closed)") }}</span>
-    {% endif %}
-</h1>
-<div class="moin-form" id="moin-ticket-form">
-    {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
-
-    {% if data_rendered %}
-        <div id="moin-content-data">
-            {{ data_rendered }}
-        </div>
-    {% endif %}
-
-    {% if is_new %}
-        <h2>Describe the ticket</h2>
-    {% else %}
-        <h2>Add comment</h2>
-    {% endif %}
-    <dl>
-    {{ forms.render(form['message']) }}
-    </dl>
-
-    <h2>Edit metadata</h2>
-    <dl>
-    {{ forms.render_errors(form) }}
-    {% for e in [
-        'summary',
-        'effort',
-        'difficulty',
-        'severity',
-        'priority',
-        'tags',
-        'assigned_to',
-        'superseded_by',
-        'depends_on',
-        ] %}
-        {{ forms.render(form['meta'][e]) }}
-    {% endfor %}
-    </dl>
-
-    {# see comments concerning the submit button within TicketForm in items/ticket.py #}
-    {% if is_new %}
-        {{ forms.render_submit(form) }}
-    {% else %}
-        {{ forms.render(form['submit']) }}
-    {% endif %}
-
-    <h2>Back references</h2>
-    <dl>
-    {% for e in [
-        'supersedes',
-        'required_by',
-        'subscribers',
-        ] %}
-        {{ forms.render(form['backrefs'][e]) }}
-    {% endfor %}
-
-    {{ gen.form.close() }}
-</div>
-{% endblock %}

MoinMoin/templates/ticket/base.html

+{% import "forms.html" as forms %}
+{% extends theme("layout.html") %}
+
+{% macro render_meta() %}
+    {% for e in [
+        'summary',
+        'effort',
+        'difficulty',
+        'severity',
+        'priority',
+        'tags',
+        'assigned_to',
+        'superseded_by',
+        'depends_on',
+        ] %}
+        {{ forms.render(form['meta'][e]) }}
+    {% endfor %}
+{% endmacro %}
+
+{% macro render_backref() %}
+    {% for e in [
+        'supersedes',
+        'required_by',
+        'subscribers',
+        ] %}
+        {{ forms.render(form['backrefs'][e]) }}
+    {% endfor %}
+{% endmacro %}
+
+{% block head %}
+    {{ super() }}
+    <link media="all" rel="stylesheet" href="{{ url_for('static', filename='css/ticket.css') }}" />
+{% endblock %}
+
+{% block content %}
+<h1>
+    {% block title_text %}
+    {% endblock %}
+    {% if closed %}
+        {# TODO style .moin-ticket-closed #}
+        <span class="moin-ticket-closed">{{ _("(Closed)") }}</span>
+    {% endif %}
+</h1>
+<div class="moin-form" id="moin-ticket-form">
+    {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
+
+    {% if data_rendered %}
+        <div id="moin-content-data">
+            {{ data_rendered }}
+        </div>
+    {% endif %}
+
+    {% block form_controls %}
+    {% endblock %}
+
+    {{ gen.form.close() }}
+</div>
+{% endblock %}

MoinMoin/templates/ticket/modify.html

+{% extends "ticket/base.html" %}
+
+{% block title_text %}
+    {{ _("Ticket: '%(item_name)s'", item_name=item_name) }}
+{% endblock %}
+
+{% block form_controls %}
+    <h2>Add comment</h2>
+    <dl>
+    {{ forms.render(form['message']) }}
+    </dl>
+
+    <h2>Edit metadata</h2>
+    <dl>
+    {{ forms.render_errors(form) }}
+    {{ render_meta() }}
+    </dl>
+
+    {{ forms.render(form['submit']) }}
+
+    <h2>Back references</h2>
+    <dl>
+    {{ render_backref() }}
+{% endblock %}

MoinMoin/templates/ticket/submit.html

+{% extends "ticket/base.html" %}
+
+{% block title_text %}
+    {{ _("Creating new ticket: '%(item_name)s'", item_name=item_name) }}
+{% endblock %}
+
+{% block form_controls %}
+    <h2>Describe the ticket</h2>
+
+    <dl>
+    {{ forms.render(form['message']) }}
+    </dl>
+
+    <h2>Provide metadata</h2>
+    <dl>
+    {{ forms.render_errors(form) }}
+    {{ render_meta() }}
+    </dl>
+
+    {{ forms.render_submit(form) }}
+{% endblock %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.