~launchpad-pqm/launchpad/devel

3691.220.8 by James Henstridge
add a page test for the new form layout
1
<div
4939.2.12 by Curtis Hovey
Added namespaces to launchpad form templates and fixed markup.
2
  xmlns="http://www.w3.org/1999/xhtml"
3
  xmlns:tal="http://xml.zope.org/namespaces/tal"
4
  xmlns:metal="http://xml.zope.org/namespaces/metal"
5
  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6
  i18n:domain="launchpad">
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
7
8
  <div metal:define-macro="form">
9
5369.1.1 by Mark Shuttleworth
Add PopCalXP in date and datetime picker configurations
10
    <form action="."
8752.5.2 by Graham Binns
Merged additional dupefinder changes (oh boy, is this going to be fun at merge time).
11
          tal:attributes="action view/action_url;
12
                          id launchpad_form_id|nothing;"
5369.1.1 by Mark Shuttleworth
Add PopCalXP in date and datetime picker configurations
13
          name="launchpadform"
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
14
          method="post"
3691.68.29 by James Henstridge
add accept-charset="UTF-8" to new form base template
15
          enctype="multipart/form-data"
16
          accept-charset="UTF-8">
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
17
18
      <div metal:define-macro="formbody">
10374.2.8 by Edwin Grubbs
Replace renderDeletePackagingAction with a link to the $sourcepackage/+remove-packaging.
19
        <tal:comment condition="nothing">
10513.1.1 by Adi Roiban
Implement a more elegant solution for next_url redirection.
20
          The _return_url, _return_attribute_name and _return_attribute_value
21
          fields are used by the ReturnToReferrerMixin.
10374.2.8 by Edwin Grubbs
Replace renderDeletePackagingAction with a link to the $sourcepackage/+remove-packaging.
22
        </tal:comment>
23
        <input type="hidden"
24
               name="_return_url"
25
               tal:condition="view/_return_url | nothing"
26
               tal:attributes="value view/_return_url" />
10513.1.1 by Adi Roiban
Implement a more elegant solution for next_url redirection.
27
        <input type="hidden"
28
               name="_return_attribute_name"
29
               tal:condition="view/_return_attribute_name | nothing"
30
               tal:attributes="value view/_return_attribute_name" />
31
        <input type="hidden"
32
               name="_return_attribute_value"
33
               tal:condition="view/_return_attribute_value | nothing"
34
               tal:attributes="value view/_return_attribute_value" />
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
35
36
        <p metal:define-slot="extra_info" tal:replace="nothing">
37
          This is the description of the form.
3691.9.91 by Guilherme Salgado
Move distributionmirror-related dbschemas to DBEnumeratedTypes
38
          This text will be in bold, beneath the title of the form,
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
39
          and should give any introductory information required.
40
          Don't use it to state the bleeding obvious!
41
        </p>
42
3691.61.5 by Bjorn Tillenius
make the user confirm when a new bug tag is added.
43
        <p metal:define-slot="error_count" class="error message"
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
44
           tal:condition="view/errors"
45
           tal:content="view/error_count" />
46
3691.61.5 by Bjorn Tillenius
make the user confirm when a new bug tag is added.
47
        <p metal:define-slot="error_messages" class="error message"
3691.68.24 by James Henstridge
add form widget focus code
48
          tal:repeat="form_wide_error view/form_wide_errors"
49
          tal:content="structure form_wide_error">
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
50
          Schema validation errors.
51
        </p>
52
9297.2.9 by Barry Warsaw
Remove the view/label display from the launchpad-form.pt because even non-form
53
        <div class="row"
54
             metal:define-slot="extra_top"
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
55
             tal:replace="nothing">
56
            <div>Extra top</div>
8971.21.1 by Martin Albisetti
Kick off fixing forms in Launchpad
57
            <div><input type="text"/></div>
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
58
        </div>
59
60
        <metal:widgets metal:define-slot="widgets">
3691.220.1 by James Henstridge
new FormLayout, with special casing of TextAreaWidget and CheckBoxWidget
61
          <div metal:use-macro="context/@@launchpad_form/widget_rows" />
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
62
        </metal:widgets>
63
3691.68.24 by James Henstridge
add form widget focus code
64
        <script type="text/javascript"
3691.111.1 by James Henstridge
move "focus first widget with error" behaviour server side
65
                tal:define="script view/focusedElementScript"
66
                tal:condition="script"
67
                tal:content="structure script" />
3691.68.24 by James Henstridge
add form widget focus code
68
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
69
        <div class="row"
9297.2.9 by Barry Warsaw
Remove the view/label display from the launchpad-form.pt because even non-form
70
             metal:define-slot="extra_bottom"
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
71
             tal:replace="nothing">
