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.
@@ -130,6 +130,24 @@ module RightRails::Helpers::Forms
130
130
  ).to_tags_field_tag(options)
131
131
  end
132
132
 
133
+ #
134
+ # a standalone RTE field tag
135
+ #
136
+ def rte_field_tag(name, value, options={})
137
+ text_area_tag name, value, Util.rte_options(self, options)
138
+ end
139
+
140
+ #
141
+ # a rte-field for a form
142
+ #
143
+ def rte_field(object_name, method, options={})
144
+ options = Util.rte_options(self, options)
145
+
146
+ ActionView::Helpers::InstanceTag.new(
147
+ object_name, method, self, options.delete(:object)
148
+ ).to_rte_field_tag(options)
149
+ end
150
+
133
151
  private
134
152
 
135
153
  #
@@ -239,6 +257,14 @@ private
239
257
  require_modules context, 'tags'
240
258
  unit_options(options, 'tags').merge(in_rightjs_1 ? {:rel => 'tags'} : {})
241
259
  end
260
+
261
+ #
262
+ # Prepares the RTE widget options
263
+ #
264
+ def rte_options(context, options)
265
+ require_modules context, 'rte'
266
+ unit_options(options, 'rte')
267
+ end
242
268
  end
243
269
  end
244
270
 
@@ -273,6 +299,10 @@ private
273
299
  def tags_field(name, options={})
274
300
  @template.tags_field(@object_name, name, objectify_options(options))
275
301
  end
302
+
303
+ def rte_field(name, options={})
304
+ @template.rte_field(@object_name, name, objectify_options(options))
305
+ end
276
306
  end
277
307
 
278
308
  module InstanceTagMethods
@@ -311,6 +341,10 @@ private
311
341
  def to_tags_field_tag(options)
312
342
  to_input_field_tag('text', options)
313
343
  end
344
+
345
+ def to_rte_field_tag(options)
346
+ to_text_area_tag(options)
347
+ end
314
348
  end
315
349
 
316
350
  def self.included(base)
@@ -133,6 +133,14 @@ module RightRails::Helpers
133
133
  maxHeight
134
134
  }
135
135
 
