(function() {
	'use strict';

	// generic UI For listing files
	angular.module('ti_common').directive('ticView', ticView);

	
	function ticView() {

		var directive = {
			restrict: 'E',
			templateUrl: 'ti_common/containers/view.html',
			scope: {
				heading: '='
			},
			controller: ViewController,
			controllerAs: 'vm',
			bindToController : true,
			transclude : true
		};

		ViewController.$inject = ['ticViewStickyPanel'];
		function ViewController(ticViewStickyPanel){
			
			var vm = this;
			setStickyState();

			ticViewStickyPanel.registerViewStickyStateChangedHandler(function(){
				setStickyState();
			});

			function setStickyState(){
				vm.stickyState = ticViewStickyPanel.stickyPanelExpanded() ? 'expanded' : 'collapsed';
			}

		}

		return directive;
	}

})();