Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding image alt attribute #467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/javascripts/mercury/modals/insertmedia.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@element.find('#media_image_float').val(if image.attr('style')? then image.css('float') else '')
@element.find('#media_image_width').val(image.width() || '')
@element.find('#media_image_height').val(image.height() || '')
@element.find('#media_image_alt').val(image.attr('alt') || '')
@focus('#media_image_url')

# if we're editing an iframe (assume it's a video for now)
Expand Down Expand Up @@ -105,6 +106,7 @@
attrs['style'] += 'float: ' + float + '; ' if float = @element.find('#media_image_float').val()
attrs['style'] += 'width: ' + width + 'px; ' if width = @element.find('#media_image_width').val()
attrs['style'] += 'height: ' + height + 'px;' if height = @element.find('#media_image_height').val()
attrs['alt'] = @element.find('#media_image_alt').val()
Mercury.trigger('action', {action: 'insertImage', value: attrs})

when 'youtube_url'
Expand Down
7 changes: 7 additions & 0 deletions app/views/mercury/modals/media.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@
<div class="controls">
<input class="number optional" id="media_image_width" name="media[image_width]" size="50" type="number">
</div>

<label class="number optional control-label" for="media_image_height">Height</label>
<div class="controls">
<input class="number optional" id="media_image_height" name="media[image_height]" size="50" type="number">
</div>

<label class="number optional control-label" for="media_image_alt">Alt</label>
<div class="controls">
<input class="text optional" id="media_image_alt" name="media[image_alt]" size="50">
</div>

</div>
</div>
<div class="media-options" id="youtube_url_options" style="display:none">
Expand Down