Sha256: c53786d5b7649cb21456b0912f738a9497f6f3e5aa68e6a4576b125612f78089

Contents?: true

Size: 1.61 KB

Versions: 5

Compression:

Stored size: 1.61 KB

Contents

// console.log("Loading PopoverView...");


Spontaneous.PopoverView = (function($, S) {
	var dom = S.Dom;
	var PopoverView = new JS.Class({
		initialize: function() {
			// should be over-ridden by subclasses
			// who should call #super
		},
		set_manager: function(manager) {
			this.manager = manager;
		},
		view: function() {
			// construct view
		},
		align: 'left',
		has_navigation: true,
		title: function() {
			return 'Popover';
		},
		width: function() {
			return 400;
		},
		position_from_event: function(target) {
			var p = this.position_from_element(target);
			// need to subtract the height of the top-bar because the
			// popover is positioned absolutely inside the data-pane but
			// given coordinates relative to the body
			p.top = p.top + 18 - 37 - this.attach_to().scrollTop();
			return p;
		},
		position_from_element: function(t) {
			var $t = $(t), o = this.element_position($t);
			o.top += $t.outerHeight();
			o.left += $t.outerWidth() / 2;
			return o;
		},
		element_position: function(el) {
			return $(el).offset();
		},
		position_from_mouse: function(event) {
			return {top: event.clientX, left: event.clientY};
		},
		after_open: function() {
		},
		close_text: function() {
			return 'Close';
		},
		close: function() {
			this.manager.close();
		},
		before_close: function() {
		},
		do_close: function() {
		},
		after_close: function() {
		},
		attach_to: function() {
			return Spontaneous.Popover.div();
		},
		// Should the popover scroll with the document?
		scroll: false,
		scroll_element: function() {
			return S.ContentArea.inner;
		}
	});
	return PopoverView;
})(jQuery, Spontaneous);



Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 application/js/popover_view.js
spontaneous-0.2.0.beta9 application/js/popover_view.js
spontaneous-0.2.0.beta8 application/js/popover_view.js
spontaneous-0.2.0.beta7 application/js/popover_view.js
spontaneous-0.2.0.beta6 application/js/popover_view.js