Skip to content

Commit

Permalink
Merge pull request #1949 from PenghaiZhang/feature/ebp-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
PenghaiZhang committed Jun 30, 2020
1 parent 8bf4e81 commit 2569aee
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1922,13 +1922,23 @@ div.skinnysearch {
overflow: hidden;
}

.autocompleteControl .autocomplete-container {
float: left;
width: 513px;
@media only screen and (max-width: 1200px) {
.autocompleteControl .autocomplete-container {
float: left;
width: 85%;
}
}

@media only screen and (min-width: 1201px) {
.autocompleteControl .autocomplete-container {
float: left;
width: 96%;
}
}

#wizard-controls .autocompleteControl input[type="text"] {
height: 34px;
width: 98%;
}

.ac_odd {
Expand Down Expand Up @@ -2672,9 +2682,15 @@ Contribution wizard styling
width: 221px;
}

.wizard-layout .rightNav {
.wizard-layout .contribution-rightNav {
position: fixed;
right: 30px;
}

.wizard-layout .moderation-rightNav {
position: fixed;
right: 30px;
top: 70px;
}

.wizard-layout #col2 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
/*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0, (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var WizardCtrl = {
setMessage : function(ctrlid, message)
{
var $ctrl = $("#" + ctrlid);
var $content = $ctrl.children("div:first-child");
var $msg = $content.children("p.ctrlinvalidmessage");
if (!message)
{
$content.removeClass("ctrlinvalid");
$msg.empty();
}
else
{
$content.addClass("ctrlinvalid");
$msg.html(message);
}
},
affixDiv: function() {
var ad = $("#affix-div");
ad.attr("data-spy", "affix");
var offset = (ad.offset().top) - 55;
ad.attr("data-offset-top",offset);
}
};
setMessage: function (ctrlid, message) {
var $ctrl = $("#" + ctrlid);
var $content = $ctrl.children("div:first-child");
var $msg = $content.children("p.ctrlinvalidmessage");
if (!message) {
$content.removeClass("ctrlinvalid");
$msg.empty();
} else {
$content.addClass("ctrlinvalid");
$msg.html(message);
}
},
affixDiv: function () {
var ad = $("#affix-div");
ad.attr("data-spy", "affix");
var offset = ad.offset().top - 55;
ad.attr("data-offset-top", offset);
},
affixDivNewUI: function () {
const moderationPanel = $("#moderate");
const affixDiv = $("#affix-div");
if (moderationPanel.length > 0) {
$(window).on("scroll", function () {
// Use outerHeight to include margin.
const moderationPanelHeight = moderationPanel.outerHeight(true);
const currentWindowYPos = $(window).scrollTop();
currentWindowYPos >= moderationPanelHeight
? affixDiv.addClass("moderation-rightNav")
: affixDiv.removeClass("moderation-rightNav");
});
} else {
affixDiv.addClass("contribution-rightNav");
}
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public final class WizardJSLibrary {
new ExternallyDefinedFunction("WizardCtrl", INCLUDE);
public static final JSCallable AffixDiv =
new ExternallyDefinedFunction(WIZARDCTRLCLASS, "affixDiv", 0);
public static final JSCallable AffixDivNewUI =
new ExternallyDefinedFunction(WIZARDCTRLCLASS, "affixDivNewUI", 0);

private WizardJSLibrary() {
throw new Error();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.tle.web.sections.events.js.JSHandler;
import com.tle.web.sections.events.js.SubmitValuesFunction;
import com.tle.web.sections.generic.CachedData.CacheFiller;
import com.tle.web.sections.js.JSCallable;
import com.tle.web.sections.js.generic.OverrideHandler;
import com.tle.web.sections.js.generic.statement.ReturnStatement;
import com.tle.web.sections.js.validators.Confirm;
Expand Down Expand Up @@ -280,12 +281,14 @@ public SectionResult renderHtml(RenderEventContext context) throws Exception {
}

// To make the Navigation bar stick to top of the page, Old UI uses Bootstrap affix
// whereas New UI adds a CSS style.
// whereas New UI dynamically adds a CSS style by JS.
JSCallable affixScript = null;
if (!RenderNewTemplate.isNewLayout(context)) {
model.getFixedDiv().getTagState().addReadyStatements(WizardJSLibrary.AffixDiv);
affixScript = WizardJSLibrary.AffixDiv;
} else {
model.getFixedDiv().addClasses("rightNav");
affixScript = WizardJSLibrary.AffixDivNewUI;
}
model.getFixedDiv().getTagState().addReadyStatements(affixScript);
return viewFactory.createTemplateResult("wizard/body.ftl", context);
}

Expand Down

0 comments on commit 2569aee

Please sign in to comment.