Image = require '../image'

class DetailsImage extends Image
	className: 'control control-url control-image-details'
	template:  'core/views/image-details'

	elements: '.image-title': 'title'
	silent: true

	onInvalidURL: => 
		@$removeClass 'invalid'
		@title.text 'File missing.'

	update: ->
		super
		(title = @item.image.split('/').pop().split('.')).pop()
		@title.text (unescape title.join '.').trim() or @item.metadata?.name or 'No Title'

module.exports = DetailsImage