riojs 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +24 -0
- data/VERSION +1 -0
- data/bin/rio +5 -0
- data/generators/rio_app/USAGE +19 -0
- data/generators/rio_app/rio_app_generator.rb +40 -0
- data/generators/rio_app/templates/app.build +10 -0
- data/generators/rio_app/templates/app.css +0 -0
- data/generators/rio_app/templates/app.js +20 -0
- data/generators/rio_app/templates/app_view.html.erb +19 -0
- data/generators/rio_app/templates/fixture.js +4 -0
- data/generators/rio_app/templates/rio.html.erb +18 -0
- data/generators/rio_app/templates/rio_controller.rb +2 -0
- data/generators/rio_app/templates/spec.js +7 -0
- data/generators/rio_component/USAGE +13 -0
- data/generators/rio_component/rio_component_generator.rb +16 -0
- data/generators/rio_component/templates/component.css +0 -0
- data/generators/rio_component/templates/component.js +11 -0
- data/generators/rio_component/templates/fixture.js +3 -0
- data/generators/rio_component/templates/spec.js +6 -0
- data/generators/rio_model/USAGE +12 -0
- data/generators/rio_model/rio_model_generator.rb +21 -0
- data/generators/rio_model/templates/fixture.js +3 -0
- data/generators/rio_model/templates/model.js +9 -0
- data/generators/rio_model/templates/spec.js +6 -0
- data/generators/rio_page/USAGE +14 -0
- data/generators/rio_page/rio_page_generator.rb +16 -0
- data/generators/rio_page/templates/fixture.js +3 -0
- data/generators/rio_page/templates/page.css +12 -0
- data/generators/rio_page/templates/page.js +12 -0
- data/generators/rio_page/templates/page.jst +64 -0
- data/generators/rio_page/templates/spec.js +6 -0
- data/generators/rio_resource/USAGE +20 -0
- data/generators/rio_resource/rio_resource_generator.rb +10 -0
- data/generators/rio_resource/templates/controller.rb +3 -0
- data/init.rb +4 -0
- data/install/config/juggernaut_hosts.yml +18 -0
- data/install/lib/tasks/rio.rake +1 -0
- data/install/script/rio_server +37 -0
- data/lib/rio/autospec.rb +86 -0
- data/lib/rio/install.rb +90 -0
- data/lib/rio/juggernaut.rb +212 -0
- data/lib/rio/path.rb +3 -0
- data/lib/rio/rio_compressor.rb +219 -0
- data/lib/rio/rio_file_controller.rb +16 -0
- data/lib/rio/rio_on_rails.rb +586 -0
- data/lib/rio/rio_proxy_controller.rb +60 -0
- data/lib/rio/rio_push_controller.rb +48 -0
- data/lib/rio/rio_routes.rb +24 -0
- data/lib/rio/rio_spec_controller.rb +70 -0
- data/lib/riojs.rb +14 -0
- data/lib/tasks/rio.rb +63 -0
- data/public/images/background-chiffon.png +0 -0
- data/public/images/button-gradient-overlay-down.png +0 -0
- data/public/images/button-gradient-overlay.png +0 -0
- data/public/images/icons/add.png +0 -0
- data/public/images/icons/error-big.png +0 -0
- data/public/images/icons/warning-big.png +0 -0
- data/public/images/rio-logo-big.png +0 -0
- data/public/images/rio-logo.png +0 -0
- data/public/images/splitter-handle-horizontal.png +0 -0
- data/public/images/splitter-handle-vertical.png +0 -0
- data/public/images/tab-bar-gradient-overlay.png +0 -0
- data/public/images/title-gradient-overlay.png +0 -0
- data/public/images/trash.gif +0 -0
- data/public/javascripts/components/accordion.js +144 -0
- data/public/javascripts/components/alert_box.js +59 -0
- data/public/javascripts/components/base.js +47 -0
- data/public/javascripts/components/box.js +63 -0
- data/public/javascripts/components/button.js +98 -0
- data/public/javascripts/components/checkbox.js +44 -0
- data/public/javascripts/components/container.js +265 -0
- data/public/javascripts/components/grid_view.js +107 -0
- data/public/javascripts/components/image.js +19 -0
- data/public/javascripts/components/input.js +171 -0
- data/public/javascripts/components/label.js +15 -0
- data/public/javascripts/components/lightbox.js +160 -0
- data/public/javascripts/components/link.js +43 -0
- data/public/javascripts/components/list_item.js +44 -0
- data/public/javascripts/components/list_view.js +192 -0
- data/public/javascripts/components/marquee.js +131 -0
- data/public/javascripts/components/menu.js +89 -0
- data/public/javascripts/components/notification.js +75 -0
- data/public/javascripts/components/overlay.js +134 -0
- data/public/javascripts/components/panel.js +146 -0
- data/public/javascripts/components/radio.js +46 -0
- data/public/javascripts/components/splitter.js +65 -0
- data/public/javascripts/components/tab_bar.js +64 -0
- data/public/javascripts/components/tab_panel.js +57 -0
- data/public/javascripts/components/textarea.js +223 -0
- data/public/javascripts/components/toggle_button.js +22 -0
- data/public/javascripts/components/tooltip.js +80 -0
- data/public/javascripts/lib/application.js +482 -0
- data/public/javascripts/lib/attr.js +760 -0
- data/public/javascripts/lib/benchmark.js +235 -0
- data/public/javascripts/lib/blank.html +39 -0
- data/public/javascripts/lib/boot.js +300 -0
- data/public/javascripts/lib/clipboard.js +96 -0
- data/public/javascripts/lib/collection_entity.js +46 -0
- data/public/javascripts/lib/component.js +129 -0
- data/public/javascripts/lib/console.js +75 -0
- data/public/javascripts/lib/console/apps/console.build +43 -0
- data/public/javascripts/lib/console/apps/console.js +28 -0
- data/public/javascripts/lib/console/blank.html +39 -0
- data/public/javascripts/lib/console/components/benchmark.js +196 -0
- data/public/javascripts/lib/console/components/console.js +352 -0
- data/public/javascripts/lib/console/components/dependencies_list.js +17 -0
- data/public/javascripts/lib/console/components/docs.js +66 -0
- data/public/javascripts/lib/console/components/playground.js +30 -0
- data/public/javascripts/lib/console/console.html +27 -0
- data/public/javascripts/lib/console/console_commands.js +287 -0
- data/public/javascripts/lib/console/console_commands.js.rej +21 -0
- data/public/javascripts/lib/console/console_mixin.js +22 -0
- data/public/javascripts/lib/console/docs/files.html +579 -0
- data/public/javascripts/lib/console/docs/index.html +323 -0
- data/public/javascripts/lib/console/docs/symbols/Object.html +291 -0
- data/public/javascripts/lib/console/docs/symbols/_global_.html +413 -0
- data/public/javascripts/lib/console/docs/symbols/rio.AIM.html +490 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Application.html +841 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Attr.html +1075 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Binding.html +272 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Component.html +419 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Cookie.html +543 -0
- data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask#initialize.html +270 -0
- data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask.html +391 -0
- data/public/javascripts/lib/console/docs/symbols/rio.JsTemplate.html +271 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Juggernaut.html +329 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Model.html +822 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Page.html +383 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Template.html +328 -0
- data/public/javascripts/lib/console/docs/symbols/rio.Utils.html +617 -0
- data/public/javascripts/lib/console/docs/symbols/rio.html +506 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_components_base.js.html +54 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_application.js.html +490 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_attr.js.html +768 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_boot.js.html +308 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_clipboard.js.html +103 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_collection_entity.js.html +53 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_component.js.html +137 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_cookie.js.html +81 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_delayed_task.js.html +68 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_file.js.html +80 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_flash_detect.js.html +129 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_form.js.html +95 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_id.js.html +50 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_inflector.js.html +167 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_js_template.js.html +283 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_juggernaut.js.html +303 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_key_map.js.html +68 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_layout_manager.js.html +175 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_log.js.html +17 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_model.js.html +1074 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_page.js.html +246 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_parameters.js.html +66 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_protohack.js.html +305 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_push.js.html +12 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_rsh.js.html +659 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_swfobject.js.html +12 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_tag.js.html +60 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_template.js.html +64 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_theme.js.html +105 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_undo.js.html +142 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_utils.js.html +87 -0
- data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_yaml.js.html +88 -0
- data/public/javascripts/lib/console/file-small.png +0 -0
- data/public/javascripts/lib/console/green-circle.png +0 -0
- data/public/javascripts/lib/console/loading.gif +0 -0
- data/public/javascripts/lib/console/pages/console_page.js +149 -0
- data/public/javascripts/lib/console/pages/console_page.jst +27 -0
- data/public/javascripts/lib/console/red-circle.png +0 -0
- data/public/javascripts/lib/cookie.js +74 -0
- data/public/javascripts/lib/delayed_task.js +61 -0
- data/public/javascripts/lib/dependencies.js +76 -0
- data/public/javascripts/lib/environment.js +30 -0
- data/public/javascripts/lib/event.simulate.js +137 -0
- data/public/javascripts/lib/expressinstall.swf +0 -0
- data/public/javascripts/lib/file.js +72 -0
- data/public/javascripts/lib/flash_detect.js +122 -0
- data/public/javascripts/lib/flashembed.min.js +16 -0
- data/public/javascripts/lib/form.js +88 -0
- data/public/javascripts/lib/id.js +43 -0
- data/public/javascripts/lib/inflector.js +160 -0
- data/public/javascripts/lib/instrumenter.js +106 -0
- data/public/javascripts/lib/js_template.js +275 -0
- data/public/javascripts/lib/jslint.js +4950 -0
- data/public/javascripts/lib/juggernaut.js +295 -0
- data/public/javascripts/lib/juggernaut.swf +0 -0
- data/public/javascripts/lib/key_map.js +60 -0
- data/public/javascripts/lib/layout_manager.js +167 -0
- data/public/javascripts/lib/model.js +1067 -0
- data/public/javascripts/lib/page.js +238 -0
- data/public/javascripts/lib/parameters.js +59 -0
- data/public/javascripts/lib/png_fix.js +75 -0
- data/public/javascripts/lib/protohack.js +297 -0
- data/public/javascripts/lib/push.js +5 -0
- data/public/javascripts/lib/rio.build +28 -0
- data/public/javascripts/lib/rio_development.build +5 -0
- data/public/javascripts/lib/rio_lint.js +66 -0
- data/public/javascripts/lib/rsh.js +651 -0
- data/public/javascripts/lib/spec.js +545 -0
- data/public/javascripts/lib/spec_runner.js +242 -0
- data/public/javascripts/lib/swfobject.js +5 -0
- data/public/javascripts/lib/tag.js +52 -0
- data/public/javascripts/lib/undo.js +134 -0
- data/public/javascripts/lib/utils.js +80 -0
- data/public/javascripts/lib/yaml.js +80 -0
- data/public/javascripts/pages/playground_page.js +15 -0
- data/public/javascripts/prototype/builder.js +146 -0
- data/public/javascripts/prototype/controls.js +1004 -0
- data/public/javascripts/prototype/dragdrop.js +1030 -0
- data/public/javascripts/prototype/effects.js +1137 -0
- data/public/javascripts/prototype/prototype.js +4320 -0
- data/public/javascripts/prototype/slider.js +283 -0
- data/public/javascripts/prototype/sound.js +67 -0
- data/public/javascripts/specs/components/box_spec.js +6 -0
- data/public/javascripts/specs/components/checkbox_spec.js +26 -0
- data/public/javascripts/specs/components/container_spec.js +6 -0
- data/public/javascripts/specs/components/input_spec.js +71 -0
- data/public/javascripts/specs/components/panel_spec.js +6 -0
- data/public/javascripts/specs/components/radio_spec.js +40 -0
- data/public/javascripts/specs/fixtures/components/box.js +3 -0
- data/public/javascripts/specs/fixtures/components/checkbox.js +9 -0
- data/public/javascripts/specs/fixtures/components/container.js +3 -0
- data/public/javascripts/specs/fixtures/components/input.js +12 -0
- data/public/javascripts/specs/fixtures/components/menu.js +19 -0
- data/public/javascripts/specs/fixtures/components/menu_item.js +18 -0
- data/public/javascripts/specs/fixtures/components/radio.js +11 -0
- data/public/javascripts/specs/lib/application_spec.js +281 -0
- data/public/javascripts/specs/lib/attr_spec.js +1514 -0
- data/public/javascripts/specs/lib/benchmark_spec.js +361 -0
- data/public/javascripts/specs/lib/collection_entity_spec.js +131 -0
- data/public/javascripts/specs/lib/component_spec.js +86 -0
- data/public/javascripts/specs/lib/form_spec.js +171 -0
- data/public/javascripts/specs/lib/id_spec.js +21 -0
- data/public/javascripts/specs/lib/instrumenter_spec.js +5 -0
- data/public/javascripts/specs/lib/js_template_spec.js +131 -0
- data/public/javascripts/specs/lib/key_map_spec.js +227 -0
- data/public/javascripts/specs/lib/model_spec.js +2268 -0
- data/public/javascripts/specs/lib/parameters_spec.js +94 -0
- data/public/javascripts/specs/lib/spec_spec.js +943 -0
- data/public/javascripts/specs/lib/undo_spec.js +105 -0
- data/public/javascripts/specs/lib/yaml_spec.js +127 -0
- data/public/sounds/basso.wav +0 -0
- data/public/sounds/purr.wav +0 -0
- data/public/stylesheets/components/accordion.css +24 -0
- data/public/stylesheets/components/alert_box.css +35 -0
- data/public/stylesheets/components/box.css +0 -0
- data/public/stylesheets/components/button.css +39 -0
- data/public/stylesheets/components/checkbox.css +9 -0
- data/public/stylesheets/components/container.css +3 -0
- data/public/stylesheets/components/grid_view.css +52 -0
- data/public/stylesheets/components/input.css +10 -0
- data/public/stylesheets/components/label.css +3 -0
- data/public/stylesheets/components/lightbox.css +31 -0
- data/public/stylesheets/components/link.css +4 -0
- data/public/stylesheets/components/list_view.css +23 -0
- data/public/stylesheets/components/marquee.css +29 -0
- data/public/stylesheets/components/menu.css +34 -0
- data/public/stylesheets/components/notification.css +52 -0
- data/public/stylesheets/components/overlay.css +8 -0
- data/public/stylesheets/components/panel.css +36 -0
- data/public/stylesheets/components/radio.css +9 -0
- data/public/stylesheets/components/splitter.css +35 -0
- data/public/stylesheets/components/tab_bar.css +59 -0
- data/public/stylesheets/components/tab_panel.css +15 -0
- data/public/stylesheets/components/textarea.css +11 -0
- data/public/stylesheets/components/tooltip.css +10 -0
- data/public/stylesheets/console.css +151 -0
- data/public/stylesheets/css_reset.css +55 -0
- metadata +343 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
rio.Application.require("components/list_view");
|
2
|
+
|
3
|
+
rio.components.GridView = rio.Component.create(rio.components.ListView, "GridView", {
|
4
|
+
requireCss: "grid_view",
|
5
|
+
attrAccessors: [
|
6
|
+
["columns", []] // e.g. [{ header: "Name", renderer: function... }, { header: "Description", renderer: function... }]
|
7
|
+
],
|
8
|
+
attrReaders: [
|
9
|
+
["header", true],
|
10
|
+
["rowClassName", ""],
|
11
|
+
["rowHoverClassName", "gridItemHover"],
|
12
|
+
["rowSelectedClassName", "gridItemSelected"]
|
13
|
+
],
|
14
|
+
attrHtmls: ["header"],
|
15
|
+
styles: ["headerColor", "headerBackgroundColor", "headerPadding", "headerFontWeight"],
|
16
|
+
methods: {
|
17
|
+
initialize: function($super, options) {
|
18
|
+
$super(options);
|
19
|
+
this._listItemBuilder = function(item, renderer) {
|
20
|
+
return new rio.components.GridItem({
|
21
|
+
item: item,
|
22
|
+
columns: this.getColumns(),
|
23
|
+
rowClassName: this.getRowClassName(),
|
24
|
+
hoverClassName: this.getRowHoverClassName(),
|
25
|
+
selectedClassName: this.getRowSelectedClassName()
|
26
|
+
});
|
27
|
+
}.bind(this);
|
28
|
+
},
|
29
|
+
|
30
|
+
|
31
|
+
buildHtml: function() {
|
32
|
+
var boxHtml = this.boxHtml();
|
33
|
+
var gridBody = rio.Tag.tbody();
|
34
|
+
var gridHtml = rio.Tag.table([gridBody], { className: "listView", style: "width: 100%" });
|
35
|
+
|
36
|
+
this.addBindings(gridBody);
|
37
|
+
if (this.getHeader()) {
|
38
|
+
var gridHead = rio.Tag.thead();
|
39
|
+
gridHtml.insert({ top: gridHead });
|
40
|
+
gridHead.insert(this.headerHtml());
|
41
|
+
}
|
42
|
+
|
43
|
+
boxHtml.insert(gridHtml);
|
44
|
+
|
45
|
+
boxHtml.addClassName("gridView");
|
46
|
+
|
47
|
+
return boxHtml;
|
48
|
+
},
|
49
|
+
|
50
|
+
buildHeaderHtml: function() {
|
51
|
+
return rio.Tag.tr(
|
52
|
+
this.getColumns().map(function(column) {
|
53
|
+
var header = rio.Tag.td(column.header);
|
54
|
+
// header.applyStyle({
|
55
|
+
// color: this.headerColor,
|
56
|
+
// width: column.width,
|
57
|
+
// backgroundColor: this.headerBackgroundColor,
|
58
|
+
// padding: this.headerPadding,
|
59
|
+
// fontWeight: this.headerFontWeight,
|
60
|
+
// border: "1px solid #888"
|
61
|
+
// });
|
62
|
+
return header;
|
63
|
+
}.bind(this)),
|
64
|
+
{ className: "gridViewHeaderRow" }
|
65
|
+
);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
});
|
69
|
+
|
70
|
+
|
71
|
+
rio.components.GridItem = rio.Component.create(rio.components.ListItem, "GridItem", {
|
72
|
+
attrAccessors: [["columns", []], ["selected", false]],
|
73
|
+
attrReaders: ["rowClassName"],
|
74
|
+
attrEvents: ["click"],
|
75
|
+
methods: {
|
76
|
+
buildHtml: function() {
|
77
|
+
var rowClassName = this.getRowClassName();
|
78
|
+
var className = Object.isFunction(rowClassName) ? rowClassName(this.getItem()) : rowClassName;
|
79
|
+
var html = rio.Tag.tr(
|
80
|
+
this.getColumns().map(function(column) {
|
81
|
+
var cell = rio.Tag.td(column.renderer(this.getItem()));
|
82
|
+
cell.setStyle({
|
83
|
+
width: column.width,
|
84
|
+
textAlign: column.align || "left",
|
85
|
+
padding: (column.padding != undefined) ? column.padding : this.padding
|
86
|
+
});
|
87
|
+
return cell;
|
88
|
+
}.bind(this)),
|
89
|
+
{
|
90
|
+
className: className
|
91
|
+
}
|
92
|
+
);
|
93
|
+
|
94
|
+
html.addHoverClass(this.getHoverClassName());
|
95
|
+
html.observe("click", function() {
|
96
|
+
this.fire("click");
|
97
|
+
}.bind(this));
|
98
|
+
|
99
|
+
this.bind("selected", function(selected) {
|
100
|
+
html[selected ? "addClassName" : "removeClassName"](this.getSelectedClassName());
|
101
|
+
}.bind(this));
|
102
|
+
|
103
|
+
|
104
|
+
return html;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
rio.components.Image = new rio.Component.create(rio.components.Base, "Image", {
|
2
|
+
attrAccessors: ["src", "title"],
|
3
|
+
attrEvents: ["click"],
|
4
|
+
methods: {
|
5
|
+
buildHtml: function() {
|
6
|
+
var imgHtml = rio.Tag.img("");
|
7
|
+
this.src.bind(function(src) {
|
8
|
+
imgHtml.src = rio.url(src);
|
9
|
+
});
|
10
|
+
this.title.bind(function(title) {
|
11
|
+
imgHtml.title = title;
|
12
|
+
});
|
13
|
+
imgHtml.observe("click", function() {
|
14
|
+
this.fire("click");
|
15
|
+
}.bind(this));
|
16
|
+
return imgHtml;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
});
|
@@ -0,0 +1,171 @@
|
|
1
|
+
rio.Application.require("components/box");
|
2
|
+
|
3
|
+
rio.components.Input = rio.Component.create(rio.components.Box, "Input", {
|
4
|
+
requireCss: "input",
|
5
|
+
attrReaders: [
|
6
|
+
["className", ""],
|
7
|
+
["hoverClassName", ""],
|
8
|
+
["focusClassName", ""],
|
9
|
+
["placeHolderClassName", "inputPlaceHolder"],
|
10
|
+
["sync", "blur"], // options are "blur", "type", "none"
|
11
|
+
["typeSyncDelay", 250],
|
12
|
+
["tabIndex", 0],
|
13
|
+
["blurOnEnter", true],
|
14
|
+
["revertOnEscape", false],
|
15
|
+
["password", false],
|
16
|
+
["rioUndo", false],
|
17
|
+
["readOnly", false],
|
18
|
+
"placeHolderText"
|
19
|
+
],
|
20
|
+
attrAccessors: [
|
21
|
+
["value", ""],
|
22
|
+
["focus", false],
|
23
|
+
["enabled", true]
|
24
|
+
],
|
25
|
+
attrEvents: ["enter", "keyPress", "keyDown", "keyUp", "focus", "blur"],
|
26
|
+
methods: {
|
27
|
+
buildHtml: function() {
|
28
|
+
var inputHtml = rio.Tag.input("", {
|
29
|
+
href: "",
|
30
|
+
onclick: "return false;",
|
31
|
+
tabIndex: this.getTabIndex(),
|
32
|
+
className: "input",
|
33
|
+
type: this.getPassword() ? "password" : "text"
|
34
|
+
});
|
35
|
+
|
36
|
+
inputHtml.addHoverClass(this.getHoverClassName(), this.getFocusClassName());
|
37
|
+
|
38
|
+
this.readOnly.bind(function(readOnly) {
|
39
|
+
inputHtml.readOnly = readOnly;
|
40
|
+
});
|
41
|
+
|
42
|
+
var placeHolderApplies = function() {
|
43
|
+
return this.getPlaceHolderText() && (this.getValue() == undefined || this.getValue() == "");
|
44
|
+
}.bind(this);
|
45
|
+
|
46
|
+
var addPlaceHolderIfNeeded = function() {
|
47
|
+
if (placeHolderApplies()) {
|
48
|
+
inputHtml.addClassName("inputPlaceHolder");
|
49
|
+
inputHtml.value = this.getPlaceHolderText();
|
50
|
+
}
|
51
|
+
}.bind(this);
|
52
|
+
|
53
|
+
|
54
|
+
this.bind("value", function(value) {
|
55
|
+
inputHtml.value = value;
|
56
|
+
});
|
57
|
+
|
58
|
+
addPlaceHolderIfNeeded();
|
59
|
+
|
60
|
+
this.bind("focus", function(focus){
|
61
|
+
if(focus){
|
62
|
+
if (!this._nativeFocus) {
|
63
|
+
inputHtml.focus();
|
64
|
+
}
|
65
|
+
} else {
|
66
|
+
// if this is a native blur we shouldn't follow it up with another call to blur. It will result in weird behavior.
|
67
|
+
if (!this._nativeBlur) {
|
68
|
+
inputHtml.blur();
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}.bind(this));
|
72
|
+
this.bind("enabled", function(enabled) {
|
73
|
+
inputHtml.disabled = !enabled;
|
74
|
+
});
|
75
|
+
|
76
|
+
inputHtml.observe('blur', function() {
|
77
|
+
addPlaceHolderIfNeeded();
|
78
|
+
this._nativeBlur = true;
|
79
|
+
this.setFocus(false);
|
80
|
+
this._nativeBlur = false;
|
81
|
+
this.fire("blur");
|
82
|
+
}.bind(this));
|
83
|
+
inputHtml.observe('focus', function(){
|
84
|
+
if (placeHolderApplies()) {
|
85
|
+
inputHtml.value = "";
|
86
|
+
inputHtml.removeClassName("inputPlaceHolder");
|
87
|
+
}
|
88
|
+
this._nativeFocus = true;
|
89
|
+
this.setFocus(true);
|
90
|
+
this._nativeFocus = false;
|
91
|
+
this.fire("focus");
|
92
|
+
}.bind(this));
|
93
|
+
|
94
|
+
inputHtml.observe('change', function() {
|
95
|
+
if (this.getSync() != "none") {
|
96
|
+
this.setValue(inputHtml.value);
|
97
|
+
}
|
98
|
+
this.fire("change");
|
99
|
+
}.bind(this));
|
100
|
+
inputHtml.observe('keypress', function(e) {
|
101
|
+
if (e.keyCode == Event.KEY_RETURN) {
|
102
|
+
if(this.getBlurOnEnter()) {
|
103
|
+
inputHtml.blur();
|
104
|
+
}
|
105
|
+
this.fire('enter');
|
106
|
+
}
|
107
|
+
if (e.keyCode == Event.KEY_ESC && this.getRevertOnEscape()) {
|
108
|
+
inputHtml.value = this.getValue();
|
109
|
+
inputHtml.blur();
|
110
|
+
}
|
111
|
+
this.fire("keyPress", e);
|
112
|
+
}.bindAsEventListener(this));
|
113
|
+
inputHtml.observe('keydown', function(e) {
|
114
|
+
if (e.keyCode == 90 && e.metaKey && !this.getReadOnly()) {
|
115
|
+
if (this.getRioUndo() && (this.getValue() == inputHtml.value)) {
|
116
|
+
if (e.shiftKey) {
|
117
|
+
rio.Undo.redo();
|
118
|
+
} else {
|
119
|
+
rio.Undo.undo();
|
120
|
+
}
|
121
|
+
e.stop();
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
if (this.getSync() == "type") {
|
126
|
+
if (!this._syncAfter) { this._syncAfter = new rio.DelayedTask(); }
|
127
|
+
this._syncAfter.delay(this.getTypeSyncDelay(), function() {
|
128
|
+
this.setValue(inputHtml.value);
|
129
|
+
}, this);
|
130
|
+
}
|
131
|
+
this.fire("keyDown", e);
|
132
|
+
}.bindAsEventListener(this));
|
133
|
+
inputHtml.observe('keyup', function(e) {
|
134
|
+
this.fire("keyUp", e);
|
135
|
+
}.bindAsEventListener(this));
|
136
|
+
|
137
|
+
|
138
|
+
inputHtml.applyStyle(this.boxStyles());
|
139
|
+
|
140
|
+
return inputHtml;
|
141
|
+
},
|
142
|
+
forceFocus: function() {
|
143
|
+
this.setFocus(true);
|
144
|
+
this.html().focus();
|
145
|
+
},
|
146
|
+
clear: function() {
|
147
|
+
this.setValue("");
|
148
|
+
},
|
149
|
+
cursorEnd: function() {
|
150
|
+
this.setSelectionRange(this.getValue().length, this.getValue().length);
|
151
|
+
},
|
152
|
+
|
153
|
+
focusAndHighlight: function() {
|
154
|
+
this.setFocus(true);
|
155
|
+
this.setSelectionRange(0, (this.getValue() || "").length);
|
156
|
+
},
|
157
|
+
|
158
|
+
setSelectionRange: function(selectionStart, selectionEnd) {
|
159
|
+
var input = this.html();
|
160
|
+
if (input.setSelectionRange) {
|
161
|
+
input.setSelectionRange(selectionStart, selectionEnd);
|
162
|
+
} else if (input.createTextRange) {
|
163
|
+
var range = input.createTextRange();
|
164
|
+
range.collapse(true);
|
165
|
+
range.moveEnd('character', selectionEnd);
|
166
|
+
range.moveStart('character', selectionStart);
|
167
|
+
range.select();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
rio.components.Label = rio.Component.create(rio.components.Base, {
|
2
|
+
requireCss: "label",
|
3
|
+
attrAccessors: ["content"],
|
4
|
+
attrEvents: ["dblClick"],
|
5
|
+
methods: {
|
6
|
+
buildHtml: function() {
|
7
|
+
var labelHtml = rio.Tag.span();
|
8
|
+
this.content.bind(function(content) {
|
9
|
+
labelHtml.update(content);
|
10
|
+
});
|
11
|
+
labelHtml.observe("dblclick", this.fire.curry("dblClick").bind(this));
|
12
|
+
return labelHtml;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
@@ -0,0 +1,160 @@
|
|
1
|
+
// Copyright 2008, Thinklink
|
2
|
+
// Adapted from:
|
3
|
+
// - lightbox.js by Chris Cambell
|
4
|
+
|
5
|
+
rio.Application.require("components/overlay");
|
6
|
+
|
7
|
+
rio.components.Lightbox = rio.Component.create(rio.components.Overlay);
|
8
|
+
|
9
|
+
rio.components.Lightbox.requireCss("lightbox");
|
10
|
+
|
11
|
+
rio.components.Lightbox.attrAccessor("contentUrl");
|
12
|
+
rio.components.Lightbox.attrReader("content");
|
13
|
+
|
14
|
+
rio.components.Lightbox.attrHtml("outer", "lightbox", "loading");
|
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
|
+
}
|
32
|
+
|
33
|
+
if (!this._content) {
|
34
|
+
this._contentUrl = options.url || options.ctrl.href;
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
buildOuterHtml: function() {
|
39
|
+
var position = Prototype.Browser.IE ? "absolute" : "fixed";
|
40
|
+
var outerHtml = rio.Tag.div([this.loadingHtml(), this.lightboxHtml()], {className: "lightboxOuter", style: "display: none; position: " + position});
|
41
|
+
Element.insert(Element.body(), outerHtml);
|
42
|
+
return outerHtml;
|
43
|
+
},
|
44
|
+
|
45
|
+
buildLightboxHtml: function() {
|
46
|
+
return rio.Tag.div('', { className: 'lightbox' });
|
47
|
+
},
|
48
|
+
|
49
|
+
buildLoadingHtml: function() {
|
50
|
+
var position = Prototype.Browser.IE ? "absolute" : "fixed";
|
51
|
+
return rio.Tag.div(rio.Tag.img('', { src: "/images/lightbox-loading.gif" }), { className: 'lightboxLoading', style: "display: none; position: " + position });
|
52
|
+
},
|
53
|
+
|
54
|
+
// Turn everything on - mainly the IE fixes
|
55
|
+
activate: function($super){
|
56
|
+
if (this.isActive()) { return; }
|
57
|
+
|
58
|
+
if (rio.components.Lightbox.currentLightbox) { rio.components.Lightbox.deactivateCurrentLightbox(); }
|
59
|
+
|
60
|
+
$super();
|
61
|
+
rio.components.Lightbox.currentLightbox = this;
|
62
|
+
Event.observe(this.outerHtml(), 'click', this._outerLigthboxClick);
|
63
|
+
Element.show(this.outerHtml());
|
64
|
+
Element.show(this.loadingHtml());
|
65
|
+
this.loadInfo();
|
66
|
+
},
|
67
|
+
|
68
|
+
outerLightboxClick: function(e) {
|
69
|
+
if (this.getDeactivateOnClick() && !Element.descendantOf(e.element(), this.lightboxHtml())) {
|
70
|
+
this._deactivate();
|
71
|
+
}
|
72
|
+
},
|
73
|
+
|
74
|
+
// Begin Ajax request based off of the href of the clicked linked
|
75
|
+
loadInfo: function() {
|
76
|
+
if (this.getContent()) {
|
77
|
+
this.processInfo(this.getContent());
|
78
|
+
} else {
|
79
|
+
new Ajax.Request(this.getContentUrl(), {
|
80
|
+
method: 'get',
|
81
|
+
parameters: "",
|
82
|
+
onComplete: function(response) {
|
83
|
+
this.processInfo(response.responseText);
|
84
|
+
}.bind(this)
|
85
|
+
});
|
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
|
+
}
|
130
|
+
|
131
|
+
$super(skipFade);
|
132
|
+
Element.hide(this.outerHtml());
|
133
|
+
Event.stopObserving(window, "resize", this._resize);
|
134
|
+
Event.stopObserving(this.lightboxHtml(), 'click', this._markLightboxEvent);
|
135
|
+
Event.stopObserving(this.outerHtml(), 'click', this._outerLigthboxClick);
|
136
|
+
if (rio.components.Lightbox.currentLightbox == this) { rio.components.Lightbox.currentLightbox = null; }
|
137
|
+
|
138
|
+
this.fire("deactivate");
|
139
|
+
},
|
140
|
+
|
141
|
+
toggle: function() {
|
142
|
+
if (this.isActive()) { this.deactivate(); } else { this.activate(); }
|
143
|
+
}
|
144
|
+
});
|
145
|
+
|
146
|
+
Object.extend(rio.components.Lightbox, {
|
147
|
+
deactivateCurrentLightbox: function() {
|
148
|
+
if (this.currentLightbox) { this.currentLightbox.deactivate(); }
|
149
|
+
},
|
150
|
+
|
151
|
+
registerClassName: function(className) {
|
152
|
+
lbox = $$('.' + className).each(function(a) {
|
153
|
+
new rio.components.Lightbox({ ctrl: a });
|
154
|
+
});
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
/*-----------------------------------------------------------------------------------------------*/
|
159
|
+
|
160
|
+
Event.observe(window, 'load', function() { rio.components.Lightbox.registerClassName('lbOn'); });
|