diff --git a/ckan/public/base/css/fuchsia.css b/ckan/public/base/css/fuchsia.css index 9353e542365..c0e2f7fd3c3 100644 --- a/ckan/public/base/css/fuchsia.css +++ b/ckan/public/base/css/fuchsia.css @@ -8150,6 +8150,11 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { .js .image-upload .btn-remove-url .icon-remove { margin-right: 0; } +.js .image-upload .error-inline { + margin-top: 5px; + margin-left: 2px; + font-weight: bold; +} .add-member-form .control-label { display: block; } @@ -8481,6 +8486,29 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { #activity-archive-notice { clear: both; } +/* diff styles */ +table.diff { + font-family: Courier; + border: medium; +} +.diff_header { + background-color: #e0e0e0; +} +td.diff_header { + text-align: right; +} +.diff_next { + background-color: #c0c0c0; +} +.diff_add { + background-color: #aaffaa; +} +.diff_chg { + background-color: #ffff77; +} +.diff_sub { + background-color: #ffaaaa; +} .search-form { margin-bottom: 20px; padding-bottom: 25px; @@ -10366,6 +10394,13 @@ h4 small { .activity .item.follow-group .icon { background-color: #8ba669; } +.select-time { + width: 250px; + display: inline; +} +br.line-height2 { + line-height: 2; +} .dropdown:hover .dropdown-menu { display: block; } @@ -10760,25 +10795,3 @@ iframe { .reduced-padding { padding: 3px 5px; } -table.diff { - font-family:Courier; - border:medium; -} -.diff_header { - background-color:#e0e0e0; -} -td.diff_header { - text-align:right; -} -.diff_next { - background-color:#c0c0c0; -} -.diff_add { - background-color:#aaffaa; -} -.diff_chg { - background-color:#ffff77; -} -.diff_sub { - background-color:#ffaaaa; -} diff --git a/ckan/public/base/css/green.css b/ckan/public/base/css/green.css index 13a38aacf8b..6042ab9eeaa 100644 --- a/ckan/public/base/css/green.css +++ b/ckan/public/base/css/green.css @@ -8150,6 +8150,11 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { .js .image-upload .btn-remove-url .icon-remove { margin-right: 0; } +.js .image-upload .error-inline { + margin-top: 5px; + margin-left: 2px; + font-weight: bold; +} .add-member-form .control-label { display: block; } @@ -8481,6 +8486,29 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { #activity-archive-notice { clear: both; } +/* diff styles */ +table.diff { + font-family: Courier; + border: medium; +} +.diff_header { + background-color: #e0e0e0; +} +td.diff_header { + text-align: right; +} +.diff_next { + background-color: #c0c0c0; +} +.diff_add { + background-color: #aaffaa; +} +.diff_chg { + background-color: #ffff77; +} +.diff_sub { + background-color: #ffaaaa; +} .search-form { margin-bottom: 20px; padding-bottom: 25px; @@ -10366,6 +10394,13 @@ h4 small { .activity .item.follow-group .icon { background-color: #8ba669; } +.select-time { + width: 250px; + display: inline; +} +br.line-height2 { + line-height: 2; +} .dropdown:hover .dropdown-menu { display: block; } @@ -10760,25 +10795,3 @@ iframe { .reduced-padding { padding: 3px 5px; } -table.diff { - font-family:Courier; - border:medium; -} -.diff_header { - background-color:#e0e0e0; -} -td.diff_header { - text-align:right; -} -.diff_next { - background-color:#c0c0c0; -} -.diff_add { - background-color:#aaffaa; -} -.diff_chg { - background-color:#ffff77; -} -.diff_sub { - background-color:#ffaaaa; -} diff --git a/ckan/public/base/css/main.css b/ckan/public/base/css/main.css index 2c670a61371..eb978223865 100644 --- a/ckan/public/base/css/main.css +++ b/ckan/public/base/css/main.css @@ -8150,6 +8150,11 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { .js .image-upload .btn-remove-url .icon-remove { margin-right: 0; } +.js .image-upload .error-inline { + margin-top: 5px; + margin-left: 2px; + font-weight: bold; +} .add-member-form .control-label { display: block; } @@ -8481,6 +8486,29 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { #activity-archive-notice { clear: both; } +/* diff styles */ +table.diff { + font-family: Courier; + border: medium; +} +.diff_header { + background-color: #e0e0e0; +} +td.diff_header { + text-align: right; +} +.diff_next { + background-color: #c0c0c0; +} +.diff_add { + background-color: #aaffaa; +} +.diff_chg { + background-color: #ffff77; +} +.diff_sub { + background-color: #ffaaaa; +} .search-form { margin-bottom: 20px; padding-bottom: 25px; @@ -10767,25 +10795,3 @@ iframe { .reduced-padding { padding: 3px 5px; } -table.diff { - font-family:Courier; - border:medium; -} -.diff_header { - background-color:#e0e0e0; -} -td.diff_header { - text-align:right; -} -.diff_next { - background-color:#c0c0c0; -} -.diff_add { - background-color:#aaffaa; -} -.diff_chg { - background-color:#ffff77; -} -.diff_sub { - background-color:#ffaaaa; -} diff --git a/ckan/public/base/css/maroon.css b/ckan/public/base/css/maroon.css index 49d29a3d18f..a4ac0d0b4d2 100644 --- a/ckan/public/base/css/maroon.css +++ b/ckan/public/base/css/maroon.css @@ -8150,6 +8150,11 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { .js .image-upload .btn-remove-url .icon-remove { margin-right: 0; } +.js .image-upload .error-inline { + margin-top: 5px; + margin-left: 2px; + font-weight: bold; +} .add-member-form .control-label { display: block; } @@ -8481,6 +8486,29 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { #activity-archive-notice { clear: both; } +/* diff styles */ +table.diff { + font-family: Courier; + border: medium; +} +.diff_header { + background-color: #e0e0e0; +} +td.diff_header { + text-align: right; +} +.diff_next { + background-color: #c0c0c0; +} +.diff_add { + background-color: #aaffaa; +} +.diff_chg { + background-color: #ffff77; +} +.diff_sub { + background-color: #ffaaaa; +} .search-form { margin-bottom: 20px; padding-bottom: 25px; @@ -10366,6 +10394,13 @@ h4 small { .activity .item.follow-group .icon { background-color: #8ba669; } +.select-time { + width: 250px; + display: inline; +} +br.line-height2 { + line-height: 2; +} .dropdown:hover .dropdown-menu { display: block; } @@ -10760,25 +10795,3 @@ iframe { .reduced-padding { padding: 3px 5px; } -table.diff { - font-family:Courier; - border:medium; -} -.diff_header { - background-color:#e0e0e0; -} -td.diff_header { - text-align:right; -} -.diff_next { - background-color:#c0c0c0; -} -.diff_add { - background-color:#aaffaa; -} -.diff_chg { - background-color:#ffff77; -} -.diff_sub { - background-color:#ffaaaa; -} diff --git a/ckan/public/base/css/red.css b/ckan/public/base/css/red.css index 3c0a73f413e..e4aeeba39d4 100644 --- a/ckan/public/base/css/red.css +++ b/ckan/public/base/css/red.css @@ -8150,6 +8150,11 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { .js .image-upload .btn-remove-url .icon-remove { margin-right: 0; } +.js .image-upload .error-inline { + margin-top: 5px; + margin-left: 2px; + font-weight: bold; +} .add-member-form .control-label { display: block; } @@ -8481,6 +8486,29 @@ fieldset[disabled] .control-custom.disabled .checkbox.btn.focus { #activity-archive-notice { clear: both; } +/* diff styles */ +table.diff { + font-family: Courier; + border: medium; +} +.diff_header { + background-color: #e0e0e0; +} +td.diff_header { + text-align: right; +} +.diff_next { + background-color: #c0c0c0; +} +.diff_add { + background-color: #aaffaa; +} +.diff_chg { + background-color: #ffff77; +} +.diff_sub { + background-color: #ffaaaa; +} .search-form { margin-bottom: 20px; padding-bottom: 25px; @@ -10366,6 +10394,13 @@ h4 small { .activity .item.follow-group .icon { background-color: #8ba669; } +.select-time { + width: 250px; + display: inline; +} +br.line-height2 { + line-height: 2; +} .dropdown:hover .dropdown-menu { display: block; } @@ -10760,25 +10795,3 @@ iframe { .reduced-padding { padding: 3px 5px; } -table.diff { - font-family:Courier; - border:medium; -} -.diff_header { - background-color:#e0e0e0; -} -td.diff_header { - text-align:right; -} -.diff_next { - background-color:#c0c0c0; -} -.diff_add { - background-color:#aaffaa; -} -.diff_chg { - background-color:#ffff77; -} -.diff_sub { - background-color:#ffaaaa; -} diff --git a/ckan/public/base/javascript/modules/image-upload.js b/ckan/public/base/javascript/modules/image-upload.js index 49255b711d5..9437305632b 100644 --- a/ckan/public/base/javascript/modules/image-upload.js +++ b/ckan/public/base/javascript/modules/image-upload.js @@ -11,7 +11,8 @@ this.ckan.module('image-upload', function($) { field_url: 'image_url', field_clear: 'clear_upload', field_name: 'name', - upload_label: '' + upload_label: '', + previous_upload: false }, /* Should be changed to true if user modifies resource's name @@ -43,6 +44,7 @@ this.ckan.module('image-upload', function($) { this.label_location = $('label[for="field-image-url"]'); // determines if the resource is a data resource this.is_data_resource = (this.options.field_url === 'url') && (this.options.field_upload === 'upload'); + this.previousUpload = this.options.previous_upload; // Is there a clear checkbox on the form already? var checkbox = $(field_clear, this.el); @@ -68,6 +70,11 @@ this.ckan.module('image-upload', function($) { this._('Upload') + '') .insertAfter(this.input); + if (this.previousUpload) { + $('
' + + this._('Please select the file to upload again') + '
').appendTo(this.field_image); + } + // Button for resetting the form when there is a URL set var removeText = this._('Remove'); $('' diff --git a/ckan/public/base/less/forms.less b/ckan/public/base/less/forms.less index 79cc069b63f..41c33932b31 100644 --- a/ckan/public/base/less/forms.less +++ b/ckan/public/base/less/forms.less @@ -752,6 +752,12 @@ select[data-module="autocomplete"] { margin-right: 0; } } + + .error-inline { + margin-top: 5px; + margin-left: 2px; + font-weight: bold; + } } .add-member-form .control-label { diff --git a/ckan/templates/macros/form.html b/ckan/templates/macros/form.html index dd9a3fef6ff..ff01a076c02 100644 --- a/ckan/templates/macros/form.html +++ b/ckan/templates/macros/form.html @@ -422,10 +422,21 @@ {% set placeholder = placeholder if placeholder else _('http://example.com/my-image.jpg') %} {% set url_label = url_label or _('Image URL') %} {% set upload_label = upload_label or _('Image') %} + {% set previous_upload = data['previous_upload'] %} {% if is_upload_enabled %} -
+ + +
{% endif %} diff --git a/ckan/tests/controllers/test_user.py b/ckan/tests/controllers/test_user.py index 71e25741916..05c47e98efc 100644 --- a/ckan/tests/controllers/test_user.py +++ b/ckan/tests/controllers/test_user.py @@ -850,7 +850,7 @@ def test_request_reset_when_duplicate_emails(self, send_reset_link, app): emailed_users = [ call[0][0].name for call in send_reset_link.call_args_list ] - assert emailed_users == [user_a["name"], user_b["name"]] + assert sorted(emailed_users) == sorted([user_a["name"], user_b["name"]]) def test_request_reset_without_param(self, app): diff --git a/ckan/views/resource.py b/ckan/views/resource.py index 293c30f8a8c..274a648d8b6 100644 --- a/ckan/views/resource.py +++ b/ckan/views/resource.py @@ -243,6 +243,10 @@ def post(self, package_type, id): except ValidationError as e: errors = e.error_dict error_summary = e.error_summary + if data.get(u'url_type') == u'upload' and data.get(u'url'): + data[u'url'] = u'' + data[u'url_type'] = u'' + data[u'previous_upload'] = True return self.get(package_type, id, data, errors, error_summary) except NotAuthorized: return base.abort(403, _(u'Unauthorized to create a resource'))