Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
07dc110f
Commit
07dc110f
authored
Feb 18, 2014
by
Richard Bruskiewich
Committed by
Matija Obreza
Feb 26, 2014
Browse files
A special view for /descriptors/categories partially implemented
parent
f6daa885
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/DescriptorController.java
View file @
07dc110f
...
...
@@ -26,10 +26,12 @@ import org.genesys2.spring.ResourceNotFoundException;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.http.MediaType
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
...
...
@@ -42,6 +44,12 @@ public class DescriptorController extends BaseController {
@Autowired
private
TraitService
traitService
;
@RequestMapping
(
value
=
"/categories"
,
method
=
RequestMethod
.
GET
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
public
String
viewCategories
(
ModelMap
model
)
{
model
.
addAttribute
(
"categories"
,
traitService
.
listCategories
());
return
"/descr/categories"
;
}
@RequestMapping
public
String
index
(
ModelMap
model
,
@RequestParam
(
value
=
"page"
,
required
=
false
,
defaultValue
=
"1"
)
int
page
)
{
model
.
addAttribute
(
"pagedData"
,
traitService
.
listTraits
(
new
PageRequest
(
page
-
1
,
50
,
new
Sort
(
"title"
))));
...
...
src/main/java/org/genesys2/server/servlet/controller/rest/TraitsController.java
View file @
07dc110f
...
...
@@ -101,7 +101,14 @@ public class TraitsController extends RestController {
return
OAuth2Cleanup
.
clean
(
methods
);
}
@RequestMapping
(
value
=
"/categories"
,
method
=
RequestMethod
.
GET
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
public
@ResponseBody
Object
listCategories
()
{
LOG
.
info
(
"Listing parameter categories"
);
List
<
ParameterCategory
>
categories
=
traitService
.
listCategories
();
return
OAuth2Cleanup
.
clean
(
categories
);
}
/**
* Create a new crop property category (ParameterCategory) to
* use with descriptors (property/method/scale) meta-data
...
...
src/main/webapp/WEB-INF/jsp/descr/categories.jsp
0 → 100644
View file @
07dc110f
<!DOCTYPE html>
<%@include
file=
"/WEB-INF/jsp/init.jsp"
%>
<html>
<head>
<title><spring:message
code=
"descriptor.category"
/></title>
</head>
<body>
<h1>
<spring:message
code=
"descriptor.category"
/>
</h1>
<table>
<thead>
<tr>
<td><spring:message
code=
"descriptor.category"
/></td>
<td><spring:message
code=
"ce.sameAs"
/></td>
</tr>
</thead>
<tbody>
<c:forEach
items=
"
${
categories
}
"
var=
"category"
varStatus=
"status"
>
<tr
class=
"${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<td><a
href=
"
<c:url
value=
"/category/${category.id}"
/>
"
><c:out
value=
"
${
category
.
getName
(
pageContext
.
response
.
locale
)
}
"
/></a></td>
<td>
<c:if
test=
"
${
category
.
rdfUri
ne
null
}
"
>
<a
href=
"
<c:url
value=
"
${
category
.
rdfUri
}
"
/>
"
>
<c:out
value=
"
${
category
.
getRdfUriId
()
}
"
/>
</a>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment