Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 5907:fe96015445e9
Reorder html entities generated by submit button
issue2551065: This allows styles to be applied. Thanks to Garth Jensen
for the patch against release 1.6
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Tue, 08 Oct 2019 14:37:29 +0200 |
| parents | c3728772c594 |
| children | a2a7860502fa |
comparison
equal
deleted
inserted
replaced
| 5906:d3447888c690 | 5907:fe96015445e9 |
|---|---|
| 774 Generate nothing if we're not editable. | 774 Generate nothing if we're not editable. |
| 775 """ | 775 """ |
| 776 if not self.is_edit_ok(): | 776 if not self.is_edit_ok(): |
| 777 return '' | 777 return '' |
| 778 | 778 |
| 779 return self.input(type="hidden", name="@csrf", | 779 return \ |
| 780 value=anti_csrf_nonce(self._client)) + \ | 780 self.input(type="submit", name="submit_button", |
| 781 value=self._(label)) + \ | |
| 781 '\n' + \ | 782 '\n' + \ |
| 782 self.input(type="hidden", name="@action", value=action) + \ | 783 self.input(type="hidden", name="@csrf", |
| 784 value=anti_csrf_nonce(self._client)) + \ | |
| 783 '\n' + \ | 785 '\n' + \ |
| 784 self.input(type="submit", name="submit_button", value=self._(label)) | 786 self.input(type="hidden", name="@action", value=action) |
| 785 | 787 |
| 786 def history(self): | 788 def history(self): |
| 787 if not self.is_view_ok(): | 789 if not self.is_view_ok(): |
| 788 return self._('[hidden]') | 790 return self._('[hidden]') |
| 789 return self._('New node - no history') | 791 return self._('New node - no history') |
| 914 def submit(self, label=''"Submit Changes", action="edit"): | 916 def submit(self, label=''"Submit Changes", action="edit"): |
| 915 """Generate a submit button. | 917 """Generate a submit button. |
| 916 | 918 |
| 917 Also sneak in the lastactivity and action hidden elements. | 919 Also sneak in the lastactivity and action hidden elements. |
| 918 """ | 920 """ |
| 919 return self.input(type="hidden", name="@lastactivity", | 921 return \ |
| 920 value=self.activity.local(0)) + \ | 922 self.input(type="submit", name="submit_button", |
| 923 value=self._(label)) + \ | |
| 924 '\n' + \ | |
| 925 self.input(type="hidden", name="@lastactivity", | |
| 926 value=self.activity.local(0)) + \ | |
| 921 '\n' + \ | 927 '\n' + \ |
| 922 self.input(type="hidden", name="@csrf", | 928 self.input(type="hidden", name="@csrf", |
| 923 value=anti_csrf_nonce(self._client)) + \ | 929 value=anti_csrf_nonce(self._client)) + \ |
| 924 '\n' + \ | 930 '\n' + \ |
| 925 self.input(type="hidden", name="@action", value=action) + \ | 931 self.input(type="hidden", name="@action", value=action) |
| 926 '\n' + \ | |
| 927 self.input(type="submit", name="submit_button", | |
| 928 value=self._(label)) | |
| 929 | 932 |
| 930 def journal(self, direction='descending'): | 933 def journal(self, direction='descending'): |
| 931 """ Return a list of HTMLJournalEntry instances. | 934 """ Return a list of HTMLJournalEntry instances. |
| 932 """ | 935 """ |
| 933 # XXX do this | 936 # XXX do this |
