1 | <%inherit file="/base.mako"/> |
---|
2 | <%namespace file="/message.mako" import="render_msg" /> |
---|
3 | |
---|
4 | %if message: |
---|
5 | ${render_msg( message, status )} |
---|
6 | %endif |
---|
7 | |
---|
8 | <script type="text/javascript"> |
---|
9 | $(document).ready(function(){ |
---|
10 | //hide the all of the element with class msg_body |
---|
11 | $(".msg_body").hide(); |
---|
12 | //toggle the componenet with class msg_body |
---|
13 | $(".msg_head").click(function(){ |
---|
14 | $(this).next(".msg_body").slideToggle(450); |
---|
15 | }); |
---|
16 | }); |
---|
17 | </script> |
---|
18 | <style type="text/css"> |
---|
19 | .msg_head { |
---|
20 | padding: 0px 0px; |
---|
21 | cursor: pointer; |
---|
22 | } |
---|
23 | |
---|
24 | } |
---|
25 | </style> |
---|
26 | |
---|
27 | <%def name="render_selectbox_options( index, field_attr )"> |
---|
28 | %if field_attr[0] == 'Type': |
---|
29 | %if field_attr[1].get_selected( return_label=True ) == 'SelectField': |
---|
30 | <% options = field_attr[2] %> |
---|
31 | <div class="repeat-group-item"> |
---|
32 | <div class="form-row"> |
---|
33 | <label> Options</label> |
---|
34 | %for i, option in enumerate(options): |
---|
35 | <div class="form-row"> |
---|
36 | <b> ${i+1}</b> |
---|
37 | ${option[1].get_html()} |
---|
38 | <input type="submit" name="removeoption_${index}_${i}" value="Remove"/> |
---|
39 | </div> |
---|
40 | %endfor |
---|
41 | </div> |
---|
42 | </div> |
---|
43 | <div class="form-row"> |
---|
44 | <input type="submit" name="addoption_${index}" value="Add"/> |
---|
45 | </div> |
---|
46 | %endif |
---|
47 | %endif |
---|
48 | </%def> |
---|
49 | |
---|
50 | <%def name="render_field( index, field, saved )"> |
---|
51 | %if saved: |
---|
52 | <h4 class="msg_head"> |
---|
53 | <div class="form-row">${index+1}. ${field[0][1].value} (${field[2][1].get_selected( return_value=True )})</div> |
---|
54 | </h4> |
---|
55 | <div class="msg_body"> |
---|
56 | %else: |
---|
57 | <div class="msg_body2"> |
---|
58 | %endif |
---|
59 | <div class="repeat-group-item"> |
---|
60 | %for field_attr in field: |
---|
61 | <div class="form-row"> |
---|
62 | <label>${field_attr[0]}</label> |
---|
63 | ${field_attr[1].get_html()} |
---|
64 | ${render_selectbox_options( index, field_attr )} |
---|
65 | </div> |
---|
66 | %endfor |
---|
67 | <div class="form-row"> |
---|
68 | <input type="submit" name="remove_button" value="Remove field ${index+1}"/> |
---|
69 | </div> |
---|
70 | </div> |
---|
71 | </div> |
---|
72 | </%def> |
---|
73 | |
---|
74 | <%def name="render_layout( index, widget )"> |
---|
75 | <div class="repeat-group-item"> |
---|
76 | <div class="form-row"> |
---|
77 | <b> ${index+1}</b> |
---|
78 | ${widget.get_html()} |
---|
79 | <input type="submit" name="remove_layout_grid_button" value="Remove grid ${index+1}"/> |
---|
80 | </div> |
---|
81 | </div> |
---|
82 | </%def> |
---|
83 | |
---|
84 | <div class="toolForm"> |
---|
85 | <div class="toolFormTitle">Edit form definition "${form.name}"</div> |
---|
86 | <form id="edit_form" name="edit_form" action="${h.url_for( controller='forms', action='edit', id=trans.security.encode_id(form.current.id) )}" method="post" > |
---|
87 | %if response_redirect: |
---|
88 | <input type="hidden" name="response_redirect" value="${response_redirect}" size="40" /> |
---|
89 | %endif |
---|
90 | %for label, input in form_details: |
---|
91 | <div class="form-row"> |
---|
92 | ## TODO: RC, this will keep the form type select list label |
---|
93 | ## from being displayed here. At this point, the select list is a hidden field. |
---|
94 | ## Make sure this is the best solution to this problem. |
---|
95 | %if label != 'Type': |
---|
96 | <label>${label}</label> |
---|
97 | %endif |
---|
98 | <div style="float: left; width: 250px; margin-right: 10px;"> |
---|
99 | ${input.get_html()} |
---|
100 | </div> |
---|
101 | <div style="clear: both"></div> |
---|
102 | </div> |
---|
103 | %endfor |
---|
104 | %if current_form_type == trans.app.model.FormDefinition.types.SAMPLE: |
---|
105 | <div class="toolFormTitle">Form Layout</div> |
---|
106 | <div class="form-row"> |
---|
107 | <label>Layout grid names</label> |
---|
108 | </div> |
---|
109 | %for index, lg in enumerate(layout_grids): |
---|
110 | ${render_layout( index, lg )} |
---|
111 | %endfor |
---|
112 | <div class="form-row"> |
---|
113 | <input type="submit" name="add_layout_grid" value="Add layout grid"/> |
---|
114 | </div> |
---|
115 | %endif |
---|
116 | <div class="toolFormTitle">Fields (${len(form.fields)})</div> |
---|
117 | %for ctr, field in enumerate(field_details): |
---|
118 | %if ctr < len(form.fields): |
---|
119 | ${render_field( ctr, field, True )} |
---|
120 | %else: |
---|
121 | ${render_field( ctr, field, False )} |
---|
122 | %endif |
---|
123 | %endfor |
---|
124 | <div class="form-row"> |
---|
125 | <input type="submit" name="add_field_button" value="Add field"/> |
---|
126 | </div> |
---|
127 | <div class="form-row"> |
---|
128 | <div style="float: left; width: 250px; margin-right: 10px;"> |
---|
129 | <input type="hidden" name="refresh" value="true" size="40"/> |
---|
130 | </div> |
---|
131 | <div style="clear: both"></div> |
---|
132 | </div> |
---|
133 | <div class="form-row"> |
---|
134 | <input type="submit" name="save_changes_button" value="Save"/> |
---|
135 | </div> |
---|
136 | </form> |
---|
137 | </div> |
---|