active_scaffold 3.2.17 → 3.2.18
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -1
- metadata +17 -261
- data/app/assets/images/active_scaffold/add.png +0 -0
- data/app/assets/images/active_scaffold/arrow_down.png +0 -0
- data/app/assets/images/active_scaffold/arrow_up.png +0 -0
- data/app/assets/images/active_scaffold/close.png +0 -0
- data/app/assets/images/active_scaffold/close_touch.png +0 -0
- data/app/assets/images/active_scaffold/config.png +0 -0
- data/app/assets/images/active_scaffold/cross.png +0 -0
- data/app/assets/images/active_scaffold/gears.png +0 -0
- data/app/assets/images/active_scaffold/indicator-small.gif +0 -0
- data/app/assets/images/active_scaffold/indicator.gif +0 -0
- data/app/assets/images/active_scaffold/magnifier.png +0 -0
- data/app/assets/javascripts/active_scaffold.js.erb +0 -19
- data/app/assets/javascripts/jquery/active_scaffold.js +0 -1113
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +0 -24
- data/app/assets/javascripts/jquery/draggable_lists.js +0 -27
- data/app/assets/javascripts/jquery/jquery.editinplace.js +0 -743
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +0 -7
- data/app/assets/javascripts/prototype/active_scaffold.js +0 -1107
- data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
- data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
- data/app/assets/javascripts/prototype/rico_corner.js +0 -370
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -7
- data/app/assets/stylesheets/active_scaffold-ie.css.scss +0 -54
- data/app/assets/stylesheets/active_scaffold.css.scss +0 -14
- data/app/assets/stylesheets/active_scaffold_colors.css.scss +0 -395
- data/app/assets/stylesheets/active_scaffold_extensions.css.erb +0 -2
- data/app/assets/stylesheets/active_scaffold_images.css.scss +0 -40
- data/app/assets/stylesheets/active_scaffold_layout.css +0 -936
- data/app/assets/stylesheets/blue-theme.css +0 -74
- data/config/locales/de.yml +0 -125
- data/config/locales/en.yml +0 -127
- data/config/locales/es.yml +0 -128
- data/config/locales/fr.yml +0 -131
- data/config/locales/hu.yml +0 -126
- data/config/locales/ja.yml +0 -126
- data/config/locales/ru.yml +0 -135
- data/frontends/default/views/_action_group.html.erb +0 -24
- data/frontends/default/views/_add_existing_form.html.erb +0 -30
- data/frontends/default/views/_base_form.html.erb +0 -53
- data/frontends/default/views/_create_form.html.erb +0 -8
- data/frontends/default/views/_create_form_on_list.html.erb +0 -6
- data/frontends/default/views/_field_search.html.erb +0 -32
- data/frontends/default/views/_form.html.erb +0 -28
- data/frontends/default/views/_form_association.html.erb +0 -17
- data/frontends/default/views/_form_association_footer.html.erb +0 -47
- data/frontends/default/views/_form_attribute.html.erb +0 -23
- data/frontends/default/views/_form_hidden_attribute.html.erb +0 -7
- data/frontends/default/views/_form_messages.html.erb +0 -5
- data/frontends/default/views/_horizontal_subform.html.erb +0 -22
- data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
- data/frontends/default/views/_horizontal_subform_header.html.erb +0 -11
- data/frontends/default/views/_horizontal_subform_record.html.erb +0 -43
- data/frontends/default/views/_human_conditions.html.erb +0 -1
- data/frontends/default/views/_list.html.erb +0 -18
- data/frontends/default/views/_list_actions.html.erb +0 -15
- data/frontends/default/views/_list_calculations.html.erb +0 -16
- data/frontends/default/views/_list_column_headings.html.erb +0 -12
- data/frontends/default/views/_list_header.html.erb +0 -10
- data/frontends/default/views/_list_inline_adapter.html.erb +0 -21
- data/frontends/default/views/_list_messages.html.erb +0 -28
- data/frontends/default/views/_list_pagination.html.erb +0 -11
- data/frontends/default/views/_list_pagination_links.html.erb +0 -9
- data/frontends/default/views/_list_record.html.erb +0 -13
- data/frontends/default/views/_list_record_columns.html.erb +0 -8
- data/frontends/default/views/_list_with_header.html.erb +0 -36
- data/frontends/default/views/_messages.html.erb +0 -10
- data/frontends/default/views/_refresh_list.js.erb +0 -1
- data/frontends/default/views/_render_field.js.erb +0 -20
- data/frontends/default/views/_row.html.erb +0 -1
- data/frontends/default/views/_search.html.erb +0 -34
- data/frontends/default/views/_search_attribute.html.erb +0 -10
- data/frontends/default/views/_show.html.erb +0 -8
- data/frontends/default/views/_show_columns.html.erb +0 -15
- data/frontends/default/views/_update_actions.html.erb +0 -9
- data/frontends/default/views/_update_calculations.js.erb +0 -4
- data/frontends/default/views/_update_form.html.erb +0 -6
- data/frontends/default/views/_update_messages.js.erb +0 -2
- data/frontends/default/views/_vertical_subform.html.erb +0 -12
- data/frontends/default/views/_vertical_subform_record.html.erb +0 -43
- data/frontends/default/views/action_confirmation.html.erb +0 -13
- data/frontends/default/views/add_existing.js.erb +0 -14
- data/frontends/default/views/add_existing_form.html.erb +0 -5
- data/frontends/default/views/create.html.erb +0 -5
- data/frontends/default/views/delete.html.erb +0 -13
- data/frontends/default/views/destroy.js.erb +0 -26
- data/frontends/default/views/edit_associated.js.erb +0 -12
- data/frontends/default/views/field_search.html.erb +0 -5
- data/frontends/default/views/form_messages.js.erb +0 -1
- data/frontends/default/views/list.html.erb +0 -1
- data/frontends/default/views/on_action_update.js.erb +0 -22
- data/frontends/default/views/on_create.js.erb +0 -38
- data/frontends/default/views/on_mark.js.erb +0 -6
- data/frontends/default/views/on_update.js.erb +0 -29
- data/frontends/default/views/refresh_list.js.erb +0 -2
- data/frontends/default/views/render_field.js.erb +0 -1
- data/frontends/default/views/row.js.erb +0 -2
- data/frontends/default/views/search.html.erb +0 -5
- data/frontends/default/views/show.html.erb +0 -5
- data/frontends/default/views/update.html.erb +0 -8
- data/frontends/default/views/update_column.js.erb +0 -15
- data/frontends/default/views/update_row.js.erb +0 -1
- data/lib/active_scaffold.rb +0 -373
- data/lib/active_scaffold/actions/common_search.rb +0 -22
- data/lib/active_scaffold/actions/core.rb +0 -203
- data/lib/active_scaffold/actions/create.rb +0 -139
- data/lib/active_scaffold/actions/delete.rb +0 -74
- data/lib/active_scaffold/actions/field_search.rb +0 -78
- data/lib/active_scaffold/actions/list.rb +0 -208
- data/lib/active_scaffold/actions/mark.rb +0 -89
- data/lib/active_scaffold/actions/nested.rb +0 -244
- data/lib/active_scaffold/actions/search.rb +0 -48
- data/lib/active_scaffold/actions/show.rb +0 -61
- data/lib/active_scaffold/actions/subform.rb +0 -23
- data/lib/active_scaffold/actions/update.rb +0 -156
- data/lib/active_scaffold/active_record_permissions.rb +0 -135
- data/lib/active_scaffold/attribute_params.rb +0 -200
- data/lib/active_scaffold/bridges.rb +0 -61
- data/lib/active_scaffold/bridges/ancestry.rb +0 -5
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +0 -39
- data/lib/active_scaffold/bridges/bitfields.rb +0 -6
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +0 -37
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -24
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -66
- data/lib/active_scaffold/bridges/cancan.rb +0 -15
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +0 -127
- data/lib/active_scaffold/bridges/carrierwave.rb +0 -12
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +0 -31
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +0 -10
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +0 -45
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +0 -17
- data/lib/active_scaffold/bridges/country_helper.rb +0 -9
- data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +0 -358
- data/lib/active_scaffold/bridges/date_picker.rb +0 -23
- data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -63
- data/lib/active_scaffold/bridges/date_picker/helper.rb +0 -180
- data/lib/active_scaffold/bridges/dragonfly.rb +0 -9
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +0 -34
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +0 -10
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +0 -27
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +0 -16
- data/lib/active_scaffold/bridges/file_column.rb +0 -11
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +0 -46
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +0 -57
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -34
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +0 -26
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +0 -43
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +0 -9
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -15
- data/lib/active_scaffold/bridges/paperclip.rb +0 -12
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +0 -27
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +0 -16
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +0 -36
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +0 -24
- data/lib/active_scaffold/bridges/record_select.rb +0 -11
- data/lib/active_scaffold/bridges/record_select/helpers.rb +0 -92
- data/lib/active_scaffold/bridges/semantic_attributes.rb +0 -5
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +0 -20
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -209
- data/lib/active_scaffold/bridges/tiny_mce.rb +0 -17
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +0 -46
- data/lib/active_scaffold/config/base.rb +0 -75
- data/lib/active_scaffold/config/core.rb +0 -236
- data/lib/active_scaffold/config/create.rb +0 -32
- data/lib/active_scaffold/config/delete.rb +0 -32
- data/lib/active_scaffold/config/field_search.rb +0 -79
- data/lib/active_scaffold/config/form.rb +0 -64
- data/lib/active_scaffold/config/list.rb +0 -247
- data/lib/active_scaffold/config/mark.rb +0 -30
- data/lib/active_scaffold/config/nested.rb +0 -42
- data/lib/active_scaffold/config/search.rb +0 -73
- data/lib/active_scaffold/config/show.rb +0 -31
- data/lib/active_scaffold/config/subform.rb +0 -35
- data/lib/active_scaffold/config/update.rb +0 -33
- data/lib/active_scaffold/configurable.rb +0 -29
- data/lib/active_scaffold/constraints.rb +0 -171
- data/lib/active_scaffold/data_structures/action_columns.rb +0 -142
- data/lib/active_scaffold/data_structures/action_link.rb +0 -185
- data/lib/active_scaffold/data_structures/action_links.rb +0 -191
- data/lib/active_scaffold/data_structures/actions.rb +0 -45
- data/lib/active_scaffold/data_structures/bridge.rb +0 -22
- data/lib/active_scaffold/data_structures/column.rb +0 -401
- data/lib/active_scaffold/data_structures/columns.rb +0 -75
- data/lib/active_scaffold/data_structures/error_message.rb +0 -24
- data/lib/active_scaffold/data_structures/nested_info.rb +0 -171
- data/lib/active_scaffold/data_structures/set.rb +0 -61
- data/lib/active_scaffold/data_structures/sorting.rb +0 -167
- data/lib/active_scaffold/engine.rb +0 -4
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +0 -20
- data/lib/active_scaffold/extensions/action_controller_rescueing.rb +0 -7
- data/lib/active_scaffold/extensions/action_view_rendering.rb +0 -115
- data/lib/active_scaffold/extensions/active_record_offset.rb +0 -12
- data/lib/active_scaffold/extensions/array.rb +0 -7
- data/lib/active_scaffold/extensions/cache_association.rb +0 -16
- data/lib/active_scaffold/extensions/localize.rb +0 -10
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +0 -12
- data/lib/active_scaffold/extensions/nil_id_in_url_params.rb +0 -7
- data/lib/active_scaffold/extensions/paginator_extensions.rb +0 -26
- data/lib/active_scaffold/extensions/reverse_associations.rb +0 -64
- data/lib/active_scaffold/extensions/routing_mapper.rb +0 -48
- data/lib/active_scaffold/extensions/to_label.rb +0 -8
- data/lib/active_scaffold/extensions/unsaved_associated.rb +0 -61
- data/lib/active_scaffold/extensions/unsaved_record.rb +0 -20
- data/lib/active_scaffold/extensions/usa_state.rb +0 -46
- data/lib/active_scaffold/finder.rb +0 -399
- data/lib/active_scaffold/helpers/association_helpers.rb +0 -42
- data/lib/active_scaffold/helpers/controller_helpers.rb +0 -94
- data/lib/active_scaffold/helpers/form_column_helpers.rb +0 -322
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +0 -64
- data/lib/active_scaffold/helpers/id_helpers.rb +0 -131
- data/lib/active_scaffold/helpers/list_column_helpers.rb +0 -374
- data/lib/active_scaffold/helpers/pagination_helpers.rb +0 -62
- data/lib/active_scaffold/helpers/search_column_helpers.rb +0 -257
- data/lib/active_scaffold/helpers/show_column_helpers.rb +0 -44
- data/lib/active_scaffold/helpers/view_helpers.rb +0 -398
- data/lib/active_scaffold/marked_model.rb +0 -38
- data/lib/active_scaffold/paginator.rb +0 -136
- data/lib/active_scaffold/responds_to_parent.rb +0 -70
- data/lib/active_scaffold/tableless.rb +0 -83
- data/lib/active_scaffold/version.rb +0 -9
- data/lib/active_scaffold_env.rb +0 -13
- data/lib/generators/active_scaffold/USAGE +0 -29
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
- data/lib/generators/active_scaffold_controller/USAGE +0 -19
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
- data/lib/generators/active_scaffold_controller/templates/controller.rb +0 -4
- data/lib/generators/active_scaffold_controller/templates/helper.rb +0 -2
- data/public/blank.html +0 -33
- data/shoulda_macros/macros.rb +0 -136
- data/vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/vendor/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/vendor/assets/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_228ef1_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ef8c08_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ffd27a_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +0 -1276
- data/vendor/assets/stylesheets/jquery-ui.css +0 -568
@@ -1,117 +0,0 @@
|
|
1
|
-
|
2
|
-
// TODO Change to dropping the name property off the input element when in example mode
|
3
|
-
TextFieldWithExample = Class.create();
|
4
|
-
TextFieldWithExample.prototype = {
|
5
|
-
initialize: function(inputElementId, defaultText, options) {
|
6
|
-
this.setOptions(options);
|
7
|
-
|
8
|
-
this.input = $(inputElementId);
|
9
|
-
this.name = this.input.name;
|
10
|
-
this.defaultText = defaultText;
|
11
|
-
this.createHiddenInput();
|
12
|
-
|
13
|
-
if (options.focus) this.input.focus();
|
14
|
-
this.checkAndShowExample();
|
15
|
-
if (options.focus) {
|
16
|
-
this.input.selectionStart = 0;
|
17
|
-
this.input.selectionEnd = 0;
|
18
|
-
}
|
19
|
-
|
20
|
-
Event.observe(this.input, "blur", this.onBlur.bindAsEventListener(this));
|
21
|
-
Event.observe(this.input, "focus", this.onFocus.bindAsEventListener(this));
|
22
|
-
Event.observe(this.input, "select", this.onFocus.bindAsEventListener(this));
|
23
|
-
Event.observe(this.input, "keydown", this.onKeyPress.bindAsEventListener(this));
|
24
|
-
Event.observe(this.input, "click", this.onClick.bindAsEventListener(this));
|
25
|
-
},
|
26
|
-
createHiddenInput: function() {
|
27
|
-
this.hiddenInput = document.createElement("input");
|
28
|
-
this.hiddenInput.type = "hidden";
|
29
|
-
this.hiddenInput.value = "";
|
30
|
-
this.input.parentNode.appendChild(this.hiddenInput);
|
31
|
-
},
|
32
|
-
setOptions: function(options) {
|
33
|
-
this.options = { exampleClassName: 'example' };
|
34
|
-
Object.extend(this.options, options || {});
|
35
|
-
},
|
36
|
-
onKeyPress: function(event) {
|
37
|
-
if (!event) var event = window.event;
|
38
|
-
var code = (event.which) ? event.which : event.keyCode
|
39
|
-
if (this.isAlphanumeric(code)) {
|
40
|
-
this.removeExample();
|
41
|
-
}
|
42
|
-
},
|
43
|
-
onBlur: function(event) {
|
44
|
-
this.checkAndShowExample();
|
45
|
-
},
|
46
|
-
onFocus: function(event) {
|
47
|
-
this.removeExample();
|
48
|
-
},
|
49
|
-
onClick: function(event) {
|
50
|
-
this.removeExample();
|
51
|
-
},
|
52
|
-
isAlphanumeric: function(keyCode) {
|
53
|
-
return keyCode >= 40 && keyCode <= 90;
|
54
|
-
},
|
55
|
-
checkAndShowExample: function() {
|
56
|
-
if (this.input.value == '') {
|
57
|
-
this.input.value = this.defaultText;
|
58
|
-
this.input.name = null;
|
59
|
-
this.hiddenInput.name = this.name;
|
60
|
-
Element.addClassName(this.input, this.options.exampleClassName);
|
61
|
-
}
|
62
|
-
},
|
63
|
-
removeExample: function() {
|
64
|
-
if (this.exampleShown()) {
|
65
|
-
this.input.value = '';
|
66
|
-
this.input.name = this.name;
|
67
|
-
this.hiddenInput.name = null;
|
68
|
-
Element.removeClassName(this.input, this.options.exampleClassName);
|
69
|
-
}
|
70
|
-
},
|
71
|
-
exampleShown: function() {
|
72
|
-
return Element.hasClassName(this.input, this.options.exampleClassName);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
Form.disable = function(form) {
|
77
|
-
var elements = this.getElements(form);
|
78
|
-
for (var i = 0; i < elements.length; i++) {
|
79
|
-
var element = elements[i];
|
80
|
-
try { element.blur(); } catch (e) {}
|
81
|
-
element.disabled = 'disabled';
|
82
|
-
Element.addClassName(element, 'disabled');
|
83
|
-
}
|
84
|
-
}
|
85
|
-
Form.enable = function(form) {
|
86
|
-
var elements = this.getElements(form);
|
87
|
-
for (var i = 0; i < elements.length; i++) {
|
88
|
-
var element = elements[i];
|
89
|
-
element.disabled = '';
|
90
|
-
Element.removeClassName(element, 'disabled');
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
DraggableLists = Class.create({
|
95
|
-
initialize: function(list) {
|
96
|
-
list = $(list).addClassName('draggable-list');
|
97
|
-
var list_selected = list.cloneNode(false).addClassName('selected');
|
98
|
-
list_selected.id += '_seleted';
|
99
|
-
list.select('input[type=checkbox]').each(function(item) {
|
100
|
-
var li = item.up('li');
|
101
|
-
li.down('label').htmlFor = null;
|
102
|
-
new Draggable(li, {revert: 'failure', ghosting: true});
|
103
|
-
if (item.checked) list_selected.insert(li.remove());
|
104
|
-
});
|
105
|
-
list.insert({after: list_selected});
|
106
|
-
Droppables.add(list, {hoverclass: 'hover', containment: list_selected.id, onDrop: this.drop_to_list});
|
107
|
-
Droppables.add(list_selected, {hoverclass: 'hover', containment: list.id, onDrop: this.drop_to_list});
|
108
|
-
list.undoPositioned(); // undo positioned to fix dragging from elements with overflow auto
|
109
|
-
list_selected.undoPositioned();
|
110
|
-
},
|
111
|
-
|
112
|
-
drop_to_list: function(draggable, droppable, event) {
|
113
|
-
droppable.insert(draggable.remove());
|
114
|
-
draggable.setStyle({left: '0px', top: '0px'});
|
115
|
-
draggable.down('input').checked = droppable.hasClassName('selected');
|
116
|
-
}
|
117
|
-
});
|
@@ -1,370 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
*
|
3
|
-
* Copyright 2005 Sabre Airline Solutions
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
6
|
-
* file except in compliance with the License. You may obtain a copy of the License at
|
7
|
-
*
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
*
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the
|
11
|
-
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
12
|
-
* either express or implied. See the License for the specific language governing permissions
|
13
|
-
* and limitations under the License.
|
14
|
-
**/
|
15
|
-
|
16
|
-
|
17
|
-
//-------------------- rico.js
|
18
|
-
var Rico = {
|
19
|
-
Version: '1.1.0',
|
20
|
-
prototypeVersion: parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1])
|
21
|
-
}
|
22
|
-
|
23
|
-
//-------------------- ricoColor.js
|
24
|
-
Rico.Color = Class.create();
|
25
|
-
|
26
|
-
Rico.Color.prototype = {
|
27
|
-
|
28
|
-
initialize: function(red, green, blue) {
|
29
|
-
this.rgb = { r: red, g : green, b : blue };
|
30
|
-
},
|
31
|
-
|
32
|
-
blend: function(other) {
|
33
|
-
this.rgb.r = Math.floor((this.rgb.r + other.rgb.r)/2);
|
34
|
-
this.rgb.g = Math.floor((this.rgb.g + other.rgb.g)/2);
|
35
|
-
this.rgb.b = Math.floor((this.rgb.b + other.rgb.b)/2);
|
36
|
-
},
|
37
|
-
|
38
|
-
asRGB: function() {
|
39
|
-
return "rgb(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ")";
|
40
|
-
},
|
41
|
-
|
42
|
-
asHex: function() {
|
43
|
-
return "#" + this.rgb.r.toColorPart() + this.rgb.g.toColorPart() + this.rgb.b.toColorPart();
|
44
|
-
},
|
45
|
-
|
46
|
-
asHSB: function() {
|
47
|
-
return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
|
48
|
-
},
|
49
|
-
|
50
|
-
toString: function() {
|
51
|
-
return this.asHex();
|
52
|
-
}
|
53
|
-
|
54
|
-
};
|
55
|
-
|
56
|
-
Rico.Color.createFromHex = function(hexCode) {
|
57
|
-
if(hexCode.length==4) {
|
58
|
-
var shortHexCode = hexCode;
|
59
|
-
var hexCode = '#';
|
60
|
-
for(var i=1;i<4;i++) hexCode += (shortHexCode.charAt(i) + shortHexCode.charAt(i));
|
61
|
-
}
|
62
|
-
if ( hexCode.indexOf('#') == 0 )
|
63
|
-
hexCode = hexCode.substring(1);
|
64
|
-
var red = hexCode.substring(0,2);
|
65
|
-
var green = hexCode.substring(2,4);
|
66
|
-
var blue = hexCode.substring(4,6);
|
67
|
-
return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
|
68
|
-
}
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Factory method for creating a color from the background of
|
72
|
-
* an HTML element.
|
73
|
-
*/
|
74
|
-
Rico.Color.createColorFromBackground = function(elem) {
|
75
|
-
|
76
|
-
//var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color"); // Changed to prototype style
|
77
|
-
var actualColor = $(elem).getStyle('backgroundColor');
|
78
|
-
|
79
|
-
if ( actualColor == "transparent" && elem.parentNode )
|
80
|
-
return Rico.Color.createColorFromBackground(elem.parentNode);
|
81
|
-
|
82
|
-
if ( actualColor == null )
|
83
|
-
return new Rico.Color(255,255,255);
|
84
|
-
|
85
|
-
if ( actualColor.indexOf("rgb(") == 0 ) {
|
86
|
-
var colors = actualColor.substring(4, actualColor.length - 1 );
|
87
|
-
var colorArray = colors.split(",");
|
88
|
-
return new Rico.Color( parseInt( colorArray[0] ),
|
89
|
-
parseInt( colorArray[1] ),
|
90
|
-
parseInt( colorArray[2] ) );
|
91
|
-
|
92
|
-
}
|
93
|
-
else if ( actualColor.indexOf("#") == 0 ) {
|
94
|
-
return Rico.Color.createFromHex(actualColor);
|
95
|
-
}
|
96
|
-
else
|
97
|
-
return new Rico.Color(255,255,255);
|
98
|
-
}
|
99
|
-
|
100
|
-
/* next two functions changed to mootools color.js functions */
|
101
|
-
Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
|
102
|
-
|
103
|
-
var br = Math.round(brightness / 100 * 255);
|
104
|
-
if (this[1] == 0){
|
105
|
-
return [br, br, br];
|
106
|
-
} else {
|
107
|
-
var hue = this[0] % 360;
|
108
|
-
var f = hue % 60;
|
109
|
-
var p = Math.round((brightness * (100 - saturation)) / 10000 * 255);
|
110
|
-
var q = Math.round((brightness * (6000 - saturation * f)) / 600000 * 255);
|
111
|
-
var t = Math.round((brightness * (6000 - saturation * (60 - f))) / 600000 * 255);
|
112
|
-
switch(Math.floor(hue / 60)){
|
113
|
-
case 0: return { r : br, g : t, b : p };
|
114
|
-
case 1: return { r : q, g : br, b : p };
|
115
|
-
case 2: return { r : p, g : br, b : t };
|
116
|
-
case 3: return { r : p, g : q, b : br };
|
117
|
-
case 4: return { r : t, g : p, b : br };
|
118
|
-
case 5: return { r : br, g : p, b : q };
|
119
|
-
}
|
120
|
-
}
|
121
|
-
return false;
|
122
|
-
}
|
123
|
-
|
124
|
-
Rico.Color.RGBtoHSB = function(red, green, blue) {
|
125
|
-
var hue, saturation, brightness;
|
126
|
-
var max = Math.max(red, green, blue), min = Math.min(red, green, blue);
|
127
|
-
var delta = max - min;
|
128
|
-
brightness = max / 255;
|
129
|
-
saturation = (max != 0) ? delta / max : 0;
|
130
|
-
if (saturation == 0){
|
131
|
-
hue = 0;
|
132
|
-
} else {
|
133
|
-
var rr = (max - red) / delta;
|
134
|
-
var gr = (max - green) / delta;
|
135
|
-
var br = (max - blue) / delta;
|
136
|
-
if (red == max) hue = br - gr;
|
137
|
-
else if (green == max) hue = 2 + rr - br;
|
138
|
-
else hue = 4 + gr - rr;
|
139
|
-
hue /= 6;
|
140
|
-
if (hue < 0) hue++;
|
141
|
-
}
|
142
|
-
return { h : Math.round(hue * 360), s : Math.round(saturation * 100), b : Math.round(brightness * 100)};
|
143
|
-
}
|
144
|
-
|
145
|
-
|
146
|
-
//-------------------- ricoCorner.js
|
147
|
-
Rico.Corner = {
|
148
|
-
|
149
|
-
round: function(e, options) {
|
150
|
-
var e = $(e);
|
151
|
-
this._setOptions(options);
|
152
|
-
|
153
|
-
var color = this.options.color;
|
154
|
-
if ( this.options.color == "fromElement" )
|
155
|
-
color = this._background(e);
|
156
|
-
|
157
|
-
var bgColor = this.options.bgColor;
|
158
|
-
if ( this.options.bgColor == "fromParent" )
|
159
|
-
bgColor = this._background(e.offsetParent);
|
160
|
-
|
161
|
-
this._roundCornersImpl(e, color, bgColor);
|
162
|
-
},
|
163
|
-
|
164
|
-
_roundCornersImpl: function(e, color, bgColor) {
|
165
|
-
if(this.options.border)
|
166
|
-
this._renderBorder(e,bgColor);
|
167
|
-
if(this._isTopRounded())
|
168
|
-
this._roundTopCorners(e,color,bgColor);
|
169
|
-
if(this._isBottomRounded())
|
170
|
-
this._roundBottomCorners(e,color,bgColor);
|
171
|
-
},
|
172
|
-
|
173
|
-
_renderBorder: function(el,bgColor) {
|
174
|
-
var borderValue = "1px solid " + this._borderColor(bgColor);
|
175
|
-
var borderL = "border-left: " + borderValue;
|
176
|
-
var borderR = "border-right: " + borderValue;
|
177
|
-
var style = "style='" + borderL + ";" + borderR + "'";
|
178
|
-
el.innerHTML = "<div " + style + ">" + el.innerHTML + "</div>"
|
179
|
-
},
|
180
|
-
|
181
|
-
_roundTopCorners: function(el, color, bgColor) {
|
182
|
-
var corner = this._createCorner(bgColor);
|
183
|
-
for(var i=0 ; i < this.options.numSlices ; i++ )
|
184
|
-
corner.appendChild(this._createCornerSlice(color,bgColor,i,"top"));
|
185
|
-
el.style.paddingTop = 0;
|
186
|
-
el.insertBefore(corner,el.firstChild);
|
187
|
-
},
|
188
|
-
|
189
|
-
_roundBottomCorners: function(el, color, bgColor) {
|
190
|
-
var corner = this._createCorner(bgColor);
|
191
|
-
for(var i=(this.options.numSlices-1) ; i >= 0 ; i-- )
|
192
|
-
corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));
|
193
|
-
el.style.paddingBottom = 0;
|
194
|
-
el.appendChild(corner);
|
195
|
-
},
|
196
|
-
|
197
|
-
_createCorner: function(bgColor) {
|
198
|
-
var corner = document.createElement("div");
|
199
|
-
corner.style.backgroundColor = (this._isTransparent() ? "transparent" : bgColor);
|
200
|
-
return corner;
|
201
|
-
},
|
202
|
-
|
203
|
-
_createCornerSlice: function(color,bgColor, n, position) {
|
204
|
-
var slice = document.createElement("span");
|
205
|
-
|
206
|
-
var inStyle = slice.style;
|
207
|
-
inStyle.backgroundColor = color;
|
208
|
-
inStyle.display = "block";
|
209
|
-
inStyle.height = "1px";
|
210
|
-
inStyle.overflow = "hidden";
|
211
|
-
inStyle.fontSize = "1px";
|
212
|
-
|
213
|
-
var borderColor = this._borderColor(color,bgColor);
|
214
|
-
if ( this.options.border && n == 0 ) {
|
215
|
-
inStyle.borderTopStyle = "solid";
|
216
|
-
inStyle.borderTopWidth = "1px";
|
217
|
-
inStyle.borderLeftWidth = "0px";
|
218
|
-
inStyle.borderRightWidth = "0px";
|
219
|
-
inStyle.borderBottomWidth = "0px";
|
220
|
-
inStyle.height = "0px"; // assumes css compliant box model
|
221
|
-
inStyle.borderColor = borderColor;
|
222
|
-
}
|
223
|
-
else if(borderColor) {
|
224
|
-
inStyle.borderColor = borderColor;
|
225
|
-
inStyle.borderStyle = "solid";
|
226
|
-
inStyle.borderWidth = "0px 1px";
|
227
|
-
}
|
228
|
-
|
229
|
-
if ( !this.options.compact && (n == (this.options.numSlices-1)) )
|
230
|
-
inStyle.height = "2px";
|
231
|
-
|
232
|
-
this._setMargin(slice, n, position);
|
233
|
-
this._setBorder(slice, n, position);
|
234
|
-
return slice;
|
235
|
-
},
|
236
|
-
|
237
|
-
_setOptions: function(options) {
|
238
|
-
this.options = {
|
239
|
-
corners : "all",
|
240
|
-
color : "fromElement",
|
241
|
-
bgColor : "fromParent",
|
242
|
-
blend : true,
|
243
|
-
border : false,
|
244
|
-
compact : false
|
245
|
-
}
|
246
|
-
Object.extend(this.options, options || {});
|
247
|
-
|
248
|
-
this.options.numSlices = this.options.compact ? 2 : 4;
|
249
|
-
if ( this._isTransparent() )
|
250
|
-
this.options.blend = false;
|
251
|
-
},
|
252
|
-
|
253
|
-
_whichSideTop: function() {
|
254
|
-
if ( this._hasString(this.options.corners, "all", "top") )
|
255
|
-
return "";
|
256
|
-
|
257
|
-
if ( this.options.corners.indexOf("tl") >= 0 && this.options.corners.indexOf("tr") >= 0 )
|
258
|
-
return "";
|
259
|
-
|
260
|
-
if (this.options.corners.indexOf("tl") >= 0)
|
261
|
-
return "left";
|
262
|
-
else if (this.options.corners.indexOf("tr") >= 0)
|
263
|
-
return "right";
|
264
|
-
return "";
|
265
|
-
},
|
266
|
-
|
267
|
-
_whichSideBottom: function() {
|
268
|
-
if ( this._hasString(this.options.corners, "all", "bottom") )
|
269
|
-
return "";
|
270
|
-
|
271
|
-
if ( this.options.corners.indexOf("bl")>=0 && this.options.corners.indexOf("br")>=0 )
|
272
|
-
return "";
|
273
|
-
|
274
|
-
if(this.options.corners.indexOf("bl") >=0)
|
275
|
-
return "left";
|
276
|
-
else if(this.options.corners.indexOf("br")>=0)
|
277
|
-
return "right";
|
278
|
-
return "";
|
279
|
-
},
|
280
|
-
|
281
|
-
_borderColor : function(color,bgColor) {
|
282
|
-
if ( color == "transparent" )
|
283
|
-
return bgColor;
|
284
|
-
else if ( this.options.border )
|
285
|
-
return this.options.border;
|
286
|
-
else if ( this.options.blend )
|
287
|
-
return this._blend( bgColor, color );
|
288
|
-
else
|
289
|
-
return "";
|
290
|
-
},
|
291
|
-
|
292
|
-
|
293
|
-
_setMargin: function(el, n, corners) {
|
294
|
-
var marginSize = this._marginSize(n);
|
295
|
-
var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
|
296
|
-
|
297
|
-
if ( whichSide == "left" ) {
|
298
|
-
el.style.marginLeft = marginSize + "px"; el.style.marginRight = "0px";
|
299
|
-
}
|
300
|
-
else if ( whichSide == "right" ) {
|
301
|
-
el.style.marginRight = marginSize + "px"; el.style.marginLeft = "0px";
|
302
|
-
}
|
303
|
-
else {
|
304
|
-
el.style.marginLeft = marginSize + "px"; el.style.marginRight = marginSize + "px";
|
305
|
-
}
|
306
|
-
},
|
307
|
-
|
308
|
-
_setBorder: function(el,n,corners) {
|
309
|
-
var borderSize = this._borderSize(n);
|
310
|
-
var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
|
311
|
-
if ( whichSide == "left" ) {
|
312
|
-
el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = "0px";
|
313
|
-
}
|
314
|
-
else if ( whichSide == "right" ) {
|
315
|
-
el.style.borderRightWidth = borderSize + "px"; el.style.borderLeftWidth = "0px";
|
316
|
-
}
|
317
|
-
else {
|
318
|
-
el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px";
|
319
|
-
}
|
320
|
-
if (this.options.border != false)
|
321
|
-
el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px";
|
322
|
-
},
|
323
|
-
|
324
|
-
_marginSize: function(n) {
|
325
|
-
if ( this._isTransparent() )
|
326
|
-
return 0;
|
327
|
-
|
328
|
-
var marginSizes = [ 5, 3, 2, 1 ];
|
329
|
-
var blendedMarginSizes = [ 3, 2, 1, 0 ];
|
330
|
-
var compactMarginSizes = [ 2, 1 ];
|
331
|
-
var smBlendedMarginSizes = [ 1, 0 ];
|
332
|
-
|
333
|
-
if ( this.options.compact && this.options.blend )
|
334
|
-
return smBlendedMarginSizes[n];
|
335
|
-
else if ( this.options.compact )
|
336
|
-
return compactMarginSizes[n];
|
337
|
-
else if ( this.options.blend )
|
338
|
-
return blendedMarginSizes[n];
|
339
|
-
else
|
340
|
-
return marginSizes[n];
|
341
|
-
},
|
342
|
-
|
343
|
-
_borderSize: function(n) {
|
344
|
-
var transparentBorderSizes = [ 5, 3, 2, 1 ];
|
345
|
-
var blendedBorderSizes = [ 2, 1, 1, 1 ];
|
346
|
-
var compactBorderSizes = [ 1, 0 ];
|
347
|
-
var actualBorderSizes = [ 0, 2, 0, 0 ];
|
348
|
-
|
349
|
-
if ( this.options.compact && (this.options.blend || this._isTransparent()) )
|
350
|
-
return 1;
|
351
|
-
else if ( this.options.compact )
|
352
|
-
return compactBorderSizes[n];
|
353
|
-
else if ( this.options.blend )
|
354
|
-
return blendedBorderSizes[n];
|
355
|
-
else if ( this.options.border )
|
356
|
-
return actualBorderSizes[n];
|
357
|
-
else if ( this._isTransparent() )
|
358
|
-
return transparentBorderSizes[n];
|
359
|
-
return 0;
|
360
|
-
},
|
361
|
-
|
362
|
-
_hasString: function(str) { for(var i=1 ; i<arguments.length ; i++) if (str.indexOf(arguments[i]) >= 0) return true; return false; },
|
363
|
-
_blend: function(c1, c2) { var cc1 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; },
|
364
|
-
_background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
|
365
|
-
_isTransparent: function() { return this.options.color == "transparent"; },
|
366
|
-
_isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); },
|
367
|
-
_isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); },
|
368
|
-
_hasSingleTextChild: function(el) { return el.childNodes.length == 1 && el.childNodes[0].nodeType == 3; }
|
369
|
-
}
|
370
|
-
|