136
+ RTE_OPTION_KEYS = %w{
137
+ toolbar
138
+ autoresize
139
+ showToolbar
140
+ showStatus
141
+ videoSize
142
+ }
143
+
136
144
  SORTABLE_OPTION_KEYS = %w{
137
145
  url
138
146
  direction
data/lib/right_rails.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # The RightRails module. Just a namespace
3
3
  #
4
4
  module RightRails
5
- VERSION = '1.1.0'
5
+ VERSION = '1.2.1'
6
6
 
7
7
  autoload :Config, 'right_rails/config'
8
8
  autoload :JavaScriptGenerator, 'right_rails/java_script_generator'
Binary file
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * Copyright (C) Nikolay Nemshilov
5
5
  */
6
- if (self.Calendar) {
7
- $ext(Calendar.i18n, {
6
+ RightJS.Object.each({
7
+
8
+ Calendar: {
8
9
  Done: 'Erledigt',
9
10
  Now: 'Jetzt',
10
11
  NextMonth: 'Nächster Monat',
@@ -12,37 +13,29 @@ if (self.Calendar) {
12
13
  NextYear: 'Nächstes Jahr',
13
14
  PrevYear: 'Vorhergehendes Jahr',
14
15
 
15
- dayNames: $w('Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag'),
16
- dayNamesShort: $w('So Mo Di Mi Do Fr Sa'),
17
- dayNamesMin: $w('So Mo Di Mi Do Fr Sa'),
18
- monthNames: $w('Januar Februar März April Mai Juni Juli August September Oktober November Dezember'),
19
- monthNamesShort: $w('Jan Feb Mär Apr Mai Jun Jul Aug Sep Okt Nov Dez')
20
- });
21
- }
16
+ dayNames: 'Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag'.split(' '),
17
+ dayNamesShort: 'So Mo Di Mi Do Fr Sa'.split(' '),
18
+ dayNamesMin: 'So Mo Di Mi Do Fr Sa'.split(' '),
19
+ monthNames: 'Januar Februar März April Mai Juni Juli August September Oktober November Dezember'.split(' '),
20
+ monthNamesShort: 'Jan Feb Mär Apr Mai Jun Jul Aug Sep Okt Nov Dez'.split(' ')
21
+ },
22
22
 
23
- if (self.Lightbox) {
24
- $ext(Lightbox.i18n, {
23
+ Lightbox: {
25
24
  Close: 'Schliessen',
26
25
  Prev: 'Vorhergehendes Bild',
27
26
  Next: 'Nächstes Bild'
28
- });
29
- }
27
+ },
30
28
 
31
- if (self.InEdit) {
32
- $ext(InEdit.i18n, {
29
+ InEdit: {
33
30
  Save: "Speichern",
34
31
  Cancel: "Abbruch"
35
- });
36
- }
32
+ },
37
33
 
38
- if (self.Colorpicker) {
39
- $ext(Colorpicker.i18n, {
34
+ Colorpicker: {
40
35
  Done: 'Erledigt'
41
- });
42
- }
36
+ },
43
37
 
44
- if (self.Dialog) {
45
- $ext(Dialog.i18n, {
38
+ Dialog: {
46
39
  Ok: 'Ok',
47
40
  Close: 'Close',
48
41
  Cancel: 'Cancel',
@@ -53,6 +46,50 @@ if (self.Dialog) {
53
46
  Alert: 'Warning!',
54
47
  Confirm: 'Confirm',
55
48
  Prompt: 'Enter'
56
- })
57
- }
49
+ },
50
+
51
+ Rte: {
52
+ Clear: 'Clear',
53
+ Save: 'Save',
54
+ Source: 'Source',
55
+ Bold: 'Bold',
56
+ Italic: 'Italic',
57
+ Underline: 'Underline',
58
+ Strike: 'Strike through',
59
+ Ttext: 'Typetext',
60
+ Header: 'Header',
61
+ Cut: 'Cut',
62
+ Copy: 'Copy',
63
+ Paste: 'Paste',
64
+ Left: 'Left',
65
+ Center: 'Center',
66
+ Right: 'Right',
67
+ Justify: 'Justify',
68
+ Undo: 'Undo',
69
+ Redo: 'Redo',
70
+ Code: 'Code block',
71
+ Quote: 'Block quote',
72
+ Link: 'Add link',
73
+ Image: 'Insert image',
74
+ Video: 'Insert video',
75
+ Dotlist: 'List with dots',
76
+ Numlist: 'List with numbers',
77
+ Indent: 'Indent',
78
+ Outdent: 'Outdent',
79
+ Forecolor: 'Text color',
80
+ Backcolor: 'Background color',
81
+ Select: 'Select',
82
+ Remove: 'Remove',
83
+ Format: 'Format',
84
+ Fontname: 'Font name',
85
+ Fontsize: 'Size',
86
+ Subscript: 'Subscript',
87
+ Superscript: 'Superscript',
88
+ UrlAddress: 'URL Address'
89
+ }
58
90
 
91
+ }, function(module, i18n) {
92
+ if (self[module]) {
93
+ RightJS.$ext(self[module].i18n, i18n);
94
+ }
95
+ });
@@ -4,7 +4,7 @@
4
4
  * Copyright (C) Nikolay Nemshilov
5
5
  */
6
6
  if (self.Calendar) {
7
- $ext(Calendar.Options, {
7
+ RightJS.$ext(self.Calendar.Options, {
8
8
  firstDay: 0,
9
9
  format: 'US'
10
10
  });
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * Copyright (C) Nikolay Nemshilov
5
5
  */
6
- if (self.Calendar) {
7
- $ext(Calendar.i18n, {
6
+ RightJS.Object.each({
7
+
8
+ Calendar: {
8
9
  Done: 'Hecho',
9
10
  Now: 'Ahora',
10
11
  NextMonth: 'Mes siguiente',
@@ -12,37 +13,29 @@ if (self.Calendar) {
12
13
  NextYear: 'Año siguiente',
13
14
  PrevYear: 'Año precedente',
14
15
 
15
- dayNames: $w('Domingo Lunes Martes Miércoles Jueves Viernes Sábado'),
16
- dayNamesShort: $w('Dom Lun Mar Mié Jue Vie Sab'),
17
- dayNamesMin: $w('Do Lu Ma Mi Ju Vi Sa'),
18
- monthNames: $w('Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre'),
19
- monthNamesShort: $w('Ene Feb Mar Abr May Jun Jul Ago Sep Oct Nov Dic')
20
- });
21
- }
16
+ dayNames: 'Domingo Lunes Martes Miércoles Jueves Viernes Sábado'.split(' '),
17
+ dayNamesShort: 'Dom Lun Mar Mié Jue Vie Sab'.split(' '),
18
+ dayNamesMin: 'Do Lu Ma Mi Ju Vi Sa'.split(' '),
19
+ monthNames: 'Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre'.split(' '),
20
+ monthNamesShort: 'Ene Feb Mar Abr May Jun Jul Ago Sep Oct Nov Dic'.split(' ')
21
+ },
22
22
 
23
- if (self.Lightbox) {
24
- $ext(Lightbox.i18n, {
23
+ Lightbox: {
25
24
  Close: 'Cerrar',
26
25
  Prev: 'Imagen precedente',
27
26
  Next: 'Imagen siguiente'
28
- });
29
- }
27
+ },
30
28
 
31
- if (self.InEdit) {
32
- $ext(InEdit.i18n, {
29
+ InEdit: {
33
30
  Save: "Guardar",
34
31
  Cancel: "Borrar"
35
- });
36
- }
32
+ },
37
33
 
38
- if (self.Colorpicker) {
39
- $ext(Colorpicker.i18n, {
34
+ Colorpicker: {
40
35
  Done: 'Hecho'
41
- });
42
- }
36
+ },
43
37
 
44
- if (self.Dialog) {
45
- $ext(Dialog.i18n, {
38
+ Dialog: {
46
39
  Ok: 'Ok',
47
40
  Close: 'Cerrar',
48
41
  Cancel: 'Cancelar',
@@ -53,6 +46,50 @@ if (self.Dialog) {
53
46
  Alert: 'Aviso!',
54
47
  Confirm: 'Confirmar',
55
48
  Prompt: 'Entrar'
56
- })
57
- }
49
+ },
50
+
51
+ Rte: {
52
+ Clear: 'Clear',
53
+ Save: 'Save',
54
+ Source: 'Source',
55
+ Bold: 'Bold',
56
+ Italic: 'Italic',
57
+ Underline: 'Underline',
58
+ Strike: 'Strike through',
59
+ Ttext: 'Typetext',
60
+ Header: 'Header',
61
+ Cut: 'Cut',
62
+ Copy: 'Copy',
63
+ Paste: 'Paste',
64
+ Left: 'Left',
65
+ Center: 'Center',
66
+ Right: 'Right',
67
+ Justify: 'Justify',
68
+ Undo: 'Undo',
69
+ Redo: 'Redo',
70
+ Code: 'Code block',
71
+ Quote: 'Block quote',
72
+ Link: 'Add link',
73
+ Image: 'Insert image',
74
+ Video: 'Insert video',
75
+ Dotlist: 'List with dots',
76
+ Numlist: 'List with numbers',
77
+ Indent: 'Indent',
78
+ Outdent: 'Outdent',
79
+ Forecolor: 'Text color',
80
+ Backcolor: 'Background color',
81
+ Select: 'Select',
82
+ Remove: 'Remove',
83
+ Format: 'Format',
84
+ Fontname: 'Font name',
85
+ Fontsize: 'Size',
86
+ Subscript: 'Subscript',
87
+ Superscript: 'Superscript',
88
+ UrlAddress: 'URL Address'
89
+ }
58
90
 
91
+ }, function(module, i18n) {
92
+ if (self[module]) {
93
+ RightJS.$ext(self[module].i18n, i18n);
94
+ }
95
+ });
@@ -4,8 +4,9 @@
4
4
  * Copyright (C) Juho Vepsäläinen
5
5
  * Source: http://www.csc.fi/sivut/kotoistus/suositukset/vahv_kalenterit_cldr1_4.htm
6
6
  */
7
- if (self.Calendar) {
8
- $ext(Calendar.i18n, {
7
+ RightJS.Object.each({
8
+
9
+ Calendar: {
9
10
  Done: "OK",
10
11
  Now: "Tänään",
11
12
  NextMonth: "Seuraava kuukausi",
@@ -13,47 +14,83 @@ if (self.Calendar) {
13
14
  NextYear: "Seuraava vuosi",
14
15
  PrevYear: "Edellinen vuosi",
15
16
 
16
- dayNames: $w('Sunnuntai Maanantai Tiistai Keskiviikko Torstai Perjantai Lauantai'),
17
- dayNamesShort: $w('Su Ma Ti Ke To Pe La'),
18
- dayNamesMin: $w('S M T K T P L'),
19
- monthNames: $w('Tammikuu Helmikuu Maaliskuu Huhtikuu Toukokuu Kesäkuu Heinäkuu Elokuu Syyskuu Lokakuu Marraskuu Joulukuu'),
20
- monthNamesShort: $w('Tammi Helmi Maalis Huhti Touko Kesä Heinä Elo Syys Loka Marras Joulu')
21
- });
22
- }
17
+ dayNames: 'Sunnuntai Maanantai Tiistai Keskiviikko Torstai Perjantai Lauantai'.split(' '),
18
+ dayNamesShort: 'Su Ma Ti Ke To Pe La'.split(' '),
19
+ dayNamesMin: 'S M T K T P L'.split(' '),
20
+ monthNames: 'Tammikuu Helmikuu Maaliskuu Huhtikuu Toukokuu Kesäkuu Heinäkuu Elokuu Syyskuu Lokakuu Marraskuu Joulukuu'.split(' '),
21
+ monthNamesShort: 'Tammi Helmi Maalis Huhti Touko Kesä Heinä Elo Syys Loka Marras Joulu'.split(' ')
22
+ },
23
23
 
24
- if (self.Lightbox) {
25
- $ext(Lightbox.i18n, {
24
+ Lightbox: {
26
25
  Close: 'Sulje',
27
26
  Prev: 'Edellinen kuva',
28
27
  Next: 'Seuraava kuva'
29
- });
30
- }
28
+ },
31
29
 
32
- if (self.InEdit) {
33
- $ext(InEdit.i18n, {
30
+ InEdit: {
34
31
  Save: "Tallenna",
35
32
  Cancel: "Peruuta"
36
- });
37
- }
33
+ },
38
34
 
39
- if (self.Colorpicker) {
40
- $ext(Colorpicker.i18n, {
35
+ Colorpicker: {
41
36
  Done: 'OK'
42
- });
43
- }
37
+ },
44
38
 
45
- if (self.Dialog) {
46
- $ext(Dialog.i18n, {
39
+ Dialog: {
47
40
  Ok: 'Ok',
48
- Close: 'Close',
49
- Cancel: 'Cancel',
50
- Help: 'Help',
51
- Expand: 'Expand',
52
- Collapse: 'Collapse',
53
-
54
- Alert: 'Warning!',
55
- Confirm: 'Confirm',
56
- Prompt: 'Enter'
57
- })
58
- }
41
+ Close: 'Sulje',
42
+ Cancel: 'Peruuta',
43
+ Help: 'Ohje',
44
+ Expand: 'Laajenna',
45
+ Collapse: 'Luhista',
46
+
47
+ Alert: 'Varoitus!',
48
+ Confirm: 'Vahvista',
49
+ Prompt: 'Syötä'
50
+ },
51
+
52
+ Rte: {
53
+ Clear: 'Tyhjennä',
54
+ Save: 'Tallenna',
55
+ Source: 'Lähdekoodi',
56
+ Bold: 'Lihavointi',
57
+ Italic: 'Kursivointi',
58
+ Underline: 'Alleviivaus',
59
+ Strike: 'Yliviivaus',
60
+ Ttext: 'Tasamittainen',
61
+ Header: 'Otsikko',
62
+ Cut: 'Leikkaa',
63
+ Copy: 'Kopioi',
64
+ Paste: 'Liitä',
65
+ Left: 'Vasemmalle',
66
+ Center: 'Keskelle',
67
+ Right: 'Oikealle',
68
+ Justify: 'Tasaa',
69
+ Undo: 'Kumoa',
70
+ Redo: 'Toista',
71
+ Code: 'Koodilohko',
72
+ Quote: 'Lainaus',
73
+ Link: 'Lisää linkki',
74
+ Image: 'Lisää kuva',
75
+ Video: 'Lisää video',
76
+ Dotlist: 'Tavallinen lista',
77
+ Numlist: 'Numeroitu lista',
78
+ Indent: 'Sisennä',
79
+ Outdent: 'Ulonna',
80
+ Forecolor: 'Tekstin väri',
81
+ Backcolor: 'Taustan väri',
82
+ Select: 'Valitse',
83
+ Remove: 'Poista',
84
+ Format: 'Muotoilu',
85
+ Fontname: 'Fontin nimi',
86
+ Fontsize: 'Koko',
87
+ Subscript: 'Alaindeksi',
88
+ Superscript: 'Yläindeksi',
89
+ UrlAddress: 'www-osoite'
90
+ }
59
91
 
92
+ }, function(module, i18n) {
93
+ if (self[module]) {
94
+ RightJS.$ext(self[module].i18n, i18n);
95
+ }
96
+ });
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * Copyright (C) Nikolay Nemshilov
5
5
  */
6
- if (self.Calendar) {
7
- $ext(Calendar.i18n, {
6
+ RightJS.Object.each({
7
+
8
+ Calendar: {
8
9
  Done: "Fait",
9
10
  Now: "Maint.",
10
11
  NextMonth: "Mois prochain",
@@ -12,37 +13,29 @@ if (self.Calendar) {
12
13
  NextYear: "L'année prochain",
13
14
  PrevYear: "L'année précédente",
14
15
 
15
- dayNames: $w('Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi'),
16
- dayNamesShort: $w('Dim Lun Mar Mer Jeu Ven Sam'),
17
- dayNamesMin: $w('Di Lu Ma Me Je Ve Sa'),
18
- monthNames: $w('Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre'),
19
- monthNamesShort: $w('Jan Fév Mar Avr Mai Juin Juil Août Sept Oct Nov Déc')
20
- });
21
- }
16
+ dayNames: 'Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi'.split(' '),
17
+ dayNamesShort: 'Dim Lun Mar Mer Jeu Ven Sam'.split(' '),
18
+ dayNamesMin: 'Di Lu Ma Me Je Ve Sa'.split(' '),
19
+ monthNames: 'Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre'.split(' '),
20
+ monthNamesShort: 'Jan Fév Mar Avr Mai Juin Juil Août Sept Oct Nov Déc'.split(' ')
21
+ },
22
22
 
23
- if (self.Lightbox) {
24
- $ext(Lightbox.i18n, {
23
+ Lightbox: {
25
24
  Close: 'Fermer',
26
25
  Prev: 'Image précédente',
27
26
  Next: 'Image suivante'
28
- });
29
- }
27
+ },
30
28
 
31
- if (self.InEdit) {
32
- $ext(InEdit.i18n, {
29
+ InEdit: {
33
30
  Save: "Enregistrer",
34
31
  Cancel: "Annuler"
35
- });
36
- }
32
+ },
37
33
 
38
- if (self.Colorpicker) {
39
- $ext(Colorpicker.i18n, {
34
+ Colorpicker: {
40
35
  Done: 'Fait'
41
- });
42
- }
36
+ },
43
37
 
44
- if (self.Dialog) {
45
- $ext(Dialog.i18n, {
38
+ Dialog: {
46
39
  Ok: 'Ok',
47
40
  Close: 'Close',
48
41
  Cancel: 'Cancel',
@@ -53,6 +46,50 @@ if (self.Dialog) {
53
46
  Alert: 'Warning!',
54
47
  Confirm: 'Confirm',
55
48
  Prompt: 'Enter'
56
- })
57
- }
49
+ },
50
+
51
+ Rte: {
52
+ Clear: 'Clear',
53
+ Save: 'Save',
54
+ Source: 'Source',
55
+ Bold: 'Bold',
56
+ Italic: 'Italic',
57
+ Underline: 'Underline',
58
+ Strike: 'Strike through',
59
+ Ttext: 'Typetext',
60
+ Header: 'Header',
61
+ Cut: 'Cut',
62
+ Copy: 'Copy',
63
+ Paste: 'Paste',
64
+ Left: 'Left',
65
+ Center: 'Center',
66
+ Right: 'Right',
67
+ Justify: 'Justify',
68
+ Undo: 'Undo',
69
+ Redo: 'Redo',
70
+ Code: 'Code block',
71
+ Quote: 'Block quote',
72
+ Link: 'Add link',
73
+ Image: 'Insert image',
74
+ Video: 'Insert video',
75
+ Dotlist: 'List with dots',
76
+ Numlist: 'List with numbers',
77
+ Indent: 'Indent',
78
+ Outdent: 'Outdent',
79
+ Forecolor: 'Text color',
80
+ Backcolor: 'Background color',
81
+ Select: 'Select',
82
+ Remove: 'Remove',
83
+ Format: 'Format',
84
+ Fontname: 'Font name',
85
+ Fontsize: 'Size',
86
+ Subscript: 'Subscript',
87
+ Superscript: 'Superscript',
88
+ UrlAddress: 'URL Address'
89
+ }
58
90
 
91
+ }, function(module, i18n) {
92
+ if (self[module]) {
93
+ RightJS.$ext(self[module].i18n, i18n);
94
+ }
95
+ });