pages_core 3.7.0 → 3.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/Rakefile +37 -0
- data/app/assets/builds/pages_core/admin-dist.js +55 -0
- data/app/assets/stylesheets/pages/admin/components/image_editor.scss +1 -0
- data/app/assets/stylesheets/pages/admin/components/image_grid.scss +33 -5
- data/app/assets/stylesheets/pages/admin/components/layout.scss +2 -1
- data/app/assets/stylesheets/pages/admin/components/login.scss +6 -0
- data/app/assets/stylesheets/pages/admin/components/tabs.scss +5 -0
- data/app/assets/stylesheets/pages/admin/components/tag_editor.scss +13 -7
- data/app/assets/stylesheets/pages/admin/controllers/pages.scss +13 -5
- data/app/assets/stylesheets/pages/admin.scss +0 -1
- data/app/controller_dummies/admin/admin_controller.rb +1 -1
- data/app/controller_dummies/application_controller.rb +1 -1
- data/app/controller_dummies/attachments_controller.rb +1 -1
- data/app/controller_dummies/frontend_controller.rb +1 -1
- data/app/controller_dummies/images_controller.rb +1 -1
- data/app/controller_dummies/page_files_controller.rb +1 -1
- data/app/controller_dummies/pages_controller.rb +1 -1
- data/app/controller_dummies/sitemaps_controller.rb +1 -1
- data/app/controllers/admin/attachments_controller.rb +1 -1
- data/app/controllers/admin/images_controller.rb +11 -8
- data/app/controllers/concerns/pages_core/authentication.rb +9 -4
- data/app/controllers/concerns/pages_core/preview_pages_controller.rb +5 -0
- data/app/controllers/pages_core/frontend/pages_controller.rb +5 -2
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/formatters/pages_core/link_renderer.rb +2 -2
- data/app/helpers/application_helper.rb +1 -1
- data/app/helpers/frontend_helper.rb +1 -1
- data/app/helpers/pages_core/admin/content_tabs_helper.rb +5 -2
- data/app/helpers/pages_core/admin/image_uploads_helper.rb +2 -3
- data/app/helpers/pages_core/admin/tag_editor_helper.rb +9 -39
- data/app/helpers/pages_core/head_tags_helper.rb +11 -20
- data/app/helpers/pages_core/open_graph_tags_helper.rb +1 -1
- data/app/javascript/admin-dist.js +2 -0
- data/app/javascript/components/Attachments/Attachment.jsx +121 -0
- data/app/javascript/components/Attachments/AttachmentEditor.jsx +116 -0
- data/app/javascript/components/Attachments/Placeholder.jsx +10 -0
- data/app/javascript/components/Attachments.jsx +165 -0
- data/app/{assets/javascripts/pages/admin/components/date_range_select.jsx → javascript/components/DateRangeSelect.jsx} +16 -5
- data/app/javascript/components/EditableImage.jsx +61 -0
- data/app/javascript/components/FileUploadButton.jsx +47 -0
- data/app/{assets/javascripts/pages/admin/components/focal_point.jsx → javascript/components/ImageCropper/FocalPoint.jsx} +12 -1
- data/app/javascript/components/ImageCropper/Image.jsx +65 -0
- data/app/javascript/components/ImageCropper/Toolbar.jsx +73 -0
- data/app/javascript/components/ImageCropper/useCrop.js +199 -0
- data/app/javascript/components/ImageCropper.jsx +90 -0
- data/app/javascript/components/ImageEditor/Form.jsx +98 -0
- data/app/javascript/components/ImageEditor.jsx +62 -0
- data/app/javascript/components/ImageGrid/DragElement.jsx +30 -0
- data/app/javascript/components/ImageGrid/FilePlaceholder.jsx +9 -0
- data/app/javascript/components/ImageGrid/GridImage.jsx +103 -0
- data/app/javascript/components/ImageGrid/Placeholder.jsx +23 -0
- data/app/javascript/components/ImageGrid.jsx +257 -0
- data/app/javascript/components/ImageUploader.jsx +171 -0
- data/app/{assets/javascripts/pages/admin/components/modal.jsx → javascript/components/Modal.jsx} +13 -2
- data/app/{assets/javascripts/pages/admin/components/page_dates.jsx → javascript/components/PageDates.jsx} +11 -1
- data/app/{assets/javascripts/pages/admin/components/page_files.jsx → javascript/components/PageFiles.jsx} +11 -2
- data/app/{assets/javascripts/pages/admin/components/page_images.jsx → javascript/components/PageImages.jsx} +11 -2
- data/app/{assets/javascripts/pages/admin/components/page_tree_store.jsx → javascript/components/PageTree.jsx} +127 -137
- data/app/{assets/javascripts/pages/admin/components/page_tree.jsx → javascript/components/PageTreeDraggable.jsx} +35 -29
- data/app/{assets/javascripts/pages/admin/components/page_tree_node.jsx → javascript/components/PageTreeNode.jsx} +35 -20
- data/app/javascript/components/RichTextArea.jsx +213 -0
- data/app/javascript/components/RichTextToolbarButton.jsx +20 -0
- data/app/javascript/components/TagEditor/AddTagForm.jsx +42 -0
- data/app/javascript/components/TagEditor/Tag.jsx +32 -0
- data/app/javascript/components/TagEditor.jsx +61 -0
- data/app/javascript/components/Toast.jsx +72 -0
- data/app/javascript/components/drag/draggedOrder.js +51 -0
- data/app/javascript/components/drag/useDragCollection.js +84 -0
- data/app/javascript/components/drag/useDragUploader.js +112 -0
- data/app/javascript/components/drag/useDraggable.js +17 -0
- data/app/javascript/components/drag.js +6 -0
- data/app/javascript/components.js +15 -0
- data/app/javascript/controllers/EditPageController.js +20 -0
- data/app/javascript/controllers/LoginController.js +29 -0
- data/app/javascript/controllers/MainController.js +65 -0
- data/app/javascript/controllers/PageOptionsController.js +62 -0
- data/app/javascript/features/RichText.jsx +34 -0
- data/app/javascript/hooks.js +2 -0
- data/app/javascript/index.js +38 -0
- data/app/{assets/javascripts/pages/admin/lib/tree.jsx → javascript/lib/Tree.js} +55 -54
- data/app/javascript/lib/copyToClipboard.js +13 -0
- data/app/javascript/lib/readyHandler.js +22 -0
- data/app/javascript/lib/request.js +36 -0
- data/app/javascript/stores/ModalStore.jsx +12 -0
- data/app/javascript/stores/ToastStore.jsx +14 -0
- data/app/javascript/stores.js +2 -0
- data/app/models/concerns/pages_core/page_model/images.rb +3 -1
- data/app/models/concerns/pages_core/page_model/searchable.rb +19 -0
- data/app/models/concerns/pages_core/searchable_document.rb +71 -0
- data/app/models/concerns/pages_core/taggable.rb +27 -12
- data/app/models/page.rb +2 -0
- data/app/models/page_exporter.rb +2 -2
- data/app/models/page_image.rb +0 -2
- data/app/models/role.rb +1 -1
- data/app/models/search_document.rb +72 -0
- data/app/models/tag.rb +1 -0
- data/app/models/user.rb +1 -1
- data/app/{serializers/admin/attachment_serializer.rb → resources/admin/attachment_resource.rb} +6 -5
- data/app/{serializers/admin/image_serializer.rb → resources/admin/image_resource.rb} +9 -9
- data/app/resources/admin/page_file_resource.rb +10 -0
- data/app/{serializers/admin/page_image_serializer.rb → resources/admin/page_image_resource.rb} +4 -2
- data/app/resources/export/attachment_resource.rb +10 -0
- data/app/resources/export/page_image_resource.rb +45 -0
- data/app/resources/export/page_resource.rb +42 -0
- data/app/{serializers/page_image_serializer.rb → resources/page_image_resource.rb} +8 -16
- data/app/resources/page_resource.rb +33 -0
- data/app/services/pages_core/destroy_invite_service.rb +2 -2
- data/app/services/pages_core/invite_service.rb +2 -2
- data/app/views/admin/pages/_edit_content.html.erb +1 -1
- data/app/views/admin/pages/_edit_files.html.erb +1 -5
- data/app/views/admin/pages/_edit_images.html.erb +1 -5
- data/app/views/admin/pages/_edit_options.html.erb +74 -55
- data/app/views/admin/pages/_form.html.erb +19 -0
- data/app/views/admin/pages/edit.html.erb +35 -61
- data/app/views/admin/pages/index.html.erb +0 -1
- data/app/views/admin/pages/new.html.erb +32 -32
- data/app/views/admin/users/_access_control.html.erb +5 -1
- data/app/views/admin/users/login.html.erb +12 -4
- data/app/views/feeds/pages.rss.builder +1 -2
- data/app/views/layouts/admin/_header.html.erb +1 -1
- data/app/views/layouts/admin/_page_header.html.erb +33 -0
- data/app/views/layouts/admin.html.erb +23 -42
- data/app/views/pages_core/_google_analytics.html.erb +8 -0
- data/db/migrate/20180625154059_enable_search_extensions.rb +10 -0
- data/db/migrate/20210209151400_create_search_configurations.rb +35 -0
- data/db/migrate/20210210235200_create_search_documents.rb +74 -0
- data/lib/pages_core/engine.rb +1 -5
- data/lib/pages_core/templates/block_configuration.rb +1 -1
- data/lib/pages_core/templates/configuration_handler.rb +1 -1
- data/lib/pages_core/version.rb +3 -1
- data/lib/pages_core.rb +3 -5
- data/lib/rails/generators/pages_core/frontend/frontend_generator.rb +0 -7
- data/lib/rails/generators/pages_core/install/templates/page_templates_initializer.rb +2 -2
- metadata +116 -115
- data/app/assets/javascripts/pages/admin/components/attachment.jsx +0 -130
- data/app/assets/javascripts/pages/admin/components/attachment_editor.jsx +0 -131
- data/app/assets/javascripts/pages/admin/components/attachments.jsx +0 -211
- data/app/assets/javascripts/pages/admin/components/drag_uploader.jsx +0 -174
- data/app/assets/javascripts/pages/admin/components/editable_image.jsx +0 -57
- data/app/assets/javascripts/pages/admin/components/file_upload_button.jsx +0 -44
- data/app/assets/javascripts/pages/admin/components/grid_image.jsx +0 -124
- data/app/assets/javascripts/pages/admin/components/image_editor.jsx +0 -496
- data/app/assets/javascripts/pages/admin/components/image_grid.jsx +0 -306
- data/app/assets/javascripts/pages/admin/components/image_uploader.jsx +0 -176
- data/app/assets/javascripts/pages/admin/components/modal_store.jsx +0 -20
- data/app/assets/javascripts/pages/admin/components/rich_text_area.jsx +0 -64
- data/app/assets/javascripts/pages/admin/components/rich_text_toolbar.jsx +0 -91
- data/app/assets/javascripts/pages/admin/components/toast.jsx +0 -34
- data/app/assets/javascripts/pages/admin/components/toast_store.jsx +0 -52
- data/app/assets/javascripts/pages/admin/components.jsx +0 -2
- data/app/assets/javascripts/pages/admin/features/content_tabs.jsx +0 -72
- data/app/assets/javascripts/pages/admin/features/edit_page.jsx +0 -97
- data/app/assets/javascripts/pages/admin/features/rich_text.jsx +0 -14
- data/app/assets/javascripts/pages/admin/features/tag_editor.jsx +0 -160
- data/app/assets/javascripts/pages/admin.jsx +0 -17
- data/app/assets/javascripts/pages/login_form.jsx +0 -21
- data/app/serializers/admin/page_file_serializer.rb +0 -8
- data/app/serializers/page_export_serializer.rb +0 -32
- data/app/serializers/page_file_export_serializer.rb +0 -6
- data/app/serializers/page_image_export_serializer.rb +0 -42
- data/app/serializers/page_serializer.rb +0 -23
- data/app/views/layouts/admin/_analytics.html.erb +0 -16
- data/lib/rails/generators/pages_core/frontend/templates/application.js.erb +0 -15
- data/vendor/assets/javascripts/ReactCrop.min.js +0 -1
- data/vendor/assets/javascripts/reflux.min.js +0 -1
@@ -1,52 +0,0 @@
|
|
1
|
-
var ToastActions = Reflux.createActions([
|
2
|
-
"notice",
|
3
|
-
"error"
|
4
|
-
]);
|
5
|
-
|
6
|
-
class ToastStore extends Reflux.Store {
|
7
|
-
constructor() {
|
8
|
-
super();
|
9
|
-
this.state = {
|
10
|
-
current: null,
|
11
|
-
fadeout: false,
|
12
|
-
queue: []
|
13
|
-
};
|
14
|
-
this.listenToMany(ToastActions);
|
15
|
-
}
|
16
|
-
|
17
|
-
addToQueue(msg, type) {
|
18
|
-
let entry = { message: msg, type: type };
|
19
|
-
if (this.state.current) {
|
20
|
-
this.setState({ queue: [...this.state.queue, entry] });
|
21
|
-
} else {
|
22
|
-
this.showToast(entry, this.state.queue);
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
showToast(entry, queue) {
|
27
|
-
let store = this;
|
28
|
-
this.setState({ current: entry, queue: queue, fadeout: false });
|
29
|
-
setTimeout(function () {
|
30
|
-
store.setState({ fadeout: true });
|
31
|
-
setTimeout(() => store.next(), 500);
|
32
|
-
}, 4000);
|
33
|
-
}
|
34
|
-
|
35
|
-
next() {
|
36
|
-
let queue = this.state.queue;
|
37
|
-
if (queue.length > 0) {
|
38
|
-
let entry = queue.shift();
|
39
|
-
this.showToast(entry, queue);
|
40
|
-
} else {
|
41
|
-
this.setState({ current: null, fadeout: false });
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
onNotice(msg) {
|
46
|
-
this.addToQueue(msg, "notice");
|
47
|
-
}
|
48
|
-
|
49
|
-
onError(msg) {
|
50
|
-
this.addToQueue(msg, "error");
|
51
|
-
}
|
52
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
var ContentTabs = {
|
2
|
-
tabs: [],
|
3
|
-
ids: [],
|
4
|
-
|
5
|
-
show: function(id, skipPushState) {
|
6
|
-
let tabs = ContentTabs.tabs;
|
7
|
-
let tab = tabs[id];
|
8
|
-
if (tab) {
|
9
|
-
$.each(ContentTabs.ids, function(i) {
|
10
|
-
if (tabs[this]) {
|
11
|
-
$(tabs[this]).hide();
|
12
|
-
}
|
13
|
-
$("#content-tab-link-" + this).removeClass("current");
|
14
|
-
});
|
15
|
-
$(tab).show();
|
16
|
-
$("#content-tab-link-" + id).addClass("current");
|
17
|
-
if (!skipPushState) {
|
18
|
-
history.pushState({ tabId: id }, "", `${window.location.pathname}#${id}`);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
},
|
22
|
-
|
23
|
-
showFromURL: function(url) {
|
24
|
-
let tab_expression = /#(.*)$/;
|
25
|
-
if (url.toString().match(tab_expression)) {
|
26
|
-
let id = url.toString().match(tab_expression)[1];
|
27
|
-
if (ContentTabs.tabs[id]) {
|
28
|
-
ContentTabs.show(id);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
},
|
32
|
-
|
33
|
-
enable: function(ids) {
|
34
|
-
let tabs = ContentTabs.tabs;
|
35
|
-
ContentTabs.ids = ids;
|
36
|
-
$.each(ids, function(i) {
|
37
|
-
let id = this;
|
38
|
-
return $("#content-tab-" + this).each(function(i) {
|
39
|
-
this.id = id;
|
40
|
-
return tabs[id] = this;
|
41
|
-
});
|
42
|
-
});
|
43
|
-
ContentTabs.show(ids[0], true);
|
44
|
-
ContentTabs.showFromURL(document.location);
|
45
|
-
},
|
46
|
-
|
47
|
-
init: function() {
|
48
|
-
if ($("#content-tabs").length > 0) {
|
49
|
-
window.addEventListener("popstate", (evt) => {
|
50
|
-
if (evt.state && evt.state.tabId) {
|
51
|
-
ContentTabs.show(evt.state.tabId);
|
52
|
-
}
|
53
|
-
});
|
54
|
-
|
55
|
-
let tabNames = $("#content-tabs li").map(function() {
|
56
|
-
return $(this).data("tab-name");
|
57
|
-
}).get();
|
58
|
-
ContentTabs.enable(tabNames);
|
59
|
-
$("#content-tabs a").each(function() {
|
60
|
-
$(this).click(function() {
|
61
|
-
ContentTabs.showFromURL(this.href);
|
62
|
-
return false;
|
63
|
-
});
|
64
|
-
});
|
65
|
-
}
|
66
|
-
window.showContentTab = ContentTabs.show;
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
|
-
$(function() {
|
71
|
-
ContentTabs.init();
|
72
|
-
});
|
@@ -1,97 +0,0 @@
|
|
1
|
-
class EditPage {
|
2
|
-
constructor(container) {
|
3
|
-
this.container = container;
|
4
|
-
this.toggleAdvancedOptions();
|
5
|
-
this.replicateFormElements();
|
6
|
-
this.checkPublishedStatus();
|
7
|
-
this.checkPublishedDate();
|
8
|
-
this.previewButton();
|
9
|
-
}
|
10
|
-
|
11
|
-
checkPublishedStatus() {
|
12
|
-
let checkStatus = function() {
|
13
|
-
var pageStatus = $("#page-form-sidebar #page_status").val();
|
14
|
-
if (pageStatus === "2") {
|
15
|
-
return $("#page-form-sidebar .published-date").fadeIn();
|
16
|
-
} else {
|
17
|
-
return $("#page-form-sidebar .published-date").hide();
|
18
|
-
}
|
19
|
-
};
|
20
|
-
$("#page-form-sidebar #page_status").change(checkStatus);
|
21
|
-
checkStatus();
|
22
|
-
}
|
23
|
-
|
24
|
-
checkPublishedDate() {
|
25
|
-
$(".autopublish-notice").hide();
|
26
|
-
let publishedAt = function(i) {
|
27
|
-
return $(`#page-form-sidebar select[name="page[published_at(${i}i)]"]`)
|
28
|
-
.val();
|
29
|
-
};
|
30
|
-
let checkDate = function() {
|
31
|
-
var year = publishedAt(1);
|
32
|
-
var month = publishedAt(2);
|
33
|
-
var day = publishedAt(3);
|
34
|
-
var hour = publishedAt(4);
|
35
|
-
var minute = publishedAt(5);
|
36
|
-
var publishDate = new Date(year, (month - 1), day, hour, minute);
|
37
|
-
var now = new Date();
|
38
|
-
if (publishDate > now) {
|
39
|
-
return $(".autopublish-notice").fadeIn();
|
40
|
-
} else {
|
41
|
-
return $(".autopublish-notice").fadeOut();
|
42
|
-
}
|
43
|
-
};
|
44
|
-
$(".published-date").find("select").change(checkDate);
|
45
|
-
checkDate();
|
46
|
-
}
|
47
|
-
|
48
|
-
previewButton() {
|
49
|
-
$("#previewButton").click(function() {
|
50
|
-
var button = this;
|
51
|
-
var form = $(button).closest("form").get(0);
|
52
|
-
var previewUrl = $(this).data("url");
|
53
|
-
|
54
|
-
// Rewrite the form and submit
|
55
|
-
form.oldAction = form.action;
|
56
|
-
form.target = "_blank";
|
57
|
-
form.action = previewUrl;
|
58
|
-
$(form).submit();
|
59
|
-
|
60
|
-
// Undo rewrite
|
61
|
-
form.action = form.oldAction;
|
62
|
-
form.target = "";
|
63
|
-
});
|
64
|
-
}
|
65
|
-
|
66
|
-
replicateFormElements() {
|
67
|
-
let replicateFormElement = function() {
|
68
|
-
var newValue = this;
|
69
|
-
$("#page-form").find("[name=\"" + newValue.name + "\"]")
|
70
|
-
.each(function() {
|
71
|
-
if (newValue.type === "checkbox") {
|
72
|
-
$(this).prop("checked", $(newValue).prop("checked"));
|
73
|
-
} else {
|
74
|
-
$(this).val($(newValue).val());
|
75
|
-
}
|
76
|
-
});
|
77
|
-
};
|
78
|
-
|
79
|
-
$("#page-form-sidebar")
|
80
|
-
.find("input,textarea,select")
|
81
|
-
.change(replicateFormElement);
|
82
|
-
}
|
83
|
-
|
84
|
-
toggleAdvancedOptions() {
|
85
|
-
let container = this.container;
|
86
|
-
$(container).find(".advanced-options").hide();
|
87
|
-
$(container).find(".advanced-toggle").click(function() {
|
88
|
-
return $(container).find(".advanced-options").slideToggle();
|
89
|
-
});
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
$(function () {
|
94
|
-
$(".edit-page").each(function() {
|
95
|
-
new EditPage(this);}
|
96
|
-
);
|
97
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
$(function() {
|
2
|
-
$("textarea.rich").each(function () {
|
3
|
-
let container = document.createElement("div");
|
4
|
-
this.parentNode.appendChild(container);
|
5
|
-
ReactDOM.render(
|
6
|
-
<RichTextArea value={this.value}
|
7
|
-
name={this.name}
|
8
|
-
rows={this.rows}
|
9
|
-
id={this.id} />,
|
10
|
-
container
|
11
|
-
);
|
12
|
-
this.parentNode.removeChild(this);
|
13
|
-
});
|
14
|
-
});
|
@@ -1,160 +0,0 @@
|
|
1
|
-
var TagEditor = function(container) {
|
2
|
-
this.initialize(container);
|
3
|
-
};
|
4
|
-
|
5
|
-
$.extend(TagEditor.prototype, {
|
6
|
-
initialize: function(container) {
|
7
|
-
var tagEditor = this;
|
8
|
-
tagEditor.container = container;
|
9
|
-
tagEditor.tags = Array();
|
10
|
-
tagEditor.serializeField = $(tagEditor.container).find(".serialized_tags").get(0);
|
11
|
-
tagEditor.findTags(true);
|
12
|
-
|
13
|
-
tagEditor.inputField = $(tagEditor.container).find(".add-tag").get(0);
|
14
|
-
$(tagEditor.container).find(".add-tag-button").click(function() {
|
15
|
-
tagEditor.addTag();
|
16
|
-
$(tagEditor.container).find(".add-tag").blur();
|
17
|
-
return false;
|
18
|
-
});
|
19
|
-
$(tagEditor.container).find(".add-tag").keydown(function(event) {
|
20
|
-
if (event.which === 13) {
|
21
|
-
tagEditor.addTag();
|
22
|
-
return false;
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
$(tagEditor.container).find(".add-tag").each(function(){
|
27
|
-
var field = this;
|
28
|
-
field.exampleText = $(field).val();
|
29
|
-
$(field).addClass("example");
|
30
|
-
$(field).focus(function(event){
|
31
|
-
$(tagEditor.container).find(".add-tag-button").fadeIn("fast");
|
32
|
-
$(field).removeClass("example");
|
33
|
-
if ($(field).val() === field.exampleText) {
|
34
|
-
$(field).val("");
|
35
|
-
}
|
36
|
-
});
|
37
|
-
$(field).blur(function(event) {
|
38
|
-
$(tagEditor.container).find(".add-tag-button").fadeOut("fast");
|
39
|
-
if (!$(field).val() || $(field).val() === field.exampleText) {
|
40
|
-
$(field).addClass("example").val(field.exampleText);
|
41
|
-
}
|
42
|
-
});
|
43
|
-
});
|
44
|
-
$(tagEditor.container).find(".add-tag-button").hide();
|
45
|
-
},
|
46
|
-
|
47
|
-
addTag: function() {
|
48
|
-
var tagEditor = this;
|
49
|
-
var tagName = $(tagEditor.inputField).val().replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
50
|
-
if (tagName) {
|
51
|
-
if (this.hasTag(tagName)) {
|
52
|
-
this.enable(this.getTagByName(tagName));
|
53
|
-
} else {
|
54
|
-
$(tagEditor.container).find(".tags").append("<span class=\"tag\"><input type=\"checkbox\" name=\"tag-"+tagName+"\" value=\"1\" checked=\"checked\"><span class=\"name\">"+tagName+"</span></span>");
|
55
|
-
tagEditor.findTags();
|
56
|
-
}
|
57
|
-
}
|
58
|
-
$(tagEditor.inputField).val("");
|
59
|
-
},
|
60
|
-
|
61
|
-
findTags: function(permanentize) {
|
62
|
-
var tagEditor = this;
|
63
|
-
$(this.container).find(".tag").each(function () {
|
64
|
-
var tag = this;
|
65
|
-
if (!tag.tagEditorApplied) {
|
66
|
-
tag.checkBox = $(tag).find("input[type=checkbox]").get(0);
|
67
|
-
tag.name = $(tag).find(".name").text();
|
68
|
-
if(tagEditor.isChecked(tag)){
|
69
|
-
tag.enabled = true;
|
70
|
-
$(tag).addClass("enabled");
|
71
|
-
} else {
|
72
|
-
tag.enabled = false;
|
73
|
-
}
|
74
|
-
$(tag).click(function () {
|
75
|
-
tagEditor.toggle(tag);
|
76
|
-
});
|
77
|
-
tagEditor.tags[tagEditor.tags.length] = tag;
|
78
|
-
tag.tagEditorApplied = true;
|
79
|
-
}
|
80
|
-
});
|
81
|
-
tagEditor.serializeTags();
|
82
|
-
},
|
83
|
-
|
84
|
-
hasTag: function(tagName) {
|
85
|
-
var hasTag = false;
|
86
|
-
$(this.tags).each(function () {
|
87
|
-
if (tagName.toLowerCase() === this.name.toLowerCase()) {
|
88
|
-
hasTag = true;
|
89
|
-
}
|
90
|
-
});
|
91
|
-
return hasTag;
|
92
|
-
},
|
93
|
-
|
94
|
-
setEnabled: function(tag, enabled) {
|
95
|
-
tag.enabled = enabled;
|
96
|
-
if (tag.enabled) {
|
97
|
-
$(tag).addClass("enabled");
|
98
|
-
} else {
|
99
|
-
$(tag).removeClass("enabled");
|
100
|
-
}
|
101
|
-
$(tag.checkBox).attr("checked", tag.enabled);
|
102
|
-
this.serializeTags();
|
103
|
-
},
|
104
|
-
|
105
|
-
toggle: function(tag) {
|
106
|
-
if (tag.enabled) {
|
107
|
-
this.disable(tag);
|
108
|
-
} else {
|
109
|
-
this.enable(tag);
|
110
|
-
}
|
111
|
-
},
|
112
|
-
|
113
|
-
enable: function(tag) {
|
114
|
-
this.setEnabled(tag, true);
|
115
|
-
},
|
116
|
-
|
117
|
-
disable: function(tag) {
|
118
|
-
this.setEnabled(tag, false);
|
119
|
-
},
|
120
|
-
|
121
|
-
getTagByName: function(tagName) {
|
122
|
-
var tag = null;
|
123
|
-
$(this.tags).each(function(){
|
124
|
-
if (this.name.toLowerCase() === tagName.toLowerCase()) {
|
125
|
-
tag = this;
|
126
|
-
}
|
127
|
-
});
|
128
|
-
return tag;
|
129
|
-
},
|
130
|
-
|
131
|
-
isChecked: function(tag) {
|
132
|
-
return $(tag.checkBox).attr("checked");
|
133
|
-
},
|
134
|
-
|
135
|
-
enabledTags: function() {
|
136
|
-
var enabledTags = Array();
|
137
|
-
$(this.tags).each(function() {
|
138
|
-
if (this.enabled) {
|
139
|
-
enabledTags[enabledTags.length] = this;
|
140
|
-
}
|
141
|
-
});
|
142
|
-
return enabledTags;
|
143
|
-
},
|
144
|
-
|
145
|
-
serializeTags: function() {
|
146
|
-
var tagNames = Array();
|
147
|
-
$(this.enabledTags()).each(function() {
|
148
|
-
tagNames[tagNames.length] = "\"" + this.name.replace("\"", "\\\"") + "\"";
|
149
|
-
});
|
150
|
-
$(this.serializeField).val("["+tagNames.join(", ")+"]");
|
151
|
-
$(this.container).find(".add-tag").attr("disabled", false);
|
152
|
-
}
|
153
|
-
});
|
154
|
-
|
155
|
-
// Apply the tag editor to each instance
|
156
|
-
$(function() {
|
157
|
-
$(".tag-editor").each(function() {
|
158
|
-
this.tagEditor = new TagEditor(this);
|
159
|
-
});
|
160
|
-
});
|
@@ -1,17 +0,0 @@
|
|
1
|
-
// Gem assets
|
2
|
-
//= require jquery
|
3
|
-
//= require jquery_ujs
|
4
|
-
//= require jquery-ui
|
5
|
-
//= require react
|
6
|
-
//= require react_ujs
|
7
|
-
//= require reflux.min
|
8
|
-
|
9
|
-
// Vendored assets
|
10
|
-
//= require ReactCrop.min
|
11
|
-
|
12
|
-
//= require_self
|
13
|
-
//= require pages/login_form
|
14
|
-
//= require_tree ./admin/lib
|
15
|
-
|
16
|
-
//= require pages/admin/components
|
17
|
-
//= require_tree ./admin/features
|
@@ -1,21 +0,0 @@
|
|
1
|
-
$(function () {
|
2
|
-
$(".login-form").each(function () {
|
3
|
-
let container = this;
|
4
|
-
|
5
|
-
function showTab(tabName) {
|
6
|
-
$(container).find(".login-tab").hide();
|
7
|
-
$(container).find(`.login-tab.${tabName}`).show();
|
8
|
-
return false;
|
9
|
-
}
|
10
|
-
|
11
|
-
$(container).find(".show-password").click(function () {
|
12
|
-
return showTab("password");
|
13
|
-
});
|
14
|
-
|
15
|
-
$(container).find(".show-password-reset").click(function () {
|
16
|
-
return showTab("password-reset");
|
17
|
-
});
|
18
|
-
|
19
|
-
showTab("password");
|
20
|
-
});
|
21
|
-
});
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class PageExportSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :path, :locale, :author_name, :status
|
5
|
-
attributes(*PagesCore::Templates::TemplateConfiguration.all_blocks)
|
6
|
-
attributes :created_at, :published_at, :pinned, :template, :redirect_to,
|
7
|
-
:starts_at, :ends_at, :all_day
|
8
|
-
|
9
|
-
has_one :image, serializer: PageImageExportSerializer
|
10
|
-
has_many :images, serializer: PageImageExportSerializer
|
11
|
-
has_many :page_files, serializer: PageFileExportSerializer
|
12
|
-
|
13
|
-
def author_name
|
14
|
-
object&.author&.name
|
15
|
-
end
|
16
|
-
|
17
|
-
def path
|
18
|
-
object.full_path || object.to_param
|
19
|
-
end
|
20
|
-
|
21
|
-
def image
|
22
|
-
object.page_images.where(primary: true).try(:first)
|
23
|
-
end
|
24
|
-
|
25
|
-
def images
|
26
|
-
object.page_images
|
27
|
-
end
|
28
|
-
|
29
|
-
def status
|
30
|
-
object.status_label
|
31
|
-
end
|
32
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class PageImageExportSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :primary, :content_hash, :content_type, :filename,
|
5
|
-
:alternative, :caption, :created_at
|
6
|
-
|
7
|
-
def id
|
8
|
-
object.image.id
|
9
|
-
end
|
10
|
-
|
11
|
-
def name
|
12
|
-
object.image.name
|
13
|
-
end
|
14
|
-
|
15
|
-
def alternative
|
16
|
-
object.image.alternative
|
17
|
-
end
|
18
|
-
|
19
|
-
def caption
|
20
|
-
object.image.caption
|
21
|
-
end
|
22
|
-
|
23
|
-
def content_hash
|
24
|
-
object.image.content_hash
|
25
|
-
end
|
26
|
-
|
27
|
-
def content_type
|
28
|
-
object.image.content_type
|
29
|
-
end
|
30
|
-
|
31
|
-
def filename
|
32
|
-
object.image.filename
|
33
|
-
end
|
34
|
-
|
35
|
-
def size
|
36
|
-
object.image.crop_size
|
37
|
-
end
|
38
|
-
|
39
|
-
def created_at
|
40
|
-
object.image.created_at
|
41
|
-
end
|
42
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class PageSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :param, :parent_page_id, :locale
|
5
|
-
attributes(*PagesCore::Templates::TemplateConfiguration.all_blocks)
|
6
|
-
attributes :published_at, :pinned
|
7
|
-
|
8
|
-
has_one :image
|
9
|
-
has_many :images
|
10
|
-
has_many :pages
|
11
|
-
|
12
|
-
def param
|
13
|
-
object.to_param
|
14
|
-
end
|
15
|
-
|
16
|
-
def image
|
17
|
-
object.page_images.where(primary: true).try(:first)
|
18
|
-
end
|
19
|
-
|
20
|
-
def images
|
21
|
-
object.page_images
|
22
|
-
end
|
23
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<script type="text/javascript">
|
2
|
-
var _gaq = _gaq || [];
|
3
|
-
_gaq.push(['_setAccount', 'UA-5468672-21']);
|
4
|
-
_gaq.push(['_setDomainName', 'none']);
|
5
|
-
_gaq.push(['_setAllowLinker', true]);
|
6
|
-
_gaq.push(['_trackPageview']);
|
7
|
-
|
8
|
-
(function() {
|
9
|
-
var ga = document.createElement('script');
|
10
|
-
ga.type = 'text/javascript';
|
11
|
-
ga.async = true;
|
12
|
-
ga.src = 'https://ssl.google-analytics.com/ga.js';
|
13
|
-
var s = document.getElementsByTagName('script')[0];
|
14
|
-
s.parentNode.insertBefore(ga, s);
|
15
|
-
})();
|
16
|
-
</script>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|
@@ -1 +0,0 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactCrop=t(require("react")):e.ReactCrop=t(e.React)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(o){if(r[o])return r[o].exports;var a=r[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function a(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e){var t=e.getBoundingClientRect(),r=document.documentElement;return{top:t.top+window.pageYOffset-r.clientTop,left:t.left+window.pageXOffset-r.clientLeft}}function d(e){var t=void 0,r=void 0;return e.touches?(t=e.touches[0].pageX,r=e.touches[0].pageY):(t=e.pageX,r=e.pageY),{x:t,y:r}}function h(e,t,r){return Math.min(Math.max(e,t),r)}function u(e){return e&&e.width&&e.height}function p(e){var t=void 0;return"n"===e?t="s":"ne"===e?t="sw":"e"===e?t="w":"se"===e?t="nw":"s"===e?t="n":"sw"===e?t="ne":"w"===e?t="e":"nw"===e&&(t="se"),t}function f(e,t){if(isNaN(e.aspect)||isNaN(t))return console.warn("`crop.aspect` and `imageAspect` need to be numbers in order to make an aspect crop",e),e;var r=y({},e);return e.width&&(r.height=e.width/e.aspect*t),e.height&&(r.width=(r.height||e.height)*(e.aspect/t)),e.y+(r.height||e.height)>100&&(r.height=100-e.y,r.width=r.height*e.aspect/t),e.x+(r.width||e.width)>100&&(r.width=100-e.x,r.height=r.width/e.aspect*t),r}function l(e,t){return e&&e.aspect&&(!e.width&&e.height||e.width&&!e.height)?f(e,t.naturalWidth/t.naturalHeight):e}function g(e,t){if(!e||!t)return null;var r=Math.round(e.naturalWidth*(t.x/100)),o=Math.round(e.naturalHeight*(t.y/100)),a=Math.round(e.naturalWidth*(t.width/100)),n=Math.round(e.naturalHeight*(t.height/100));return{x:r,y:o,width:h(a,0,e.naturalWidth-r),height:h(n,0,e.naturalHeight-o)}}function v(e,t,r){var o=y({},t),a=!1;o.x+o.width>100?(o.width=t.width+(100-(t.x+t.width)),o.x=t.x+(100-(t.x+o.width)),a=!0):o.x<0&&(o.width=t.x+t.width,o.x=0,a=!0),a&&t.aspect&&(o.height=o.width/t.aspect*r,e.y>o.y&&(o.y=t.y+(t.height-o.height)));var n=!1;return o.y+o.height>100?(o.height=t.height+(100-(t.y+t.height)),o.y=t.y+(100-(t.y+o.height)),n=!0):o.y<0&&(o.height=t.y+t.height,o.y=0,n=!0),n&&t.aspect&&(o.width=o.height*t.aspect/r,o.x<t.x&&(o.x=t.x+(t.width-o.width))),o}var m=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},w=r(1),C=o(w),x=r(2),O=o(x),b=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return b=!0,!0}}))}catch(e){}var R=function(e){function t(){var e,r,o,a;n(this,t);for(var s=arguments.length,p=Array(s),f=0;f<s;f++)p[f]=arguments[f];return r=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(p))),o.state={},o.onCropMouseTouchDown=function(e){var t=o.props,r=t.crop;if(!t.disabled){e.preventDefault();var a=d(e);o.componentRef.focus({preventScroll:!0});var n=e.target.dataset.ord,i="nw"===n||"w"===n||"sw"===n,s="nw"===n||"n"===n||"ne"===n,h=void 0;r.aspect&&(h=c(o.cropSelectRef)),o.evData={clientStartX:a.x,clientStartY:a.y,cropStartWidth:r.width,cropStartHeight:r.height,cropStartX:i?r.x+r.width:r.x,cropStartY:s?r.y+r.height:r.y,xInversed:i,yInversed:s,xCrossOver:i,yCrossOver:s,startXCrossOver:i,startYCrossOver:s,isResize:e.target!==o.cropSelectRef,ord:n,cropOffset:h},o.mouseDownOnCrop=!0,o.setState({cropIsActive:!0})}},o.onComponentMouseTouchDown=function(e){var t=o.props,r=t.crop,a=t.disabled,n=t.keepSelection,i=t.onChange;if(e.target===o.imageRef&&!(a||n&&u(r))){e.preventDefault();var s=d(e);o.componentRef.focus({preventScroll:!0});var h=c(o.imageRef),p=(s.x-h.left)/o.imageRef.width*100,f=(s.y-h.top)/o.imageRef.height*100,l={aspect:r?r.aspect:void 0,x:p,y:f,width:0,height:0};o.evData={clientStartX:s.x,clientStartY:s.y,cropStartWidth:l.width,cropStartHeight:l.height,cropStartX:l.x,cropStartY:l.y,xInversed:!1,yInversed:!1,xCrossOver:!1,yCrossOver:!1,startXCrossOver:!1,startYCrossOver:!1,isResize:!0,ord:"nw"},o.mouseDownOnCrop=!0,i(l,g(o.imageRef,l)),o.setState({cropIsActive:!0})}},o.onDocMouseTouchMove=function(e){var t=o.props,r=t.crop,a=t.disabled,n=t.onChange;if((0,t.onDragStart)(),!a&&o.mouseDownOnCrop){e.preventDefault();var i=o,s=i.evData,c=d(e);s.isResize&&r.aspect&&s.cropOffset&&(c.y=o.straightenYPath(c.x));var h=c.x-s.clientStartX;s.xDiffPc=h/o.imageRef.width*100;var u=c.y-s.clientStartY;s.yDiffPc=u/o.imageRef.height*100;var p=void 0;p=s.isResize?o.resizeCrop():o.dragCrop(),n(p,g(o.imageRef,p))}},o.onComponentKeyDown=function(e){var r=o.props,a=r.crop,n=r.disabled,i=r.onChange,s=r.onComplete;if(!n){var c=e.which,d=!1;if(u(a)){var p=o.makeNewCrop();c===t.arrowKey.left?(p.x-=t.nudgeStep,d=!0):c===t.arrowKey.right?(p.x+=t.nudgeStep,d=!0):c===t.arrowKey.up?(p.y-=t.nudgeStep,d=!0):c===t.arrowKey.down&&(p.y+=t.nudgeStep,d=!0),d&&(e.preventDefault(),p.x=h(p.x,0,100-p.width),p.y=h(p.y,0,100-p.height),i(p,g(o.imageRef,p)),s(p,g(o.imageRef,p)))}}},o.onDocMouseTouchEnd=function(){var e=o.props,t=e.crop,r=e.disabled,a=e.onComplete;(0,e.onDragEnd)(),r||o.mouseDownOnCrop&&(o.mouseDownOnCrop=!1,a(t,g(o.imageRef,t)),o.setState({cropIsActive:!1}))},a=r,i(o,a)}return s(t,e),m(t,[{key:"componentDidMount",value:function(){var e=!!b&&{passive:!1};if(document.addEventListener("mousemove",this.onDocMouseTouchMove,e),document.addEventListener("touchmove",this.onDocMouseTouchMove,e),document.addEventListener("mouseup",this.onDocMouseTouchEnd,e),document.addEventListener("touchend",this.onDocMouseTouchEnd,e),document.addEventListener("touchcancel",this.onDocMouseTouchEnd,e),this.imageRef.complete||this.imageRef.readyState)if(0===this.imageRef.naturalWidth){var t=this.imageRef.src;this.imageRef.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",this.imageRef.src=t}else this.onImageLoad(this.imageRef)}},{key:"componentDidUpdate",value:function(e){e.crop!==this.props.crop&&this.resolveCropAndTriggerChange(this.props.crop,this.imageRef)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousemove",this.onDocMouseTouchMove),document.removeEventListener("touchmove",this.onDocMouseTouchMove),document.removeEventListener("mouseup",this.onDocMouseTouchEnd),document.removeEventListener("touchend",this.onDocMouseTouchEnd),document.removeEventListener("touchcancel",this.onDocMouseTouchEnd)}},{key:"onImageLoad",value:function(e){var t=this.resolveCropAndTriggerChange(this.props.crop,e);this.props.onImageLoaded(e,g(e,t))}},{key:"getCropStyle",value:function(){var e=this.props.crop;return{top:e.y+"%",left:e.x+"%",width:e.width+"%",height:e.height+"%"}}},{key:"getNewSize",value:function(){var e=this.props,t=e.crop,r=e.minWidth,o=e.maxWidth,a=e.minHeight,n=e.maxHeight,i=this.evData,s=this.imageRef.width/this.imageRef.height,c=i.cropStartWidth+i.xDiffPc;i.xCrossOver&&(c=Math.abs(c)),c=h(c,r,o);var d=void 0;return d=t.aspect?c/t.aspect*s:i.cropStartHeight+i.yDiffPc,i.yCrossOver&&(d=Math.min(Math.abs(d),i.cropStartY)),d=h(d,a,n),t.aspect&&(c=h(d*t.aspect/s,0,100)),{width:c,height:d}}},{key:"resolveCropAndTriggerChange",value:function(e,t){var r=l(e,t);return r!==e&&(this.props.onChange(r,g(t,r)),this.props.onComplete(r,g(t,r))),r}},{key:"dragCrop",value:function(){var e=this.makeNewCrop(),t=this.evData;return e.x=h(t.cropStartX+t.xDiffPc,0,100-e.width),e.y=h(t.cropStartY+t.yDiffPc,0,100-e.height),e}},{key:"resizeCrop",value:function(){var e=this.makeNewCrop(),r=this.evData,o=r.ord,a=this.imageRef.width/this.imageRef.height;r.xInversed&&(r.xDiffPc-=2*r.cropStartWidth),r.yInversed&&(r.yDiffPc-=2*r.cropStartHeight);var n=this.getNewSize(),i=r.cropStartX,s=r.cropStartY;r.xCrossOver&&(i=e.x+(e.width-n.width)),r.yCrossOver&&(s=!1===r.lastYCrossover?e.y-n.height:e.y+(e.height-n.height));var c=v(this.props.crop,{x:i,y:s,width:n.width,height:n.height,aspect:e.aspect},a);return e.aspect||t.xyOrds.indexOf(o)>-1?(e.x=c.x,e.y=c.y,e.width=c.width,e.height=c.height):t.xOrds.indexOf(o)>-1?(e.x=c.x,e.width=c.width):t.yOrds.indexOf(o)>-1&&(e.y=c.y,e.height=c.height),r.lastYCrossover=r.yCrossOver,this.crossOverCheck(),e}},{key:"straightenYPath",value:function(e){var t=this.evData,r=t.ord,o=t.cropOffset,a=t.cropStartWidth/100*this.imageRef.width,n=t.cropStartHeight/100*this.imageRef.height,i=void 0,s=void 0;return"nw"===r||"se"===r?(i=n/a,s=o.top-o.left*i):(i=-n/a,s=o.top+(n-o.left*i)),i*e+s}},{key:"createCropSelection",value:function(){var e=this,t=this.props.disabled,r=this.getCropStyle();return C.default.createElement("div",{ref:function(t){e.cropSelectRef=t},style:r,className:"ReactCrop__crop-selection",onMouseDown:this.onCropMouseTouchDown,onTouchStart:this.onCropMouseTouchDown,role:"presentation"},!t&&C.default.createElement("div",{className:"ReactCrop__drag-elements"},C.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),C.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),C.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),C.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw"}),C.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w"})))}},{key:"makeNewCrop",value:function(){return y({},t.defaultCrop,this.props.crop)}},{key:"crossOverCheck",value:function(){var e=this.evData;(!e.xCrossOver&&-Math.abs(e.cropStartWidth)-e.xDiffPc>=0||e.xCrossOver&&-Math.abs(e.cropStartWidth)-e.xDiffPc<=0)&&(e.xCrossOver=!e.xCrossOver),(!e.yCrossOver&&-Math.abs(e.cropStartHeight)-e.yDiffPc>=0||e.yCrossOver&&-Math.abs(e.cropStartHeight)-e.yDiffPc<=0)&&(e.yCrossOver=!e.yCrossOver);var t=e.xCrossOver!==e.startXCrossOver,r=e.yCrossOver!==e.startYCrossOver;e.inversedXOrd=!!t&&p(e.ord),e.inversedYOrd=!!r&&p(e.ord)}},{key:"render",value:function(){var e=this,t=this.props,r=t.children,o=t.className,n=t.crossorigin,i=t.crop,s=t.disabled,c=t.imageAlt,d=t.onImageError,h=t.src,p=t.style,f=t.imageStyle,l=this.state.cropIsActive,g=void 0;u(i)&&(g=this.createCropSelection());var v=["ReactCrop"];return l&&v.push("ReactCrop--active"),i&&(i.aspect&&v.push("ReactCrop--fixed-aspect"),!l||i.width&&i.height||v.push("ReactCrop--crop-invisible")),s&&v.push("ReactCrop--disabled"),o&&v.push.apply(v,a(o.split(" "))),C.default.createElement("div",{ref:function(t){e.componentRef=t},className:v.join(" "),style:p,onTouchStart:this.onComponentMouseTouchDown,onMouseDown:this.onComponentMouseTouchDown,role:"presentation",tabIndex:"1",onKeyDown:this.onComponentKeyDown},C.default.createElement("img",{ref:function(t){e.imageRef=t},crossOrigin:n,className:"ReactCrop__image",style:f,src:h,onLoad:function(t){return e.onImageLoad(t.target)},onError:d,alt:c}),g,r)}}]),t}(w.PureComponent);R.xOrds=["e","w"],R.yOrds=["n","s"],R.xyOrds=["nw","ne","se","sw"],R.arrowKey={left:37,up:38,right:39,down:40},R.nudgeStep=.2,R.defaultCrop={x:0,y:0,width:0,height:0},R.propTypes={className:O.default.string,crossorigin:O.default.string,children:O.default.oneOfType([O.default.arrayOf(O.default.node),O.default.node]),crop:O.default.shape({aspect:O.default.number,x:O.default.number,y:O.default.number,width:O.default.number,height:O.default.number}),disabled:O.default.bool,imageAlt:O.default.string,imageStyle:O.default.shape({}),keepSelection:O.default.bool,minWidth:O.default.number,minHeight:O.default.number,maxWidth:O.default.number,maxHeight:O.default.number,onChange:O.default.func.isRequired,onImageError:O.default.func,onComplete:O.default.func,onImageLoaded:O.default.func,onDragStart:O.default.func,onDragEnd:O.default.func,src:O.default.string.isRequired,style:O.default.shape({})},R.defaultProps={className:void 0,crop:void 0,crossorigin:void 0,disabled:!1,imageAlt:"",maxWidth:100,maxHeight:100,minWidth:0,minHeight:0,keepSelection:!1,onComplete:function(){},onImageError:function(){},onImageLoaded:function(){},onDragStart:function(){},onDragEnd:function(){},children:void 0,style:void 0,imageStyle:void 0},e.exports=R,e.exports.getPixelCrop=g,e.exports.makeAspectCrop=f,e.exports.containCrop=v},function(t,r){t.exports=e},function(e,t,r){e.exports=r(3)()},function(e,t,r){"use strict";function o(){}var a=r(4);e.exports=function(){function e(e,t,r,o,n,i){if(i!==a){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=o,r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}])});
|