72
          <div>Extra bottom</div>
8971.21.1 by Martin Albisetti
Kick off fixing forms in Launchpad
73
          <div class="field"><input type="text" /></div>
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
74
        </div>
75
76
      </div>
7915.3.4 by Barry Warsaw
Make all the nice JavaScripty stuff work.
77
      <div class="actions" id="launchpad-form-actions"
78
           metal:define-slot="buttons">
7675.834.50 by Michael Nelson
Changes from jtv's review, and then updated tests to work around person_logged_in issue.
79
        <tal:actions repeat="action view/actions">
80
          <input tal:replace="structure action/render"
81
                 tal:condition="action/available"/>
82
        </tal:actions>
5763.4.16 by Tim Penhey
Updates following review.
83
        <tal:has-cancel-link condition="view/cancel_url">
8868.2.3 by Curtis Hovey
Converted the annoucement and product modification pages to UI 3.0.
84
          <tal:or condition="view/has_available_actions">or&nbsp;</tal:or>
8255.11.4 by Curtis Hovey
Changes per review. Moved the delete productseries rule to the RegistryDeleteMixin. Added support for BeautifulSoup PageElements as content to find_tag_by_id(). Added has_available_actions to LaunchpadFormView and made the 'or' before the cancel link conditional upon it.
85
          <a tal:attributes="href view/cancel_url">Cancel</a>
5763.4.16 by Tim Penhey
Updates following review.
86
        </tal:has-cancel-link>
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
87
      </div>
88
9297.2.9 by Barry Warsaw
Remove the view/label display from the launchpad-form.pt because even non-form
89
      <div class="row"
90
           metal:define-slot="extra_buttons"
3691.68.3 by James Henstridge
convert securitycontact edit form to LaunchpadFormView, and make LaunchpadFormView actually work
91
           tal:replace="nothing">
92
      </div>
93
94
    </form>
95
  </div>
96
14521.1.3 by Gavin Panella
Put the new widget_row stuff into launchpad-form.pt.
97
  <metal:macro define-macro="widget_single_line">
98
    <div tal:attributes="class widget_class">
99
      <tal:label condition="display_label|widget/display_label|python:True">
100
        <label tal:attributes="for widget/name"
101
               tal:content="string:${widget/label}:">Label</label>
102
        <span tal:condition="show_optional"
103
              class="fieldRequired">(Optional)</span>
104
      </tal:label>
105
      <div>
106
        <input tal:replace="structure widget" />
107
        <tal:help-link condition="widget_help_link">
108
          <a tal:attributes="href widget_help_link"
109
             target="help" class="sprite maybe">
110
            &nbsp;<span class="invisible-link">(?)</span>
111
          </a>
112
        </tal:help-link>
113
      </div>
114
      <div class="message" tal:condition="error"
115
           tal:content="structure error">Error message</div>
116
      <metal:help-hint use-macro="widget/@@launchpad_form/help_hint" />
117
    </div>
118
  </metal:macro>
119
120
  <metal:macro define-macro="widget_multi_line">
121
    <div tal:attributes="class widget_class">
122
      <tal:label condition="display_label|widget/display_label|python:True">
123
        <label
124
            tal:attributes="for widget/name"
125
            tal:content="string:${widget/label}:">Label:</label>
126
        <span tal:condition="show_optional"
127
              class="fieldRequired">(Optional)</span>
128
      </tal:label>
129
      <tal:help-link condition="widget_help_link">
130
        <a tal:attributes="href widget_help_link"
131
           target="help" class="sprite maybe">
132
          &nbsp;<span class="invisible-link">(?)</span>
133
        </a>
134
      </tal:help-link>
135
      <div tal:condition="error" tal:content="structure error"
136
           class="message">Error message</div>
137
      <div tal:content="structure widget">
138
        <input type="text" />
139
      </div>
140
      <metal:help-hint use-macro="widget/@@launchpad_form/help_hint" />
141
    </div>
142
  </metal:macro>
143
144
  <metal:macro define-macro="widget_checkbox">
145
    <div tal:attributes="class widget_class">
146
      <input type="checkbox" tal:replace="structure widget" />
147
      <label tal:attributes="for widget/name"
148
             tal:content="widget/label">Label</label>
149
      <tal:help-link condition="widget_help_link">
150
        <a tal:attributes="href widget_help_link"
151
           target="help" class="sprite maybe">
152
          &nbsp;<span class="invisible-link">(?)</span>
153
        </a>
154
      </tal:help-link>
155
      <div tal:condition="error" tal:content="structure error"
156
           class="message">Error message</div>
157
      <metal:help-hint use-macro="widget/@@launchpad_form/help_hint" />
158
    </div>
159
  </metal:macro>
