parent
38ecc4df18
commit
e3b428536f
|
|
@ -7,12 +7,17 @@ package org.librecms.ui;
|
||||||
|
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.mvc.Controller;
|
import javax.mvc.Controller;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -27,16 +32,34 @@ public class ContentSectionsController {
|
||||||
@Inject
|
@Inject
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ServletContext servletContext;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
public Response getRoot() {
|
public Response getRoot() {
|
||||||
return Response
|
try {
|
||||||
.status(Response.Status.MOVED_PERMANENTLY)
|
return Response.seeOther(
|
||||||
.entity(
|
new URI(
|
||||||
String.format("%s/@content-sections/list", request
|
request.getScheme(),
|
||||||
.getContextPath())
|
"",
|
||||||
|
request.getServerName(),
|
||||||
|
request.getServerPort(),
|
||||||
|
String.format(
|
||||||
|
"%s/@content-sections/list",
|
||||||
|
request.getContextPath()
|
||||||
|
),
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
)
|
||||||
).build();
|
).build();
|
||||||
|
} catch (URISyntaxException ex) {
|
||||||
|
throw new WebApplicationException(ex);
|
||||||
|
}
|
||||||
|
// return String.format(
|
||||||
|
// "redirect:/%s/@content-sections/list", request.getContextPath()
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
|
|
@ -57,7 +80,7 @@ public class ContentSectionsController {
|
||||||
@Path("/search")
|
@Path("/search")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
public String getSearch() {
|
public String getSearch() {
|
||||||
return "org/librecms/ui/content-sections/pages.xhtml";
|
return "org/librecms/ui/content-sections/search.xhtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,21 +28,21 @@
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link #{activePage == 'contentSections'} ? 'active' : ''}"
|
<a class="nav-link #{activePage == 'contentSections'} ? 'active' : ''}"
|
||||||
href="#{mvc.uri('ContentSectionsController#getContentSections')}">
|
href="#{mvc.basePath}/list">
|
||||||
<bootstrap:svgIcon icon="bookshelf" />
|
<bootstrap:svgIcon icon="bookshelf" />
|
||||||
<span>#{CmsAdminMessages['contentsections.list.nav.link.title']}</span>
|
<span>#{CmsAdminMessages['contentsections.list.nav.link.title']}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link #{activePage == 'pages'} ? 'active' : ''}"
|
<a class="nav-link #{activePage == 'pages'} ? 'active' : ''}"
|
||||||
href="#{mvc.uri('ContentSectionsController#getPages')}">
|
href="#{mvc.basePath}/pages">
|
||||||
<bootstrap:svgIcon icon="diagram-3" />
|
<bootstrap:svgIcon icon="diagram-3" />
|
||||||
<span>#{CmsAdminMessages['contentsections.pages.nav.link.title']}</span>
|
<span>#{CmsAdminMessages['contentsections.pages.nav.link.title']}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link #{activePage == 'search'} ? 'active' : ''}"
|
<a class="nav-link #{activePage == 'search'} ? 'active' : ''}"
|
||||||
href="#{mvc.uri('ContentSectionsController#getSearch')}">
|
href="#{mvc.basePath}/search">
|
||||||
<bootstrap:svgIcon icon="search" />
|
<bootstrap:svgIcon icon="search" />
|
||||||
<span>#{CmsAdminMessages['contentsections.search.nav.link.title']}</span>
|
<span>#{CmsAdminMessages['contentsections.search.nav.link.title']}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<p>
|
<p>
|
||||||
Content Sections List Placeholder
|
Content Sections List Placeholder
|
||||||
</p>
|
</p>
|
||||||
|
<pre>MVC base path: #{mvc.basePath}</pre>
|
||||||
</div>
|
</div>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue