Skip to content

Commit

Permalink
SAK-33280 Use PortalUtils instead of hard coding a jquery version (sa…
Browse files Browse the repository at this point in the history
…kaiproject#4731)

* SAK-33280 Use PortalUtils instead of hard coding a jquery version

* spaces
  • Loading branch information
adrianfish authored Aug 26, 2017
1 parent 1f578fc commit 35bf285
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions sitemembers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-kernel-util</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.portal</groupId>
<artifactId>sakai-portal-util</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.sakaiproject.component.api.ServerConfigurationService;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.portal.util.PortalUtils;
import org.sakaiproject.profile2.logic.ProfileConnectionsLogic;
import org.sakaiproject.profile2.model.BasicConnection;
import org.sakaiproject.profile2.util.ProfileConstants;
Expand Down Expand Up @@ -146,8 +147,6 @@ public boolean isVisible() {
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);

final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

// get the Sakai skin header fragment from the request attribute
final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

Expand All @@ -159,8 +158,9 @@ public void renderHead(final IHeaderResponse response) {

// render jQuery and the Wicket event library
// Both must be priority so they are emitted into the head
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));
final String cdnQuery = PortalUtils.getCDNQuery();
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));

// NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
Expand Down

0 comments on commit 35bf285

Please sign in to comment.