Show More
@@ -29,6 +29,8 b' from boards.utils import validate_file_s' | |||||
29 | FILE_EXTENSION_DELIMITER, get_tripcode_from_text |
|
29 | FILE_EXTENSION_DELIMITER, get_tripcode_from_text | |
30 | from boards.settings import SECTION_FORMS |
|
30 | from boards.settings import SECTION_FORMS | |
31 |
|
31 | |||
|
32 | FORMAT_PANEL_BUTTON = '<span class="mark_btn" ' \ | |||
|
33 | 'onClick="addMarkToMsg(\'{}\', \'{}\')">{}{}{}</span>' | |||
32 |
|
34 | |||
33 | POW_HASH_LENGTH = 16 |
|
35 | POW_HASH_LENGTH = 16 | |
34 | POW_LIFE_MINUTES = 5 |
|
36 | POW_LIFE_MINUTES = 5 | |
@@ -103,19 +105,24 b' class FormatPanel(forms.Textarea):' | |||||
103 | """ |
|
105 | """ | |
104 |
|
106 | |||
105 | def render(self, name, value, attrs=None): |
|
107 | def render(self, name, value, attrs=None): | |
106 | output = '<div id="mark-panel">' |
|
108 | output_template = '<div id="mark-panel">{}</div>' | |
107 | for formatter in formatters: |
|
|||
108 | output += '<span class="mark_btn"' + \ |
|
|||
109 | ' onClick="addMarkToMsg(\'' + formatter.format_left + \ |
|
|||
110 | '\', \'' + formatter.format_right + '\')">' + \ |
|
|||
111 | formatter.preview_left + formatter.name + \ |
|
|||
112 | formatter.preview_right + '</span>' |
|
|||
113 |
|
109 | |||
114 | output += '</div>' |
|
110 | buttons = [self._get_button(formatter) for formatter in formatters] | |
|
111 | ||||
|
112 | output = output_template.format(''.join(buttons)) | |||
|
113 | ||||
115 | output += super(FormatPanel, self).render(name, value, attrs=attrs) |
|
114 | output += super(FormatPanel, self).render(name, value, attrs=attrs) | |
116 |
|
115 | |||
117 | return output |
|
116 | return output | |
118 |
|
117 | |||
|
118 | def _get_button(self, formatter): | |||
|
119 | return FORMAT_PANEL_BUTTON.format( | |||
|
120 | formatter.format_left, | |||
|
121 | formatter.format_right, | |||
|
122 | formatter.preview_left, | |||
|
123 | formatter.name, | |||
|
124 | formatter.preview_right) | |||
|
125 | ||||
119 |
|
126 | |||
120 | class PlainErrorList(ErrorList): |
|
127 | class PlainErrorList(ErrorList): | |
121 | def __unicode__(self): |
|
128 | def __unicode__(self): |
General Comments 0
You need to be logged in to leave comments.
Login now