Blame view

assets/js/ace/elements.wizard.js 1.13 KB
5a739853   patrick.he   commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  /**
   <b>Wizard</b>. A wrapper for FuelUX wizard element.
   It's just a wrapper so you still need to include FuelUX wizard script first.
  */
  (function($ , undefined) {
  	$.fn.aceWizard = $.fn.ace_wizard = function(options) {
  
  		this.each(function() {
  			var $this = $(this);
  			$this.wizard();
  			
  			if(ace.vars['old_ie']) $this.find('ul.steps > li').last().addClass('last-child');
  
  			var buttons = (options && options['buttons']) ? $(options['buttons']) : $this.siblings('.wizard-actions').eq(0);
  			var $wizard = $this.data('fu.wizard');
  			$wizard.$prevBtn.remove();
  			$wizard.$nextBtn.remove();
  			
  			$wizard.$prevBtn = buttons.find('.btn-prev').eq(0).on(ace.click_event,  function(){
  				$wizard.previous();
  			}).attr('disabled', 'disabled');
  			$wizard.$nextBtn = buttons.find('.btn-next').eq(0).on(ace.click_event,  function(){
  				$wizard.next();
  			}).removeAttr('disabled');
  			$wizard.nextText = $wizard.$nextBtn.text();
  			
  			var step = options && ((options.selectedItem && options.selectedItem.step) || options.step);
  			if(step) {
  				$wizard.currentStep = step;
  				$wizard.setState();
  			}
  		});
  
  		return this;
  	}
  
  })(window.jQuery);