Sha256: d18b7901c790cdc78c51a2d192ac5c3688db7b21711665e57b066e3c58408064

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

// console.log('Loading Editing Interface...')

Spontaneous.Editing = (function($, S) {
	var dom = S.Dom, Page = S.Page;

	var Editing = new JS.Singleton({
		include: Spontaneous.Properties,

		init: function(container) {
			this.container = dom.div('#data_pane');
			this.container.hide();
			container.append(this.container);
			return this;
		},
		display: function(page) {
			this.goto_page(page);
		},
		goto_page: function(page) {
			if (!page) { return; }
			this.container.show().fadeOut(0)
			S.Ajax.get(["/page", page.id].join("/"), this.page_loaded.bind(this));
			this.set('location', page);
		},
		page_loaded: function(page_data) {
			var page = this.get('page');
			if (page) { page.unload(); }
			page = new Page(page_data);
			page.watch('path', this.path_updated.bind(this));
			view = new S.Views.PageView(page);
			this.container.empty();
			this.container.append(view.panel());
			this.set('page', page);
			this.container.fadeIn(300);
		},
		path_updated: function(path) {
			this.set('path', path);
		},
		path: function() {
			var path = this.get('path');
			if (path) {
				return path;
			} else {
				return this.get('page').get('path');
			}
		},
		hide: function() {
			this.container.hide();
		},
		show: function() {
			this.container.show();
		}
	});
	return Editing;
})(jQuery, Spontaneous);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta5 application/js/editing.js
spontaneous-0.2.0.beta4 application/js/editing.js
spontaneous-0.2.0.beta3 application/js/editing.js
spontaneous-0.2.0.beta2 application/js/editing.js