From 7d5eafb47d89600eb09a89c71b738eff11f75008 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 1 Apr 2016 17:07:28 +0200 Subject: [PATCH] do not depend on auquotidien to show fargo pick a file button It also changes the behaviour from auquotien so that the button is hidden if is user is not connected. --- wcs/qommon/form.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wcs/qommon/form.py b/wcs/qommon/form.py index 0305835..99e638f 100644 --- a/wcs/qommon/form.py +++ b/wcs/qommon/form.py @@ -772,6 +772,22 @@ class FileWithPreviewWidget(CompositeWidget): if not valid_file_type: self.error = _('invalid file type') + def render_hint(self, hint): + hint = CompositeWidget.render_hint(self, hint) + if not self.allow_portfolio_picking: + return t + root_url = get_publisher().get_root_url() + if file_validation.has_file_validation() and get_request().user and not self.preview: + get_response().add_javascript(['fargo.js']) + params = root_url, _('Pick a file from your dropbox'), _('Use file from my dropbox') + hint += htmltext('

%s

' % params) + return hint + class PicklableUpload(Upload): def __getstate__(self): -- 2.1.4