Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amparo Oliver
th-app-java
Commits
d6b0b79d
Commit
d6b0b79d
authored
3 years ago
by
Joel Florentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
se unificaron los path de todos los controllers
parent
a355ef3d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
38 deletions
+18
-38
curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java
+2
-3
curriculumsearch/src/main/java/com/roshka/controller/CargoController.java
+4
-3
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
+7
-27
curriculumsearch/src/main/webapp/jsp/cargo-form.jsp
+1
-1
curriculumsearch/src/main/webapp/jsp/cargos.jsp
+2
-2
curriculumsearch/src/main/webapp/jsp/convocatorias.jsp
+1
-1
curriculumsearch/src/main/webapp/jsp/layouts/base.jsp
+1
-1
No files found.
curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java
View file @
d6b0b79d
...
...
@@ -48,9 +48,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.
authorizeRequests
()
.
mvcMatchers
(
"/"
).
authenticated
()
.
mvcMatchers
(
"/home"
).
authenticated
()
.
mvcMatchers
(
"/cargo*"
).
authenticated
()
.
mvcMatchers
(
"/convocatoria*"
).
authenticated
()
.
mvcMatchers
(
"/convocatoria/crear/*"
).
authenticated
()
.
mvcMatchers
(
"/cargos"
,
"/cargos/**"
).
authenticated
()
.
mvcMatchers
(
"/convocatorias"
,
"/convocatorias/**"
).
authenticated
()
.
mvcMatchers
(
"/tecnologias"
,
"/tecnologias/**"
).
authenticated
()
.
mvcMatchers
(
"/postulantes"
,
"/postulantes/**"
).
authenticated
()
.
mvcMatchers
(
"/edit-user-data"
).
authenticated
()
...
...
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/java/com/roshka/controller/CargoController.java
View file @
d6b0b79d
...
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.validation.Valid
;
@Controller
@RequestMapping
(
"/cargos"
)
public
class
CargoController
{
CargoRepository
cargoRepo
;
...
...
@@ -25,7 +26,7 @@ public class CargoController {
this
.
cargoRepo
=
cargoRepo
;
}
@RequestMapping
(
"/cargos"
)
@RequestMapping
()
public
String
menuCargos
(
Model
model
,
@RequestParam
(
required
=
false
)
String
nombre
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
nroPagina
)
{
final
Integer
CANTIDAD_POR_PAGINA
=
10
;
Pageable
page
=
PageRequest
.
of
(
nroPagina
,
CANTIDAD_POR_PAGINA
,
Sort
.
by
(
"id"
));
...
...
@@ -42,7 +43,7 @@ public class CargoController {
return
"cargos"
;
}
@RequestMapping
(
path
=
{
"/
cargo"
,
"/cargo
/{id}"
},
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
{
"/
agregar"
,
"/modificar
/{id}"
},
method
=
RequestMethod
.
GET
)
public
String
formCargo
(
Model
model
,
@PathVariable
(
required
=
false
)
Long
id
)
{
if
(
id
==
null
)
model
.
addAttribute
(
"cargo"
,
new
Cargo
());
...
...
@@ -50,7 +51,7 @@ public class CargoController {
return
"cargo-form"
;
}
@PostMapping
(
path
=
{
"/
cargo"
,
"/cargo
/{id}"
})
@PostMapping
(
path
=
{
"/
agregar"
,
"/modificar
/{id}"
})
public
String
guardarCargo
(
@Valid
@ModelAttribute
Cargo
cargo
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
,
Model
model
)
{
if
(
result
.
hasErrors
()
||
(
id
==
null
&&
cargoRepo
.
existsByNombreIgnoreCase
(
cargo
.
getNombre
())
)){
model
.
addAttribute
(
"mismoNombre"
,
true
);
...
...
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
View file @
d6b0b79d
...
...
@@ -11,12 +11,12 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
java.util.Date
;
@RequestMapping
(
"/convocatorias"
)
@Controller
public
class
ConvocatoriaController
{
...
...
@@ -29,7 +29,7 @@ public class ConvocatoriaController {
this
.
convoRepo
=
convoRepo
;
}
@RequestMapping
(
"/convocatorias"
)
@RequestMapping
()
public
String
menuConvocatorias
(
Model
model
,
RedirectAttributes
redirectAttrs
,
@RequestParam
(
required
=
false
)
Long
cargoId
,
@RequestParam
(
required
=
false
)
EstadoConvocatoria
estado
,
//1: true, 0: false
...
...
@@ -48,7 +48,7 @@ public class ConvocatoriaController {
return
"convocatorias"
;
}
@RequestMapping
(
"/c
onvocatoria/c
rear/{id}"
)
@RequestMapping
(
"/crear/{id}"
)
public
String
guardarConvocatoriaa
(
@PathVariable
(
required
=
false
)
Long
id
,
RedirectAttributes
redirectAttributes
)
{
for
(
ConvocatoriaCargo
conv:
convoRepo
.
findByCargoId
(
id
))
{
if
(
conv
.
getEstado
()==
EstadoConvocatoria
.
abierto
){
...
...
@@ -68,36 +68,16 @@ public class ConvocatoriaController {
return
"redirect:/convocatorias"
;
}
/* @RequestMapping("/convocatoria/{id}")
public String formConvocatoria(Model model,@PathVariable(required = false) Long id) {
model.addAttribute("cargos", cargoRepo.findAll());
if(id == null){
model.addAttribute("convocatoria", new ConvocatoriaCargo());
model.addAttribute("listaConvocatoria", convoRepo.findAll());
}
else {
ConvocatoriaCargo cc = convoRepo.getById(id);
cc.setFechaFinS(new SimpleDateFormat("yyyy-MM-dd").format((cc.getFechaFin())));
cc.setFechaInicioS(new SimpleDateFormat("yyyy-MM-dd").format((cc.getFechaInicio())));
model.addAttribute("convocatoria", cc);
model.addAttribute("listaConvocatoria", convoRepo.findAll());
}
return "convocatoria-form";
}*/
@RequestMapping
(
"/cerrar/{id}"
)
public
String
cerrarConvocatoria
(
@PathVariable
(
required
=
false
)
Long
id
)
{
@RequestMapping
(
"/convocatoria/{id}"
)
public
String
guardarConvocatoria
(
@ModelAttribute
ConvocatoriaCargo
convocatoria
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
,
Model
model
)
{
if
(
id
!=
null
)
convocatoria
.
setId
(
id
);
convocatoria
=
convoRepo
.
findByIdConvocatoriaCargo
(
id
);
ConvocatoriaCargo
convocatoria
=
convoRepo
.
getById
(
id
);
if
(
convocatoria
==
null
||
convocatoria
.
getEstado
()
==
EstadoConvocatoria
.
cerrado
)
return
"error"
;
convocatoria
.
setEstado
(
EstadoConvocatoria
.
cerrado
);
convocatoria
.
setFechaFin
(
new
Date
());
convocatoria
.
getCargo
().
setExisteConvocatoria
(
false
);
convoRepo
.
save
(
convocatoria
);
return
"redirect:/convocatorias"
;
}
}
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/webapp/jsp/cargo-form.jsp
View file @
d6b0b79d
...
...
@@ -10,7 +10,7 @@
<h5>Cargo</h5>
</div>
<form:form
action="/cargo
/${cargo.id == null ? '' : cargo.id
}"
action="/cargo
s/${cargo.id == null ? 'agregar' : 'modificar/'.concat(cargo.id)
}"
method="post"
modelAttribute="cargo"
class="d-flex flex-column"
...
...
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/webapp/jsp/cargos.jsp
View file @
d6b0b79d
...
...
@@ -50,10 +50,10 @@ contentType="text/html;charset=UTF-8" language="java" %>
>Ver Convocatorias</a
>
</td>
<td><a href="/cargo/${cargo.id}">Editar cargo</a></td>
<td><a href="/cargo
s/modificar
/${cargo.id}">Editar cargo</a></td>
<td>
<c:if test="${!cargo.isExisteConvocatoria()}">
<a class="btn btn-secondary" href="/convocatoria/crear/${cargo.id}">Abrir Convocatoria</a>
<a class="btn btn-secondary" href="/convocatoria
s
/crear/${cargo.id}">Abrir Convocatoria</a>
</c:if>
</td>
</tr>
...
...
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/webapp/jsp/convocatorias.jsp
View file @
d6b0b79d
...
...
@@ -92,7 +92,7 @@
<td><a href="/postulantes?convId=${convocatoria.id}">Ver postulantes</a></td>
<td>
<c:if test="${convocatoria.getEstado() != 'cerrado'}">
<a class="btn btn-secondary" href="/convocatoria/${convocatoria.id}">Cerrar convocatoria</a>
<a class="btn btn-secondary" href="/convocatoria
s/cerrar
/${convocatoria.id}">Cerrar convocatoria</a>
</c:if>
</td>
</tr>
...
...
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/webapp/jsp/layouts/base.jsp
View file @
d6b0b79d
...
...
@@ -38,7 +38,7 @@
Cargos
</a>
<ul
class=
"dropdown-menu"
aria-labelledby=
"navbarDropdownMenuLink"
>
<li><a
class=
"dropdown-item"
href=
"/cargo"
>
Agregar Cargo
</a></li>
<li><a
class=
"dropdown-item"
href=
"/cargo
s/agregar
"
>
Agregar Cargo
</a></li>
<li><a
class=
"dropdown-item"
href=
"/cargos"
>
Listar cargos
</a></li>
<li><a
class=
"dropdown-item"
href=
"/convocatorias"
>
Listar convocatorias
</a></li>
</ul>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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