Skip to content

Commit

Permalink
Merge branch '1382-upload-labelling-tweaks'
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Dec 12, 2013
2 parents 9dfef5f + a21d109 commit 6fbd43b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 7 additions & 3 deletions ckan/public/base/javascript/modules/image-upload.js
Expand Up @@ -12,10 +12,12 @@ this.ckan.module('image-upload', function($, _) {
field_clear: 'clear_upload',
upload_label: '',
i18n: {
upload: _('From computer'),
url: _('From web'),
upload: _('Upload'),
url: _('Link'),
remove: _('Remove'),
upload_label: _('Upload image'),
upload_label: _('Image'),
upload_tooltip: _('Upload a file on your computer'),
url_tooltip: _('Link to a URL on the internet (you can also link to an API)'),
remove_tooltip: _('Reset this')
},
template: [
Expand Down Expand Up @@ -59,6 +61,7 @@ this.ckan.module('image-upload', function($, _) {

// Button to set the field to be a URL
this.button_url = $('<a href="javascript:;" class="btn"><i class="icon-globe"></i> '+this.i18n('url')+'</a>')
.prop('title', this.i18n('url_tooltip'))
.on('click', this._onFromWeb)
.insertAfter(this.input);

Expand Down Expand Up @@ -86,6 +89,7 @@ this.ckan.module('image-upload', function($, _) {
.on('mouseover', this._onInputMouseOver)
.on('mouseout', this._onInputMouseOut)
.on('change', this._onInputChange)
.prop('title', this.i18n('upload_tooltip'))
.css('width', this.button_upload.outerWidth());

// Fields storage. Used in this.changeState
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/macros/form.html
Expand Up @@ -408,7 +408,7 @@
url_label='', upload_label='') %}
{% 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 _('Upload Image') %}
{% set upload_label = upload_label or _('Image') %}

{% if is_upload_enabled %}
<div class="image-upload" data-module="image-upload" data-module-is_url="{{ 'true' if is_url else 'false' }}" data-module-is_upload="{{ 'true' if is_upload else 'false' }}"
Expand Down
4 changes: 1 addition & 3 deletions ckan/templates/package/snippets/resource_form.html
Expand Up @@ -21,7 +21,7 @@
{% set is_upload = (data.url_type == 'upload') %}
{{ form.image_upload(data, errors, field_url='url', field_upload='upload', field_clear='clear_upload',
is_upload_enabled=h.uploads_enabled(), is_url=data.url and not is_upload, is_upload=is_upload,
upload_label=_('File Upload'), url_label=_('URL')) }}
upload_label=_('File'), url_label=_('URL')) }}
{% endblock %}

{% block basic_fields_name %}
Expand All @@ -38,8 +38,6 @@
{% endcall %}
{% endblock %}

{{ form.required_message() }}


{% block metadata_fields %}
{% if include_metadata %}
Expand Down

0 comments on commit 6fbd43b

Please sign in to comment.