comfy_middle_seat 3.2.0 → 4.0.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 +4 -4
- data/.github/workflows/coveralls.yml +4 -0
- data/CHANGELOG.md +56 -3
- data/CONTRIBUTING.md +8 -5
- data/Gemfile +1 -1
- data/README.md +66 -29
- data/Rakefile +3 -3
- data/app/assets/javascripts/comfy/admin/cms/application.js +2 -0
- data/app/assets/javascripts/comfy/admin/cms/base.js +6 -1
- data/app/assets/javascripts/comfy/admin/cms/codemirror.js +17 -0
- data/app/assets/javascripts/comfy/admin/cms/dirty_forms.js +201 -0
- data/app/assets/javascripts/comfy/admin/cms/draft_forms.js +468 -0
- data/app/assets/javascripts/comfy/admin/cms/page_fragments.js +393 -22
- data/app/assets/javascripts/comfy/admin/cms/wysiwyg.js +21 -0
- data/app/assets/javascripts/comfy/vendor/redactor/filemanager.js +48 -30
- data/app/assets/javascripts/comfy/vendor/redactor/imagemanager.js +43 -25
- data/app/assets/stylesheets/comfy/admin/cms/base.sass +23 -0
- data/app/controllers/comfy/admin/base_controller.rb +3 -3
- data/app/controllers/comfy/admin/cms/base_controller.rb +12 -7
- data/app/controllers/comfy/admin/cms/files_controller.rb +1 -1
- data/app/controllers/comfy/admin/cms/pages_controller.rb +76 -16
- data/app/controllers/comfy/admin/cms/revisions/base_controller.rb +39 -1
- data/app/controllers/comfy/admin/cms/revisions/page_controller.rb +9 -8
- data/app/controllers/comfy/admin/cms/revisions/translation_controller.rb +14 -8
- data/app/controllers/comfy/admin/cms/sites_controller.rb +1 -1
- data/app/controllers/comfy/admin/cms/translations_controller.rb +3 -1
- data/app/controllers/comfy/cms/base_controller.rb +1 -1
- data/app/controllers/comfy/cms/content_controller.rb +5 -5
- data/app/controllers/concerns/comfy/reorder_action.rb +24 -4
- data/app/helpers/comfy/admin/cms_helper.rb +28 -3
- data/app/helpers/comfy/cms_helper.rb +1 -1
- data/app/models/comfy/cms/file.rb +25 -3
- data/app/models/comfy/cms/layout.rb +8 -6
- data/app/models/comfy/cms/page.rb +22 -0
- data/app/models/comfy/cms/site.rb +3 -3
- data/app/models/comfy/cms/snippet.rb +8 -3
- data/app/models/concerns/comfy/cms/with_fragments.rb +2 -2
- data/app/views/comfy/admin/cms/categories/_index.html.haml +1 -1
- data/app/views/comfy/admin/cms/categories/_show.html.haml +1 -1
- data/app/views/comfy/admin/cms/files/_file.html.haml +1 -1
- data/app/views/comfy/admin/cms/files/index.html.haml +9 -2
- data/app/views/comfy/admin/cms/fragments/_form_fragments.html.haml +2 -2
- data/app/views/comfy/admin/cms/pages/_form.html.haml +2 -1
- data/app/views/comfy/admin/cms/pages/_index_branch.html.haml +11 -10
- data/app/views/comfy/admin/cms/pages/edit.html.haml +3 -1
- data/app/views/comfy/admin/cms/pages/index.html.haml +9 -2
- data/app/views/comfy/admin/cms/pages/new.html.haml +3 -1
- data/app/views/comfy/admin/cms/pages/toggle_branch.js.erb +2 -2
- data/app/views/comfy/admin/cms/revisions/show.html.haml +25 -7
- data/app/views/comfy/admin/cms/shared/_search.html.haml +9 -0
- data/app/views/comfy/admin/cms/sites/_form.html.haml +1 -1
- data/app/views/comfy/admin/cms/translations/_form.html.haml +2 -1
- data/app/views/comfy/admin/cms/translations/edit.html.haml +3 -1
- data/app/views/comfy/admin/cms/translations/new.html.haml +3 -1
- data/app/views/layouts/comfy/admin/cms/_flash.html.haml +1 -1
- data/app/views/layouts/comfy/admin/cms/_head.html.haml +3 -1
- data/app/views/layouts/comfy/admin/cms/_left.html.haml +2 -2
- data/comfy_middle_seat.gemspec +10 -5
- data/config/application.rb +3 -2
- data/config/cms_routes.rb +1 -1
- data/config/environment.rb +1 -1
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/environments/test.rb +1 -1
- data/config/initializers/{comfortable_media_surfer.rb → comfy_middle_seat.rb} +4 -4
- data/config/locales/ar.yml +14 -0
- data/config/locales/ca.yml +14 -0
- data/config/locales/cs.yml +14 -0
- data/config/locales/da.yml +14 -0
- data/config/locales/de.yml +14 -0
- data/config/locales/en.yml +14 -0
- data/config/locales/es.yml +14 -0
- data/config/locales/fi.yml +14 -0
- data/config/locales/fr.yml +14 -0
- data/config/locales/gr.yml +14 -0
- data/config/locales/hr.yml +14 -0
- data/config/locales/it.yml +14 -0
- data/config/locales/ja.yml +14 -0
- data/config/locales/nb.yml +14 -0
- data/config/locales/nl.yml +14 -0
- data/config/locales/pl.yml +14 -0
- data/config/locales/pt-BR.yml +14 -0
- data/config/locales/ru.yml +14 -0
- data/config/locales/sk.yml +14 -0
- data/config/locales/sv.yml +14 -0
- data/config/locales/tr.yml +14 -0
- data/config/locales/uk.yml +14 -0
- data/config/locales/zh-CN.yml +14 -0
- data/config/locales/zh-TW.yml +14 -0
- data/config.ru +1 -1
- data/exe/comfy-middle-seat-upgrade +34 -0
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/admin_authentication.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/admin_authorization.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/public_authentication.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/public_authorization.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/configuration.rb +7 -7
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/block.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/params_parser.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/renderer.rb +10 -10
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tag.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/asset.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/audio.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/breadcrumbs.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/checkbox.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/children.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/date.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/datetime.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/file.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/file_link.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/files.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/fragment.rb +2 -2
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/helper.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/image.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/markdown.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/mixins/file_content.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/number.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/page_file_link.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/partial.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/siblings.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/snippet.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/template.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/text.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/textarea.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags/wysiwyg.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content/tags.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/content.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/engine.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/error.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/extensions/acts_as_tree.rb +3 -3
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/extensions/has_revisions.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/extensions.rb +1 -1
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/form_builder.rb +2 -2
- data/lib/comfy_middle_seat/initializer_upgrader.rb +115 -0
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/render_methods.rb +7 -7
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/routing.rb +3 -2
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/file/exporter.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/file/importer.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/layout/exporter.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/layout/importer.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/page/exporter.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/page/importer.rb +7 -7
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/snippet/exporter.rb +4 -4
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds/snippet/importer.rb +5 -5
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/seeds.rb +4 -4
- data/lib/comfy_middle_seat/version.rb +2 -2
- data/lib/{comfortable_media_surfer → comfy_middle_seat}/view_hooks.rb +2 -2
- data/lib/comfy_middle_seat.rb +54 -1
- data/lib/generators/comfy/cms/README +3 -11
- data/lib/generators/comfy/cms/cms_generator.rb +2 -2
- data/lib/generators/comfy/scaffold/templates/tests/controller.rb.tt +2 -2
- data/lib/tasks/cms_seeds.rake +8 -8
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +68 -62
- data/lib/comfortable_media_surfer/version.rb +0 -3
- data/lib/comfortable_media_surfer.rb +0 -56
data/config/locales/sv.yml
CHANGED
|
@@ -64,6 +64,13 @@ sv:
|
|
|
64
64
|
snippets: Snippets
|
|
65
65
|
files: Filer
|
|
66
66
|
|
|
67
|
+
forms:
|
|
68
|
+
unsaved_changes: Du har osparade ändringar. Är du säker på att du vill lämna den här sidan?
|
|
69
|
+
|
|
70
|
+
search:
|
|
71
|
+
submit: Sök
|
|
72
|
+
clear: Rensa
|
|
73
|
+
|
|
67
74
|
sites:
|
|
68
75
|
created: Site skapad
|
|
69
76
|
creation_failure: Kunde inte skapa site
|
|
@@ -129,6 +136,8 @@ sv:
|
|
|
129
136
|
index:
|
|
130
137
|
title: Sidor
|
|
131
138
|
new_link: Skapa ny sida
|
|
139
|
+
search_placeholder: Sök efter sidor via etikett, slug, sökväg eller innehåll
|
|
140
|
+
no_results: Inga sidor hittades.
|
|
132
141
|
index_branch:
|
|
133
142
|
toggle: Välj
|
|
134
143
|
add_child_page: Lägg till undersida
|
|
@@ -152,6 +161,9 @@ sv:
|
|
|
152
161
|
choose_link: Välj sida...
|
|
153
162
|
|
|
154
163
|
fragments:
|
|
164
|
+
loading: Läser in layoutinnehåll…
|
|
165
|
+
load_error: Layoutinnehållet kunde inte läsas in. Ditt nuvarande innehåll har behållits.
|
|
166
|
+
discard_confirmation: En del innehåll kan inte bevaras i den valda layouten. Ersätt det ändå?
|
|
155
167
|
form_fragments:
|
|
156
168
|
no_tags: |-
|
|
157
169
|
Layout har inga innehållstaggar definierade.<br/>
|
|
@@ -235,6 +247,8 @@ sv:
|
|
|
235
247
|
title: Filer
|
|
236
248
|
new_link: Ladda upp en ny fil
|
|
237
249
|
button: Ladda upp filer
|
|
250
|
+
search_placeholder: Sök efter filer via etikett, beskrivning eller filnamn
|
|
251
|
+
no_results: Inga filer hittades.
|
|
238
252
|
new:
|
|
239
253
|
title: Ny Fil
|
|
240
254
|
edit:
|
data/config/locales/tr.yml
CHANGED
|
@@ -64,6 +64,13 @@ tr:
|
|
|
64
64
|
snippets: Pasajlar
|
|
65
65
|
files: Dosyalar
|
|
66
66
|
|
|
67
|
+
forms:
|
|
68
|
+
unsaved_changes: Kaydedilmemiş değişiklikleriniz var. Bu sayfadan ayrılmak istediğinizden emin misiniz?
|
|
69
|
+
|
|
70
|
+
search:
|
|
71
|
+
submit: Ara
|
|
72
|
+
clear: Temizle
|
|
73
|
+
|
|
67
74
|
sites:
|
|
68
75
|
created: Site oluşturuldu
|
|
69
76
|
creation_failure: Site oluşturulamadı
|
|
@@ -129,6 +136,8 @@ tr:
|
|
|
129
136
|
index:
|
|
130
137
|
title: Sayfalar
|
|
131
138
|
new_link: Yeni Sayfa Oluştur
|
|
139
|
+
search_placeholder: Sayfaları etikete, kısa ada, yola veya içeriğe göre ara
|
|
140
|
+
no_results: Sayfa bulunamadı.
|
|
132
141
|
index_branch:
|
|
133
142
|
toggle: Toggle
|
|
134
143
|
add_child_page: Alt Sayfa Oluştur
|
|
@@ -152,6 +161,9 @@ tr:
|
|
|
152
161
|
choose_link: Sayfa Seç...
|
|
153
162
|
|
|
154
163
|
fragments:
|
|
164
|
+
loading: Şablon içeriği yükleniyor…
|
|
165
|
+
load_error: Şablon içeriği yüklenemedi. Mevcut içeriğiniz korundu.
|
|
166
|
+
discard_confirmation: Bazı içerikler seçilen şablonda korunamaz. Yine de değiştirilsin mi?
|
|
155
167
|
form_fragments:
|
|
156
168
|
no_tags: |-
|
|
157
169
|
Şablon etiket içermiyor.<br/>
|
|
@@ -235,6 +247,8 @@ tr:
|
|
|
235
247
|
title: Dosyalar
|
|
236
248
|
new_link: Yeni Dosya Yükle
|
|
237
249
|
button: Dosyaları Yükle
|
|
250
|
+
search_placeholder: Dosyaları etikete, açıklamaya veya dosya adına göre ara
|
|
251
|
+
no_results: Dosya bulunamadı.
|
|
238
252
|
new:
|
|
239
253
|
title: Yeni Dosya
|
|
240
254
|
edit:
|
data/config/locales/uk.yml
CHANGED
|
@@ -64,6 +64,13 @@ uk:
|
|
|
64
64
|
snippets: Сніппети
|
|
65
65
|
files: Файли
|
|
66
66
|
|
|
67
|
+
forms:
|
|
68
|
+
unsaved_changes: У вас є незбережені зміни. Ви впевнені, що хочете залишити цю сторінку?
|
|
69
|
+
|
|
70
|
+
search:
|
|
71
|
+
submit: Пошук
|
|
72
|
+
clear: Очистити
|
|
73
|
+
|
|
67
74
|
sites:
|
|
68
75
|
created: Сайт створено
|
|
69
76
|
creation_failure: Не вийшло створити сайт
|
|
@@ -129,6 +136,8 @@ uk:
|
|
|
129
136
|
index:
|
|
130
137
|
title: Сторінки
|
|
131
138
|
new_link: Створити нову сторінку
|
|
139
|
+
search_placeholder: Шукати сторінки за назвою, посиланням, шляхом або вмістом
|
|
140
|
+
no_results: Сторінок не знайдено.
|
|
132
141
|
index_branch:
|
|
133
142
|
toggle: Перемикач
|
|
134
143
|
add_child_page: Додати дочірню сторінку
|
|
@@ -152,6 +161,9 @@ uk:
|
|
|
152
161
|
choose_link: Select page...
|
|
153
162
|
|
|
154
163
|
fragments:
|
|
164
|
+
loading: Завантаження вмісту шаблону…
|
|
165
|
+
load_error: Не вдалося завантажити вміст шаблону. Ваш поточний вміст збережено.
|
|
166
|
+
discard_confirmation: Деякий вміст неможливо зберегти у вибраному шаблоні. Усе одно замінити його?
|
|
155
167
|
form_fragments:
|
|
156
168
|
no_tags: |-
|
|
157
169
|
Шаблон не містить жодного контент-тега. <br/>
|
|
@@ -235,6 +247,8 @@ uk:
|
|
|
235
247
|
title: Файли
|
|
236
248
|
new_link: Завантажити новий файл
|
|
237
249
|
button: Завантажити файли
|
|
250
|
+
search_placeholder: Шукати файли за назвою, описом або іменем файлу
|
|
251
|
+
no_results: Файлів не знайдено.
|
|
238
252
|
new:
|
|
239
253
|
title: Новий файл
|
|
240
254
|
edit:
|
data/config/locales/zh-CN.yml
CHANGED
|
@@ -64,6 +64,13 @@ zh-CN:
|
|
|
64
64
|
snippets: 片段
|
|
65
65
|
files: 文件
|
|
66
66
|
|
|
67
|
+
forms:
|
|
68
|
+
unsaved_changes: 您有未保存的更改。确定要离开此页面吗?
|
|
69
|
+
|
|
70
|
+
search:
|
|
71
|
+
submit: 搜索
|
|
72
|
+
clear: 清除
|
|
73
|
+
|
|
67
74
|
sites:
|
|
68
75
|
created: 站点创建成功
|
|
69
76
|
creation_failure: 站点创建失败
|
|
@@ -129,6 +136,8 @@ zh-CN:
|
|
|
129
136
|
index:
|
|
130
137
|
title: 页面
|
|
131
138
|
new_link: 创建新页面
|
|
139
|
+
search_placeholder: 按标签、缩略路径、路径或内容搜索页面
|
|
140
|
+
no_results: 未找到页面。
|
|
132
141
|
index_branch:
|
|
133
142
|
toggle: 切换
|
|
134
143
|
add_child_page: 创建子页面
|
|
@@ -152,6 +161,9 @@ zh-CN:
|
|
|
152
161
|
choose_link: 选择页面...
|
|
153
162
|
|
|
154
163
|
fragments:
|
|
164
|
+
loading: 正在加载布局内容…
|
|
165
|
+
load_error: 无法加载布局内容。您当前的内容已保留。
|
|
166
|
+
discard_confirmation: 部分内容无法在所选布局中保留。仍要替换吗?
|
|
155
167
|
form_fragments:
|
|
156
168
|
no_tags: |-
|
|
157
169
|
布局中没有定义内容标签。<br/>
|
|
@@ -235,6 +247,8 @@ zh-CN:
|
|
|
235
247
|
title: 文件
|
|
236
248
|
new_link: 上传新文件
|
|
237
249
|
button: 上传文件
|
|
250
|
+
search_placeholder: 按标签、描述或文件名搜索文件
|
|
251
|
+
no_results: 未找到文件。
|
|
238
252
|
new:
|
|
239
253
|
title: 新文件
|
|
240
254
|
edit:
|
data/config/locales/zh-TW.yml
CHANGED
|
@@ -64,6 +64,13 @@ zh-TW:
|
|
|
64
64
|
snippets: 片段
|
|
65
65
|
files: 文件
|
|
66
66
|
|
|
67
|
+
forms:
|
|
68
|
+
unsaved_changes: 您有尚未儲存的變更。確定要離開此頁面嗎?
|
|
69
|
+
|
|
70
|
+
search:
|
|
71
|
+
submit: 搜尋
|
|
72
|
+
clear: 清除
|
|
73
|
+
|
|
67
74
|
sites:
|
|
68
75
|
created: 站點創建成功
|
|
69
76
|
creation_failure: 站點創建失敗
|
|
@@ -129,6 +136,8 @@ zh-TW:
|
|
|
129
136
|
index:
|
|
130
137
|
title: 頁面
|
|
131
138
|
new_link: 創建新頁面
|
|
139
|
+
search_placeholder: 依標籤、路徑名、路徑或內容搜尋頁面
|
|
140
|
+
no_results: 找不到頁面。
|
|
132
141
|
index_branch:
|
|
133
142
|
toggle: 切換
|
|
134
143
|
add_child_page: 創建子頁面
|
|
@@ -152,6 +161,9 @@ zh-TW:
|
|
|
152
161
|
choose_link: 選擇頁面...
|
|
153
162
|
|
|
154
163
|
fragments:
|
|
164
|
+
loading: 正在載入佈局內容…
|
|
165
|
+
load_error: 無法載入佈局內容。您目前的內容已保留。
|
|
166
|
+
discard_confirmation: 部分內容無法保留在所選的佈局中。仍要取代嗎?
|
|
155
167
|
form_fragments:
|
|
156
168
|
no_tags: |-
|
|
157
169
|
佈局中沒有定義內容標記。<br/>
|
|
@@ -235,6 +247,8 @@ zh-TW:
|
|
|
235
247
|
title: 文件
|
|
236
248
|
new_link: 上傳新文件
|
|
237
249
|
button: 上傳文件
|
|
250
|
+
search_placeholder: 依標籤、描述或檔名搜尋文件
|
|
251
|
+
no_results: 找不到文件。
|
|
238
252
|
new:
|
|
239
253
|
title: 新文件
|
|
240
254
|
edit:
|
data/config.ru
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'optparse'
|
|
5
|
+
|
|
6
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
|
7
|
+
require 'comfy_middle_seat/initializer_upgrader'
|
|
8
|
+
|
|
9
|
+
options = { root: Dir.pwd, dry_run: false }
|
|
10
|
+
parser = OptionParser.new do |opts|
|
|
11
|
+
opts.banner = 'Usage: comfy-middle-seat-upgrade [options]'
|
|
12
|
+
|
|
13
|
+
opts.on('--root PATH', 'Rails application root (defaults to the current directory)') do |path|
|
|
14
|
+
options[:root] = path
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
opts.on('--dry-run', 'Describe changes without modifying files') do
|
|
18
|
+
options[:dry_run] = true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
opts.on('-h', '--help', 'Show this help') do
|
|
22
|
+
puts opts
|
|
23
|
+
exit
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
begin
|
|
28
|
+
parser.parse!
|
|
29
|
+
ComfyMiddleSeat::InitializerUpgrader.new(root: options[:root]).call(dry_run: options[:dry_run])
|
|
30
|
+
rescue OptionParser::ParseError, ComfyMiddleSeat::InitializerUpgrader::Error => e
|
|
31
|
+
warn "Error: #{e.message}"
|
|
32
|
+
warn parser
|
|
33
|
+
exit 1
|
|
34
|
+
end
|
data/lib/{comfortable_media_surfer → comfy_middle_seat}/access_control/admin_authentication.rb
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module ComfyMiddleSeat::AccessControl
|
|
4
4
|
module AdminAuthentication
|
|
5
|
-
# Set username and password in config/initializers/
|
|
5
|
+
# Set username and password in config/initializers/comfy_middle_seat.rb
|
|
6
6
|
# Like this:
|
|
7
|
-
#
|
|
8
|
-
#
|
|
7
|
+
# ComfyMiddleSeat::AccessControl::AdminAuthentication.username = 'myname'
|
|
8
|
+
# ComfyMiddleSeat::AccessControl::AdminAuthentication.password = 'mypassword'
|
|
9
9
|
|
|
10
10
|
mattr_accessor :username,
|
|
11
11
|
:password
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
class
|
|
4
|
-
# Don't like
|
|
3
|
+
class ComfyMiddleSeat::Configuration
|
|
4
|
+
# Don't like ComfyMiddleSeat? Set it to whatever you like. :(
|
|
5
5
|
attr_accessor :cms_title
|
|
6
6
|
|
|
7
7
|
# Controller that is inherited from CmsAdmin::BaseController
|
|
@@ -86,13 +86,13 @@ class ComfortableMediaSurfer::Configuration
|
|
|
86
86
|
|
|
87
87
|
# Configuration defaults
|
|
88
88
|
def initialize
|
|
89
|
-
@cms_title = '
|
|
89
|
+
@cms_title = 'ComfyMiddleSeat CMS Engine'
|
|
90
90
|
@admin_base_controller = 'ApplicationController'
|
|
91
91
|
@public_base_controller = 'ApplicationController'
|
|
92
|
-
@admin_auth = '
|
|
93
|
-
@admin_authorization = '
|
|
94
|
-
@public_auth = '
|
|
95
|
-
@public_authorization = '
|
|
92
|
+
@admin_auth = 'ComfyMiddleSeat::AccessControl::AdminAuthentication'
|
|
93
|
+
@admin_authorization = 'ComfyMiddleSeat::AccessControl::AdminAuthorization'
|
|
94
|
+
@public_auth = 'ComfyMiddleSeat::AccessControl::PublicAuthentication'
|
|
95
|
+
@public_authorization = 'ComfyMiddleSeat::AccessControl::PublicAuthorization'
|
|
96
96
|
@seed_data_path = nil
|
|
97
97
|
@admin_route_redirect = ''
|
|
98
98
|
@enable_sitemap = true
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# wtf does this mean
|
|
4
4
|
# it means that all nodes between this must be moved into here
|
|
5
5
|
# {{cms:block}} some content {{cms:end_block}}
|
|
6
|
-
class
|
|
6
|
+
class ComfyMiddleSeat::Content::Block < ComfyMiddleSeat::Content::Tag
|
|
7
7
|
attr_writer :nodes
|
|
8
8
|
|
|
9
9
|
def nodes
|
|
@@ -14,7 +14,7 @@ require 'strscan'
|
|
|
14
14
|
# and rendered once again until there are no tags to expand.
|
|
15
15
|
# Resulting list is flattened and joined into a final rendered string.
|
|
16
16
|
#
|
|
17
|
-
class
|
|
17
|
+
class ComfyMiddleSeat::Content::Renderer
|
|
18
18
|
class SyntaxError < StandardError; end
|
|
19
19
|
class Error < StandardError; end
|
|
20
20
|
|
|
@@ -24,13 +24,13 @@ class ComfortableMediaSurfer::Content::Renderer
|
|
|
24
24
|
TAG_REGEX = %r{\{\{\s*?cms:(?<class>\w+)(?<params>.*?)\}\}}
|
|
25
25
|
|
|
26
26
|
class << self
|
|
27
|
-
# @return [Hash<String, Class<
|
|
27
|
+
# @return [Hash<String, Class<ComfyMiddleSeat::Content::Tag>>]
|
|
28
28
|
def tags
|
|
29
29
|
@tags ||= {}
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# @param [String] name
|
|
33
|
-
# @param [Class<
|
|
33
|
+
# @param [Class<ComfyMiddleSeat::Content::Tag>] klass
|
|
34
34
|
def register_tag(name, klass)
|
|
35
35
|
tags[name.to_s] = klass
|
|
36
36
|
end
|
|
@@ -43,10 +43,10 @@ class ComfortableMediaSurfer::Content::Renderer
|
|
|
43
43
|
|
|
44
44
|
# This is how we render content out. Takes context (cms page) and content
|
|
45
45
|
# nodes
|
|
46
|
-
# @param [Array<String,
|
|
46
|
+
# @param [Array<String, ComfyMiddleSeat::Content::Tag>]
|
|
47
47
|
# @param [Boolean] allow_erb
|
|
48
48
|
# @param [Integer] depth current tag nesting position
|
|
49
|
-
def render(nodes, allow_erb =
|
|
49
|
+
def render(nodes, allow_erb = ComfyMiddleSeat.config.allow_erb, depth = 0)
|
|
50
50
|
if depth >= MAX_DEPTH
|
|
51
51
|
raise Error, 'Deep tag nesting or recursive nesting detected'
|
|
52
52
|
end
|
|
@@ -94,7 +94,7 @@ class ComfortableMediaSurfer::Content::Renderer
|
|
|
94
94
|
# their own `nodes` method that has array of strings and tags with their own
|
|
95
95
|
# `nodes` method that... you get the idea.
|
|
96
96
|
# @param [Array<String, {Symbol => String}>] tokens
|
|
97
|
-
# @return [Array<String,
|
|
97
|
+
# @return [Array<String, ComfyMiddleSeat::Content::Tag>]
|
|
98
98
|
def nodes(tokens)
|
|
99
99
|
nodes = [[]]
|
|
100
100
|
tokens.each do |token|
|
|
@@ -113,20 +113,20 @@ class ComfortableMediaSurfer::Content::Renderer
|
|
|
113
113
|
nodes.pop
|
|
114
114
|
|
|
115
115
|
else
|
|
116
|
-
# @type [Class<
|
|
116
|
+
# @type [Class<ComfyMiddleSeat::Content::Tag>]
|
|
117
117
|
klass = self.class.tags[tag_class] ||
|
|
118
118
|
raise(SyntaxError, "Unrecognized tag: #{token[:source]}")
|
|
119
119
|
|
|
120
|
-
# @type [
|
|
120
|
+
# @type [ComfyMiddleSeat::Content::Tag]
|
|
121
121
|
tag = klass.new(
|
|
122
122
|
context: @context,
|
|
123
|
-
params:
|
|
123
|
+
params: ComfyMiddleSeat::Content::ParamsParser.new(token[:tag_params]).params,
|
|
124
124
|
source: token[:source]
|
|
125
125
|
)
|
|
126
126
|
nodes.last << tag
|
|
127
127
|
|
|
128
128
|
# If it's a block tag we start collecting nodes into it
|
|
129
|
-
if tag.is_a?(
|
|
129
|
+
if tag.is_a?(ComfyMiddleSeat::Content::Block)
|
|
130
130
|
nodes << tag.nodes
|
|
131
131
|
end
|
|
132
132
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class ComfyMiddleSeat::Content::Tag
|
|
4
4
|
class Error < StandardError; end
|
|
5
5
|
|
|
6
6
|
# @type [Comfy::Cms::WithFragments]
|
|
@@ -24,14 +24,14 @@ class ComfortableMediaSurfer::Content::Tag
|
|
|
24
24
|
# Making sure we don't leak erb from tags by accident.
|
|
25
25
|
# Tag classes can override this, like partials/helpers tags.
|
|
26
26
|
def allow_erb?
|
|
27
|
-
|
|
27
|
+
ComfyMiddleSeat.config.allow_erb
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Normally it's a {(String)}. However, if tag content has tags,
|
|
31
31
|
# we need to expand them and that produces potentially more stuff.
|
|
32
|
-
# @return [Array<String,
|
|
32
|
+
# @return [Array<String, ComfyMiddleSeat::Content::Tag>]
|
|
33
33
|
def nodes
|
|
34
|
-
template =
|
|
34
|
+
template = ComfyMiddleSeat::Content::Renderer.new(@context)
|
|
35
35
|
tokens = template.tokenize(content)
|
|
36
36
|
template.nodes(tokens)
|
|
37
37
|
end
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# `type` - css | js - what we're outputting here
|
|
8
8
|
# `as` - url (default) | tag - output url or wrap it in the appropriate tag
|
|
9
9
|
#
|
|
10
|
-
class
|
|
10
|
+
class ComfyMiddleSeat::Content::Tags::Asset < ComfyMiddleSeat::Content::Tag
|
|
11
11
|
attr_reader :identifier, :type, :as
|
|
12
12
|
|
|
13
13
|
def initialize(context:, params: [], source: nil)
|
|
@@ -30,7 +30,7 @@ class ComfortableMediaSurfer::Content::Tags::Asset < ComfortableMediaSurfer::Con
|
|
|
30
30
|
def content
|
|
31
31
|
return '' unless layout
|
|
32
32
|
|
|
33
|
-
base =
|
|
33
|
+
base = ComfyMiddleSeat.config.public_cms_path || ''
|
|
34
34
|
unless base.ends_with?('/')
|
|
35
35
|
base += '/'
|
|
36
36
|
end
|
|
@@ -52,6 +52,6 @@ class ComfortableMediaSurfer::Content::Tags::Asset < ComfortableMediaSurfer::Con
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
:asset,
|
|
55
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
56
|
+
:asset, ComfyMiddleSeat::Content::Tags::Asset
|
|
57
57
|
)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# }
|
|
15
15
|
# and/or pass in style overrides with the 'style' parameter, as above
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class ComfyMiddleSeat::Content::Tags::Audio < ComfyMiddleSeat::Content::Tag
|
|
18
18
|
attr_reader :path, :style, :locals
|
|
19
19
|
|
|
20
20
|
def initialize(context:, params: [], source: nil)
|
|
@@ -34,6 +34,6 @@ class ComfortableMediaSurfer::Content::Tags::Audio < ComfortableMediaSurfer::Con
|
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
:audio,
|
|
37
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
38
|
+
:audio, ComfyMiddleSeat::Content::Tags::Audio
|
|
39
39
|
)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# }
|
|
16
16
|
# and/or pass in style overrides with the 'style' parameter, as above
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class ComfyMiddleSeat::Content::Tags::Breadcrumbs < ComfyMiddleSeat::Content::Tag
|
|
19
19
|
attr_reader :links, :style, :locals
|
|
20
20
|
|
|
21
21
|
def initialize(context:, params: [], source: nil)
|
|
@@ -38,6 +38,6 @@ class ComfortableMediaSurfer::Content::Tags::Breadcrumbs < ComfortableMediaSurfe
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
:breadcrumbs,
|
|
41
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
42
|
+
:breadcrumbs, ComfyMiddleSeat::Content::Tags::Breadcrumbs
|
|
43
43
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Tag for boolean content that is going to be rendered using checkbox
|
|
4
4
|
# {{ cms:checkbox identifier }}
|
|
5
5
|
#
|
|
6
|
-
class
|
|
6
|
+
class ComfyMiddleSeat::Content::Tags::Checkbox < ComfyMiddleSeat::Content::Tags::Fragment
|
|
7
7
|
def content
|
|
8
8
|
fragment.boolean
|
|
9
9
|
end
|
|
@@ -22,6 +22,6 @@ class ComfortableMediaSurfer::Content::Tags::Checkbox < ComfortableMediaSurfer::
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
:checkbox,
|
|
25
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
26
|
+
:checkbox, ComfyMiddleSeat::Content::Tags::Checkbox
|
|
27
27
|
)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# To exclude children, list their slugs with the 'exclude' parameter
|
|
16
16
|
# as comma-delimited string, e.g. as above - exclude: "404-page, search-page"
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class ComfyMiddleSeat::Content::Tags::Children < ComfyMiddleSeat::Content::Tag
|
|
19
19
|
attr_reader :style, :page_children, :locals
|
|
20
20
|
attr_accessor :list
|
|
21
21
|
|
|
@@ -47,6 +47,6 @@ class ComfortableMediaSurfer::Content::Tags::Children < ComfortableMediaSurfer::
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
:children,
|
|
50
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
51
|
+
:children, ComfyMiddleSeat::Content::Tags::Children
|
|
52
52
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Tag for text content that is going to be rendered using text input with date widget
|
|
4
4
|
# {{ cms:date identifier }}
|
|
5
5
|
#
|
|
6
|
-
class
|
|
6
|
+
class ComfyMiddleSeat::Content::Tags::Date < ComfyMiddleSeat::Content::Tags::Datetime
|
|
7
7
|
def form_field(object_name, view, index)
|
|
8
8
|
name = "#{object_name}[fragments_attributes][#{index}][datetime]"
|
|
9
9
|
options = { id: form_field_id, class: 'form-control', data: { 'cms-date' => true } }
|
|
@@ -14,6 +14,6 @@ class ComfortableMediaSurfer::Content::Tags::Date < ComfortableMediaSurfer::Cont
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
:date,
|
|
17
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
18
|
+
:date, ComfyMiddleSeat::Content::Tags::Date
|
|
19
19
|
)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#
|
|
6
6
|
# `strftime` - Format datetime string during rendering
|
|
7
7
|
#
|
|
8
|
-
class
|
|
8
|
+
class ComfyMiddleSeat::Content::Tags::Datetime < ComfyMiddleSeat::Content::Tags::Fragment
|
|
9
9
|
attr_reader :strftime
|
|
10
10
|
|
|
11
11
|
def initialize(context:, params: [], source: nil)
|
|
@@ -37,6 +37,6 @@ class ComfortableMediaSurfer::Content::Tags::Datetime < ComfortableMediaSurfer::
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
:datetime,
|
|
40
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
41
|
+
:datetime, ComfyMiddleSeat::Content::Tags::Datetime
|
|
42
42
|
)
|
|
@@ -13,8 +13,8 @@ require_relative 'mixins/file_content'
|
|
|
13
13
|
# `crop` - imagemagic option. For example: "100x50+0+0"
|
|
14
14
|
# `class` - any html classes that you want on the result link or image tag. For example "class1 class2"
|
|
15
15
|
#
|
|
16
|
-
class
|
|
17
|
-
include
|
|
16
|
+
class ComfyMiddleSeat::Content::Tags::File < ComfyMiddleSeat::Content::Tags::Fragment
|
|
17
|
+
include ComfyMiddleSeat::Content::Tags::Mixins::FileContent
|
|
18
18
|
|
|
19
19
|
# @type ["url", "link", "image"]
|
|
20
20
|
attr_reader :as
|
|
@@ -22,7 +22,7 @@ class ComfortableMediaSurfer::Content::Tags::File < ComfortableMediaSurfer::Cont
|
|
|
22
22
|
# @type [{String => String}]
|
|
23
23
|
attr_reader :variant_attrs
|
|
24
24
|
|
|
25
|
-
# @param (see
|
|
25
|
+
# @param (see ComfyMiddleSeat::Content::Tag#initialize)
|
|
26
26
|
def initialize(context:, params: [], source: nil)
|
|
27
27
|
super
|
|
28
28
|
@as = options['as'] || 'url'
|
|
@@ -65,6 +65,6 @@ protected
|
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
:file,
|
|
68
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
69
|
+
:file, ComfyMiddleSeat::Content::Tags::File
|
|
70
70
|
)
|
|
@@ -16,8 +16,8 @@ require_relative 'mixins/file_content'
|
|
|
16
16
|
# `gravity` - imagemagick option. For example: "center"
|
|
17
17
|
# `crop` - imagemagick option. For example: "100x50+0+0"
|
|
18
18
|
#
|
|
19
|
-
class
|
|
20
|
-
include
|
|
19
|
+
class ComfyMiddleSeat::Content::Tags::FileLink < ComfyMiddleSeat::Content::Tag
|
|
20
|
+
include ComfyMiddleSeat::Content::Tags::Mixins::FileContent
|
|
21
21
|
|
|
22
22
|
attr_reader :identifier, :as, :variant_attrs
|
|
23
23
|
|
|
@@ -53,6 +53,6 @@ class ComfortableMediaSurfer::Content::Tags::FileLink < ComfortableMediaSurfer::
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
:file_link,
|
|
56
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
57
|
+
:file_link, ComfyMiddleSeat::Content::Tags::FileLink
|
|
58
58
|
)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# Example tag:
|
|
6
6
|
# {{ cms:files identifier }}
|
|
7
7
|
#
|
|
8
|
-
class
|
|
8
|
+
class ComfyMiddleSeat::Content::Tags::Files < ComfyMiddleSeat::Content::Tags::File
|
|
9
9
|
def content
|
|
10
10
|
return '' if fragment.attachments.blank?
|
|
11
11
|
|
|
@@ -36,6 +36,6 @@ class ComfortableMediaSurfer::Content::Tags::Files < ComfortableMediaSurfer::Con
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
:files,
|
|
39
|
+
ComfyMiddleSeat::Content::Renderer.register_tag(
|
|
40
|
+
:files, ComfyMiddleSeat::Content::Tags::Files
|
|
41
41
|
)
|