redactor2_rails 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +207 -0
  7. data/Rakefile +2 -0
  8. data/app/controller/redactor2_rails/files_controller.rb +28 -0
  9. data/app/controller/redactor2_rails/images_controller.rb +28 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +7 -0
  12. data/config/routes.rb +4 -0
  13. data/lib/generators/redactor2/config_generator.rb +18 -0
  14. data/lib/generators/redactor2/install_generator.rb +75 -0
  15. data/lib/generators/redactor2/templates/active_record/carrierwave/devise_migration.rb +28 -0
  16. data/lib/generators/redactor2/templates/active_record/carrierwave/migration.rb +25 -0
  17. data/lib/generators/redactor2/templates/active_record/carrierwave/redactor2/asset.rb +6 -0
  18. data/lib/generators/redactor2/templates/active_record/carrierwave/redactor2/file.rb +7 -0
  19. data/lib/generators/redactor2/templates/active_record/carrierwave/redactor2/image.rb +7 -0
  20. data/lib/generators/redactor2/templates/base/carrierwave/uploaders/redactor2_rails_file_uploader.rb +15 -0
  21. data/lib/generators/redactor2/templates/base/carrierwave/uploaders/redactor2_rails_image_uploader.rb +54 -0
  22. data/lib/generators/redactor2/templates/config.js +14 -0
  23. data/lib/generators/redactor2/templates/mongoid/carrierwave/redactor/asset.rb +9 -0
  24. data/lib/generators/redactor2/templates/mongoid/carrierwave/redactor/file.rb +7 -0
  25. data/lib/generators/redactor2/templates/mongoid/carrierwave/redactor/picture.rb +7 -0
  26. data/lib/redactor2_rails.rb +40 -0
  27. data/lib/redactor2_rails/backend/carrierwave.rb +64 -0
  28. data/lib/redactor2_rails/devise.rb +11 -0
  29. data/lib/redactor2_rails/engine.rb +9 -0
  30. data/lib/redactor2_rails/http.rb +89 -0
  31. data/lib/redactor2_rails/orm/active_record.rb +31 -0
  32. data/lib/redactor2_rails/orm/base.rb +38 -0
  33. data/lib/redactor2_rails/orm/mongoid.rb +37 -0
  34. data/lib/redactor2_rails/version.rb +3 -0
  35. data/redactor2_rails.gemspec +28 -0
  36. data/vendor/assets/javascripts/redactor2_rails/config.js +14 -0
  37. data/vendor/assets/javascripts/redactor2_rails/index.js +2 -0
  38. data/vendor/assets/javascripts/redactor2_rails/langs/ar.js +50 -0
  39. data/vendor/assets/javascripts/redactor2_rails/langs/de.js +50 -0
  40. data/vendor/assets/javascripts/redactor2_rails/langs/en.js +50 -0
  41. data/vendor/assets/javascripts/redactor2_rails/langs/es.js +50 -0
  42. data/vendor/assets/javascripts/redactor2_rails/langs/fa.js +50 -0
  43. data/vendor/assets/javascripts/redactor2_rails/langs/fi.js +50 -0
  44. data/vendor/assets/javascripts/redactor2_rails/langs/fr.js +50 -0
  45. data/vendor/assets/javascripts/redactor2_rails/langs/hu.js +50 -0
  46. data/vendor/assets/javascripts/redactor2_rails/langs/it.js +50 -0
  47. data/vendor/assets/javascripts/redactor2_rails/langs/ja.js +50 -0
  48. data/vendor/assets/javascripts/redactor2_rails/langs/ko.js +50 -0
  49. data/vendor/assets/javascripts/redactor2_rails/langs/nl.js +50 -0
  50. data/vendor/assets/javascripts/redactor2_rails/langs/pl.js +50 -0
  51. data/vendor/assets/javascripts/redactor2_rails/langs/pt_br.js +50 -0
  52. data/vendor/assets/javascripts/redactor2_rails/langs/ru.js +50 -0
  53. data/vendor/assets/javascripts/redactor2_rails/langs/sv.js +50 -0
  54. data/vendor/assets/javascripts/redactor2_rails/langs/tr.js +50 -0
  55. data/vendor/assets/javascripts/redactor2_rails/langs/zh_cn.js +52 -0
  56. data/vendor/assets/javascripts/redactor2_rails/langs/zh_tw.js +50 -0
  57. data/vendor/assets/javascripts/redactor2_rails/plugins.js +4 -0
  58. data/vendor/assets/javascripts/redactor2_rails/plugins/clips.js +60 -0
  59. data/vendor/assets/javascripts/redactor2_rails/plugins/fullscreen.js +159 -0
  60. data/vendor/assets/javascripts/redactor2_rails/plugins/source.js +195 -0
  61. data/vendor/assets/javascripts/redactor2_rails/plugins/textdirection.js +36 -0
  62. data/vendor/assets/javascripts/redactor2_rails/redactor.js +9989 -0
  63. data/vendor/assets/javascripts/redactor2_rails/redactor.min.js +13 -0
  64. data/vendor/assets/stylesheets/redactor2_rails/css/redactor.css +931 -0
  65. data/vendor/assets/stylesheets/redactor2_rails/index.css +1 -0
  66. data/vendor/assets/stylesheets/redactor2_rails/plugins.css +1 -0
  67. data/vendor/assets/stylesheets/redactor2_rails/plugins/clips.css +10 -0
  68. metadata +183 -0
