comfortable_mexican_sofa 2.0.12 → 2.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +5 -2
- data/Gemfile +5 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/comfy/admin/cms/application.js +40 -0
- data/app/assets/javascripts/comfy/admin/cms/base.js +46 -0
- data/app/assets/javascripts/comfy/admin/cms/categories.js +17 -0
- data/app/assets/javascripts/comfy/admin/cms/codemirror.js +31 -0
- data/app/assets/javascripts/comfy/admin/cms/custom.js +1 -0
- data/app/assets/javascripts/comfy/admin/cms/diff.js +10 -0
- data/app/assets/javascripts/comfy/admin/cms/file_link.js +67 -0
- data/app/assets/javascripts/comfy/admin/cms/file_upload.js +194 -0
- data/app/assets/javascripts/comfy/admin/cms/files_modal.js +40 -0
- data/app/assets/javascripts/comfy/admin/cms/page_fragments.js +22 -0
- data/app/assets/javascripts/comfy/admin/cms/slugify.js +34 -0
- data/app/assets/javascripts/comfy/admin/cms/sortable_list.js +40 -0
- data/app/assets/javascripts/comfy/admin/cms/timepicker.js +30 -0
- data/app/assets/javascripts/comfy/admin/cms/wysiwyg.js +65 -0
- data/app/assets/javascripts/comfy/vendor/redactor.js +12 -6
- data/app/assets/stylesheets/comfy/admin/cms/base.sass +32 -35
- data/app/controllers/application_controller.rb +2 -0
- data/app/controllers/comfy/admin/base_controller.rb +3 -1
- data/app/controllers/comfy/admin/cms/base_controller.rb +9 -1
- data/app/controllers/comfy/admin/cms/categories_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/files_controller.rb +3 -1
- data/app/controllers/comfy/admin/cms/layouts_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/pages_controller.rb +4 -1
- data/app/controllers/comfy/admin/cms/revisions/base_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/revisions/layout_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/revisions/page_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/revisions/snippet_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/revisions/translation_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/sites_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/snippets_controller.rb +2 -0
- data/app/controllers/comfy/admin/cms/translations_controller.rb +8 -0
- data/app/controllers/comfy/cms/assets_controller.rb +2 -0
- data/app/controllers/comfy/cms/base_controller.rb +4 -2
- data/app/controllers/comfy/cms/content_controller.rb +3 -1
- data/app/controllers/concerns/comfy/paginate.rb +2 -0
- data/app/controllers/concerns/comfy/reorder_action.rb +2 -0
- data/app/helpers/comfy/admin/cms_helper.rb +19 -0
- data/app/helpers/comfy/cms_helper.rb +4 -2
- data/app/models/comfy/cms/categorization.rb +2 -0
- data/app/models/comfy/cms/category.rb +2 -0
- data/app/models/comfy/cms/file.rb +2 -0
- data/app/models/comfy/cms/fragment.rb +3 -1
- data/app/models/comfy/cms/layout.rb +3 -1
- data/app/models/comfy/cms/page.rb +3 -1
- data/app/models/comfy/cms/revision.rb +2 -0
- data/app/models/comfy/cms/site.rb +5 -1
- data/app/models/comfy/cms/snippet.rb +2 -0
- data/app/models/comfy/cms/translation.rb +2 -0
- data/app/models/concerns/comfy/cms/with_categories.rb +2 -0
- data/app/models/concerns/comfy/cms/with_fragments.rb +2 -0
- data/app/views/comfy/admin/cms/categories/_index.html.haml +3 -3
- data/app/views/comfy/admin/cms/categories/create.js.erb +1 -1
- data/app/views/comfy/admin/cms/categories/destroy.js.erb +8 -3
- data/app/views/comfy/admin/cms/files/_file.html.haml +9 -10
- data/app/views/comfy/admin/cms/files/_modal.html.haml +1 -2
- data/app/views/comfy/admin/cms/files/destroy.js.erb +4 -0
- data/app/views/comfy/admin/cms/files/index.html.haml +10 -10
- data/app/views/comfy/admin/cms/fragments/_form_fragment_attachments.html.haml +15 -6
- data/app/views/comfy/admin/cms/fragments/_form_fragments.html.haml +17 -21
- data/app/views/comfy/admin/cms/pages/_form.html.haml +3 -2
- data/app/views/comfy/admin/cms/pages/toggle_branch.js.erb +3 -1
- data/app/views/comfy/admin/cms/translations/_form.html.haml +3 -2
- data/app/views/layouts/comfy/admin/cms.html.haml +0 -1
- data/app/views/layouts/comfy/admin/cms/_body.html.haml +1 -0
- data/app/views/layouts/comfy/admin/cms/_left.html.haml +1 -1
- data/comfortable_mexican_sofa.gemspec +3 -2
- data/config.ru +2 -0
- data/config/application.rb +2 -0
- data/config/boot.rb +2 -0
- data/config/cms_routes.rb +2 -0
- data/config/environment.rb +2 -0
- data/config/environments/development.rb +2 -0
- data/config/environments/test.rb +2 -0
- data/config/initializers/comfortable_mexican_sofa.rb +2 -0
- data/lib/comfortable_mexican_sofa.rb +2 -0
- data/lib/comfortable_mexican_sofa/access_control/admin_authentication.rb +2 -0
- data/lib/comfortable_mexican_sofa/access_control/admin_authorization.rb +2 -0
- data/lib/comfortable_mexican_sofa/access_control/public_authentication.rb +2 -0
- data/lib/comfortable_mexican_sofa/access_control/public_authorization.rb +2 -0
- data/lib/comfortable_mexican_sofa/configuration.rb +3 -0
- data/lib/comfortable_mexican_sofa/content.rb +3 -0
- data/lib/comfortable_mexican_sofa/content/block.rb +2 -0
- data/lib/comfortable_mexican_sofa/content/params_parser.rb +59 -41
- data/lib/comfortable_mexican_sofa/content/renderer.rb +18 -4
- data/lib/comfortable_mexican_sofa/content/tag.rb +20 -5
- data/lib/comfortable_mexican_sofa/content/tags/asset.rb +2 -0
- data/lib/comfortable_mexican_sofa/content/tags/checkbox.rb +10 -3
- data/lib/comfortable_mexican_sofa/content/tags/date.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/datetime.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/file.rb +21 -27
- data/lib/comfortable_mexican_sofa/content/tags/file_link.rb +23 -24
- data/lib/comfortable_mexican_sofa/content/tags/files.rb +11 -9
- data/lib/comfortable_mexican_sofa/content/tags/fragment.rb +11 -1
- data/lib/comfortable_mexican_sofa/content/tags/helper.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/markdown.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/mixins/file_content.rb +38 -0
- data/lib/comfortable_mexican_sofa/content/tags/number.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/page_file_link.rb +82 -0
- data/lib/comfortable_mexican_sofa/content/tags/partial.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/snippet.rb +2 -0
- data/lib/comfortable_mexican_sofa/content/tags/template.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/text.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/textarea.rb +3 -1
- data/lib/comfortable_mexican_sofa/content/tags/wysiwyg.rb +3 -1
- data/lib/comfortable_mexican_sofa/engine.rb +2 -1
- data/lib/comfortable_mexican_sofa/error.rb +2 -0
- data/lib/comfortable_mexican_sofa/extensions/acts_as_tree.rb +2 -0
- data/lib/comfortable_mexican_sofa/extensions/has_revisions.rb +2 -0
- data/lib/comfortable_mexican_sofa/form_builder.rb +24 -17
- data/lib/comfortable_mexican_sofa/render_methods.rb +2 -0
- data/lib/comfortable_mexican_sofa/routes/cms.rb +2 -0
- data/lib/comfortable_mexican_sofa/routes/cms_admin.rb +2 -0
- data/lib/comfortable_mexican_sofa/routing.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds.rb +3 -1
- data/lib/comfortable_mexican_sofa/seeds/file/exporter.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/file/importer.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/layout/exporter.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/layout/importer.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/page/exporter.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/page/importer.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb +2 -0
- data/lib/comfortable_mexican_sofa/seeds/snippet/importer.rb +2 -0
- data/lib/comfortable_mexican_sofa/version.rb +3 -1
- data/lib/comfortable_mexican_sofa/view_hooks.rb +2 -0
- data/lib/generators/comfy/cms/assets_generator.rb +2 -0
- data/lib/generators/comfy/cms/cms_generator.rb +6 -4
- data/lib/generators/comfy/cms/controllers_generator.rb +2 -0
- data/lib/generators/comfy/cms/models_generator.rb +2 -0
- data/lib/generators/comfy/cms/views_generator.rb +2 -0
- data/lib/generators/comfy/scaffold/scaffold_generator.rb +6 -2
- data/lib/tasks/cms_seeds.rake +2 -0
- metadata +20 -26
- data/app/assets/javascripts/comfy/admin/cms/application.js.coffee +0 -30
- data/app/assets/javascripts/comfy/admin/cms/base.js.coffee +0 -224
- data/app/assets/javascripts/comfy/admin/cms/custom.js.coffee +0 -1
- data/app/assets/javascripts/comfy/admin/cms/files.js.coffee +0 -29
- data/app/assets/javascripts/comfy/admin/cms/uploader.js.coffee +0 -140
- data/app/views/comfy/admin/cms/files/create.js.erb +0 -1
- data/app/views/comfy/admin/cms/files/destroy.js.coffee +0 -2
- data/app/views/comfy/admin/cms/pages/form_fragments.js.erb +0 -1
- data/app/views/comfy/admin/cms/translations/form_fragments.js.erb +0 -1
@@ -0,0 +1,40 @@
|
|
1
|
+
// Site files modal.
|
2
|
+
(() => {
|
3
|
+
let modal = null;
|
4
|
+
|
5
|
+
const initModalContent = (modalContent) => {
|
6
|
+
window.CMS.fileUpload.init(modalContent);
|
7
|
+
window.CMS.fileLinks(modalContent);
|
8
|
+
modalContent.addEventListener('dragstart', (evt) => {
|
9
|
+
if (evt.target.nodeType === Node.ELEMENT_NODE &&
|
10
|
+
evt.target.matches('.cms-uploader-filelist .item-title a') && modal != null) {
|
11
|
+
modal.hide();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
};
|
15
|
+
|
16
|
+
window.CMS.files = {
|
17
|
+
init() {
|
18
|
+
const modalToggle = document.querySelector('.cms-files-open-modal');
|
19
|
+
const modalContainer = document.querySelector('.cms-files-modal');
|
20
|
+
if (modalToggle === null || modalContainer === null) return;
|
21
|
+
const modalContent = modalContainer.querySelector('.modal-content');
|
22
|
+
modalToggle.addEventListener('click', (evt) => {
|
23
|
+
evt.preventDefault();
|
24
|
+
fetch(modalContainer.dataset.url, {credentials: 'same-origin'}).then((resp) => resp.text()).then((html) => {
|
25
|
+
modalContent.innerHTML = `<div class="modal-body">${html}</div>`;
|
26
|
+
initModalContent(modalContent);
|
27
|
+
});
|
28
|
+
modal = modal || new bootstrap.Modal(modalContainer);
|
29
|
+
modal.show();
|
30
|
+
});
|
31
|
+
},
|
32
|
+
dispose() {
|
33
|
+
if (modal !== null) {
|
34
|
+
modal.hide();
|
35
|
+
modal.dispose();
|
36
|
+
modal = null;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
})();
|
@@ -0,0 +1,22 @@
|
|
1
|
+
window.CMS.pageFragments = () => {
|
2
|
+
const toggle = document.querySelector('select#fragments-toggle');
|
3
|
+
if (toggle === null) return;
|
4
|
+
const url = new URL(toggle.dataset.url, document.location.href);
|
5
|
+
toggle.addEventListener('change', () => {
|
6
|
+
url.searchParams.set('layout_id', toggle.value);
|
7
|
+
fetch(url, {credentials: 'same-origin'}).then((resp) => resp.text()).then((html) => {
|
8
|
+
const container = document.querySelector('#form-fragments-container');
|
9
|
+
container.innerHTML = html;
|
10
|
+
// TODO: Only dispose of the widgets that were within the fragment.
|
11
|
+
CMS.wysiwyg.dispose();
|
12
|
+
CMS.timepicker.dispose();
|
13
|
+
CMS.codemirror.dispose();
|
14
|
+
|
15
|
+
CMS.fileLinks(container);
|
16
|
+
// TODO: Container should also be passed here once the TODO above is addressed.
|
17
|
+
CMS.wysiwyg.init();
|
18
|
+
CMS.timepicker.init();
|
19
|
+
CMS.codemirror.init();
|
20
|
+
});
|
21
|
+
});
|
22
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
(() => {
|
2
|
+
const SLUGIFY_REPLACEMENTS = [
|
3
|
+
[/[àáâã]/g, 'a'],
|
4
|
+
[/ä/g, 'ae'],
|
5
|
+
[/[èéëê]/g, 'e'],
|
6
|
+
[/[ìíïî]/g, 'i'],
|
7
|
+
[/[òóôõ]/g, 'o'],
|
8
|
+
[/ö/g, 'oe'],
|
9
|
+
[/[ùúû]/g, 'u'],
|
10
|
+
[/ü/g, 'ue'],
|
11
|
+
[/ñ/g, 'n'],
|
12
|
+
[/ç/g, 'c'],
|
13
|
+
[/ß/g, 'ss'],
|
14
|
+
[/[·\/,:;_ ]/g, '-']
|
15
|
+
];
|
16
|
+
|
17
|
+
const slugifyValue = (value) => {
|
18
|
+
let slug = value.trim().toLowerCase();
|
19
|
+
for (const [from, to] of SLUGIFY_REPLACEMENTS) {
|
20
|
+
slug = slug.replace(from, to);
|
21
|
+
}
|
22
|
+
// Remove any other URL incompatible characters and replace multiple dashes with just a single one.
|
23
|
+
return slug.replace(/[^a-z0-9-]/g, '').replace(/-+/g, '-');
|
24
|
+
};
|
25
|
+
|
26
|
+
window.CMS.slugify = () => {
|
27
|
+
const input = document.querySelector('input[data-slugify=true]');
|
28
|
+
const slugInput = document.querySelector('input[data-slug]');
|
29
|
+
if (input === null || slugInput === null) return;
|
30
|
+
input.addEventListener('input', () => {
|
31
|
+
slugInput.value = slugifyValue(input.value);
|
32
|
+
});
|
33
|
+
};
|
34
|
+
})();
|
@@ -0,0 +1,40 @@
|
|
1
|
+
(() => {
|
2
|
+
const Rails = window.Rails;
|
3
|
+
const DATA_ID_ATTRIBUTE = 'data-id';
|
4
|
+
|
5
|
+
const sortableStore = {
|
6
|
+
get(sortable) {
|
7
|
+
return Array.from(sortable.el.children, (el) => el.getAttribute(DATA_ID_ATTRIBUTE));
|
8
|
+
},
|
9
|
+
set(sortable) {
|
10
|
+
fetch(`${CMS.current_path}/reorder`, {
|
11
|
+
body: JSON.stringify({order: sortable.toArray()}),
|
12
|
+
headers: {'Content-Type': 'application/json', 'X-CSRF-Token': Rails.csrfToken()},
|
13
|
+
credentials: 'same-origin',
|
14
|
+
method: 'PUT',
|
15
|
+
});
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
const sortableInstances = [];
|
20
|
+
window.CMS.sortableList = {
|
21
|
+
init(root = document) {
|
22
|
+
for (const sortableRoot of root.querySelectorAll('.sortable')) {
|
23
|
+
sortableInstances.push(Sortable.create(sortableRoot, {
|
24
|
+
handle: '.dragger',
|
25
|
+
draggable: 'li',
|
26
|
+
dataIdAttr: DATA_ID_ATTRIBUTE,
|
27
|
+
store: sortableStore,
|
28
|
+
onStart: (evt) => evt.from.classList.add('sortable-active'),
|
29
|
+
onEnd: (evt) => evt.from.classList.remove('sortable-active')
|
30
|
+
}));
|
31
|
+
}
|
32
|
+
},
|
33
|
+
dispose() {
|
34
|
+
for (const sortable of sortableInstances) {
|
35
|
+
sortable.destroy();
|
36
|
+
}
|
37
|
+
sortableInstances.length = 0;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
})();
|
@@ -0,0 +1,30 @@
|
|
1
|
+
(() => {
|
2
|
+
const flatpickrInstances = [];
|
3
|
+
window.CMS.timepicker = {
|
4
|
+
init(root = document) {
|
5
|
+
const datetimes = root.querySelectorAll('input[type=text][data-cms-datetime]');
|
6
|
+
const dates = root.querySelectorAll('input[type=text][data-cms-date]');
|
7
|
+
if (datetimes.length === 0 && dates.length === 0) return;
|
8
|
+
const locale = CMS.getLocale();
|
9
|
+
for (const datetime of datetimes) {
|
10
|
+
flatpickrInstances.push(flatpickr(datetime, {
|
11
|
+
format: 'yyyy-mm-dd hh:ii',
|
12
|
+
enableTime: true,
|
13
|
+
locale: locale,
|
14
|
+
}));
|
15
|
+
}
|
16
|
+
for (const date of dates) {
|
17
|
+
flatpickrInstances.push(flatpickr(date, {
|
18
|
+
format: 'yyyy-mm-dd',
|
19
|
+
locale: locale,
|
20
|
+
}));
|
21
|
+
}
|
22
|
+
},
|
23
|
+
dispose() {
|
24
|
+
for (const flatpickrInstance of flatpickrInstances) {
|
25
|
+
flatpickrInstance.destroy();
|
26
|
+
}
|
27
|
+
flatpickrInstances.length = 0;
|
28
|
+
}
|
29
|
+
};
|
30
|
+
})();
|
@@ -0,0 +1,65 @@
|
|
1
|
+
(() => {
|
2
|
+
const Rails = window.Rails;
|
3
|
+
const buildRedactorOptions = () => {
|
4
|
+
const fileUploadPath = document.querySelector('meta[name="cms-file-upload-path"]').content;
|
5
|
+
const pagesPath = document.querySelector('meta[name="cms-pages-path"]').content;
|
6
|
+
const csrfParam = Rails.csrfParam();
|
7
|
+
const csrfToken = Rails.csrfToken();
|
8
|
+
|
9
|
+
const imageUpload = new URL(fileUploadPath, document.location.href);
|
10
|
+
imageUpload.searchParams.set('source', 'redactor');
|
11
|
+
imageUpload.searchParams.set('type', 'image');
|
12
|
+
imageUpload.searchParams.set(csrfParam, csrfToken);
|
13
|
+
|
14
|
+
const imageManagerJson = new URL(fileUploadPath, document.location.href);
|
15
|
+
imageManagerJson.searchParams.set('source', 'redactor');
|
16
|
+
imageManagerJson.searchParams.set('type', 'image');
|
17
|
+
|
18
|
+
const fileUpload = new URL(fileUploadPath, document.location.href);
|
19
|
+
fileUpload.searchParams.set('source', 'redactor');
|
20
|
+
fileUpload.searchParams.set('type', 'file');
|
21
|
+
fileUpload.searchParams.set(csrfParam, csrfToken);
|
22
|
+
|
23
|
+
const fileManagerJson = new URL(fileUploadPath, document.location.href);
|
24
|
+
fileManagerJson.searchParams.set('source', 'redactor');
|
25
|
+
fileManagerJson.searchParams.set('type', 'file');
|
26
|
+
|
27
|
+
const definedLinks = new URL(pagesPath, document.location.href);
|
28
|
+
definedLinks.searchParams.set('source', 'redactor');
|
29
|
+
|
30
|
+
return {
|
31
|
+
minHeight: 160,
|
32
|
+
autoresize: true,
|
33
|
+
buttonSource: true,
|
34
|
+
formatting: ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
35
|
+
plugins: ['imagemanager', 'filemanager', 'table', 'video', 'definedlinks'],
|
36
|
+
lang: CMS.getLocale(),
|
37
|
+
convertDivs: false,
|
38
|
+
imageUpload,
|
39
|
+
imageManagerJson,
|
40
|
+
fileUpload,
|
41
|
+
fileManagerJson,
|
42
|
+
definedLinks
|
43
|
+
};
|
44
|
+
};
|
45
|
+
|
46
|
+
const redactorInstances = [];
|
47
|
+
window.CMS.wysiwyg = {
|
48
|
+
init(root = document) {
|
49
|
+
const textareas = root.querySelectorAll('textarea.rich-text-editor, textarea[data-cms-rich-text]');
|
50
|
+
if (textareas.length === 0) return;
|
51
|
+
const redactorOptions = buildRedactorOptions();
|
52
|
+
for (const textarea of textareas) {
|
53
|
+
redactorInstances.push(new jQuery.Redactor(textarea, redactorOptions));
|
54
|
+
}
|
55
|
+
},
|
56
|
+
dispose() {
|
57
|
+
for (const redactor of redactorInstances) {
|
58
|
+
redactor.core.destroy();
|
59
|
+
}
|
60
|
+
redactorInstances.length = 0;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
})();
|
64
|
+
|
65
|
+
|
@@ -8,6 +8,9 @@
|
|
8
8
|
License: http://imperavi.com/redactor/license/
|
9
9
|
|
10
10
|
Usage: $('#content').redactor();
|
11
|
+
|
12
|
+
NOTE: This is the most recent editor we have licence for. There are inline
|
13
|
+
fixes and tweaks annotated with "COMFY FIX"
|
11
14
|
*/
|
12
15
|
|
13
16
|
(function($)
|
@@ -1362,6 +1365,12 @@
|
|
1362
1365
|
},
|
1363
1366
|
setEventDrop: function(e)
|
1364
1367
|
{
|
1368
|
+
// COMFY FIX
|
1369
|
+
// Adding ability to drag-n-drop file links
|
1370
|
+
var text = e.dataTransfer.getData('text/plain');
|
1371
|
+
if (text) this.insert.html(text, false);
|
1372
|
+
// END COMFY FIX
|
1373
|
+
|
1365
1374
|
this.code.sync();
|
1366
1375
|
setTimeout(this.clean.clearUnverified, 1);
|
1367
1376
|
this.core.setCallback('drop', e);
|
@@ -7729,12 +7738,9 @@
|
|
7729
7738
|
var node2 = this.selection.getMarker(2);
|
7730
7739
|
this.selection.setMarker(this.range, node2, false);
|
7731
7740
|
|
7732
|
-
//
|
7733
|
-
if (this.utils.browser('chrome'))
|
7734
|
-
|
7735
|
-
this.caret.set(node1, 0, node2, 0);
|
7736
|
-
}
|
7737
|
-
// end fix
|
7741
|
+
// COMFY FIX
|
7742
|
+
if (this.utils.browser('chrome')) this.caret.set(node1, 0, node2, 0);
|
7743
|
+
// END COMFY FIX
|
7738
7744
|
}
|
7739
7745
|
|
7740
7746
|
this.savedSel = this.$editor.html();
|
@@ -11,13 +11,6 @@ body#comfy
|
|
11
11
|
overflow: hidden
|
12
12
|
width: 100%
|
13
13
|
|
14
|
-
&.in-iframe
|
15
|
-
height: 100%
|
16
|
-
#cms-left, #cms-right
|
17
|
-
display: none
|
18
|
-
#cms-main
|
19
|
-
padding-top: 0
|
20
|
-
|
21
14
|
.alert
|
22
15
|
border-radius: 0
|
23
16
|
margin: 0 -15px 1rem -15px
|
@@ -212,34 +205,12 @@ body#comfy
|
|
212
205
|
// -- Files ------------------------------------------------------------------
|
213
206
|
.cms-files-modal
|
214
207
|
z-index: 99999
|
215
|
-
|
216
|
-
width:
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
ul.list
|
222
|
-
input.file-path
|
223
|
-
border: 0
|
224
|
-
color: $gray-500
|
225
|
-
background: inherit
|
226
|
-
.progress
|
227
|
-
width: 100%
|
228
|
-
height: 25px
|
229
|
-
form
|
230
|
-
.file-image
|
231
|
-
img
|
232
|
-
width: 100%
|
233
|
-
|
234
|
-
.cms-uploader-drag-drop-target-active
|
235
|
-
position: fixed !important
|
236
|
-
z-index: 9999
|
237
|
-
top: 0
|
238
|
-
left: 0
|
239
|
-
width: 100%
|
240
|
-
height: 100%
|
241
|
-
border: dotted #ccc 1px
|
242
|
-
background-color: rgba(255, 255, 255, 0.7)
|
208
|
+
.modal-dialog
|
209
|
+
max-width: 900px
|
210
|
+
.modal-content
|
211
|
+
max-height: calc(100vh - 60px)
|
212
|
+
.modal-body
|
213
|
+
overflow-y: auto
|
243
214
|
|
244
215
|
// -- Revisions --------------------------------------------------------------
|
245
216
|
&[class*="c-comfy-admin-cms-revisions-"], &[class*="c-comfy-admin-blog-revisions-"]
|
@@ -257,3 +228,29 @@ body#comfy
|
|
257
228
|
text-decoration: none
|
258
229
|
del
|
259
230
|
background-color: #ffc6c6
|
231
|
+
|
232
|
+
#cms-uploader
|
233
|
+
ul.list
|
234
|
+
.file-path
|
235
|
+
border: 0
|
236
|
+
color: $gray-500
|
237
|
+
background: inherit
|
238
|
+
white-space: nowrap
|
239
|
+
user-select: all
|
240
|
+
.progress
|
241
|
+
width: 100%
|
242
|
+
height: 25px
|
243
|
+
form
|
244
|
+
.file-image
|
245
|
+
img
|
246
|
+
width: 100%
|
247
|
+
|
248
|
+
.cms-uploader-drag-drop-target-active
|
249
|
+
position: fixed !important
|
250
|
+
z-index: 9999
|
251
|
+
top: 0
|
252
|
+
left: 0
|
253
|
+
width: 100%
|
254
|
+
height: 100%
|
255
|
+
border: dotted #ccc 1px
|
256
|
+
background-color: rgba(255, 255, 255, 0.7)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Comfy::Admin::BaseController < ComfortableMexicanSofa.config.base_controller.to_s.constantize
|
2
4
|
|
3
5
|
include Comfy::Paginate
|
@@ -11,7 +13,7 @@ class Comfy::Admin::BaseController < ComfortableMexicanSofa.config.base_controll
|
|
11
13
|
helper Comfy::Admin::CmsHelper
|
12
14
|
helper Comfy::CmsHelper
|
13
15
|
|
14
|
-
protect_from_forgery
|
16
|
+
protect_from_forgery with: :exception
|
15
17
|
|
16
18
|
before_action :authenticate
|
17
19
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Comfy::Admin::Cms::BaseController < Comfy::Admin::BaseController
|
2
4
|
|
3
5
|
before_action :load_admin_site,
|
@@ -5,6 +7,8 @@ class Comfy::Admin::Cms::BaseController < Comfy::Admin::BaseController
|
|
5
7
|
:load_seeds,
|
6
8
|
except: :jump
|
7
9
|
|
10
|
+
layout :infer_layout
|
11
|
+
|
8
12
|
if ComfortableMexicanSofa.config.admin_cache_sweeper.present?
|
9
13
|
cache_sweeper(*ComfortableMexicanSofa.config.admin_cache_sweeper)
|
10
14
|
end
|
@@ -30,7 +34,7 @@ protected
|
|
30
34
|
end
|
31
35
|
|
32
36
|
def set_locale
|
33
|
-
I18n.locale = ComfortableMexicanSofa.config.admin_locale || (@site
|
37
|
+
I18n.locale = ComfortableMexicanSofa.config.admin_locale || (@site&.locale)
|
34
38
|
true
|
35
39
|
end
|
36
40
|
|
@@ -44,4 +48,8 @@ protected
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
51
|
+
def infer_layout
|
52
|
+
false if params[:layout] == "false"
|
53
|
+
end
|
54
|
+
|
47
55
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Comfy::Admin::Cms::FilesController < Comfy::Admin::Cms::BaseController
|
2
4
|
|
3
5
|
include ::Comfy::ReorderAction
|
@@ -67,7 +69,7 @@ class Comfy::Admin::Cms::FilesController < Comfy::Admin::Cms::BaseController
|
|
67
69
|
|
68
70
|
case params[:source]
|
69
71
|
when "plupload"
|
70
|
-
render
|
72
|
+
render partial: "file", object: @file
|
71
73
|
when "redactor"
|
72
74
|
render json: {
|
73
75
|
filelink: url_for(@file.attachment),
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Comfy::Admin::Cms::PagesController < Comfy::Admin::Cms::BaseController
|
2
4
|
|
3
5
|
include ::Comfy::ReorderAction
|
@@ -61,6 +63,7 @@ class Comfy::Admin::Cms::PagesController < Comfy::Admin::Cms::BaseController
|
|
61
63
|
def form_fragments
|
62
64
|
@page = @site.pages.find_by(id: params[:id]) || @site.pages.new
|
63
65
|
@page.layout = @site.layouts.find_by(id: params[:layout_id])
|
66
|
+
render partial: "comfy/admin/cms/fragments/form_fragments", locals: { record: @page, scope: :page }, layout: false
|
64
67
|
end
|
65
68
|
|
66
69
|
def toggle_branch
|
@@ -112,7 +115,7 @@ protected
|
|
112
115
|
def build_page
|
113
116
|
@page = @site.pages.new(page_params)
|
114
117
|
@page.parent ||= (@site.pages.find_by_id(params[:parent_id]) || @site.pages.root)
|
115
|
-
@page.layout ||= (@page.parent
|
118
|
+
@page.layout ||= (@page.parent&.layout || @site.layouts.first)
|
116
119
|
end
|
117
120
|
|
118
121
|
def load_page
|