Skip to content

Commit

Permalink
[#1382] Adds tooltips to button
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Dec 12, 2013
1 parent 589bb75 commit 6e9f114
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ckan/public/base/javascript/modules/image-upload.js
Expand Up @@ -15,7 +15,9 @@ this.ckan.module('image-upload', function($, _) {
upload: _('Upload'),
url: _('Link'),
remove: _('Remove'),
upload_label: _('Upload'),
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 a 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

0 comments on commit 6e9f114

Please sign in to comment.