@@ -0,0 +1,38 @@
1
+ module Redactor2Rails
2
+ module Orm
3
+ module Base
4
+ module AssetBase
5
+ module InstanceMethods
6
+ def has_dimensions?
7
+ respond_to?(:width) && respond_to?(:height)
8
+ end
9
+
10
+ def image?
11
+ Redactor2Rails::IMAGE_TYPES.include?(data_content_type)
12
+ end
13
+
14
+ def image
15
+ url
16
+ end
17
+
18
+ def thumb
19
+ url(:thumb)
20
+ end
21
+
22
+ def as_json_methods
23
+ [:image, :thumb]
24
+ end
25
+
26
+ def as_json(options = nil)
27
+ options = {
28
+ :methods => as_json_methods,
29
+ :root => false
30
+ }
31
+
32
+ super options
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ require 'redactor2_rails/orm/base'
2
+
3
+ module Redactor2Rails
4
+ module Orm
5
+ module Mongoid
6
+ module AssetBase
7
+ def self.included(base)
8
+ base.send(:include, Base::AssetBase::InstanceMethods)
9
+ base.send(:extend, ClassMethods)
10
+ end
11
+
12
+ module ClassMethods
13
+ def self.extended(base)
14
+ base.class_eval do
15
+ store_in :collection => 'redactor2_assets'
16
+
17
+ belongs_to :assetable, :polymorphic => true
18
+
19
+ field :data_file_name, :type => String
20
+ field :data_content_type, :type => String
21
+ field :data_file_size, :type => Integer
22
+
23
+ field :type, :type => String
24
+
25
+ field :width, :type => Integer
26
+ field :height, :type => Integer
27
+
28
+ index(:assetable => 1, :type => 1)
29
+ index(:assetable => 1)
30
+
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module Redactor2Rails
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'redactor2_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "redactor2_rails"
8
+ spec.version = Redactor2Rails::VERSION
9
+ spec.authors = ["Oleg Sulyanov"]
10
+ spec.email = ["oleg@sulyanov.com"]
11
+
12
+ spec.summary = %q{Imperavi Redactor for Rails 3.x - 4 Asset Pipeline}
13
+ spec.homepage = "https://github.com/osulyanov/redactor2_rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "bin"
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency("mime-types")
23
+ spec.add_dependency("orm_adapter")
24
+ spec.add_dependency("devise")
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.10"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
@@ -0,0 +1,14 @@
1
+ $(function () {
2
+ // Pass authenticity_token
3
+ var params = '[name="authenticity_token"]';
4
+ // Set global settings
5
+ $.Redactor.settings = {
6
+ //plugins: ['source', 'fullscreen', 'textdirection', 'clips'],
7
+ imageUpload: '/redactor2_rails/images',
8
+ imageUploadFields: params,
9
+ fileUpload: '/redactor2_rails/files',
10
+ fileUploadFields: params
11
+ };
12
+ // Initialize Redactor
13
+ $('.redactor').redactor();
14
+ });
@@ -0,0 +1,2 @@
1
+ //= require ./redactor
2
+ //= require ./config
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['ar'] = {
4
+ "format": "تنسيق",
5
+ "image": "صورة",
6
+ "file": "ملف",
7
+ "link": "رابط",
8
+ "bold": "متين",
9
+ "italic": "مائل",
10
+ "deleted": "مشطوب",
11
+ "underline": "مسطر",
12
+ "bold-abbr": "B",
13
+ "italic-abbr": "I",
14
+ "deleted-abbr": "S",
15
+ "underline-abbr": "U",
16
+ "lists": "قوائم",
17
+ "link-insert": "إدراج رابط",
18
+ "link-edit": "تحرير الرابط",
19
+ "link-in-new-tab": "فتح الرابط في تبويب جديد",
20
+ "unlink": "إلغاء الرابط",
21
+ "cancel": "إلغاء",
22
+ "close": "إغلاق",
23
+ "insert": "إدراج",
24
+ "save": "حفظ",
25
+ "delete": "حذف",
26
+ "text": "النص",
27
+ "edit": "تحرير",
28
+ "title": "العنوان",
29
+ "paragraph": "نص عادي",
30
+ "quote": "اقتباس",
31
+ "code": "كود",
32
+ "heading1": "عنوان 1",
33
+ "heading2": "عنوان 2",
34
+ "heading3": "عنوان 3",
35
+ "heading4": "عنوان 4",
36
+ "heading5": "عنوان 5",
37
+ "heading6": "عنوان 6",
38
+ "filename": "الاسم",
39
+ "optional": "اختياري",
40
+ "unorderedlist": "قائمة نقطية",
41
+ "orderedlist": "قائمة رقمية",
42
+ "outdent": "زيادة المسافة البادئة",
43
+ "indent": "إنقاض المسافة البادئة",
44
+ "horizontalrule": "خط أفقي",
45
+ "upload-label": "أسقط الملف هنا أو ",
46
+ "accessibility-help-label": "محرر النص الغني",
47
+ "caption": "الشرح"
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['de'] = {
4
+ "format": "Format",
5
+ "image": "Bild",
6
+ "file": "Datei",
7
+ "link": "Link",
8
+ "bold": "Fett",
9
+ "italic": "Kursiv",
10
+ "deleted": "Durchgestrichen",
11
+ "underline": "Unterstrichen",
12
+ "bold-abbr": "B",
13
+ "italic-abbr": "I",
14
+ "deleted-abbr": "S",
15
+ "underline-abbr": "U",
16
+ "lists": "Listen",
17
+ "link-insert": "Verknüpfung einsetzen",
18
+ "link-edit": "Verknüpfung bearbeiten",
19
+ "link-in-new-tab": "Verknüpfung in neuer Registerkarte öffnen",
20
+ "unlink": "Verknüpfung aufheben",
21
+ "cancel": "Abbrechen",
22
+ "close": "Schließen",
23
+ "insert": "Einsetzen",
24
+ "save": "Speichern",
25
+ "delete": "löschen",
26
+ "text": "Text",
27
+ "edit": "Bearbeiten",
28
+ "title": "Titel",
29
+ "paragraph": "Normaler Text",
30
+ "quote": "Zitieren",
31
+ "code": "Code",
32
+ "heading1": "Überschrift 1",
33
+ "heading2": "Überschrift 2",
34
+ "heading3": "Überschrift 3",
35
+ "heading4": "Überschrift 4",
36
+ "heading5": "Überschrift 5",
37
+ "heading6": "Überschrift 6",
38
+ "filename": "Name",
39
+ "optional": "Optional",
40
+ "unorderedlist": "Unsortierte Liste",
41
+ "orderedlist": "Sortierte Liste",
42
+ "outdent": "Negativer einzug",
43
+ "indent": "Einzug",
44
+ "horizontalrule": "Linie",
45
+ "upload-label": "Datei hier ablegen oder ",
46
+ "accessibility-help-label": "Rich-Text-Editor",
47
+ "caption": "Caption"
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['en'] = {
4
+ "format": "Format",
5
+ "image": "Image",
6
+ "file": "File",
7
+ "link": "Link",
8
+ "bold": "Bold",
9
+ "italic": "Italic",
10
+ "deleted": "Strikethrough",
11
+ "underline": "Underline",
12
+ "bold-abbr": "B",
13
+ "italic-abbr": "I",
14
+ "deleted-abbr": "S",
15
+ "underline-abbr": "U",
16
+ "lists": "Lists",
17
+ "link-insert": "Insert link",
18
+ "link-edit": "Edit link",
19
+ "link-in-new-tab": "Open link in new tab",
20
+ "unlink": "Unlink",
21
+ "cancel": "Cancel",
22
+ "close": "Close",
23
+ "insert": "Insert",
24
+ "save": "Save",
25
+ "delete": "Delete",
26
+ "text": "Text",
27
+ "edit": "Edit",
28
+ "title": "Title",
29
+ "paragraph": "Normal text",
30
+ "quote": "Quote",
31
+ "code": "Code",
32
+ "heading1": "Heading 1",
33
+ "heading2": "Heading 2",
34
+ "heading3": "Heading 3",
35
+ "heading4": "Heading 4",
36
+ "heading5": "Heading 5",
37
+ "heading6": "Heading 6",
38
+ "filename": "Name",
39
+ "optional": "optional",
40
+ "unorderedlist": "Unordered List",
41
+ "orderedlist": "Ordered List",
42
+ "outdent": "Outdent",
43
+ "indent": "Indent",
44
+ "horizontalrule": "Line",
45
+ "upload-label": "Drop file here or ",
46
+ "accessibility-help-label": "Rich text editor",
47
+ "caption": "Caption"
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['es'] = {
4
+ "format": "Formato",
5
+ "image": "Imagen",
6
+ "file": "Archivo",
7
+ "link": "Enlace",
8
+ "bold": "Negrita",
9
+ "italic": "Cursiva",
10
+ "deleted": "Tachado",
11
+ "underline": "Subrayado",
12
+ "bold-abbr": "N",
13
+ "italic-abbr": "C",
14
+ "deleted-abbr": "T",
15
+ "underline-abbr": "S",
16
+ "lists": "Listas",
17
+ "link-insert": "Insertar enlace",
18
+ "link-edit": "Editar enlace",
19
+ "link-in-new-tab": "Abrir enlace en nueva pestaña",
20
+ "unlink": "Quitar enlace",
21
+ "cancel": "Cancelar",
22
+ "close": "Cerrar",
23
+ "insert": "Insertar",
24
+ "save": "Guardar",
25
+ "delete": "Borrar",
26
+ "text": "Texto",
27
+ "edit": "Editar",
28
+ "title": "Título",
29
+ "paragraph": "Texto normal",
30
+ "quote": "Citar",
31
+ "code": "Código",
32
+ "heading1": "Cabecera 1",
33
+ "heading2": "Cabecera 2",
34
+ "heading3": "Cabecera 3",
35
+ "heading4": "Cabecera 4",
36
+ "heading5": "Cabecera 5",
37
+ "heading6": "Cabecera 6",
38
+ "filename": "Nombre",
39
+ "optional": "Opcional",
40
+ "unorderedlist": "Lista sin orden",
41
+ "orderedlist": "Lista ordenada",
42
+ "outdent": "Quitar sangría",
43
+ "indent": "Sangría",
44
+ "horizontalrule": "Línea",
45
+ "upload-label": "Suelta tu archivo aquí o ",
46
+ "accessibility-help-label": "Editor de texto enriquecido",
47
+ "caption": "Caption"
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['fa'] = {
4
+ "format": "فرمت",
5
+ "image": "تصویر",
6
+ "file": "فایل",
7
+ "link": "لینک",
8
+ "bold": "ضخیم",
9
+ "italic": "کج",
10
+ "deleted": "خط خورده",
11
+ "underline": "زیرخط دار",
12
+ "bold-abbr": "B",
13
+ "italic-abbr": "I",
14
+ "deleted-abbr": "S",
15
+ "underline-abbr": "U",
16
+ "lists": "لیست",
17
+ "link-insert": "اضافه کردن لینک",
18
+ "link-edit": "ویرایش لینک",
19
+ "link-in-new-tab": "باز شدن لینک در صفحه جدید",
20
+ "unlink": "غیرفعال کردن لینک",
21
+ "cancel": "لغو",
22
+ "close": "بستن",
23
+ "insert": "اضافه",
24
+ "save": "ذخیره",
25
+ "delete": "حذف",
26
+ "text": "متن",
27
+ "edit": "ویرایش",
28
+ "title": "عنوان",
29
+ "paragraph": "متن معمولی",
30
+ "quote": "نقل قول",
31
+ "code": "کد",
32
+ "heading1": "سربرگ ۱",
33
+ "heading2": "سربرگ ۲",
34
+ "heading3": "سربرگ ۳",
35
+ "heading4": "سربرگ ۴",
36
+ "heading5": "سربرگ ۵",
37
+ "heading6": "سربرگ ۶",
38
+ "filename": "نام",
39
+ "optional": "اختیاری",
40
+ "unorderedlist": "لیست نامرتب",
41
+ "orderedlist": "لیست مرتب",
42
+ "outdent": "بیرون آمدگی",
43
+ "indent": "تورفتگی",
44
+ "horizontalrule": "خط",
45
+ "upload-label": "فایل مورد نظر را اینجا رها کنید یا",
46
+ "accessibility-help-label": "ویرایشگر متن پیشرفته",
47
+ "caption": "Caption"
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['fi'] = {
4
+ "format": "Muotoilut",
5
+ "image": "Kuva",
6
+ "file": "Tiedosto",
7
+ "link": "Linkki",
8
+ "bold": "Lihavointi",
9
+ "italic": "Kursivointi",
10
+ "deleted": "Poistettu",
11
+ "underline": "Alleviivaa",
12
+ "bold-abbr": "B",
13
+ "italic-abbr": "I",
14
+ "deleted-abbr": "S",
15
+ "underline-abbr": "U",
16
+ "lists": "Luettelot",
17
+ "link-insert": "Lisää linkki",
18
+ "link-edit": "Muokkaa linkkiä",
19
+ "link-in-new-tab": "Avaa linkki uudessa välilehdessä",
20
+ "unlink": "Poista linkki",
21
+ "cancel": "Peru",
22
+ "close": "Sulkea",
23
+ "insert": "Lisää",
24
+ "save": "Tallenna",
25
+ "delete": "Poista",
26
+ "text": "Teksti",
27
+ "edit": "Muokata",
28
+ "title": "Title",
29
+ "paragraph": "Normaaliteksti",
30
+ "quote": "Lainaus",
31
+ "code": "Koodi",
32
+ "heading1": "Otsikko 1",
33
+ "heading2": "Otsikko 2",
34
+ "heading3": "Otsikko 3",
35
+ "heading4": "Otsikko 4",
36
+ "heading5": "Otsikko 5",
37
+ "heading6": "Otsikko 6",
38
+ "filename": "Nimi (valinnainen)",
39
+ "optional": "valinnainen",
40
+ "unorderedlist": "Luettelo luettelomerkein",
41
+ "orderedlist": "Numeroitu luettelo",
42
+ "outdent": "Vähennä sisennystä",
43
+ "indent": "Lisää sisennystä",
44
+ "horizontalrule": "Viiva",
45
+ "upload-label": "Vedä ja pudota kuva tähän ",
46
+ "accessibility-help-label": "Rich text editor",
47
+ "caption": "Caption"
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,50 @@
1
+ (function ($)
2
+ {
3
+ $.Redactor.opts.langs['fr'] = {
4
+ "format": "Format",
5
+ "image": "Image",
6
+ "file": "Fichier",
7
+ "link": "Lien",
8
+ "bold": "Gras",
9
+ "italic": "Italique",
10
+ "deleted": "Barré",
11
+ "underline": "Souligné",
12
+ "bold-abbr": "B",
13
+ "italic-abbr": "I",
14
+ "deleted-abbr": "S",
15
+ "underline-abbr": "U",
16
+ "lists": "Listes",
17
+ "link-insert": "Insérer un lien",
18
+ "link-edit": "Editer le lien",
19
+ "link-in-new-tab": "Ouvrir le lien dans un nouvel onglet",
20
+ "unlink": "Retirer le lien",
21
+ "cancel": "Annuler",
22
+ "close": "Fermer",
23
+ "insert": "Insérer",
24
+ "save": "Sauvegarder",
25
+ "delete": "Supprimer",
26
+ "text": "Texte",
27
+ "edit": "Editer",
28
+ "title": "Titre",
29
+ "paragraph": "Texte normal",
30
+ "quote": "Citation",
31
+ "code": "Code",
32
+ "heading1": "Titre 1",
33
+ "heading2": "Titre 2",
34
+ "heading3": "Titre 3",
35
+ "heading4": "Titre 4",
36
+ "heading5": "Titre 5",
37
+ "heading6": "Titre 6",
38
+ "filename": "Nom",
39
+ "optional": "Optionnel",
40
+ "unorderedlist": "Liste non-ordonnée",
41
+ "orderedlist": "Liste ordonnée",
42
+ "outdent": "Réduire le retrait",
43
+ "indent": "Augmenter le retrait",
44
+ "horizontalrule": "Ligne",
45
+ "upload-label": "Déposez un fichier ici ou ",
46
+ "accessibility-help-label": "Editeur de texte enrichi",
47
+ "caption": "Caption"
48
+ };
49
+
50
+ })(jQuery);