Sha256: 02486459101b1363078445ae3c5c731207e46cf746c266d80f8d734919136b8d

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

/**
* Strelka Web Admin Console
* $Id$
*
* Author/s:
* - Michael Granger <ged@FaerieMUD.org>
*
*/

const ConfigService = '/api/v1';

var App = {
	Models: {},
	Collections: {},
	Views: {},
	Controllers: {},

	init: function() {

		Backbone.history.start();
	}
};

App.VERSION = '0.0.1';

/**
 * Models
 */
App.Models.Server = Backbone.Model.extend();
App.Collections.Servers = Backbone.Collection.extend({
	model: App.Models.Server,
	url: function () {
		return this.document.location.origin + ConfigService + '/servers';
	}
});



/**
 * Views
 */
App.Views.ServerListView = Backbone.View.extend({

	tagName: 'table',
	template: _.template( '#server-template' );

	initialize: function () {
		this.model.bind( "reset", this.render, this );
	},

	render: function (eventName) {
		_.each(this.model.models, function (server) {
			$( this.el ).find( 'tbody' ).
				append( this.template(server.toJSON()) );
		}, this);
		return this;
	}

});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strelka-admin-0.0.1.pre7 data/strelka-admin/static/js/admin/app.js