redactor-rails-paperclip 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/Gemfile +24 -0
- data/MIT-LICENSE +22 -0
- data/README.md +106 -0
- data/Rakefile +3 -0
- data/app/controller/redactor_rails/base_controller.rb +27 -0
- data/app/controller/redactor_rails/documents_controller.rb +3 -0
- data/app/controller/redactor_rails/pictures_controller.rb +3 -0
- data/config/routes.rb +4 -0
- data/lib/generators/redactor/config_generator.rb +17 -0
- data/lib/generators/redactor/install_generator.rb +67 -0
- data/lib/generators/redactor/templates/active_record/carrierwave/migration.rb +25 -0
- data/lib/generators/redactor/templates/active_record/carrierwave/redactor/asset.rb +5 -0
- data/lib/generators/redactor/templates/active_record/carrierwave/redactor/document.rb +11 -0
- data/lib/generators/redactor/templates/active_record/carrierwave/redactor/picture.rb +7 -0
- data/lib/generators/redactor/templates/active_record/paperclip/migration.rb +26 -0
- data/lib/generators/redactor/templates/active_record/paperclip/redactor/asset.rb +4 -0
- data/lib/generators/redactor/templates/active_record/paperclip/redactor/document.rb +13 -0
- data/lib/generators/redactor/templates/active_record/paperclip/redactor/picture.rb +13 -0
- data/lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_document_uploader.rb +15 -0
- data/lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb +53 -0
- data/lib/generators/redactor/templates/config.js +17 -0
- data/lib/generators/redactor/templates/mongoid/carrierwave/redactor/asset.rb +9 -0
- data/lib/generators/redactor/templates/mongoid/carrierwave/redactor/document.rb +14 -0
- data/lib/generators/redactor/templates/mongoid/carrierwave/redactor/picture.rb +7 -0
- data/lib/redactor-rails.rb +34 -0
- data/lib/redactor-rails/backend/carrierwave.rb +64 -0
- data/lib/redactor-rails/backend/paperclip.rb +56 -0
- data/lib/redactor-rails/engine.rb +10 -0
- data/lib/redactor-rails/helper.rb +19 -0
- data/lib/redactor-rails/http.rb +89 -0
- data/lib/redactor-rails/orm/active_record.rb +24 -0
- data/lib/redactor-rails/orm/base.rb +38 -0
- data/lib/redactor-rails/orm/mongoid.rb +37 -0
- data/lib/redactor-rails/version.rb +3 -0
- data/redactor-rails.gemspec +20 -0
- data/vendor/assets/javascripts/redactor-rails/config.js +15 -0
- data/vendor/assets/javascripts/redactor-rails/css/docstyle.css +139 -0
- data/vendor/assets/javascripts/redactor-rails/css/style.css +26 -0
- data/vendor/assets/javascripts/redactor-rails/css/wym.css +151 -0
- data/vendor/assets/javascripts/redactor-rails/index.js +2 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ar.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ba.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/bg.js +67 -0
- data/vendor/assets/javascripts/redactor-rails/langs/by.js +65 -0
- data/vendor/assets/javascripts/redactor-rails/langs/cs.js +77 -0
- data/vendor/assets/javascripts/redactor-rails/langs/da.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/de.js +70 -0
- data/vendor/assets/javascripts/redactor-rails/langs/en.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/eo.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/es.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/fa.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/fi.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/fr.js +76 -0
- data/vendor/assets/javascripts/redactor-rails/langs/hr.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/hu.js +67 -0
- data/vendor/assets/javascripts/redactor-rails/langs/id.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/it.js +68 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ja.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ko.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/lv.js +65 -0
- data/vendor/assets/javascripts/redactor-rails/langs/nl.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/pl.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/pt_br.js +72 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ro.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ru.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/sk.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/sq.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/sr-cir.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/sr-lat.js +69 -0
- data/vendor/assets/javascripts/redactor-rails/langs/sv.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/tr.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/langs/ua.js +67 -0
- data/vendor/assets/javascripts/redactor-rails/langs/vi.js +65 -0
- data/vendor/assets/javascripts/redactor-rails/langs/zh_cn.js +70 -0
- data/vendor/assets/javascripts/redactor-rails/langs/zh_tw.js +66 -0
- data/vendor/assets/javascripts/redactor-rails/redactor.js +4210 -0
- data/vendor/assets/javascripts/redactor-rails/redactor.min.js +12 -0
- data/vendor/assets/stylesheets/redactor-rails/css/redactor.css +692 -0
- data/vendor/assets/stylesheets/redactor-rails/css/style.css +26 -0
- data/vendor/assets/stylesheets/redactor-rails/index.css +1 -0
- metadata +161 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'redactor-rails/orm/base'
|
2
|
+
|
3
|
+
module RedactorRails
|
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: 'redactor_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,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/redactor-rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Sammy", "Serge"]
|
6
|
+
gem.email = ["sammylintw@gmail.com", "sergeg1990@gmail.com"]
|
7
|
+
gem.description = "The redactor-rails gem integrates the Redactor editor without devise and with paperclip backend support"
|
8
|
+
gem.summary = ""
|
9
|
+
gem.homepage = "https://github.com/sergio1990/redactor-rails/tree/paperclip"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "redactor-rails-paperclip"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = RedactorRails::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency("mime-types")
|
19
|
+
gem.add_dependency("orm_adapter")
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$(document).ready(
|
2
|
+
function(){
|
3
|
+
var csrf_token = $('meta[name=csrf-token]').attr('content');
|
4
|
+
var csrf_param = $('meta[name=csrf-param]').attr('content');
|
5
|
+
var params;
|
6
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
7
|
+
params = csrf_param + "=" + encodeURIComponent(csrf_token);
|
8
|
+
}
|
9
|
+
$('.redactor').redactor(
|
10
|
+
{ "imageUpload":"/redactor_rails/pictures?" + params,
|
11
|
+
"imageGetJson":"/redactor_rails/pictures",
|
12
|
+
"path":"/assets/redactor-rails",
|
13
|
+
"css":"style.css"}
|
14
|
+
);
|
15
|
+
});
|
@@ -0,0 +1,139 @@
|
|
1
|
+
html {
|
2
|
+
padding: 0;
|
3
|
+
margin: 0;
|
4
|
+
}
|
5
|
+
body {
|
6
|
+
font-family: Helvetica, Arial, Verdana, Tahoma, sans-serif;
|
7
|
+
font-size: 15px;
|
8
|
+
margin: 0;
|
9
|
+
padding: 0;
|
10
|
+
overflow-x: hidden;
|
11
|
+
background: #f4f4f4;
|
12
|
+
}
|
13
|
+
#page {
|
14
|
+
max-width: 900px;
|
15
|
+
width: 74%;
|
16
|
+
margin: 20px auto;
|
17
|
+
padding: 15px 50px;
|
18
|
+
background: #fff;
|
19
|
+
border: 1px solid #ddd;
|
20
|
+
}
|
21
|
+
#page:focus {
|
22
|
+
outline: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
a {
|
26
|
+
color: #15c;
|
27
|
+
}
|
28
|
+
|
29
|
+
object,
|
30
|
+
embed,
|
31
|
+
video,
|
32
|
+
iframe {
|
33
|
+
width: auto;
|
34
|
+
max-width: 100%;
|
35
|
+
}
|
36
|
+
video,
|
37
|
+
iframe {
|
38
|
+
height: auto;
|
39
|
+
}
|
40
|
+
|
41
|
+
::selection {
|
42
|
+
background-color: #333;
|
43
|
+
color: #fff;
|
44
|
+
text-shadow: none;
|
45
|
+
}
|
46
|
+
|
47
|
+
div,
|
48
|
+
p,
|
49
|
+
ul,
|
50
|
+
ol,
|
51
|
+
table,
|
52
|
+
dl,
|
53
|
+
blockquote,
|
54
|
+
pre,
|
55
|
+
iframe,
|
56
|
+
object,
|
57
|
+
hr {
|
58
|
+
margin-bottom: 15px;
|
59
|
+
line-height: 1.5em;
|
60
|
+
}
|
61
|
+
blockquote {
|
62
|
+
margin-left: 3em;
|
63
|
+
font-style: italic;
|
64
|
+
color: #777;
|
65
|
+
}
|
66
|
+
ul, ol {
|
67
|
+
padding-left: 2em;
|
68
|
+
}
|
69
|
+
ul ul,
|
70
|
+
ol ol,
|
71
|
+
ul ol,
|
72
|
+
ol ul {
|
73
|
+
border: none;
|
74
|
+
margin: 2px !important;
|
75
|
+
padding: 0;
|
76
|
+
padding-left: 2em;
|
77
|
+
}
|
78
|
+
dl dt { font-weight: bold; }
|
79
|
+
dd { margin-left: 1em;}
|
80
|
+
|
81
|
+
table {
|
82
|
+
border-collapse: collapse;
|
83
|
+
font-size: 1em;
|
84
|
+
}
|
85
|
+
table td {
|
86
|
+
border: 1px solid #ddd;
|
87
|
+
padding: 5px;
|
88
|
+
}
|
89
|
+
table thead td {
|
90
|
+
border-bottom: 2px solid #000 !important;
|
91
|
+
font-weight: bold;
|
92
|
+
}
|
93
|
+
code, pre {
|
94
|
+
font-family: monospace sans-serif;
|
95
|
+
}
|
96
|
+
code {
|
97
|
+
background-color: #d8d7d7;
|
98
|
+
}
|
99
|
+
pre {
|
100
|
+
padding: 1em;
|
101
|
+
border: 1px dashed #ccc;
|
102
|
+
background: #f5f5f5;
|
103
|
+
overflow: auto;
|
104
|
+
}
|
105
|
+
hr {
|
106
|
+
display: block;
|
107
|
+
height: 1px;
|
108
|
+
border: 0;
|
109
|
+
border-top: 1px solid #ccc;
|
110
|
+
}
|
111
|
+
|
112
|
+
h1, h2, h3, h4,h5 {
|
113
|
+
font-weight: bold;
|
114
|
+
}
|
115
|
+
|
116
|
+
h1 {
|
117
|
+
font-size: 36px;
|
118
|
+
line-height: 40px;
|
119
|
+
margin-bottom: 10px;
|
120
|
+
}
|
121
|
+
h2 {
|
122
|
+
font-size: 30px;
|
123
|
+
line-height: 36px;
|
124
|
+
margin-bottom: 15px;
|
125
|
+
}
|
126
|
+
h3 {
|
127
|
+
font-size: 24px;
|
128
|
+
line-height: 30px;
|
129
|
+
margin-bottom: 10px;
|
130
|
+
}
|
131
|
+
h4 {
|
132
|
+
font-size: 18px;
|
133
|
+
line-height: 24px;
|
134
|
+
margin-bottom: 10px;
|
135
|
+
}
|
136
|
+
h4 {
|
137
|
+
font-size: 1em;
|
138
|
+
margin-bottom: 10px;
|
139
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
html, body {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
}
|
5
|
+
|
6
|
+
|
7
|
+
/* =Typography
|
8
|
+
-----------------------------------------------------------------------------*/
|
9
|
+
body {
|
10
|
+
font-family: Helvetica, Arial, sans-serif;
|
11
|
+
font-size: 14px;
|
12
|
+
}
|
13
|
+
|
14
|
+
|
15
|
+
/* =Layout
|
16
|
+
-----------------------------------------------------------------------------*/
|
17
|
+
#page {
|
18
|
+
width: 940px;
|
19
|
+
margin: 50px auto;
|
20
|
+
}
|
21
|
+
|
22
|
+
/* =Misc
|
23
|
+
-----------------------------------------------------------------------------*/
|
24
|
+
.list li {
|
25
|
+
margin: 10px 0;
|
26
|
+
}
|
@@ -0,0 +1,151 @@
|
|
1
|
+
|
2
|
+
body {
|
3
|
+
font-family: Helvetica, Arial, Verdana, Tahoma, sans-serif;
|
4
|
+
font-size: 15px;
|
5
|
+
margin: 0;
|
6
|
+
padding: 0;
|
7
|
+
overflow-x: hidden;
|
8
|
+
background-color: #f8f8f8;
|
9
|
+
}
|
10
|
+
|
11
|
+
#page {
|
12
|
+
margin: 20px;
|
13
|
+
background: #f8f8f8;
|
14
|
+
border: none;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
#page:focus {
|
18
|
+
outline: none;
|
19
|
+
}
|
20
|
+
|
21
|
+
a {
|
22
|
+
color: #15c;
|
23
|
+
}
|
24
|
+
|
25
|
+
object,
|
26
|
+
embed,
|
27
|
+
video,
|
28
|
+
iframe {
|
29
|
+
width: auto;
|
30
|
+
max-width: 100%;
|
31
|
+
}
|
32
|
+
video,
|
33
|
+
iframe {
|
34
|
+
height: auto;
|
35
|
+
}
|
36
|
+
|
37
|
+
div,
|
38
|
+
p,
|
39
|
+
ul,
|
40
|
+
ol,
|
41
|
+
table,
|
42
|
+
dl,
|
43
|
+
pre,
|
44
|
+
h1,
|
45
|
+
h2,
|
46
|
+
h3,
|
47
|
+
h4,
|
48
|
+
h5,
|
49
|
+
blockquote {
|
50
|
+
background-color: #fff;
|
51
|
+
border: 1px solid #ebebeb;
|
52
|
+
padding: 10px;
|
53
|
+
margin: 10px 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
p ul,
|
57
|
+
p ol {
|
58
|
+
margin: 0;
|
59
|
+
padding: 0;
|
60
|
+
border: none;
|
61
|
+
}
|
62
|
+
|
63
|
+
div,
|
64
|
+
p,
|
65
|
+
ul,
|
66
|
+
ol,
|
67
|
+
table,
|
68
|
+
dl,
|
69
|
+
blockquote,
|
70
|
+
pre,
|
71
|
+
iframe,
|
72
|
+
object,
|
73
|
+
hr {
|
74
|
+
margin-bottom: 15px;
|
75
|
+
line-height: 1.5em;
|
76
|
+
}
|
77
|
+
blockquote {
|
78
|
+
margin-left: 3em;
|
79
|
+
font-style: italic;
|
80
|
+
color: #777;
|
81
|
+
}
|
82
|
+
div {
|
83
|
+
background-color: #fff;
|
84
|
+
border: 1px dashed #ebebeb;
|
85
|
+
}
|
86
|
+
ul, ol {
|
87
|
+
padding-left: 2em !important;
|
88
|
+
}
|
89
|
+
ul ul,
|
90
|
+
ol ol,
|
91
|
+
ul ol,
|
92
|
+
ol ul {
|
93
|
+
border: none;
|
94
|
+
margin: 2px !important;
|
95
|
+
padding: 0;
|
96
|
+
padding-left: 2em;
|
97
|
+
}
|
98
|
+
dl dt { font-weight: bold; }
|
99
|
+
dd { margin-left: 1em;}
|
100
|
+
|
101
|
+
table {
|
102
|
+
border-collapse: collapse;
|
103
|
+
font-size: 1em;
|
104
|
+
}
|
105
|
+
table td {
|
106
|
+
border: 1px solid #ddd;
|
107
|
+
padding: 5px;
|
108
|
+
}
|
109
|
+
table thead td {
|
110
|
+
border-bottom: 2px solid #000 !important;
|
111
|
+
font-weight: bold;
|
112
|
+
}
|
113
|
+
code, pre {
|
114
|
+
font-family: monospace sans-serif;
|
115
|
+
}
|
116
|
+
code {
|
117
|
+
background-color: #d8d7d7;
|
118
|
+
}
|
119
|
+
pre {
|
120
|
+
padding: 1em;
|
121
|
+
border: 1px dashed #ccc;
|
122
|
+
background: #f5f5f5;
|
123
|
+
overflow: auto;
|
124
|
+
}
|
125
|
+
hr {
|
126
|
+
display: block;
|
127
|
+
height: 1px;
|
128
|
+
border: 0;
|
129
|
+
border-top: 1px solid #ccc;
|
130
|
+
}
|
131
|
+
|
132
|
+
h1, h2, h3, h4,h5 {
|
133
|
+
font-weight: bold;
|
134
|
+
margin-bottom: 10px;
|
135
|
+
}
|
136
|
+
|
137
|
+
h1 {
|
138
|
+
font-size: 36px;
|
139
|
+
}
|
140
|
+
h2 {
|
141
|
+
font-size: 30px;
|
142
|
+
}
|
143
|
+
h3 {
|
144
|
+
font-size: 24px;
|
145
|
+
}
|
146
|
+
h4 {
|
147
|
+
font-size: 18px;
|
148
|
+
}
|
149
|
+
h5 {
|
150
|
+
font-size: 1em;
|
151
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
var RELANG = {};
|
2
|
+
RELANG['ar'] = {
|
3
|
+
html: 'كود HTML',
|
4
|
+
video: 'فيديو',
|
5
|
+
image: 'صورة',
|
6
|
+
table: 'جدول',
|
7
|
+
link: 'رابط',
|
8
|
+
link_insert: 'أضف / حرر رابط',
|
9
|
+
unlink: 'إزالة الرابط',
|
10
|
+
formatting: 'التنسيق',
|
11
|
+
paragraph: 'فقرة',
|
12
|
+
quote: 'اقتباس',
|
13
|
+
code: 'كود',
|
14
|
+
header1: 'ترويسة 1',
|
15
|
+
header2: 'ترويسة 2',
|
16
|
+
header3: 'ترويسة 3',
|
17
|
+
header4: 'ترويسة 4',
|
18
|
+
bold: 'غليظ',
|
19
|
+
italic: 'مائل',
|
20
|
+
fontcolor: 'لون الخط',
|
21
|
+
backcolor: 'لون الخلفية',
|
22
|
+
unorderedlist: 'قائمة منقطة',
|
23
|
+
orderedlist: 'قائمة رقمية',
|
24
|
+
outdent: 'أزل المسافة البادئة',
|
25
|
+
indent: 'أضف المسافة البادئة',
|
26
|
+
cancel: 'تراجع',
|
27
|
+
insert: 'أدخل',
|
28
|
+
save: 'احفظ',
|
29
|
+
_delete: 'أحذف',
|
30
|
+
insert_table: 'أدخل جدول',
|
31
|
+
insert_row_above: 'أضف صف فوق',
|
32
|
+
insert_row_below: 'أضف صف تحت',
|
33
|
+
insert_column_left: 'أضف عمود يسارا',
|
34
|
+
insert_column_right: 'أضف عمود يمينا',
|
35
|
+
delete_column: 'احذف العمود',
|
36
|
+
delete_row: 'احذف الصف',
|
37
|
+
delete_table: 'احذف الجدول',
|
38
|
+
rows: 'الصفوف',
|
39
|
+
columns: 'الأعمدة',
|
40
|
+
add_head: 'أضف ترويسة',
|
41
|
+
delete_head: 'حذف ترويسة',
|
42
|
+
title: 'ترويسة',
|
43
|
+
image_position: 'الوضعية',
|
44
|
+
none: 'بدون',
|
45
|
+
left: 'يسار',
|
46
|
+
right: 'يمين',
|
47
|
+
image_web_link: 'رابط الصورة',
|
48
|
+
text: 'نص',
|
49
|
+
mailto: 'بريد الكتروني',
|
50
|
+
web: 'رابط',
|
51
|
+
video_html_code: 'كود الفيديو',
|
52
|
+
file: 'أضف ملف جديد',
|
53
|
+
upload: 'رفع',
|
54
|
+
download: 'تحميل',
|
55
|
+
choose: 'اختار',
|
56
|
+
or_choose: 'أو اختار',
|
57
|
+
drop_file_here: 'اسحب الملف هنا',
|
58
|
+
align_left: 'محاذاة الى اليسار',
|
59
|
+
align_center: 'محاذاة الى الوسط',
|
60
|
+
align_right: 'محاذاة الى اليمين',
|
61
|
+
align_justify: 'محاذاة كاملة',
|
62
|
+
horizontalrule: 'أضف خط عمودي',
|
63
|
+
fullscreen: 'الشاشة الكاملة',
|
64
|
+
deleted: 'خط في الوسط',
|
65
|
+
anchor: 'مرساة'
|
66
|
+
};
|