nacelle 0.2.2 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fe5bddc720db28466a2786fa5cdf040dc0253dc8c5ce58e3666de6a3debe22f
4
- data.tar.gz: 9e22c41cebd7bec168decb0fe5af58547cdddd44b9940fa80e17d077e56c86f6
3
+ metadata.gz: d981b232a0b7740cbb646ebcfd7f4270a57ad338f11fcfa6e7304a9e4c1244fa
4
+ data.tar.gz: 4e317a0158fdc150feab19806e75b3dc81cb713377cbc585ac8925400863b092
5
5
  SHA512:
6
- metadata.gz: 8591bb9fdbda653de0ed4ff40026efaca9dbdf104f858b3dbebf5a3e224e67c0bffd169f8924e39b60791e205b43bbfadace51667ef2a17e67c0f163cff7ae6c
7
- data.tar.gz: 7dcc211662fd33778c9eeecde5b599032ee90d06f7641786e538bf952b1a4ce8af80809c538d02a3d911999b106e08a37ce49f9e39f62b147001eaa1f6147f13
6
+ metadata.gz: 90303e656be028965b2e841710a2e2f8ca41d6646ddf31e5009a821c699310f5540bc1534f49958013f45346d40e6af6c2c1898a96fb00fa56041cad97ab3e14
7
+ data.tar.gz: 219b0e4f3536109c44b7f2bc5cae09b39e6fbc5951237a8326c0a34744285a17b34a8b009ecbc5cd0c7e617f54594146249b121a564ae61a3bd32f33945b28e4
@@ -0,0 +1,36 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ gemfile: [ rails_5.1, rails_5.2, rails_6.0, rails_6.1, rails_7.0 ]
9
+ ruby: [ 2.4, 2.5, 2.6, 2.7, '3.0' ]
10
+ exclude:
11
+ - gemfile: rails_5.1
12
+ ruby: 3.0
13
+ - gemfile: rails_5.2
14
+ ruby: 3.0
15
+ - gemfile: rails_6.0
16
+ ruby: 2.4
17
+ - gemfile: rails_6.1
18
+ ruby: 2.4
19
+ - gemfile: rails_7.0
20
+ ruby: 2.4
21
+ - gemfile: rails_7.0
22
+ ruby: 2.5
23
+ - gemfile: rails_7.0
24
+ ruby: 2.6
25
+
26
+ runs-on: ubuntu-latest
27
+ env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
28
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
35
+ - run: bundle exec rake
36
+
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /.ruby-version
11
+ /.byebug_history
data/Appraisals ADDED
@@ -0,0 +1,27 @@
1
+ appraise "rails-5.1" do
2
+ gem "rails", "~>5.1.0"
3
+ gem "sprockets", "~>3.0"
4
+ end
5
+
6
+ appraise "rails-5.2" do
7
+ gem "rails", "~>5.2.0"
8
+ gem "sprockets", "~>3.0"
9
+ end
10
+
11
+ appraise "rails-6.0" do
12
+ gem "rails", "~>6.0.0"
13
+ gem "sprockets", "~>3.0"
14
+ gem "capybara", "~>3.35.0" # 3.36 requires ruby 2.6+
15
+ end
16
+
17
+ appraise "rails-6.1" do
18
+ gem "rails", "~>6.1.0"
19
+ gem "sprockets", "~>3.0"
20
+ gem "capybara", "~>3.35.0" # 3.36 requires ruby 2.6+
21
+ end
22
+
23
+ appraise "rails-7.0" do
24
+ gem "rails", "~>7.0.0"
25
+ gem "sprockets", "~>3.0"
26
+ end
27
+
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in nacelle.gemspec
4
4
  gemspec
5
+
6
+ gem "rails", "~>6.1.0"
7
+ gem "sprockets", "~>3.0"
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Nacelle
2
2
 
