Skip to content

Commit

Permalink
LMSA-9180 - made changes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
iudsobiera committed Jul 22, 2024
1 parent 8dc7be0 commit ebb1135
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
@Tag(name = "ThemeContentRepository")
@Slf4j
/*
* This REST controller supplements the REST JPA endpoints auto-defined in BannerImageRepository.
* This REST controller supplements the REST JPA endpoints auto-defined in ThemeContentRepository.
* That's why @Tag's name matches that repository so that via swagger these endpoints are grouped under
* the JPA auto-generated ones.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -87,7 +88,8 @@ public class BannerImage {
inverseJoinColumns = @JoinColumn(name = "BANNER_IMAGE_CATEGORY_ID"),
indexes = {@Index(name = "IDX_CSW_BAN_IMG_X_CAT_BID", columnList = "BANNER_IMAGE_ID"),
@Index(name = "IDX_CSW_BAN_IMG_X_CAT_CAT", columnList = "BANNER_IMAGE_CATEGORY_ID")},
foreignKey = @ForeignKey(name = "FK_CSW_BANNER_IMAGE_ID"), inverseForeignKey = @ForeignKey(name = "FK_CSW_BANNER_IMAGE_CATEGORY_ID"))
foreignKey = @ForeignKey(name = "FK_CSW_BANNER_IMAGE_ID"), inverseForeignKey = @ForeignKey(name = "FK_CSW_BANNER_IMAGE_CATEGORY_ID"),
uniqueConstraints = @UniqueConstraint(columnNames = {"BANNER_IMAGE_ID", "BANNER_IMAGE_CATEGORY_ID"}))
private List<BannerImageCategory> bannerImageCategories;

@Column(name = "CREATEDON")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
Expand All @@ -55,7 +56,8 @@ public class ThemeContent {
@Column(name = "NAME")
private String name;

@Column(name = "TEMPLATE_TEXT")
@Lob
@Column(name = "TEMPLATE_TEXT", columnDefinition = "TEXT")
private String templateText;

@Column(name = "CREATEDON")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
Expand Down Expand Up @@ -82,7 +83,8 @@ public class ThemeLog {
@Column(name = "INCLUDE_GUIDANCE")
private boolean includeGuidance;

@Column(name = "ERRORS")
@Lob
@Column(name = "ERRORS", columnDefinition = "TEXT")
private String errors;

@Column(name = "CREATEDON")
Expand Down
23 changes: 1 addition & 22 deletions src/main/resources/templates/theme/guidance.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,9 @@ <h2 id="page-title">Include guidance</h2>

<th:block layout:fragment="script">
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
//Select control
var inputControl = document.querySelector('input[id="course-select-input"]');
//Hidden input with the actual value
var inputValue = document.querySelector('input[name="selectedCourseId"]');
if (inputValue.value == "") {
inputControl.setAttribute("aria-invalid", "true");
inputControl.setAttribute("aria-describedby", "option-message");
alertMessage = document.getElementById('select-alert');
alertMessage.classList.remove("rvt-display-none");
inputControl.focus();
return false;
}
}

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>
</body>
</html>
</html>
14 changes: 2 additions & 12 deletions src/main/resources/templates/theme/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,13 @@ <h2 id="page-title">Intro</h2>
</form>
</div>
</div>

</div>

<th:block layout:fragment="script">
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
}

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>

</body>
</html>
</html>
23 changes: 1 addition & 22 deletions src/main/resources/templates/theme/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,9 @@ <h2 id="page-title">Include navigation</h2>

<th:block layout:fragment="script">
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
//Select control
var inputControl = document.querySelector('input[id="course-select-input"]');
//Hidden input with the actual value
var inputValue = document.querySelector('input[name="selectedCourseId"]');
if (inputValue.value == "") {
inputControl.setAttribute("aria-invalid", "true");
inputControl.setAttribute("aria-describedby", "option-message");
alertMessage = document.getElementById('select-alert');
alertMessage.classList.remove("rvt-display-none");
inputControl.focus();
return false;
}
}

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>
</body>
</html>
</html>
21 changes: 0 additions & 21 deletions src/main/resources/templates/theme/review.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,9 @@ <h2 id="page-title">Review</h2>

<th:block layout:fragment="script">
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
//Select control
var inputControl = document.querySelector('input[id="course-select-input"]');
//Hidden input with the actual value
var inputValue = document.querySelector('input[name="selectedCourseId"]');
if (inputValue.value == "") {
inputControl.setAttribute("aria-invalid", "true");
inputControl.setAttribute("aria-describedby", "option-message");
alertMessage = document.getElementById('select-alert');
alertMessage.classList.remove("rvt-display-none");
inputControl.focus();
return false;
}
}

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>
</body>
</html>
11 changes: 3 additions & 8 deletions src/main/resources/templates/theme/selectBanner.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2 id="page-title">Select banner</h2>
</select>
<!-- radio list for banner options, dynamically rendered based on select component above -->
<fieldset class="rvt-fieldset">
<legend th:text="'Image options for ' + ${bannerImageCategories.get(0).name}"></legend>
<legend id="banner-image-category-legend" th:text="'Image options for ' + ${bannerImageCategories.get(0).name}"></legend>
<!-- ul will be filled by javascript on pulldown change -->
<ul id="image-ul" class="rvt-list-plain">
</ul>
Expand All @@ -75,16 +75,11 @@ <h2 id="page-title">Select banner</h2>
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
let yesBannerImage = document.querySelector('#include-banner-image-radio-yes:checked');

console.log("yesBannerImage.length = " + yesBannerImage.length);

if (yesBannerImage != null) {
let checkedRadio = document.querySelector('input[type=radio][name=banner-image-radio-group]:checked');
if (checkedRadio != null) {
Expand All @@ -97,14 +92,15 @@ <h2 id="page-title">Select banner</h2>
});
alertMessage = document.getElementById('select-alert');
alertMessage.classList.remove("rvt-display-none");
allRadio[0].focus();
return false;
}
}
}

function loadBannerImagesForSelectedCategory() {
let categoryId = $('#select-input-categories').val();
let categoryName = $('#select-input-categories option[value="' + categoryId + '"]').text();
$('#banner-image-category-legend').text('Image options for ' + categoryName);
$('#image-ul').load('/app/theme/' + courseId + '/bannerimage/' + categoryId , function() {
let bannerImageId = $('#banner-image-id').val();

Expand Down Expand Up @@ -147,7 +143,6 @@ <h2 id="page-title">Select banner</h2>
});

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>
</body>
</html>
15 changes: 2 additions & 13 deletions src/main/resources/templates/theme/selectTheme.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ <h2 id="page-title">Select theme</h2>
<!-- radio list for theme options -->
<fieldset class="rvt-fieldset">
<legend>Theme options</legend>
<div th:insert="fragments.html :: selectAlert"></div>
<ul id="image-ul" class="rvt-list-plain">
<th:block th:if="${themes != null}" th:each="theme : ${themes}">
<li class="rvt-border-all rvt-border-radius-md rvt-p-all-xs rvt-m-bottom-xxs radio-card--clickable">
Expand All @@ -39,24 +38,17 @@ <h2 id="page-title">Select theme</h2>
</li>
</th:block>
</ul>
<div th:insert="fragments.html :: selectAlert"></div>
</fieldset>
<input type="hidden" name="currentPage" value="2">
<div th:insert="theme/wizardSteps.html :: buttons(nextOnclick='return doSubmit();')"></div>
</form>
</div>
</div>

</div>

<th:block layout:fragment="script">
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
var checkedRadio = document.querySelector('input[name="themeId"]:checked');
if (checkedRadio == null) {
Expand All @@ -66,13 +58,10 @@ <h2 id="page-title">Select theme</h2>
});
alertMessage = document.getElementById('select-alert');
alertMessage.classList.remove("rvt-display-none");
allRadio[0].focus();
return false;
}
}

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>
</body>
</html>
</html>
30 changes: 1 addition & 29 deletions src/main/resources/templates/theme/submit.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,5 @@ <h2 id="page-title">Submit</h2>
</div>
</div>
</div>

<th:block layout:fragment="script">
<script th:inline="javascript">
/*<![CDATA[*/
const courseId = /*[[${courseId}]]*/
const selectedCourseId = /*[[${selectedCourseId}]]*/
var courses = /*[[${courses}]]*/;
window.config = {courses: courses};
/*]]>*/

function doSubmit() {
//Select control
var inputControl = document.querySelector('input[id="course-select-input"]');
//Hidden input with the actual value
var inputValue = document.querySelector('input[name="selectedCourseId"]');
if (inputValue.value == "") {
inputControl.setAttribute("aria-invalid", "true");
inputControl.setAttribute("aria-describedby", "option-message");
alertMessage = document.getElementById('select-alert');
alertMessage.classList.remove("rvt-display-none");
inputControl.focus();
return false;
}
}

</script>
<script type="text/javascript" th:src="@{/app/jsreact/lms-lti-coursesetupwizard/lms-lti-coursesetupwizard.js}"></script>
</th:block>
</body>
</html>
</html>

0 comments on commit ebb1135

Please sign in to comment.