activeadmin-redactor 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -19
- data/app/views/layouts/redactor.html.erb +7 -6
- data/lib/activeadmin/redactor/version.rb +1 -1
- data/lib/activeadmin/redactor_opts.rb +4 -0
- data/lib/activeadmin/viewport_opts.rb +5 -0
- data/spec/activeadmin/redactor_opts_spec.rb +18 -1
- data/spec/activeadmin/viewport_opts_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 875ac513ca0716e7d14b73c076fd71a803bc3eae
|
4
|
+
data.tar.gz: c2ec0a7c7a1ebd28a2c4c732c39a507a4a530adc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14595fb2e9ff4338d596df0b5ad8800daf852459cc37d97fb55714f12dc0f75006831e3534451127e283129a097bc88167b459934d408bf35f7a841673f33791
|
7
|
+
data.tar.gz: 0252a50f7ad63882fc0799e25dab61aebb464abcb263e625289346cb054a227e75595a4b79456dc864d4783932ed7423361a069baf2bc0c5bc336e57123f065d
|
data/README.md
CHANGED
@@ -30,27 +30,26 @@ end
|
|
30
30
|
Default setting is 'activeadmin-redactor'
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
ActiveAdmin.register Page do
|
34
33
|
redactorable stylesheets: ["fonts", "application"]
|
35
|
-
|
34
|
+
```
|
35
|
+
#### Javascripts
|
36
|
+
Default setting is 'jquery', 'jquery_ujs', 'activeadmin-redactor'
|
37
|
+
```ruby
|
38
|
+
redactorable javascripts: ["textdirection.js"]
|
36
39
|
```
|
37
40
|
|
38
41
|
#### Layout
|
39
42
|
Default setting is 'redactor'
|
40
43
|
|
41
44
|
```ruby
|
42
|
-
ActiveAdmin.register Page do
|
43
45
|
redactorable layout: ["foobar"]
|
44
|
-
end
|
45
46
|
```
|
46
47
|
|
47
48
|
#### Tempate
|
48
49
|
Default setting is 'redactor/editor'
|
49
50
|
|
50
51
|
```ruby
|
51
|
-
ActiveAdmin.register Page do
|
52
52
|
redactorable template: ["redactor/editor"]
|
53
|
-
end
|
54
53
|
```
|
55
54
|
|
56
55
|
### Optional Redactor Customization
|
@@ -58,51 +57,46 @@ end
|
|
58
57
|
Default setting is false
|
59
58
|
|
60
59
|
```ruby
|
61
|
-
ActiveAdmin.register Page do
|
62
60
|
redactorable redactor: {focus: true}
|
63
|
-
end
|
64
61
|
```
|
65
62
|
#### [iframe](http://imperavi.com/redactor/examples/iframe/)
|
66
63
|
Default setting is false
|
67
64
|
|
68
65
|
```ruby
|
69
|
-
ActiveAdmin.register Page do
|
70
66
|
redactorable redactor: {iframe: true}
|
71
|
-
end
|
72
67
|
```
|
73
68
|
#### [fullpage](http://imperavi.com/redactor/examples/fullpage/)
|
74
69
|
Default setting is false
|
75
70
|
|
76
71
|
```ruby
|
77
|
-
ActiveAdmin.register Page do
|
78
72
|
redactorable redactor: {fullpage: true}
|
79
|
-
end
|
80
73
|
```
|
81
74
|
#### [css](http://imperavi.com/redactor/examples/css/)
|
82
75
|
Default setting is none
|
83
76
|
|
84
77
|
```ruby
|
85
|
-
ActiveAdmin.register Page do
|
86
78
|
redactorable redactor: {css: ['application', 'override']}
|
87
|
-
end
|
88
79
|
```
|
89
80
|
|
90
81
|
#### minHeight
|
91
82
|
Default setting is false
|
92
83
|
|
93
84
|
```ruby
|
94
|
-
ActiveAdmin.register Page do
|
95
85
|
redactorable redactor: {minheight: 200}
|
96
|
-
end
|
97
86
|
```
|
98
87
|
|
99
88
|
#### imageUpload
|
100
89
|
Default setting is false
|
101
90
|
|
102
91
|
```ruby
|
103
|
-
|
104
|
-
|
105
|
-
|
92
|
+
redactorable redactor: {imageupload: '/foo/bar/path'}
|
93
|
+
```
|
94
|
+
|
95
|
+
#### [plugins](http://imperavi.com/redactor/examples/plugin-create/)
|
96
|
+
Default setting is none
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
redactorable redactor: {plugins: ['admin/fontfamily.js']}
|
106
100
|
```
|
107
101
|
|
108
102
|
## Contributing
|
@@ -5,12 +5,7 @@
|
|
5
5
|
<meta charset="utf-8">
|
6
6
|
<%= csrf_meta_tags %>
|
7
7
|
<%= stylesheet_link_tag *@viewport_opts.stylesheets %>
|
8
|
-
|
9
|
-
|
10
|
-
<body>
|
11
|
-
<%= render "layouts/redactor_header" %>
|
12
|
-
<%= yield %>
|
13
|
-
<%= javascript_include_tag 'jquery', 'jquery_ujs', 'activeadmin-redactor' %>
|
8
|
+
<%= javascript_include_tag *@viewport_opts.javascripts %>
|
14
9
|
<script type="text/javascript">
|
15
10
|
$(function() {
|
16
11
|
$('#redactor').redactor({
|
@@ -20,9 +15,15 @@
|
|
20
15
|
css: <%=raw redactor_css(@redactor_opts.css) %>,
|
21
16
|
minHeight: <%= @redactor_opts.minheight %>,
|
22
17
|
imageUpload: '<%= @redactor_opts.imageupload %>',
|
18
|
+
plugins: <%=raw @redactor_opts.plugins %>,
|
23
19
|
});
|
24
20
|
});
|
25
21
|
</script>
|
22
|
+
</head>
|
23
|
+
|
24
|
+
<body>
|
25
|
+
<%= render "layouts/redactor_header" %>
|
26
|
+
<%= yield %>
|
26
27
|
<%= render "layouts/redactor_footer" %>
|
27
28
|
</body>
|
28
29
|
</html>
|
@@ -6,6 +6,7 @@ module Activeadmin
|
|
6
6
|
DEFAULT_LAYOUT = 'redactor'
|
7
7
|
DEFAULT_TEMPLATE = 'redactor/editor'
|
8
8
|
DEFAULT_STYLESHEET = 'activeadmin-redactor'
|
9
|
+
DEFAULT_JAVASCRIPTS = %w(jquery jquery_ujs activeadmin-redactor)
|
9
10
|
|
10
11
|
def layout
|
11
12
|
opts[:layout] || DEFAULT_LAYOUT
|
@@ -18,6 +19,10 @@ module Activeadmin
|
|
18
19
|
def stylesheets
|
19
20
|
(opts[:stylesheets] || []).unshift(DEFAULT_STYLESHEET)
|
20
21
|
end
|
22
|
+
|
23
|
+
def javascripts
|
24
|
+
(opts[:javascripts] || []).unshift(*DEFAULT_JAVASCRIPTS)
|
25
|
+
end
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -3,7 +3,7 @@ require_relative '../../lib/activeadmin/redactor_opts.rb'
|
|
3
3
|
|
4
4
|
describe Activeadmin::Redactor::RedactorOpts do
|
5
5
|
subject { described_class.new(options) }
|
6
|
-
|
6
|
+
|
7
7
|
describe '#iframe' do
|
8
8
|
context 'no options passed' do
|
9
9
|
let(:options) {Hash.new}
|
@@ -101,4 +101,21 @@ describe Activeadmin::Redactor::RedactorOpts do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
describe '#plugins' do
|
106
|
+
context 'no options passed' do
|
107
|
+
let(:options) {Hash.new}
|
108
|
+
it 'returns empty array' do
|
109
|
+
expect(subject.plugins).to eql([])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'options passed' do
|
114
|
+
let(:options) {{plugins: ['admin/fontfamily.js']}}
|
115
|
+
it 'returns unmodified array' do
|
116
|
+
expect(subject.plugins).to eql(['admin/fontfamily.js'])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
104
121
|
end
|
@@ -20,6 +20,24 @@ describe Activeadmin::Redactor::ViewportOpts do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
describe '#javascripts' do
|
24
|
+
context 'no options passed' do
|
25
|
+
let(:options) {Hash.new}
|
26
|
+
it 'returns array with required js elements' do
|
27
|
+
expect(subject.javascripts).
|
28
|
+
to eql(['jquery', 'jquery_ujs', 'activeadmin-redactor'])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'options passed' do
|
33
|
+
let(:options) {{javascripts: ['foo.js', 'bar.js']}}
|
34
|
+
it 'returns javascripts with required js elements prepended' do
|
35
|
+
expect(subject.javascripts).
|
36
|
+
to eql(%w(jquery jquery_ujs activeadmin-redactor foo.js bar.js))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
23
41
|
describe '#layout' do
|
24
42
|
context 'no options passed' do
|
25
43
|
let(:options) {Hash.new}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-redactor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Entwistle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|