Activator 	= window.require 'spine/controller/activator'
Content 	= window.require 'core/models/content'
Composition = window.require 'core/models/composition'
class Footer extends Activator
	className		: 'editor-footer'
	containerClass 	: 'editor-breadcrumbs'
	events:
		'click .editor-next-btn':'getStep'
		'click .editor-prev-btn':'getStep'

	init: =>
		@prevBtn = $ "<div class='editor-prev-btn' data-dir='prev'>prev</div>"
		@nextBtn = $ "<div class='editor-next-btn' data-dir='next'></div>"
		@append @prevBtn, @nextBtn
		super

	getStep: (e) ->
		currentStep = @children( (i)->i.isActive() )[0]
		return unless currentStep
		desiredStep = currentStep.el[($ e.target).data('dir')]().controller().panel.title.toLowerCase()
		@$trigger 'Footer:step', desiredStep
	
	_active:(@ctrl)=>
		super
		@prevBtn.toggleClass 'disabled', !@ctrl.el.prev().controller()?

	setOptions: (opts) =>
		@el.toggle opts.enabled if opts.enabled?
		return unless opts.steps

		@children (ch) -> 
			ch.el.remove() unless ch.panel.title.toLowerCase() in opts.steps

		@_active @ctrl

module.exports = Footer