riojs 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/public/images/sub-menu-indicator.png +0 -0
- data/public/javascripts/components/alert_box.js +34 -24
- data/public/javascripts/components/grid_view.js +32 -10
- data/public/javascripts/components/input.js +6 -0
- data/public/javascripts/components/lightbox.js +137 -141
- data/public/javascripts/components/list_view.js +2 -2
- data/public/javascripts/components/menu.js +93 -50
- data/public/javascripts/components/overlay.js +117 -118
- data/public/javascripts/components/popup.js +213 -0
- data/public/javascripts/components/toggle_button.js +3 -2
- data/public/javascripts/lib/console/docs/files.html +1 -1
- data/public/javascripts/lib/console/docs/index.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/Object.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/_global_.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Application.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Attr.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Binding.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Component.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Cookie.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask#initialize.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.JsTemplate.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Juggernaut.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Model.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Page.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.Utils.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/rio.html +1 -1
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_model.js.html +506 -493
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_page.js.html +5 -5
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_protohack.js.html +126 -123
- data/public/javascripts/lib/model.js +18 -5
- data/public/javascripts/lib/page.js +5 -5
- data/public/javascripts/lib/protohack.js +12 -9
- data/public/javascripts/specs/lib/model_spec.js +13 -0
- data/public/stylesheets/components/alert_box.css +5 -1
- data/public/stylesheets/components/menu.css +17 -17
- data/public/stylesheets/components/popup.css +18 -0
- metadata +5 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
Binary file
|
@@ -1,38 +1,42 @@
|
|
1
1
|
rio.components.AlertBox = rio.Component.create("AlertBox", {
|
2
|
-
require: ["components/
|
2
|
+
require: ["components/popup", "components/button"],
|
3
3
|
requireCss: "alert_box",
|
4
4
|
attrReaders: [
|
5
|
-
"
|
5
|
+
"content",
|
6
6
|
["title", "Alert"],
|
7
|
-
["
|
7
|
+
["buttons", [{ text: "OK" }]],
|
8
8
|
["deactivateOnEscape", true],
|
9
|
-
["deactivateOnClick", true]
|
9
|
+
["deactivateOnClick", true],
|
10
|
+
"width"
|
10
11
|
],
|
11
|
-
attrHtmls: ["
|
12
|
+
attrHtmls: ["content"],
|
12
13
|
attrEvents: ["close"],
|
13
14
|
methods: {
|
14
15
|
initialize: function() {
|
15
|
-
this.
|
16
|
-
content: this.
|
16
|
+
this._popup = new rio.components.Popup({
|
17
|
+
content: this.contentHtml(),
|
17
18
|
deactivateOnClick: this.getDeactivateOnClick(),
|
18
19
|
deactivateOnEscape: this.getDeactivateOnEscape(),
|
19
|
-
|
20
|
+
onDeactivate: this.fire.bind(this, "close")
|
20
21
|
});
|
21
|
-
this.
|
22
|
+
this._popup.activate();
|
22
23
|
},
|
23
24
|
|
24
|
-
|
25
|
-
var
|
25
|
+
buildContentHtml: function() {
|
26
|
+
var contentHtml = rio.Tag.div("", { className: "alertBoxBody" });
|
26
27
|
|
27
|
-
|
28
|
+
contentHtml.update(this.getContent());
|
28
29
|
|
29
|
-
var
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
var buttons = this.getButtons().map(function(b) {
|
31
|
+
return new rio.components.Button({
|
32
|
+
text: b.text,
|
33
|
+
iconSrc: b.iconSrc,
|
34
|
+
useNative: false,
|
35
|
+
onClick: this.close.bind(this, b.value)
|
36
|
+
});
|
37
|
+
}.bind(this));
|
34
38
|
|
35
|
-
var
|
39
|
+
var buttonsHtml = rio.Tag.div(buttons, { className: "alertButtons" });
|
36
40
|
|
37
41
|
var headerHtml = rio.Tag.div(this.getTitle(), {
|
38
42
|
className: "alertBoxTitle"
|
@@ -40,20 +44,26 @@ rio.components.AlertBox = rio.Component.create("AlertBox", {
|
|
40
44
|
|
41
45
|
var innerHtml = rio.Tag.div([
|
42
46
|
headerHtml,
|
43
|
-
|
44
|
-
|
47
|
+
contentHtml,
|
48
|
+
buttonsHtml
|
45
49
|
], {
|
46
50
|
className: "alertBoxInner"
|
47
51
|
});
|
48
52
|
|
49
|
-
|
53
|
+
var html = rio.Tag.div(innerHtml, {
|
50
54
|
className: "alertBox"
|
51
55
|
});
|
56
|
+
|
57
|
+
if (this.getWidth()) {
|
58
|
+
html.setStyle({ width: this.getWidth() });
|
59
|
+
}
|
60
|
+
|
61
|
+
return html;
|
52
62
|
},
|
53
63
|
|
54
|
-
close: function() {
|
55
|
-
this.
|
56
|
-
this.fire("close");
|
64
|
+
close: function(value) {
|
65
|
+
this._popup.deactivate();
|
66
|
+
this.fire("close", value);
|
57
67
|
}
|
58
68
|
}
|
59
69
|
});
|
@@ -9,20 +9,29 @@ rio.components.GridView = rio.Component.create(rio.components.ListView, "GridVie
|
|
9
9
|
["header", true],
|
10
10
|
["rowClassName", ""],
|
11
11
|
["rowHoverClassName", "gridItemHover"],
|
12
|
-
["rowSelectedClassName", "gridItemSelected"]
|
12
|
+
["rowSelectedClassName", "gridItemSelected"],
|
13
|
+
["handleContextMenu", false]
|
13
14
|
],
|
14
15
|
attrHtmls: ["header"],
|
16
|
+
attrEvents: ["contextMenu"],
|
15
17
|
methods: {
|
16
18
|
initialize: function($super, options) {
|
17
19
|
$super(options);
|
18
20
|
this._listItemBuilder = function(item, renderer) {
|
19
|
-
|
21
|
+
var gridItem = new rio.components.GridItem({
|
20
22
|
item: item,
|
21
23
|
columns: this.getColumns(),
|
22
24
|
rowClassName: this.getRowClassName(),
|
23
25
|
hoverClassName: this.getRowHoverClassName(),
|
24
|
-
selectedClassName: this.getRowSelectedClassName()
|
26
|
+
selectedClassName: this.getRowSelectedClassName(),
|
27
|
+
handleContextMenu: this.getHandleContextMenu()
|
25
28
|
});
|
29
|
+
|
30
|
+
if (this.getHandleContextMenu()) {
|
31
|
+
gridItem.observe("contextMenu", this.fire.bind(this, "contextMenu"));
|
32
|
+
}
|
33
|
+
|
34
|
+
return gridItem;
|
26
35
|
}.bind(this);
|
27
36
|
},
|
28
37
|
|
@@ -49,7 +58,13 @@ rio.components.GridView = rio.Component.create(rio.components.ListView, "GridVie
|
|
49
58
|
buildHeaderHtml: function() {
|
50
59
|
return rio.Tag.tr(
|
51
60
|
this.getColumns().map(function(column) {
|
52
|
-
|
61
|
+
var td = rio.Tag.td(column.header);
|
62
|
+
if (column.width) {
|
63
|
+
td.setStyle({
|
64
|
+
width: column.width
|
65
|
+
});
|
66
|
+
}
|
67
|
+
return td;
|
53
68
|
}.bind(this)),
|
54
69
|
{ className: "gridViewHeaderRow" }
|
55
70
|
);
|
@@ -60,15 +75,15 @@ rio.components.GridView = rio.Component.create(rio.components.ListView, "GridVie
|
|
60
75
|
|
61
76
|
rio.components.GridItem = rio.Component.create(rio.components.ListItem, "GridItem", {
|
62
77
|
attrAccessors: [["columns", []], ["selected", false]],
|
63
|
-
attrReaders: ["rowClassName"],
|
64
|
-
attrEvents: ["click"],
|
78
|
+
attrReaders: ["rowClassName", "handleContextMenu"],
|
79
|
+
attrEvents: ["click", "contextMenu"],
|
65
80
|
methods: {
|
66
81
|
buildHtml: function() {
|
67
82
|
var rowClassName = this.getRowClassName();
|
68
83
|
var className = Object.isFunction(rowClassName) ? rowClassName(this.getItem()) : rowClassName;
|
69
84
|
var html = rio.Tag.tr(
|
70
85
|
this.getColumns().map(function(column) {
|
71
|
-
var cell = rio.Tag.td(column.renderer(this.getItem()));
|
86
|
+
var cell = rio.Tag.td(column.renderer(this.getItem(), this));
|
72
87
|
cell.setStyle({
|
73
88
|
width: column.width,
|
74
89
|
textAlign: column.align || "left",
|
@@ -82,9 +97,16 @@ rio.components.GridItem = rio.Component.create(rio.components.ListItem, "GridIte
|
|
82
97
|
);
|
83
98
|
|
84
99
|
html.addHoverClass(this.getHoverClassName());
|
85
|
-
html.observe("click", function() {
|
86
|
-
this.fire("click");
|
87
|
-
}.
|
100
|
+
html.observe("click", function(e) {
|
101
|
+
this.fire("click", e);
|
102
|
+
}.bindAsEventListener(this));
|
103
|
+
|
104
|
+
if (this.getHandleContextMenu()) {
|
105
|
+
html.observe("contextmenu", function(e) {
|
106
|
+
this.fire("contextMenu", this, e);
|
107
|
+
e.stop();
|
108
|
+
}.bindAsEventListener(this));
|
109
|
+
}
|
88
110
|
|
89
111
|
this.bind("selected", function(selected) {
|
90
112
|
html[selected ? "addClassName" : "removeClassName"](this.getSelectedClassName());
|
@@ -130,6 +130,12 @@ rio.components.Input = rio.Component.create(rio.components.Box, "Input", {
|
|
130
130
|
this.setValue(inputHtml.value);
|
131
131
|
}, this);
|
132
132
|
}
|
133
|
+
|
134
|
+
if (e.keyCode == Event.KEY_ESC && this.getRevertOnEscape()) {
|
135
|
+
inputHtml.value = this.getValue();
|
136
|
+
inputHtml.blur();
|
137
|
+
}
|
138
|
+
|
133
139
|
this.fire("keyDown", e);
|
134
140
|
}.bindAsEventListener(this));
|
135
141
|
inputHtml.observe('keyup', function(e) {
|
@@ -4,154 +4,150 @@
|
|
4
4
|
|
5
5
|
rio.Application.require("components/overlay");
|
6
6
|
|
7
|
-
rio.components.Lightbox = rio.Component.create(rio.components.Overlay
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
rio.components.Lightbox.attrEvent("deactivate");
|
17
|
-
|
18
|
-
rio.Component.extend(rio.components.Lightbox, {
|
19
|
-
initialize: function($super, options) {
|
20
|
-
$super(options);
|
21
|
-
|
22
|
-
this._keyDown = this.keyDown.bindAsEventListener(this);
|
23
|
-
this._deactivate = this.deactivate.bind(this);
|
24
|
-
this._outerLigthboxClick = this.outerLightboxClick.bindAsEventListener(this);
|
25
|
-
this._resize = this.resize.bindAsEventListener(this);
|
26
|
-
|
27
|
-
if (options.ctrl) {
|
28
|
-
options.ctrl = $(options.ctrl);
|
29
|
-
Event.observe(options.ctrl, 'click', this.activate.bindAsEventListener(this), false);
|
30
|
-
options.ctrl.onclick = function(){ return false; };
|
31
|
-
}
|
7
|
+
rio.components.Lightbox = rio.Component.create(rio.components.Overlay, "Lightbox", {
|
8
|
+
requireCss: "lightbox",
|
9
|
+
attrAccessors: ["contentUrl"],
|
10
|
+
attrReaders: ["content"],
|
11
|
+
attrHtmls: ["outer", "lightbox", "loading"],
|
12
|
+
attrEvents: ["deactivate"],
|
13
|
+
methods: {
|
14
|
+
initialize: function($super, options) {
|
15
|
+
$super(options);
|
32
16
|
|
33
|
-
|
34
|
-
this.
|
35
|
-
|
36
|
-
|
17
|
+
this._keyDown = this.keyDown.bindAsEventListener(this);
|
18
|
+
this._deactivate = this.deactivate.bind(this);
|
19
|
+
this._outerLigthboxClick = this.outerLightboxClick.bindAsEventListener(this);
|
20
|
+
this._resize = this.resize.bindAsEventListener(this);
|
37
21
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
22
|
+
if (options.ctrl) {
|
23
|
+
options.ctrl = $(options.ctrl);
|
24
|
+
Event.observe(options.ctrl, 'click', this.activate.bindAsEventListener(this), false);
|
25
|
+
options.ctrl.onclick = function(){ return false; };
|
26
|
+
}
|
27
|
+
|
28
|
+
if (!this._content) {
|
29
|
+
this._contentUrl = options.url || options.ctrl.href;
|
30
|
+
}
|
31
|
+
},
|
32
|
+
|
33
|
+
buildOuterHtml: function() {
|
34
|
+
var position = Prototype.Browser.IE ? "absolute" : "fixed";
|
35
|
+
var outerHtml = rio.Tag.div([this.loadingHtml(), this.lightboxHtml()], {className: "lightboxOuter", style: "display: none; position: " + position});
|
36
|
+
Element.insert(Element.body(), outerHtml);
|
37
|
+
return outerHtml;
|
38
|
+
},
|
39
|
+
|
40
|
+
buildLightboxHtml: function() {
|
41
|
+
return rio.Tag.div('', { className: 'lightbox' });
|
42
|
+
},
|
43
|
+
|
44
|
+
buildLoadingHtml: function() {
|
45
|
+
var position = Prototype.Browser.IE ? "absolute" : "fixed";
|
46
|
+
return rio.Tag.div(rio.Tag.img('', { src: "/images/lightbox-loading.gif" }), { className: 'lightboxLoading', style: "display: none; position: " + position });
|
47
|
+
},
|
48
|
+
|
49
|
+
// Turn everything on - mainly the IE fixes
|
50
|
+
activate: function($super){
|
51
|
+
if (this.isActive()) { return; }
|
52
|
+
|
53
|
+
if (rio.components.Lightbox.currentLightbox) { rio.components.Lightbox.deactivateCurrentLightbox(); }
|
54
|
+
|
55
|
+
$super();
|
56
|
+
rio.components.Lightbox.currentLightbox = this;
|
57
|
+
Event.observe(this.outerHtml(), 'click', this._outerLigthboxClick);
|
58
|
+
Element.show(this.outerHtml());
|
59
|
+
Element.show(this.loadingHtml());
|
60
|
+
this.loadInfo();
|
61
|
+
},
|
62
|
+
|
63
|
+
outerLightboxClick: function(e) {
|
64
|
+
if (this.getDeactivateOnClick() && !Element.descendantOf(e.element(), this.lightboxHtml())) {
|
65
|
+
this._deactivate();
|
66
|
+
}
|
67
|
+
},
|
68
|
+
|
69
|
+
// Begin Ajax request based off of the href of the clicked linked
|
70
|
+
loadInfo: function() {
|
71
|
+
if (this.getContent()) {
|
72
|
+
this.processInfo(this.getContent());
|
73
|
+
} else {
|
74
|
+
new Ajax.Request(this.getContentUrl(), {
|
75
|
+
method: 'get',
|
76
|
+
parameters: "",
|
77
|
+
onComplete: function(response) {
|
78
|
+
this.processInfo(response.responseText);
|
79
|
+
}.bind(this)
|
80
|
+
});
|
81
|
+
}
|
82
|
+
},
|
83
|
+
|
84
|
+
// Display Ajax response
|
85
|
+
processInfo: function(content){
|
86
|
+
this._contentHtml = rio.Tag.div('', { style: "visibility: hidden" });
|
87
|
+
Element.insert(this._contentHtml, content);
|
88
|
+
Element.insert(this.lightboxHtml(), this._contentHtml);
|
89
|
+
|
90
|
+
this.actions();
|
91
|
+
Event.observe(window, "resize", this._resize);
|
92
|
+
|
93
|
+
(function() {
|
94
|
+
this._contentHtml.style.visibility = "visible";
|
95
|
+
Element.hide(this.loadingHtml());
|
96
|
+
this.resize();
|
97
|
+
}.bind(this)).defer();
|
98
|
+
},
|
99
|
+
|
100
|
+
resize: function(e) {
|
101
|
+
var lbHeight = Element.getHeight(this.lightboxHtml());
|
102
|
+
var lbWidth = Element.getWidth(this.lightboxHtml());
|
103
|
+
var wHeight = document.viewport.getHeight();
|
104
|
+
var wWidth = document.viewport.getWidth();
|
105
|
+
|
106
|
+
Element.setStyle(this.lightboxHtml(), {
|
107
|
+
top: Math.max(wHeight - lbHeight, 0) / 2 + "px",
|
108
|
+
left: Math.max(wWidth - lbWidth, 0) / 2 + "px"
|
85
109
|
});
|
86
|
-
}
|
87
|
-
},
|
88
|
-
|
89
|
-
// Display Ajax response
|
90
|
-
processInfo: function(content){
|
91
|
-
this._contentHtml = rio.Tag.div('', { style: "visibility: hidden" });
|
92
|
-
Element.insert(this._contentHtml, content);
|
93
|
-
Element.insert(this.lightboxHtml(), this._contentHtml);
|
94
|
-
|
95
|
-
this.actions();
|
96
|
-
Event.observe(window, "resize", this._resize);
|
97
|
-
|
98
|
-
(function() {
|
99
|
-
this._contentHtml.style.visibility = "visible";
|
100
|
-
Element.hide(this.loadingHtml());
|
101
|
-
this.resize();
|
102
|
-
}.bind(this)).defer();
|
103
|
-
},
|
104
|
-
|
105
|
-
resize: function(e) {
|
106
|
-
var lbHeight = Element.getHeight(this.lightboxHtml());
|
107
|
-
var lbWidth = Element.getWidth(this.lightboxHtml());
|
108
|
-
var wHeight = document.viewport.getHeight();
|
109
|
-
var wWidth = document.viewport.getWidth();
|
110
|
-
|
111
|
-
Element.setStyle(this.lightboxHtml(), {
|
112
|
-
top: Math.max(wHeight - lbHeight, 0) / 2 + "px",
|
113
|
-
left: Math.max(wWidth - lbWidth, 0) / 2 + "px"
|
114
|
-
});
|
115
|
-
},
|
116
|
-
|
117
|
-
// Search through new links within the lightbox, and attach click event
|
118
|
-
actions: function(){
|
119
|
-
$$('.lbAction').each(function(a) {
|
120
|
-
Event.observe(a, 'click', this[a.rel].bindAsEventListener(this));
|
121
|
-
a.onclick = function(){ return false; };
|
122
|
-
}.bind(this));
|
123
|
-
},
|
124
|
-
|
125
|
-
// Example of creating your own functionality once lightbox is initiated
|
126
|
-
deactivate: function($super, skipFade){
|
127
|
-
if (Element.isRendered(this._contentHtml)) {
|
128
|
-
Element.remove(this._contentHtml);
|
129
|
-
}
|
110
|
+
},
|
130
111
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
});
|
112
|
+
// Search through new links within the lightbox, and attach click event
|
113
|
+
actions: function(){
|
114
|
+
$$('.lbAction').each(function(a) {
|
115
|
+
Event.observe(a, 'click', this[a.rel].bindAsEventListener(this));
|
116
|
+
a.onclick = function(){ return false; };
|
117
|
+
}.bind(this));
|
118
|
+
},
|
119
|
+
|
120
|
+
// Example of creating your own functionality once lightbox is initiated
|
121
|
+
deactivate: function($super, skipFade){
|
122
|
+
if (Element.isRendered(this._contentHtml)) {
|
123
|
+
Element.remove(this._contentHtml);
|
124
|
+
}
|
145
125
|
|
146
|
-
|
147
|
-
|
148
|
-
|
126
|
+
$super(skipFade);
|
127
|
+
Element.hide(this.outerHtml());
|
128
|
+
Event.stopObserving(window, "resize", this._resize);
|
129
|
+
Event.stopObserving(this.lightboxHtml(), 'click', this._markLightboxEvent);
|
130
|
+
Event.stopObserving(this.outerHtml(), 'click', this._outerLigthboxClick);
|
131
|
+
if (rio.components.Lightbox.currentLightbox == this) { rio.components.Lightbox.currentLightbox = null; }
|
132
|
+
|
133
|
+
this.fire("deactivate");
|
134
|
+
},
|
135
|
+
|
136
|
+
toggle: function() {
|
137
|
+
if (this.isActive()) { this.deactivate(); } else { this.activate(); }
|
138
|
+
}
|
149
139
|
},
|
150
140
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
}
|
141
|
+
classMethods: {
|
142
|
+
deactivateCurrentLightbox: function() {
|
143
|
+
if (this.currentLightbox) { this.currentLightbox.deactivate(); }
|
144
|
+
},
|
145
|
+
|
146
|
+
registerClassName: function(className) {
|
147
|
+
lbox = $$('.' + className).each(function(a) {
|
148
|
+
new rio.components.Lightbox({ ctrl: a });
|
149
|
+
});
|
150
|
+
}
|
155
151
|
}
|
156
152
|
});
|
157
153
|
|