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