Sha256: a0033c69499ff13bce9dd0ca9e8c3594362bd81747157f6f2255e2edd0f05a57

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 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

4 entries across 4 versions & 1 rubygems

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