//= require tent-client
//= require ./core
//= require ./config
//= require_self
//= require_tree ./routers
//= require_tree ./views
//= require_tree ./models

(function () {

	var Drop = window.Drop;

	_.extend(Drop, Marbles.Events, {
		Views: {},
		Models: {},
		Collections: {},
		Routers: {},
		Helpers: {

			fullPath: function (path) {
				prefix = Drop.config.PATH_PREFIX || '/';
				return (prefix + '/').replace(/\/+$/, '') + path;
			}

		},

		run: function (options) {
			if (!Marbles.history || Marbles.history.started) {
				return;
			}

			if (!options) {
				options = {};
			}

			if (!this.config.container) {
				this.config.container_el = document.getElementById('main');
			}

			this.initAppNav();

			// cleanup unwanted views before each route's handler is called
			Marbles.history.on('handler:before', function (handler, fragment, params) {
				React.unmountComponentAtNode(Drop.config.container_el);
			});

			Marbles.history.start(_.extend({ root: (this.config.PATH_PREFIX || '') + '/' }, options.history || {}));

			this.ready = true;
			this.trigger('ready');
		},

		initAppNav: function (options) {
			var appNav = React.renderComponent(
				Drop.Views.AppNav({}),
				document.getElementById('main-nav')
			);

			Marbles.history.on("handler:before", function (handler, fragment, params) {
				appNav.setState({
					activeFragment: fragment
				});
			});
		}
	});

	if (Drop.config_ready) {
		Drop.trigger('config:ready');
	}

})();

@@ -226,16 +226,35 @@
 .Events,
+ Marbles.Accessors,
  %7B%0A%09%09Vie
@@ -711,16 +711,221 @@
 ;%0A%09%09%09%7D%0A%0A
+%09%09%09this.set('current_entity', this.config.meta.content.entity)%0A%09%09%09this.client = new TentClient(this.current_entity, %7B%0A%09%09%09%09serverMetaPost: this.config.meta,%0A%09%09%09%09credentials: this.config.credentials%0A%09%09%09%7D);%0A%0A
 %09%09%09this.

Initialize tent client