//  @import com.hedgehoglab.application.view.BaseView;
//	@import com.hedgehoglab.application.helper.BaseHelper;
//  @import com.hedgehoglab.solomon.helper.ContactViewHelper;

function UserListView(scope){
    BaseView.call(this,scope);
	ContactViewHelper.call(this,scope);    
	var _this=this;
   	//var _helpers=new _this.generate_helpers(this,[ContactViewHelper]);
	

	if(scope.element.hasClass('hide')) scope.element.hide().removeClass('hide');
	$(".hide",scope.element).hide().removeClass('hide');
	
	this.hide=function(callback){
		scope.element.fadeOut(100,function(e){
			if(callback) callback();
		});
	};
	
	this.show=function(callback){
		scope.element.fadeIn(100,function(e){
			if(callback) callback();
		});
	}
	
    _this.render=function(data,term){
		if(data==null){
			_this.render_template_with_view('users/no-users-found',{term:term},_this,function(rendered_template){
				var ul=$(rendered_template);
		
				scope.list_element.html(ul);
			});
		}else{
			_this.render_template_with_view('users/users-list',data,_this,function(rendered_template){
				var ul=$(rendered_template);
		
				scope.list_element.html(ul);
				
				//	Hook onto the users name for the click and inform the controller we wish to edit
				$('.actEdit',ul).bind('click',function(e){
					var index=$(this).attr('rel');
					_this.raise_event('on_edit_user',{index:index});
					return false;
				});
		  
		   	});
		}
    };
    
};