Skip to content

Commit

Permalink
Merge pull request #1749 from SammyIsConfused/bugfix/canvas_bug_worka…
Browse files Browse the repository at this point in the history
…round

Make Canvas Integration work with new UI
  • Loading branch information
SammyIsConfused authored May 22, 2020
2 parents dd1b2ec + 1b08bc7 commit 6c7b710
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 10 deletions.
44 changes: 44 additions & 0 deletions Source/Plugins/Core/com.equella.core/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Source/Plugins/Core/com.equella.core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"react-beautiful-dnd": "7.1.3",
"react-color": "2.17.0",
"react-dom": "16.8.4",
"react-html-parser": "2.0.2",
"react-redux": "5.1.1",
"react-router": "5.0.0",
"react-router-dom": "5.0.0",
Expand All @@ -71,20 +72,21 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "22.2.3",
"@types/luxon": "1.15.1",
"@types/lodash": "4.14.144",
"@types/tinymce": "4.5.23",
"@types/luxon": "1.15.1",
"@types/node": "9.6.52",
"@types/react": "16.9.11",
"@types/react-autosuggest": "9.3.11",
"@types/react-color": "2.17.0",
"@types/react-dom": "16.9.5",
"@types/react-html-parser": "2.0.1",
"@types/react-redux": "5.0.21",
"@types/react-router": "5.1.1",
"@types/react-router-dom": "4.3.5",
"@types/react-swipeable-views": "0.12.2",
"@types/redux-logger": "3.0.7",
"@types/sprintf-js": "1.1.2",
"@types/tinymce": "4.5.23",
"@types/uuid": "3.4.4",
"argparse": "1.0.10",
"combined-stream2": "1.1.2",
Expand Down
24 changes: 16 additions & 8 deletions Source/Plugins/Core/com.equella.core/js/tsrc/mainui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
LegacyContentProps,
PageContent
} from "../legacycontent/LegacyContent";
import HtmlParser from "react-html-parser";
import { getCurrentUser } from "../api/currentuser";
import { ErrorResponse } from "../api/errors";
import ErrorPage from "./ErrorPage";
Expand Down Expand Up @@ -108,9 +109,7 @@ function IndexPage() {
}, []);
const oeqRoutes: { [key: string]: OEQRoute } = routes;

function mkRouteProps(
p: RouteComponentProps<any>
): OEQRouteComponentProps<any> {
function mkRouteProps(p: RouteComponentProps<any>): OEQRouteComponentProps {
return {
...p,
updateTemplate,
Expand Down Expand Up @@ -218,11 +217,20 @@ function IndexPage() {
{routeSwitch(content)}
</Template>
);
return !content || content.noForm ? (
template
) : (
<LegacyForm state={content.state}>{template}</LegacyForm>
);
const render = () => {
if (!content || content.noForm) {
return template;
} else {
const { form } = content.html;
return (
<>
<LegacyForm state={content.state}>{template}</LegacyForm>
{form && HtmlParser(form)}
</>
);
}
};
return render();
}}
/>
</BrowserRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,19 @@ class LegacyContentApi {
val body = SectionUtils.renderToString(
context,
wrapBody(context, tr.getNamedResult(context, "body")))
val form = context.getForm
val formString: Option[String] = Option(form.getAction) match {
case Some(action) => Some(SectionUtils.renderToString(context, form))
case None => None
}
val upperbody =
SectionUtils.renderToString(context, tr.getNamedResult(context, "upperbody"))
val scrops = renderScreenOptions(context)
val crumbs = renderCrumbs(context, decs).map(SectionUtils.renderToString(context, _))
Iterable(
Some("body" -> body),
Option(upperbody).filter(_.nonEmpty).map("upperbody" -> _),
formString.map("form" -> _),
scrops.map("so" -> _),
crumbs.map("crumbs" -> _)
).flatten.toMap
Expand Down

0 comments on commit 6c7b710

Please sign in to comment.