0001-forms-move-fargo-markup-out-of-hint-into-widget-cont.patch
wcs/qommon/form.py | ||
---|---|---|
636 | 636 |
self.max_file_size_bytes = FileSizeWidget.parse_file_size(self.max_file_size) |
637 | 637 |
self.add(HiddenWidget, 'token') |
638 | 638 |
if not self.readonly: |
639 |
hint = '' |
|
640 |
if self.allow_portfolio_picking: |
|
641 |
root_url = get_publisher().get_root_url() |
|
642 |
if get_request().user: |
|
643 |
params = (root_url, |
|
644 |
_('Pick a file from the portfolio'), |
|
645 |
_('Use file from the portfolio')) |
|
646 |
hint += htmltext('<p class="use-file-from-fargo"><span ' |
|
647 |
'data-src="%sfargo/pick" ' |
|
648 |
'data-width="500" ' |
|
649 |
'data-height="400" ' |
|
650 |
'data-title="%s" ' |
|
651 |
'rel="popup">%s</span></p>' % params) |
|
652 |
# relative fargo.js is added later in self.render_content() |
|
653 |
hint += self.hint or '' |
|
654 | 639 |
attrs = {'data-url': get_publisher().get_root_url() + 'tmp-upload'} |
655 | 640 |
self.file_type = kwargs.pop('file_type', None) |
656 | 641 |
if self.file_type: |
... | ... | |
658 | 643 |
if self.max_file_size_bytes: |
659 | 644 |
# this could be used for client size validation of file size |
660 | 645 |
attrs['data-max-file-size'] = str(self.max_file_size_bytes) |
661 |
self.add(FileWidget, 'file', hint=hint, render_br=False, attrs=attrs)
|
|
646 |
self.add(FileWidget, 'file', render_br=False, attrs=attrs) |
|
662 | 647 |
if value: |
663 | 648 |
self.set_value(value) |
664 | 649 | |
... | ... | |
771 | 756 |
if not valid_file_type: |
772 | 757 |
self.error = _('invalid file type') |
773 | 758 | |
774 |
def render_hint(self, hint): |
|
775 |
return '' |
|
776 | ||
777 | 759 | |
778 | 760 |
class PicklableUpload(Upload): |
779 | 761 |
def __getstate__(self): |
wcs/qommon/templates/qommon/forms/widgets/file.html | ||
---|---|---|
8 | 8 |
<div class="fileprogress" style="display: none;"> |
9 | 9 |
<div class="bar">{% trans "Upload in progress..." %}</div> |
10 | 10 |
</div> |
11 |
{% block portfolio-picker %} |
|
12 |
{% if not widget.readonly and widget.allow_portfolio_picking and session_user %} |
|
13 |
<p class="use-file-from-fargo"><span |
|
14 |
data-src="{{site_url}}/fargo/pick" data-width="500" data-height="400" |
|
15 |
data-title="{% trans "Pick a file from the portfolio" %}" |
|
16 |
rel="popup">{% trans "Use file from the portfolio" %}</span></p> |
|
17 |
{% endif %} |
|
18 |
{% endblock %} |
|
11 | 19 |
<div class="fileinfo"> |
12 | 20 |
<span class="filename">{{ widget.tempfile.base_filename }}</span> |
13 | 21 |
{% if not widget.readonly %} |
14 |
- |