3
+ [![CI Status](https://github.com/botandrose/nacelle/workflows/CI/badge.svg?branch=master)](https://github.com/botandrose/nacelle/actions?query=workflow%3ACI+branch%3Amaster)
4
+
3
5
  Rails engine for inserting magic blocks into CMS content via cells.
4
6
 
5
7
  In your CMS content:
@@ -0,0 +1,125 @@
1
+ CKEDITOR.dialog.add("cellDialog", function(editor) {
2
+ return {
3
+ title: "Insert Cell",
4
+ minWidth: 400,
5
+ minHeight: 200,
6
+ contents: [{
7
+ id: "main",
8
+ elements: [{
9
+ type: "select",
10
+ id: "cellName",
11
+ label: "Select Cell",
12
+ items: [],
13
+ onChange: (event) => {
14
+ let select = event.sender
15
+ let dialog = select.getDialog()
16
+ let form = dialog.getContentElement("main", "form")
17
+ let cellConfig = dialog.cellConfigs.find(config => config.id === event.data.value)
18
+
19
+ form.getElement().setHtml(cellConfig.form)
20
+
21
+ if(selectedCell = getSelectedCell()) {
22
+ form.getElement().$.querySelectorAll("[name]").forEach(element => {
23
+ setValue(element, selectedCell.getAttribute(element.name))
24
+ })
25
+ }
26
+ },
27
+ },
28
+ {
29
+ type: "html",
30
+ id: "form",
31
+ html: "",
32
+ }],
33
+ }],
34
+
35
+ onShow: function() {
36
+ fetch("/nacelle/cells.json").then(r => r.json()).then(data => {
37
+ this.cellConfigs = data.cells
38
+ let select = this.getContentElement("main", "cellName")
39
+ select.clear()
40
+
41
+ this.cellConfigs.forEach(config => select.add(config.name, config.id))
42
+
43
+ let selectedCell = getSelectedCell()
44
+ if(selectedCell) {
45
+ select.setValue(selectedCell.getAttribute("name"))
46
+ }
47
+ });
48
+ },
49
+
50
+ onOk: function() {
51
+ let cell = editor.document.createElement("cell")
52
+ cell.setAttribute("name", this.getValueOf("main", "cellName"));
53
+
54
+ let form = this.getContentElement("main", "form")
55
+ form.getElement().$.querySelectorAll("[name]").forEach(element => {
56
+ cell.setAttribute(element.name, getValue(element))
57
+ })
58
+
59
+ editor.insertElement(cell)
60
+ },
61
+ };
62
+
63
+ function getSelectedCell() {
64
+ let node = editor.getSelectedHtml().$.firstElementChild
65
+ if(node && node.nodeName == "CELL") {
66
+ return node
67
+ }
68
+ }
69
+
70
+ function getValue(element) {
71
+ switch(element.type) {
72
+ case 'radio':
73
+ case 'checkbox':
74
+ const elements = document.querySelectorAll(`[name="${element.name}"]:checked`)
75
+ const values = Array.from(elements).map(e => e.value)
76
+ if(element.name.endsWith("[]")) {
77
+ return values
78
+ } else {
79
+ return values[0]
80
+ }
81
+ default:
82
+ return element.value
83
+ }
84
+ }
85
+
86
+ function setValue(element, value) {
87
+ if ('undefined' === typeof value) {
88
+ value = '';
89
+ }
90
+
91
+ if (null === value) {
92
+ value = '';
93
+ }
94
+
95
+ var type = element.type || element[0].type;
96
+
97
+ switch(type ) {
98
+ default:
99
+ element.value = value;
100
+ break;
101
+
102
+ case 'radio':
103
+ case 'checkbox':
104
+ element.checked = element.value === value;
105
+ break;
106
+
107
+ case 'select-multiple':
108
+ var values = value.constructor === Array ? value : [value];
109
+ for(var k = 0; k < element.options.length; k++) {
110
+ element.options[k].selected = (values.indexOf(element.options[k].value) > -1 );
111
+ }
112
+ break;
113
+
114
+ case 'select':
115
+ case 'select-one':
116
+ element.value = value.toString() || value;
117
+ break;
118
+
119
+ case 'date':
120
+ element.value = new Date(value).toISOString().split('T')[0];
121
+ break;
122
+ }
123
+ };
124
+ });
125
+
@@ -0,0 +1,19 @@
1
+ CKEDITOR.plugins.add("cells", {
2
+ icons: "insertcell",
3
+ init: function(editor) {
4
+ editor.addCommand("insertCellDialog", new CKEDITOR.dialogCommand("cellDialog"));
5
+
6
+ CKEDITOR.dialog.add("cellDialog", "/assets/ckeditor/plugins/cells/dialogs/cells.js");
7
+
8
+ editor.ui.addButton("InsertCell", {
9
+ label: "Insert Cell",
10
+ command: "insertCellDialog",
11
+ icon: "/assets/ckeditor/plugins/cells/icons/insertcell.png",
12
+ });
13
+ },
14
+ });
15
+
16
+ CKEDITOR.dtd.$empty.cell = 1;
17
+ CKEDITOR.dtd.$nonEditable.cell = 1;
18
+ CKEDITOR.dtd.$object.cell = 1;
19
+
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>5.1.0"
6
+ gem "sprockets", "~>3.0"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,165 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ nacelle (0.3.0)
5
+ cells (~> 3.0)
6
+ rails
7
+ sprockets-rails
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (5.1.7)
13
+ actionpack (= 5.1.7)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (~> 0.6.1)
16
+ actionmailer (5.1.7)
17
+ actionpack (= 5.1.7)
18
+ actionview (= 5.1.7)
19
+ activejob (= 5.1.7)
20
+ mail (~> 2.5, >= 2.5.4)
21
+ rails-dom-testing (~> 2.0)
22
+ actionpack (5.1.7)
23
+ actionview (= 5.1.7)
24
+ activesupport (= 5.1.7)
25
+ rack (~> 2.0)
26
+ rack-test (>= 0.6.3)
27
+ rails-dom-testing (~> 2.0)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ actionview (5.1.7)
30
+ activesupport (= 5.1.7)
31
+ builder (~> 3.1)
32
+ erubi (~> 1.4)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
+ activejob (5.1.7)
36
+ activesupport (= 5.1.7)
37
+ globalid (>= 0.3.6)
38
+ activemodel (5.1.7)
39
+ activesupport (= 5.1.7)
40
+ activerecord (5.1.7)
41
+ activemodel (= 5.1.7)
42
+ activesupport (= 5.1.7)
43
+ arel (~> 8.0)
44
+ activesupport (5.1.7)
45
+ concurrent-ruby (~> 1.0, >= 1.0.2)
46
+ i18n (>= 0.7, < 2)
47
+ minitest (~> 5.1)
48
+ tzinfo (~> 1.1)
49
+ addressable (2.8.0)
50
+ public_suffix (>= 2.0.2, < 5.0)
51
+ appraisal (2.4.1)
52
+ bundler
53
+ rake
54
+ thor (>= 0.14.0)
55
+ arel (8.0.0)
56
+ builder (3.2.4)
57
+ byebug (11.1.3)
58
+ capybara (3.32.2)
59
+ addressable
60
+ mini_mime (>= 0.1.3)
61
+ nokogiri (~> 1.8)
62
+ rack (>= 1.6.0)
63
+ rack-test (>= 0.6.3)
64
+ regexp_parser (~> 1.5)
65
+ xpath (~> 3.2)
66
+ cells (3.11.3)
67
+ actionpack (>= 3.0)
68
+ railties (>= 3.0)
69
+ uber (~> 0.0.8)
70
+ concurrent-ruby (1.1.9)
71
+ crass (1.0.6)
72
+ diff-lcs (1.5.0)
73
+ erubi (1.10.0)
74
+ globalid (0.4.2)
75
+ activesupport (>= 4.2.0)
76
+ i18n (1.8.11)
77
+ concurrent-ruby (~> 1.0)
78
+ loofah (2.13.0)
79
+ crass (~> 1.0.2)
80
+ nokogiri (>= 1.5.9)
81
+ mail (2.7.1)
82
+ mini_mime (>= 0.1.1)
83
+ method_source (1.0.0)
84
+ mini_mime (1.1.2)
85
+ mini_portile2 (2.4.0)
86
+ minitest (5.15.0)
87
+ nio4r (2.5.8)
88
+ nokogiri (1.10.10)
89
+ mini_portile2 (~> 2.4.0)
90
+ public_suffix (4.0.6)
91
+ rack (2.2.3)
92
+ rack-test (1.1.0)
93
+ rack (>= 1.0, < 3)
94
+ rails (5.1.7)
95
+ actioncable (= 5.1.7)
96
+ actionmailer (= 5.1.7)
97
+ actionpack (= 5.1.7)
98
+ actionview (= 5.1.7)
99
+ activejob (= 5.1.7)
100
+ activemodel (= 5.1.7)
101
+ activerecord (= 5.1.7)
102
+ activesupport (= 5.1.7)
103
+ bundler (>= 1.3.0)
104
+ railties (= 5.1.7)
105
+ sprockets-rails (>= 2.0.0)
106
+ rails-dom-testing (2.0.3)
107
+ activesupport (>= 4.2.0)
108
+ nokogiri (>= 1.6)
109
+ rails-html-sanitizer (1.4.2)
110
+ loofah (~> 2.3)
111
+ railties (5.1.7)
112
+ actionpack (= 5.1.7)
113
+ activesupport (= 5.1.7)
114
+ method_source
115
+ rake (>= 0.8.7)
116
+ thor (>= 0.18.1, < 2.0)
117
+ rake (13.0.6)
118
+ regexp_parser (1.8.2)
119
+ rspec (3.10.0)
120
+ rspec-core (~> 3.10.0)
121
+ rspec-expectations (~> 3.10.0)
122
+ rspec-mocks (~> 3.10.0)
123
+ rspec-core (3.10.1)
124
+ rspec-support (~> 3.10.0)
125
+ rspec-expectations (3.10.1)
126
+ diff-lcs (>= 1.2.0, < 2.0)
127
+ rspec-support (~> 3.10.0)
128
+ rspec-mocks (3.10.2)
129
+ diff-lcs (>= 1.2.0, < 2.0)
130
+ rspec-support (~> 3.10.0)
131
+ rspec-support (3.10.3)
132
+ sprockets (3.7.2)
133
+ concurrent-ruby (~> 1.0)
134
+ rack (> 1, < 3)
135
+ sprockets-rails (3.2.2)
136
+ actionpack (>= 4.0)
137
+ activesupport (>= 4.0)
138
+ sprockets (>= 3.0.0)
139
+ thor (1.1.0)
140
+ thread_safe (0.3.6)
141
+ tzinfo (1.2.9)
142
+ thread_safe (~> 0.1)
143
+ uber (0.0.15)
144
+ websocket-driver (0.6.5)
145
+ websocket-extensions (>= 0.1.0)
146
+ websocket-extensions (0.1.5)
147
+ xpath (3.2.0)
148
+ nokogiri (~> 1.8)
149
+
150
+ PLATFORMS
151
+ ruby
152
+
153
+ DEPENDENCIES
154
+ appraisal
155
+ bundler
156
+ byebug
157
+ capybara
158
+ nacelle!
159
+ rails (~> 5.1.0)
160
+ rake
161
+ rspec
162
+ sprockets (~> 3.0)
163
+
164
+ BUNDLED WITH
165
+ 2.2.32
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>5.2.0"
6
+ gem "sprockets", "~>3.0"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,171 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ nacelle (0.3.0)
5
+ cells (~> 3.0)
6
+ rails
7
+ sprockets-rails
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (5.2.6)
13
+ actionpack (= 5.2.6)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailer (5.2.6)
17
+ actionpack (= 5.2.6)
18
+ actionview (= 5.2.6)
19
+ activejob (= 5.2.6)
20
+ mail (~> 2.5, >= 2.5.4)
21
+ rails-dom-testing (~> 2.0)
22
+ actionpack (5.2.6)
23
+ actionview (= 5.2.6)
24
+ activesupport (= 5.2.6)
25
+ rack (~> 2.0, >= 2.0.8)
26
+ rack-test (>= 0.6.3)
27
+ rails-dom-testing (~> 2.0)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ actionview (5.2.6)
30
+ activesupport (= 5.2.6)
31
+ builder (~> 3.1)
32
+ erubi (~> 1.4)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
+ activejob (5.2.6)
36
+ activesupport (= 5.2.6)
37
+ globalid (>= 0.3.6)
38
+ activemodel (5.2.6)
39
+ activesupport (= 5.2.6)
40
+ activerecord (5.2.6)
41
+ activemodel (= 5.2.6)
42
+ activesupport (= 5.2.6)
43
+ arel (>= 9.0)
44
+ activestorage (5.2.6)
45
+ actionpack (= 5.2.6)
46
+ activerecord (= 5.2.6)
47
+ marcel (~> 1.0.0)
48
+ activesupport (5.2.6)
49
+ concurrent-ruby (~> 1.0, >= 1.0.2)
50
+ i18n (>= 0.7, < 2)
51
+ minitest (~> 5.1)
52
+ tzinfo (~> 1.1)
53
+ addressable (2.8.0)
54
+ public_suffix (>= 2.0.2, < 5.0)
55
+ appraisal (2.4.1)
56
+ bundler
57
+ rake
58
+ thor (>= 0.14.0)
59
+ arel (9.0.0)
60
+ builder (3.2.4)
61
+ byebug (11.1.3)
62
+ capybara (3.32.2)
63
+ addressable
64
+ mini_mime (>= 0.1.3)
65
+ nokogiri (~> 1.8)
66
+ rack (>= 1.6.0)
67
+ rack-test (>= 0.6.3)
68
+ regexp_parser (~> 1.5)
69
+ xpath (~> 3.2)
70
+ cells (3.11.3)
71
+ actionpack (>= 3.0)
72
+ railties (>= 3.0)
73
+ uber (~> 0.0.8)
74
+ concurrent-ruby (1.1.9)
75
+ crass (1.0.6)
76
+ diff-lcs (1.5.0)
77
+ erubi (1.10.0)
78
+ globalid (0.4.2)
79
+ activesupport (>= 4.2.0)
80
+ i18n (1.8.11)
81
+ concurrent-ruby (~> 1.0)
82
+ loofah (2.13.0)
83
+ crass (~> 1.0.2)
84
+ nokogiri (>= 1.5.9)
85
+ mail (2.7.1)
86
+ mini_mime (>= 0.1.1)
87
+ marcel (1.0.2)
88
+ method_source (1.0.0)
89
+ mini_mime (1.1.2)
90
+ mini_portile2 (2.4.0)
91
+ minitest (5.15.0)
92
+ nio4r (2.5.8)
93
+ nokogiri (1.10.10)
94
+ mini_portile2 (~> 2.4.0)
95
+ public_suffix (4.0.6)
96
+ rack (2.2.3)
97
+ rack-test (1.1.0)
98
+ rack (>= 1.0, < 3)
99
+ rails (5.2.6)
100
+ actioncable (= 5.2.6)
101
+ actionmailer (= 5.2.6)
102
+ actionpack (= 5.2.6)
103
+ actionview (= 5.2.6)
104
+ activejob (= 5.2.6)
105
+ activemodel (= 5.2.6)
106
+ activerecord (= 5.2.6)
107
+ activestorage (= 5.2.6)
108
+ activesupport (= 5.2.6)
109
+ bundler (>= 1.3.0)
110
+ railties (= 5.2.6)
111
+ sprockets-rails (>= 2.0.0)
112
+ rails-dom-testing (2.0.3)
113
+ activesupport (>= 4.2.0)
114
+ nokogiri (>= 1.6)
115
+ rails-html-sanitizer (1.4.2)
116
+ loofah (~> 2.3)
117
+ railties (5.2.6)
118
+ actionpack (= 5.2.6)
119
+ activesupport (= 5.2.6)
120
+ method_source
121
+ rake (>= 0.8.7)
122
+ thor (>= 0.19.0, < 2.0)
123
+ rake (13.0.6)
124
+ regexp_parser (1.8.2)
125
+ rspec (3.10.0)
126
+ rspec-core (~> 3.10.0)
127
+ rspec-expectations (~> 3.10.0)
128
+ rspec-mocks (~> 3.10.0)
129
+ rspec-core (3.10.1)
130
+ rspec-support (~> 3.10.0)
131
+ rspec-expectations (3.10.1)
132
+ diff-lcs (>= 1.2.0, < 2.0)
133
+ rspec-support (~> 3.10.0)
134
+ rspec-mocks (3.10.2)
135
+ diff-lcs (>= 1.2.0, < 2.0)
136
+ rspec-support (~> 3.10.0)
137
+ rspec-support (3.10.3)
138
+ sprockets (3.7.2)
139
+ concurrent-ruby (~> 1.0)
140
+ rack (> 1, < 3)
141
+ sprockets-rails (3.2.2)
142
+ actionpack (>= 4.0)
143
+ activesupport (>= 4.0)
144
+ sprockets (>= 3.0.0)
145
+ thor (1.1.0)
146
+ thread_safe (0.3.6)
147
+ tzinfo (1.2.9)
148
+ thread_safe (~> 0.1)
149
+ uber (0.0.15)
150
+ websocket-driver (0.7.5)
151
+ websocket-extensions (>= 0.1.0)
152
+ websocket-extensions (0.1.5)
153
+ xpath (3.2.0)
154
+ nokogiri (~> 1.8)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ appraisal
161
+ bundler
162
+ byebug
163
+ capybara
164
+ nacelle!
165
+ rails (~> 5.2.0)
166
+ rake
167
+ rspec
168
+ sprockets (~> 3.0)
169
+
170
+ BUNDLED WITH
171
+ 2.2.32
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>6.0.0"
6
+ gem "sprockets", "~>3.0"
7
+ gem "capybara", "~>3.35.0"
8
+
9
+ gemspec path: "../"