160
161
  <metal:macro define-macro="widget_hidden">
162
    <div tal:replace="structure widget/hidden" />
163
  </metal:macro>
164
3691.220.8 by James Henstridge
add a page test for the new form layout
165
  <metal:macro define-macro="widget_rows">
7915.3.4 by Barry Warsaw
Make all the nice JavaScripty stuff work.
166
    <table class="form" id="launchpad-form-widgets">
14521.1.3 by Gavin Panella
Put the new widget_row stuff into launchpad-form.pt.
167
      <tal:block define="widgets widgets|view/widgets" repeat="widget widgets">
168
        <metal:macro
169
            define-macro="widget_row"
170
            tal:define="field_name widget/context/__name__;
171
                        error python:view.getFieldError(field_name);
172
                        error_class python:'error' if error else None;
173
                        show_optional python:view.showOptionalMarker(field_name);
174
                        widget_class widget/widget_class|nothing;
175
                        widget_help_link widget_help_link|widget/help_link|nothing">
176
          <tal:is-visible condition="widget/visible">
177
            <tr tal:condition="python: view.isSingleLineLayout(field_name)"
178
                tal:attributes="class error_class">
179
              <td colspan="2">
180
                <metal:widget
181
                    use-macro="widget/@@launchpad_form/widget_single_line" />
182
              </td>
183
            </tr>
184
            <tal:block condition="python: view.isMultiLineLayout(field_name)">
185
              <tr tal:attributes="class error_class">
186
                <td colspan="2" style="text-align: left">
187
                  <metal:widget
188
                      use-macro="widget/@@launchpad_form/widget_multi_line" />
189
                </td>
190
              </tr>
191
            </tal:block>
192
            <tr tal:condition="python: view.isCheckBoxLayout(field_name)">
193
              <td tal:attributes="class error_class" colspan="2">
194
                <metal:widget
195
                    use-macro="widget/@@launchpad_form/widget_checkbox" />
196
              </td>
197
            </tr>
198
          </tal:is-visible>
199
          <tal:not-visible condition="not: widget/visible">
200
            <tr>
201
              <td>
202
                  <metal:widget
203
                      use-macro="widget/@@launchpad_form/widget_hidden" />
204
              </td>
205
            </tr>
206
          </tal:not-visible>
207
        </metal:macro>
3691.220.8 by James Henstridge
add a page test for the new form layout
208
      </tal:block>
209
    </table>
210
  </metal:macro>
211
11929.11.12 by Tim Penhey
Fix the launchpad-form template to be more DRY.
212
  <metal:help-hint metal:define-macro="help_hint">
213
    <tal:widget-help
214
        define="use_structure widget/query:has-structured-doc"
215
        condition="widget/hint">
216
     <p class="formHelp" tal:content="widget/hint"
217
         tal:condition="not: use_structure">
218
        Some Help Text
219
      </p>
220
      <p class="formHelp" tal:content="structure widget/hint"
221
         tal:condition="use_structure">
222
        Some Structured Help Text
223
      </p>
224
    </tal:widget-help>
225
  </metal:help-hint>
226
14521.1.4 by Gavin Panella
WIP for tests of widget_div.
227
  <metal:macro
228
      define-macro="widget_div"
229
      tal:define="field_name widget/context/__name__;
230
                  error python:view.getFieldError(field_name);
231
                  error_class python:'error' if error else None;
232
                  show_optional python:view.showOptionalMarker(field_name);
233
                  widget_class widget/widget_class|nothing;
234
                  widget_help_link widget_help_link|widget/help_link|nothing">
235
    <tal:is-visible condition="widget/visible">
14521.1.5 by Gavin Panella
Use a template to test the widget_div macro.
236
      <div tal:condition="python: view.isSingleLineLayout(field_name)"
237
           tal:attributes="class error_class">
238
        <metal:widget use-macro="widget/@@launchpad_form/widget_single_line" />
239
      </div>
240
      <div tal:condition="python: view.isMultiLineLayout(field_name)"
241
           tal:attributes="class error_class">
242
        <metal:widget use-macro="widget/@@launchpad_form/widget_multi_line" />
243
      </div>
244
      <div tal:condition="python: view.isCheckBoxLayout(field_name)"
245
           tal:attributes="class error_class">
246
        <metal:widget use-macro="widget/@@launchpad_form/widget_checkbox" />
247
      </div>
14521.1.4 by Gavin Panella
WIP for tests of widget_div.
248
    </tal:is-visible>
249
    <tal:not-visible condition="not: widget/visible">
250
      <metal:widget use-macro="widget/@@launchpad_form/widget_hidden" />
251
    </tal:not-visible>
252
  </metal:macro>
253
3691.220.8 by James Henstridge
add a page test for the new form layout
254
</div>