Sha256: 5eb4a22552d6a7b8c41743ee7f788f25390f83b2bfeef3bd50be50e220df04a9

Contents?: true

Size: 1.96 KB

Versions: 10

Compression:

Stored size: 1.96 KB

Contents

App.Views.Stats = Backbone.View.extend({
	
	events: {
		"click a#user_count"    		: "user_count",
		"click a#device_count"  		: "device_count",
		"click a#http_timing"   		: "http_timing",
		"click a#source_timing" 		: "source_timing",
		"click a#source_timing_display" : "source_timing_display",
		
	},
	
	initialize: function(){
		this.render();
		this.user_count();
	},
	
	user_count: function(){
		this.change_tab('user_count');
		this.model.user_stats();
	},

    device_count: function(){
		this.change_tab('device_count');
		this.model.device_count();
	},
	
	http_timing: function(ev){
		var display_name = ev.currentTarget.innerHTML;
		this.change_tab('http_timing');
		this.model.http_timing(display_name);
	},
	
	source_timing: function(){
	   this.change_tab('source_timing');
	   this.model.source_timing();
	},
	
	source_timing_display: function(ev){
		var display_name = ev.currentTarget.innerHTML;
		this.change_tab('source_timing');
		this.model.source_timing(display_name);	
	},
	
	change_tab: function(tab){
		$('#user_count').parent().attr('class','');
		$('#device_count').parent().attr('class','');
		$('#http_timing').parent().attr('class','');
		$('#source_timing').parent().attr('class','');
		$('#'+tab).parent().attr('class','active');
	},
	
	render: function(){
		$('#secondary-nav').css('display','block');
		out = "<div id='stats-alert' class='alert alert-error' style='display:none'></div>"
		out += "<div class='tabs-left'><ul class='nav nav-tabs'>"
		out += "<li class='active'><a id='user_count'>User Count</a></li>"
		out += "<li><a id='device_count'>Device Count</a></li>"
		out += "<li><a id='http_timing'>HTTP Timing</a></li>"
		out += "<li><a id='source_timing'>Source Timing</a></li>"
		out += "</ul>"
		out += "<div id='stats_main' style='margin-left:200px'>"
		out += "</div>"
		//out += "<ul id='source-list' class='nav nav-pills' style='margin-left:200px'></ul>"
		out += "</div></div>"
				
        $(this.el).html(out);
        $('#main_content').html(this.el);
	}
})

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rhoconnect-3.3.1.beta4 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.3.1.beta3 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.3.1.beta2 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.1 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.0 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.0.beta5 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.0.beta4 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.0.beta3 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.0.beta2 lib/rhoconnect/web-console/views/stats.js
rhoconnect-3.2.0.beta1 lib/rhoconnect/web-console/views/stats.js