Skip to content

Commit

Permalink
Improving documentation and styling
Browse files Browse the repository at this point in the history
  • Loading branch information
tigreped committed Nov 26, 2015
1 parent c2d811c commit 8cf27cf
Show file tree
Hide file tree
Showing 14 changed files with 1,054 additions and 216 deletions.
44 changes: 22 additions & 22 deletions src/main/java/br/gov/sibbr/api/controller/InterfaceController.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public String login(LoginForm loginForm, Model model) {
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/register", method = RequestMethod.POST)
@RequestMapping(value = "/registrar", method = RequestMethod.POST)
public String register(LoginForm loginForm, Model model) {
String email = loginForm.getEmail();
String password = loginForm.getPassword();
Expand Down Expand Up @@ -99,17 +99,17 @@ public String register(LoginForm loginForm, Model model) {
return "register";
}

// Method responsible for managing admin password change
@RequestMapping(value = "/admin/changePassword", method = RequestMethod.POST)
public String adminChangePassword(LoginForm loginForm, Model model) {
// Method responsible for managing user password changes
@RequestMapping(value = "/alterarSenha", method = RequestMethod.POST)
public String changePassword(LoginForm loginForm, Model model) {
String token = loginForm.getToken();
String password = loginForm.getPassword();
String passwordCheck = loginForm.getPasswordCheck();
if (password != null && passwordCheck != null) {
if (token != null) {
// Check if token is valid for admin:
String tokenCheck = authService.checkTokenAdmin(token);
// Token is valid for user admin, authorize operation to continue:
String tokenCheck = authService.checkToken(token);
// Token is valid for user, authorize operation to continue:
if (tokenCheck == null) {
// Check if both passwords are equal:
if (password.equalsIgnoreCase(passwordCheck)) {
Expand Down Expand Up @@ -143,20 +143,14 @@ public String adminChangePassword(LoginForm loginForm, Model model) {
model.addAttribute("error",
"You must provide a valid password and repeat it on the Veirification field. Please, try again.");
}
return "admin_password_change";
return "password_change";
}

/* GET methods */

// Method responsible for calling the documentation on admin operations
@RequestMapping(value = "/admin/", method = RequestMethod.GET)
public String admin(@RequestParam(value = "token", defaultValue = "null") String token, Model model) {
String message = authService.checkTokenAdmin(token);
// Something went wrong. Display error message.
if (message != null) {
model.addAttribute("error", message);
}
// Proper admin identification, display
@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String admin() {
return "admin";
}

Expand All @@ -166,26 +160,32 @@ public String greeting(Model model) {
return "index";
}

// Method responsible for calling the login template
@RequestMapping(value = "/ocorrencia", method = RequestMethod.GET)
public String occurrences() {
return "occurrences";
}

// Method responsible for calling the login template
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login() {
return "login";
}

// Method responsible for calling the user registration template
@RequestMapping(value = "/register", method = RequestMethod.GET)
@RequestMapping(value = "/registrar", method = RequestMethod.GET)
public String register() {
return "register";
}

// Method responsible for calling the admin password change template
@RequestMapping(value = "/admin/changePassword", method = RequestMethod.GET)
public String adminPasswordChange() {
return "admin_password_change";
// Method responsible for calling the user password change template
@RequestMapping(value = "/alterarSenha", method = RequestMethod.GET)
public String changePassword() {
return "password_change";
}

// Method responsible for displaying statistics documentation
@RequestMapping(value = "/stats", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas", method = RequestMethod.GET)
public String stats() {
return "stats";
}
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/br/gov/sibbr/api/controller/StatisticsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class StatisticsController {
AuthService authService = new AuthService();

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalRegistros", method = RequestMethod.GET)
@RequestMapping(value = "/statisticas/totalRegistros", method = RequestMethod.GET)
@Cacheable("total_records")
public Object fetchTotalRecords(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -52,7 +52,7 @@ public Object fetchTotalRecords(@RequestParam(value = "token", defaultValue = "n
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalRegistrosGeorreferenciados", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalRegistrosGeorreferenciados", method = RequestMethod.GET)
@Cacheable("total_geo_records")
public Object fetchTotalGeoRecords(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -65,7 +65,7 @@ public Object fetchTotalGeoRecords(@RequestParam(value = "token", defaultValue =
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalRegistrosRepatriados", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalRegistrosRepatriados", method = RequestMethod.GET)
@Cacheable("total_repatriados")
public Object fetchTotalRepatriatedRecords(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -78,7 +78,7 @@ public Object fetchTotalRepatriatedRecords(@RequestParam(value = "token", defaul
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalPublicadores", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalPublicadores", method = RequestMethod.GET)
public Object fetchTotalPublishers(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
String tokenCheck = authService.checkToken(token);
Expand All @@ -90,7 +90,7 @@ public Object fetchTotalPublishers(@RequestParam(value = "token", defaultValue =
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalRecursos", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalRecursos", method = RequestMethod.GET)
public Object fetchTotalResources(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
String tokenCheck = authService.checkToken(token);
Expand All @@ -102,7 +102,7 @@ public Object fetchTotalResources(@RequestParam(value = "token", defaultValue =
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalEspecies", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalEspecies", method = RequestMethod.GET)
@Cacheable("total_species")
public Object fetchTotalSpecies(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -115,7 +115,7 @@ public Object fetchTotalSpecies(@RequestParam(value = "token", defaultValue = "n
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalFilo", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalFilo", method = RequestMethod.GET)
@Cacheable("total_phylum")
public Object fetchTotalPhylum(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -128,7 +128,7 @@ public Object fetchTotalPhylum(@RequestParam(value = "token", defaultValue = "nu
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalClasse", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalClasse", method = RequestMethod.GET)
@Cacheable("total_class")
public Object fetchTotalClass(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -141,7 +141,7 @@ public Object fetchTotalClass(@RequestParam(value = "token", defaultValue = "nul
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalOrdem", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalOrdem", method = RequestMethod.GET)
@Cacheable("total_order")
public Object fetchTotalOrder(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -154,7 +154,7 @@ public Object fetchTotalOrder(@RequestParam(value = "token", defaultValue = "nul
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalGenero", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalGenero", method = RequestMethod.GET)
@Cacheable("total_genus")
public Object fetchTotalGenus(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand All @@ -167,7 +167,7 @@ public Object fetchTotalGenus(@RequestParam(value = "token", defaultValue = "nul
}

// Method responsible for managing occurrence requests
@RequestMapping(value = "/stats/totalFamilia", method = RequestMethod.GET)
@RequestMapping(value = "/estatisticas/totalFamilia", method = RequestMethod.GET)
@Cacheable("total_family")
public Object fetchTotalFamily(@RequestParam(value = "token", defaultValue = "null") String token) {
// Check of the user has proper access grant token
Expand Down
106 changes: 106 additions & 0 deletions src/main/resources/static/stylesheets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
@charset "UTF-8";
/* HTML5 ✰ Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*
* Detailed information about this CSS: h5bp.com/css
*
* ==|== normalize ========================================================== */
/* =============================================================================
* HTML5 display definitions
* ========================================================================== */
body {
font-size: 13px;
line-height: 1.231;
font-family: sans-serif;
color: #000000;
background-color: #f1f2f3;
padding: 0 5%;
text-align: justify;
}

.loginbox {
position: absolute;
background-color: #9D97B6;
border: 1px thin;
float: center;
border-radius: 10px;
padding: 5% 10%;
margin: 5% 28%;
}

positive {
color: green;
}

negative {
color: red;
}

h2 {

}

.container {
display: table;
width: 100%;
border-collapse: collapse;
}

.heading {
font-weight: bold;
display: table-row;
background-color: #50D67B;
text-align: center;
line-height: 25px;
font-size: 14px;
font-family: georgia;
color: #fff;
}

.table-row {
display: table-row;
text-align: center;
}

.col {
display: table-cell;
border: 1px solid #CCC;
padding: 1% 1% 1% 1%;
}

input:focus,textarea:focus {
outline: 0;
border-color: #c4ae30;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px #c4ae30;
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px
rgba(82, 168, 236, 0.6);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px #c4ae30;
}

input,textarea {
margin: 0 0 0 10px;
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
-ms-transition: border linear 0.2s, box-shadow linear 0.2s;
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
transition: border linear 0.2s, box-shadow linear 0.2s;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

input {
display: inline-block;
height: 25px;
margin: 4px;
font-size: 13px;
line-height: 18px;
color: gray;
border: 1px solid #cccccc;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
Loading

0 comments on commit 8cf27cf

Please sign in to comment.