(function(app) {
  'use strict';

  var jCore = require('jcore');
  var helper = app.helper || require('../helper.js');
  var dom = app.dom || require('../dom.js');

  var ContentHeader = helper.inherits(function(props) {
    ContentHeader.super_.call(this);

    this.sidebarToggleType = this.prop(ContentHeader.SIDEBAR_TOGGLE_TYPE_COLLAPSE);
    this.sidebarToggleDisabled = this.prop(false);
    this.element = this.prop(props.element);
    this.cache = this.prop({});
  }, jCore.Component);

  ContentHeader.prototype.sidebarToggleButtonElement = function() {
    return dom.child(this.element(), 0);
  };

  ContentHeader.prototype.redraw = function() {
    var cache = this.cache();

    var sidebarToggleType = this.sidebarToggleType();
    if (sidebarToggleType !== cache.sidebarToggleType) {
      dom.data(this.sidebarToggleButtonElement(), 'type', sidebarToggleType);
      cache.sidebarToggleType = sidebarToggleType;
    }

    var sidebarToggleDisabled = this.sidebarToggleDisabled();
    if (sidebarToggleDisabled !== cache.sidebarToggleDisabled) {
      dom.disabled(this.sidebarToggleButtonElement(), sidebarToggleDisabled);
      cache.sidebarToggleDisabled = sidebarToggleDisabled;
    }
  };

  ContentHeader.SIDEBAR_TOGGLE_TYPE_COLLAPSE = 'collapse';
  ContentHeader.SIDEBAR_TOGGLE_TYPE_EXPAND = 'expand';

  if (typeof module !== 'undefined' && module.exports)
    module.exports = ContentHeader;
  else
    app.ContentHeader = ContentHeader;
})(this.app || (this.app = {}));

@@ -165,29 +165,35 @@
 %0A%0A  var 
-ContentHeader
+SidebarToggleButton
  = helpe
@@ -225,29 +225,35 @@
 ) %7B%0A    
-ContentHeader
+SidebarToggleButton
 .super_.
@@ -274,30 +274,17 @@
    this.
-sidebarToggleT
+t
 ype = th
@@ -295,37 +295,28 @@
 rop(
-ContentHeader.SIDEBAR_TOGGLE_
+SidebarToggleButton.
 TYPE
@@ -332,38 +332,25 @@
 );%0A    this.
-sidebarToggleD
+d
 isabled = th
@@ -472,304 +472,143 @@
 %0A%0A  
-ContentHeader.prototype.sidebarToggleButtonElement = function() %7B%0A    return dom.child(this.element(), 0);%0A  %7D;%0A%0A  ContentHeader.prototype.redraw = function() %7B%0A    var cache = this.cache();%0A%0A    var sidebarToggleType = this.sidebarToggleType();%0A    if (sidebarToggleType !== cache.sidebarToggleT
+SidebarToggleButton.prototype.redraw = function() %7B%0A    var cache = this.cache();%0A%0A    var type = this.type();%0A    if (type !== cache.t
 ype)
@@ -630,36 +630,17 @@
 ta(this.
-sidebarToggleButtonE
+e
 lement()
@@ -649,30 +649,17 @@
 'type', 
-sidebarToggleT
+t
 ype);%0A  
@@ -672,42 +672,16 @@
 che.
-sidebarToggleType = sidebarToggleT
+type = t
 ype;
@@ -696,30 +696,17 @@
     var 
-sidebarToggleD
+d
 isabled 
@@ -712,30 +712,17 @@
  = this.
-sidebarToggleD
+d
 isabled(
@@ -732,30 +732,17 @@
     if (
-sidebarToggleD
+d
 isabled 
@@ -747,38 +747,25 @@
 d !== cache.
-sidebarToggleD
+d
 isabled) %7B%0A 
@@ -791,130 +791,458 @@
 his.
-sidebarToggleButtonElement(), sidebarToggleDisabled
+element(), disabled);%0A      cache.disabled = disabled;%0A    %7D%0A  %7D;%0A%0A  SidebarToggleButton.TYPE_COLLAPSE = 'collapse';%0A  SidebarToggleButton.TYPE_EXPAND = 'expand';%0A%0A  var ContentHeader = helper.inherits(function(props) %7B%0A    ContentHeader.super_.call(this
 );%0A
+%0A
     
-  cache.sidebarToggleDisabled = sidebarToggleDisabled;
+this.element = this.prop(props.element);%0A%0A    this.sidebarToggleButton = this.prop(new SidebarToggleButton(%7B%0A      element: this.sidebarToggleButtonElement()
 %0A    %7D
+));
 %0A  %7D
+, jCore.Component)
 ;%0A%0A 
@@ -1260,104 +1260,199 @@
 der.
-SIDEBAR_TOGGLE_TYPE_COLLAPSE = 'collapse';%0A  ContentHeader.SIDEBAR_TOGGLE_TYPE_EXPAND = 'expand'
+prototype.sidebarToggleButtonElement = function() %7B%0A    return dom.child(this.element(), 0);%0A  %7D;%0A%0A  ContentHeader.prototype.redraw = function() %7B%0A    this.sidebarToggleButton().redraw();%0A  %7D
 ;%0A%0A 

Refactor code of sidebar-toggle-button