lib/classiccms/public/js/images.coffee in classiccms-0.6.3 vs lib/classiccms/public/js/images.coffee in classiccms-0.6.4
- old
+ new
@@ -4,10 +4,11 @@
class Browser
constructor: ->
+ @input = $('#input').first().val()
@p =
images: '.images'
image: 'img'
destroy: '.destroy'
button: '#file_upload'
@@ -32,16 +33,17 @@
else
$('.images').hide()
$('.'+id).show()
select: () ->
- $('.item').click ->
- input = $('input').first().val()
- url = $(this).attr('url')
+ $('.item').click (event)=>
+ url = $(event.currentTarget).attr('url')
+ input = $('input[name=return]').first().val()
if input.length > 0
window.opener.CKEDITOR.tools.callFunction(input, url)
else
- window.opener.$('#file_select').val($(this).attr('id'))
+ window.opener.$('#' + @input).first().val($(event.currentTarget).attr('id'))
+ window.opener.$("##{@input}_preview img").attr('src', $(event.currentTarget).attr('src'))
self.close()
destroy: () ->
$(@p.destroy).click (event) =>
id = $(event.currentTarget).attr('data-id')