Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
calculateResults() {
if (!this.props.params.q) {
return {
searchResults: [],
totalCount: 0,
tags: [],
};
}
let search = Scrivito.Obj.where(
"*",
"containsPrefix",
this.props.params.q
).andNot("_objClass", "equals", blacklistObjClasses);
// make sure, that tags are calculated _before_ limiting to specific tag.
const tags = search.facet("tags").map(tag => tag.name());
if (this.props.params.tag) {
search = search.and("tags", "equals", this.props.params.tag);
}
return {
searchResults: search.take(this.state.maxItems),
totalCount: search.count(),
tags,
<section style="{{">
<div>
<div>
<h1>Ooops</h1>
</div>
<div>
<h2>
The page you are looking for does not exist.
</h2>
</div>
<div>
Go to mainpage{" "}
<i aria-hidden="true">
</i><i aria-hidden="true">
</i></div><i aria-hidden="true">
</i></div><i aria-hidden="true">
</i></section><i aria-hidden="true">
);
}
}</i>
function allObjs(objClassesBlacklist) {
return Scrivito.Obj.all()
.andNot("_objClass", "equals", objClassesBlacklist)
.take();
}
return Scrivito.load(() => {
const rootPage = Scrivito.Obj.root();
if (!rootPage) {
return undefined;
}
return rootPage.get("googleAnalyticsTrackingId");
}).then(trackingId => {
if (trackingId) {
import * as Scrivito from "scrivito";
Scrivito.configureContentBrowser({
filters: {
_objClass: {
options: {
All: {
title: "All",
icon: "folder",
query: Scrivito.Obj.all(),
selected: true,
},
Images: {
title: "Images",
icon: "image",
field: "_objClass",
value: "Image",
},
Pages: {
title: "Pages",
icon: "sheet",
field: "_objClass",
value: [
"Author",
"Blog",
"BlogPost",
function logoObj({ scrolled, navigationStyle }) {
let logoVersion;
if (scrolled) {
logoVersion = "logoDark";
} else if (navigationStyle === "transparentDark") {
logoVersion = "logoWhite";
} else {
logoVersion = "logoDark";
}
const root = Scrivito.Obj.root();
if (root) {
return root.get(logoVersion);
}
return undefined;
}
Scrivito.provideComponent("DividerWidget", ({ widget }) => {
const showLogo = widget.get("showLogo") !== "no";
const root = Scrivito.Obj.root();
if (showLogo && root) {
return (
<div>
</div>
);
}
return <div>;
});
</div>
render() {
return (
(
)}
/>
);
}
}
function blogPostNavigationOptions(obj) {
let backgroundImage = obj.get("titleImage");
if (!backgroundImage) {
const blog = Scrivito.Obj.getByPermalink("blog");
if (blog) {
backgroundImage = blog.get("navigationBackgroundImage");
}
}
return imageWithMediumHeightOrMinHeight(backgroundImage);
}
function googleMapsApiKey() {
const root = Scrivito.Obj.root();
if (!root) {
return "";
}
return root.get("googleMapsApiKey");
}