right-rails 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/right_rails/helpers/forms.rb +34 -0
- data/lib/right_rails/helpers.rb +8 -0
- data/lib/right_rails.rb +1 -1
- data/public/images/rightjs-ui/rte.png +0 -0
- data/public/javascripts/right/i18n/de.js +62 -25
- data/public/javascripts/right/i18n/en-us.js +1 -1
- data/public/javascripts/right/i18n/es.js +62 -25
- data/public/javascripts/right/i18n/fi.js +71 -34
- data/public/javascripts/right/i18n/fr.js +62 -25
- data/public/javascripts/right/i18n/hu.js +66 -31
- data/public/javascripts/right/i18n/it.js +62 -25
- data/public/javascripts/right/i18n/jp.js +64 -27
- data/public/javascripts/right/i18n/nl.js +70 -32
- data/public/javascripts/right/i18n/pt-br.js +64 -26
- data/public/javascripts/right/i18n/ru.js +63 -25
- data/public/javascripts/right/i18n/ua.js +65 -27
- data/public/javascripts/right/rails-src.js +25 -23
- data/public/javascripts/right/rails.js +2 -2
- data/public/javascripts/right/rte-src.js +2685 -0
- data/public/javascripts/right/rte.js +7 -0
- data/spec/lib/right_rails/helpers/forms_spec.rb +25 -0
- metadata +27 -8
@@ -3,8 +3,9 @@
|
|
3
3
|
*
|
4
4
|
* Copyright (C) Nikolay Nemshilov
|
5
5
|
*/
|
6
|
-
|
7
|
-
|
6
|
+
RightJS.Object.each({
|
7
|
+
|
8
|
+
Calendar: {
|
8
9
|
Done: 'Готово',
|
9
10
|
Now: 'Сейчас',
|
10
11
|
NextMonth: 'Следующий месяц',
|
@@ -12,37 +13,29 @@ if (self.Calendar) {
|
|
12
13
|
NextYear: 'Следующий год',
|
13
14
|
PrevYear: 'Предыдущий год',
|
14
15
|
|
15
|
-
dayNames:
|
16
|
-
dayNamesShort:
|
17
|
-
dayNamesMin:
|
18
|
-
monthNames:
|
19
|
-
monthNamesShort:
|
20
|
-
}
|
21
|
-
}
|
16
|
+
dayNames: 'Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота'.split(' '),
|
17
|
+
dayNamesShort: 'Вск Пнд Втр Срд Чтв Птн Сбт'.split(' '),
|
18
|
+
dayNamesMin: 'Вс Пн Вт Ср Чт Пт Сб'.split(' '),
|
19
|
+
monthNames: 'Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь'.split(' '),
|
20
|
+
monthNamesShort: 'Янв Фев Мар Апр Май Инь Иль Авг Сен Окт Ноя Дек'.split(' ')
|
21
|
+
},
|
22
22
|
|
23
|
-
|
24
|
-
$ext(Lightbox.i18n, {
|
23
|
+
Lightbox: {
|
25
24
|
Close: 'Закрыть',
|
26
25
|
Prev: 'Предыдущее изображение',
|
27
26
|
Next: 'Следующее изображение'
|
28
|
-
}
|
29
|
-
}
|
27
|
+
},
|
30
28
|
|
31
|
-
|
32
|
-
$ext(InEdit.i18n, {
|
29
|
+
InEdit: {
|
33
30
|
Save: "Сохранить",
|
34
31
|
Cancel: "Отмена"
|
35
|
-
}
|
36
|
-
}
|
32
|
+
},
|
37
33
|
|
38
|
-
|
39
|
-
$ext(Colorpicker.i18n, {
|
34
|
+
Colorpicker: {
|
40
35
|
Done: 'Готово'
|
41
|
-
}
|
42
|
-
}
|
36
|
+
},
|
43
37
|
|
44
|
-
|
45
|
-
$ext(Dialog.i18n, {
|
38
|
+
Dialog: {
|
46
39
|
Ok: 'Готово',
|
47
40
|
Close: 'Закрыть',
|
48
41
|
Cancel: 'Отмена',
|
@@ -53,5 +46,50 @@ if (self.Dialog) {
|
|
53
46
|
Alert: 'Внимание!',
|
54
47
|
Confirm: 'Подтверждение',
|
55
48
|
Prompt: 'Ввод данных'
|
56
|
-
}
|
57
|
-
|
49
|
+
},
|
50
|
+
|
51
|
+
Rte: {
|
52
|
+
Clear: 'Очистить',
|
53
|
+
Save: 'Сохранить',
|
54
|
+
Source: 'Исходный код',
|
55
|
+
Bold: 'Жирный',
|
56
|
+
Italic: 'Наклонный',
|
57
|
+
Underline: 'Подчеркнутый',
|
58
|
+
Strike: 'Зачеркнутый',
|
59
|
+
Ttext: 'Моноширинный',
|
60
|
+
Header: 'Заголовок',
|
61
|
+
Cut: 'Вырезать',
|
62
|
+
Copy: 'Копировать',
|
63
|
+
Paste: 'Вставить',
|
64
|
+
Left: 'Ровнять по левому краю',
|
65
|
+
Center: 'Ровнять по центру',
|
66
|
+
Right: 'Ровнять по правому краю',
|
67
|
+
Justify: 'Ровнять по ширине',
|
68
|
+
Undo: 'Отменить',
|
69
|
+
Redo: 'Повторить',
|
70
|
+
Code: 'Блок кода',
|
71
|
+
Quote: 'Цитата',
|
72
|
+
Link: 'Добавить ссылку',
|
73
|
+
Image: 'Вставить картинку',
|
74
|
+
Video: 'Вставить видео',
|
75
|
+
Dotlist: 'Обычный список',
|
76
|
+
Numlist: 'Нумерованый список',
|
77
|
+
Indent: 'Добавить уровень',
|
78
|
+
Outdent: 'Убрать уровень',
|
79
|
+
Forecolor: 'Цвет текста',
|
80
|
+
Backcolor: 'Цвет подсветки',
|
81
|
+
Select: 'Выделить',
|
82
|
+
Remove: 'Удалить',
|
83
|
+
Format: 'Формат',
|
84
|
+
Fontname: 'Шрифт',
|
85
|
+
Fontsize: 'Размер',
|
86
|
+
Subscript: 'Нижний индекс',
|
87
|
+
Superscript: 'Верхний индекс',
|
88
|
+
UrlAddress: 'URL адрес'
|
89
|
+
}
|
90
|
+
|
91
|
+
}, function(module, i18n) {
|
92
|
+
if (self[module]) {
|
93
|
+
RightJS.$ext(self[module].i18n, i18n);
|
94
|
+
}
|
95
|
+
});
|
@@ -5,11 +5,12 @@
|
|
5
5
|
* Copyright (C) Nikolay Nemshilov
|
6
6
|
*/
|
7
7
|
if (self.Calendar) {
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
Calendar.Options.firstDay = 0;
|
9
|
+
}
|
10
|
+
|
11
|
+
RightJS.Object.each({
|
11
12
|
|
12
|
-
|
13
|
+
Calendar: {
|
13
14
|
Done: 'Гаразд',
|
14
15
|
Now: 'Зараз',
|
15
16
|
NextMonth: 'Наступный мiсяць',
|
@@ -17,37 +18,29 @@ if (self.Calendar) {
|
|
17
18
|
NextYear: 'Наступний рiк',
|
18
19
|
PrevYear: 'Попереднiй рiк',
|
19
20
|
|
20
|
-
dayNames:
|
21
|
-
dayNamesShort:
|
22
|
-
dayNamesMin:
|
23
|
-
monthNames:
|
24
|
-
monthNamesShort:
|
25
|
-
}
|
26
|
-
}
|
21
|
+
dayNames: 'Неділя Понеділок Вівторок Середа Четвер П\'ятниця Субота'.split(' '),
|
22
|
+
dayNamesShort: 'Ндл Пнд Втр Срд Чтв Птн Сбт'.split(' '),
|
23
|
+
dayNamesMin: 'Нд Пн Вт Ср Чт Пт Сб'.split(' '),
|
24
|
+
monthNames: 'Січень Лютий Березень Квітень Травень Червень Липень Серпень Вересень Жовтень Листопад Грудень'.split(' '),
|
25
|
+
monthNamesShort: 'Січ Лют Бер Квіт Трав Черв Лип Серп Вер Жовт Лист Груд'.split(' ')
|
26
|
+
},
|
27
27
|
|
28
|
-
|
29
|
-
$ext(Lightbox.i18n, {
|
28
|
+
Lightbox: {
|
30
29
|
Close: 'Сховати',
|
31
30
|
Prev: 'Попереднє зображення',
|
32
31
|
Next: 'Наступне зображення'
|
33
|
-
}
|
34
|
-
}
|
32
|
+
},
|
35
33
|
|
36
|
-
|
37
|
-
$ext(InEdit.i18n, {
|
34
|
+
InEdit: {
|
38
35
|
Save: "Зберегти",
|
39
36
|
Cancel: "Скасувати"
|
40
|
-
}
|
41
|
-
}
|
37
|
+
},
|
42
38
|
|
43
|
-
|
44
|
-
$ext(Colorpicker.i18n, {
|
39
|
+
Colorpicker: {
|
45
40
|
Done: 'Гаразд'
|
46
|
-
}
|
47
|
-
}
|
41
|
+
},
|
48
42
|
|
49
|
-
|
50
|
-
$ext(Dialog.i18n, {
|
43
|
+
Dialog: {
|
51
44
|
Ok: 'Гаразд',
|
52
45
|
Close: 'Сховати',
|
53
46
|
Cancel: 'Сховати',
|
@@ -57,5 +50,50 @@ if (self.Dialog) {
|
|
57
50
|
Alert: 'Внимание!',
|
58
51
|
Confirm: 'Подтверждение',
|
59
52
|
Prompt: 'Ввод данных'
|
60
|
-
}
|
61
|
-
|
53
|
+
},
|
54
|
+
|
55
|
+
Rte: {
|
56
|
+
Clear: 'Clear',
|
57
|
+
Save: 'Save',
|
58
|
+
Source: 'Source',
|
59
|
+
Bold: 'Bold',
|
60
|
+
Italic: 'Italic',
|
61
|
+
Underline: 'Underline',
|
62
|
+
Strike: 'Strike through',
|
63
|
+
Ttext: 'Typetext',
|
64
|
+
Header: 'Header',
|
65
|
+
Cut: 'Cut',
|
66
|
+
Copy: 'Copy',
|
67
|
+
Paste: 'Paste',
|
68
|
+
Left: 'Left',
|
69
|
+
Center: 'Center',
|
70
|
+
Right: 'Right',
|
71
|
+
Justify: 'Justify',
|
72
|
+
Undo: 'Undo',
|
73
|
+
Redo: 'Redo',
|
74
|
+
Code: 'Code block',
|
75
|
+
Quote: 'Block quote',
|
76
|
+
Link: 'Add link',
|
77
|
+
Image: 'Insert image',
|
78
|
+
Video: 'Insert video',
|
79
|
+
Dotlist: 'List with dots',
|
80
|
+
Numlist: 'List with numbers',
|
81
|
+
Indent: 'Indent',
|
82
|
+
Outdent: 'Outdent',
|
83
|
+
Forecolor: 'Text color',
|
84
|
+
Backcolor: 'Background color',
|
85
|
+
Select: 'Select',
|
86
|
+
Remove: 'Remove',
|
87
|
+
Format: 'Format',
|
88
|
+
Fontname: 'Font name',
|
89
|
+
Fontsize: 'Size',
|
90
|
+
Subscript: 'Subscript',
|
91
|
+
Superscript: 'Superscript',
|
92
|
+
UrlAddress: 'URL Address'
|
93
|
+
}
|
94
|
+
|
95
|
+
}, function(module, i18n) {
|
96
|
+
if (self[module]) {
|
97
|
+
RightJS.$ext(self[module].i18n, i18n);
|
98
|
+
}
|
99
|
+
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* RubyOnRails Support Module v2.2.
|
2
|
+
* RubyOnRails Support Module v2.2.2
|
3
3
|
* http://rightjs.org/plugins/rails
|
4
4
|
*
|
5
5
|
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
@@ -19,7 +19,7 @@ var R = RightJS,
|
|
19
19
|
Object = RightJS.Object;
|
20
20
|
|
21
21
|
RightJS.Rails = {
|
22
|
-
version: '2.2.
|
22
|
+
version: '2.2.2'
|
23
23
|
};
|
24
24
|
|
25
25
|
|
@@ -27,7 +27,7 @@ RightJS.Rails = {
|
|
27
27
|
/**
|
28
28
|
* Underscored aliases for Ruby On Rails
|
29
29
|
*
|
30
|
-
* Copyright (C) 2009-
|
30
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
31
31
|
*/
|
32
32
|
|
33
33
|
// the language and window level aliases
|
@@ -39,12 +39,12 @@ R([
|
|
39
39
|
RightJS.Options,
|
40
40
|
RightJS.Observer,
|
41
41
|
RightJS.Observer.prototype,
|
42
|
-
|
43
|
-
|
42
|
+
RightJS.Window.prototype,
|
43
|
+
RightJS.Document.prototype
|
44
44
|
]).each(function(object) {
|
45
45
|
for (var key in object) {
|
46
46
|
try { // some keys are not accessable
|
47
|
-
|
47
|
+
|
48
48
|
if (/[A-Z]/.test(key) && typeof(object[key]) === 'function') {
|
49
49
|
var u_key = R(key).underscored();
|
50
50
|
if (object[u_key] === null || object[u_key] === undefined) {
|
@@ -64,9 +64,9 @@ R([
|
|
64
64
|
RightJS.Input
|
65
65
|
]).each(function(object) {
|
66
66
|
if (!object) { return; }
|
67
|
-
|
67
|
+
|
68
68
|
var aliases = {}, methods = object.prototype;
|
69
|
-
|
69
|
+
|
70
70
|
for (var key in methods) {
|
71
71
|
if (/[A-Z]/.test(key) && typeof(methods[key]) === 'function') {
|
72
72
|
object.prototype[R(key).underscored()] = methods[key];
|
@@ -103,30 +103,29 @@ RightJS.$alias(RightJS.Array.prototype, {
|
|
103
103
|
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
104
104
|
*/
|
105
105
|
// tries to cancel the event via confirmation
|
106
|
-
|
106
|
+
function user_cancels(event, element) {
|
107
107
|
var message = element.get('data-confirm');
|
108
108
|
if (message && !confirm(message)) {
|
109
109
|
event.stop();
|
110
110
|
return true;
|
111
111
|
}
|
112
|
-
}
|
112
|
+
}
|
113
113
|
|
114
114
|
// adds XHR events to the element
|
115
|
-
|
115
|
+
function add_xhr_events(element, options) {
|
116
116
|
return Object.merge({
|
117
117
|
onCreate: function() { element.fire('ajax:loading', {xhr: this}); },
|
118
118
|
onComplete: function() { element.fire('ajax:complete', {xhr: this}); },
|
119
119
|
onSuccess: function() { element.fire('ajax:success', {xhr: this}); },
|
120
120
|
onFailure: function() { element.fire('ajax:failure', {xhr: this}); }
|
121
121
|
}, options);
|
122
|
-
}
|
122
|
+
}
|
123
123
|
|
124
124
|
// processes link clicks
|
125
|
-
|
126
|
-
var
|
125
|
+
function try_link_submit(event, link) {
|
126
|
+
var url = link.get('href'),
|
127
127
|
method = link.get('data-method'),
|
128
|
-
remote = link.get('data-remote')
|
129
|
-
url = link.get('href');
|
128
|
+
remote = link.get('data-remote');
|
130
129
|
|
131
130
|
if (user_cancels(event, link)) { return; }
|
132
131
|
if (method || remote) { event.stop(); }
|
@@ -142,21 +141,24 @@ var try_link_submit = function(event) {
|
|
142
141
|
token = $$('meta[name=csrf-token]')[0],
|
143
142
|
form = $E('form', {action: url, method: 'post'});
|
144
143
|
|
144
|
+
param = param && param.get('content');
|
145
|
+
token = token && token.get('content');
|
146
|
+
|
145
147
|
if (param && token) {
|
146
|
-
form.insert('<input type="hidden" name="'+param
|
148
|
+
form.insert('<input type="hidden" name="'+param+'" value="'+token+'" />');
|
147
149
|
}
|
148
150
|
|
149
151
|
form.insert('<input type="hidden" name="_method" value="'+method+'"/>')
|
150
152
|
.insertTo(document.body).submit();
|
151
153
|
}
|
152
|
-
}
|
154
|
+
}
|
153
155
|
|
154
156
|
// global events listeners
|
155
157
|
$(document).on({
|
156
158
|
click: function(event) {
|
157
|
-
var
|
158
|
-
if (
|
159
|
-
try_link_submit(event);
|
159
|
+
var link = event.find('a');
|
160
|
+
if (link) {
|
161
|
+
try_link_submit(event, link);
|
160
162
|
}
|
161
163
|
},
|
162
164
|
|
@@ -384,13 +386,13 @@ var RR = {
|
|
384
386
|
/**
|
385
387
|
* the document onload hooks
|
386
388
|
*
|
387
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
389
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
388
390
|
*/
|
389
391
|
$(document).on({
|
390
392
|
ready: function() {
|
391
393
|
RR.hide_flash();
|
392
394
|
},
|
393
|
-
|
395
|
+
|
394
396
|
click: function(event) {
|
395
397
|
RR.process_click(event);
|
396
398
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* RubyOnRails Support Module v2.2.
|
2
|
+
* RubyOnRails Support Module v2.2.2
|
3
3
|
* http://rightjs.org/plugins/rails
|
4
4
|
*
|
5
5
|
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
|
-
(function(a,b,c){var d=c,e=c.$,f=c.$$,g=c.$E,h=c.Xhr,i=c.Object;c.Rails={version:"2.2.
|
7
|
+
(function(a,b,c){function l(a,c){var d=c.get("href"),e=c.get("data-method"),i=c.get("data-remote");if(!j(a,c)){(e||i)&&a.stop();if(i)h.load(d,k(c,{method:e||"get",spinner:c.get("data-spinner")}));else if(e){var l=f("meta[name=csrf-param]")[0],m=f("meta[name=csrf-token]")[0],n=g("form",{action:d,method:"post"});l=l&&l.get("content"),m=m&&m.get("content"),l&&m&&n.insert('<input type="hidden" name="'+l+'" value="'+m+'" />'),n.insert('<input type="hidden" name="_method" value="'+e+'"/>').insertTo(b.body).submit()}}}function k(a,b){return i.merge({onCreate:function(){a.fire("ajax:loading",{xhr:this})},onComplete:function(){a.fire("ajax:complete",{xhr:this})},onSuccess:function(){a.fire("ajax:success",{xhr:this})},onFailure:function(){a.fire("ajax:failure",{xhr:this})}},b)}function j(a,b){var c=b.get("data-confirm");if(c&&!confirm(c)){a.stop();return!0}}var d=c,e=c.$,f=c.$$,g=c.$E,h=c.Xhr,i=c.Object;c.Rails={version:"2.2.2"},d([c.String.prototype,c.Array.prototype,c.Function.prototype,c.Object,c.Options,c.Observer,c.Observer.prototype,c.Window.prototype,c.Document.prototype]).each(function(a){for(var b in a)try{if(/[A-Z]/.test(b)&&typeof a[b]==="function"){var c=d(b).underscored();if(a[c]===null||a[c]===undefined)a[c]=a[b]}}catch(e){}}),d([c.Element,c.Event,c.Form,c.Input]).each(function(a){if(a){var b={},c=a.prototype;for(var e in c)/[A-Z]/.test(e)&&typeof c[e]==="function"&&(a.prototype[d(e).underscored()]=c[e])}}),c.$alias(c.String.prototype,{index_of:"indexOf",last_index_of:"lastIndexOf",to_f:"toFloat",to_i:"toInt",gsub:"replace",downcase:"toLowerCase",upcase:"toUpperCase",index:"indexOf",rindex:"lastIndexOf",strip:"trim"}),c.$alias(c.Array.prototype,{collect:"map",detect:"filter",index_of:"indexOf",last_index_of:"lastIndexOf",index:"indexOf",rindex:"lastIndexOf"}),e(b).on({click:function(a){var b=a.find("a");b&&l(a,b)},submit:function(a){var b=a.target;b.has("data-remote")&&!j(a,b)&&(a.stop(),b.send(k(b,{spinner:b.get("data-spinner")||b.first(".spinner")})))}});var m={Options:{format:"js",flashId:"flashes",flashHideFx:"slide",flashHideDelay:3200,highlightUpdates:!0,removeFx:"fade",insertFx:"fade",insertPosition:"bottom",linkToAjaxEdit:".ajax_edit",linkToAjaxDelete:".ajax_delete",rescanWithScopes:!0},update_flash:function(a){var b=e(this.Options.flashId);b&&this.replace(b,a).hide_flash();return this},hide_flash:function(){if(this.Options.flashHideDelay>-1){var a=e(this.Options.flashId);a&&a.visible()&&a.hide.bind(a,this.Options.flashHideFx).delay(this.Options.flashHideDelay)}return this},highlight:function(a){e(a)&&this.Options.highlightUpdates&&e(a).highlight();return this},insert:function(a,b,c){var d=c||this.Options.insertPosition,f,g=e(a).insert(b,d);switch(d){case"bottom":f=g.children().last();break;case"top":f=g.first();break;case"before":f=g.prev();break;case"after":f=g.next()}f&&this.Options.insertFx?f.hide().show(this.Options.insertFx,{onFinish:this.highlight.bind(this,f)}):this.highlight(f);return this.rescan(a)},replace:function(a,b){e(a).replace(b);return this.highlight(a).rescan(a)},remove:function(a){e(a)&&e(a).remove(this.Options.removeFx)},remotize_form:function(a){var b=e(a);b&&(b.remotize().enable()._.action+="."+this.Options.format);return this},replace_form:function(a,b){var c=e(a);c&&(c.replace(b),this.remotize_form(a));return this.rescan(a)},show_form_for:function(a,b){e(a).find("form").each("remove"),e(a).insert(b);return this.remotize_form(e(a).first("form")).rescan(a)},process_click:function(a){var b;(b=a.find("a"+this.Options.linkToAjaxEdit))?(a.stop(),h.load(b.get("href")+"."+this.Options.format)):(b=a.find("a"+this.Options.linkToAjaxDelete))&&b.has("onclick")&&(a.stop(),(new Function("return "+b.onclick.toString().replace(".submit",".send")))().call(b))},rescan:function(b){$w("Draggable Droppable Tabs Tags Slider Selectable").each(function(c){c in a&&a[c].rescan(this.Options.rescanWithScopes?b:null)},this);return this}};e(b).on({ready:function(){m.hide_flash()},click:function(a){m.process_click(a)}}),a.RR=m})(window,document,RightJS)
|