Update header; move 'manage users' to 'settings' sub
This commit is contained in:
parent
d66ab98e1f
commit
eb593e8e28
13 changed files with 149 additions and 70 deletions
|
@ -23,7 +23,7 @@ import ru.redrise.marinesco.data.UserRepository;
|
|||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/manage_users")
|
||||
@RequestMapping("/settings/manage_users")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public class ManageUsersController {
|
||||
|
||||
|
@ -83,14 +83,14 @@ public class ManageUsersController {
|
|||
log.error(id, e);
|
||||
}
|
||||
|
||||
return "redirect:/manage_users";
|
||||
return "redirect:/settings/manage_users";
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public String update(UserGenerified userGenerified) {
|
||||
User user = userRepository.findById(userGenerified.getId()).get();
|
||||
if (user == null)
|
||||
return "redirect:/manage_users";
|
||||
return "redirect:/settings/manage_users";
|
||||
|
||||
user.setAuthorities(userGenerified.getAthorities());
|
||||
user.setDisplayname(userGenerified.getDisplayName());
|
||||
|
@ -99,7 +99,7 @@ public class ManageUsersController {
|
|||
user.setPassword(passwordEncoder.encode(userGenerified.getPassword()));
|
||||
userRepository.save(user);
|
||||
|
||||
return "redirect:/manage_users";
|
||||
return "redirect:/settings/manage_users";
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
@ -117,6 +117,6 @@ public class ManageUsersController {
|
|||
log.info("Added user {} {} {}", user.getId(), user.getUsername(), user.getDisplayname(),
|
||||
user.getAuthorities().get(0));
|
||||
// Reloads page therefore new records appears
|
||||
return "redirect:/manage_users";
|
||||
return "redirect:/settings/manage_users";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,6 @@ public class UserSettingsController {
|
|||
log.info("{} {}", userSettingsForm.getDisplayname(), userSettingsForm.getNewPassword());
|
||||
userRepo.save(user);
|
||||
|
||||
return "user_settings";
|
||||
return "redirect:/profile/settings";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,13 +109,22 @@ header {
|
|||
float: right;
|
||||
padding: 0%;
|
||||
}
|
||||
#header_menu_block{
|
||||
list-style-type: none;
|
||||
list-style-image: none;
|
||||
height: 100%;
|
||||
margin-right: 0;
|
||||
right: 0;
|
||||
float: left;
|
||||
padding: 0%;
|
||||
}
|
||||
|
||||
.ul_right_block {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.li_right_block {
|
||||
.li_header_block {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
height: 100%;
|
||||
|
@ -135,6 +144,22 @@ header {
|
|||
color: #74bfbd;
|
||||
}
|
||||
|
||||
.header_logo_link:link {
|
||||
color: #74bfbd;
|
||||
}
|
||||
.header_logo_link:visited{
|
||||
color: #74bfbd;
|
||||
}
|
||||
.header_logo_link:hover {
|
||||
color: #74bfbd;
|
||||
}
|
||||
|
||||
.header_entry_link:link {
|
||||
color: #74bfbd;
|
||||
}
|
||||
.header_entry_link:visited {
|
||||
color: #74bfbd;
|
||||
}
|
||||
.header_entry_link:hover {
|
||||
color: #b6a795;
|
||||
}
|
||||
|
@ -156,6 +181,25 @@ a.entry {
|
|||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
.button-header {
|
||||
margin: 1em 0;
|
||||
font-family: sans-serif;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
font-variant: small-caps !important;
|
||||
background-color: #74bfbd !important;
|
||||
border: none;
|
||||
border-radius: 2px;
|
||||
padding: 4px 15px 4px 15px;
|
||||
color: #4a3c3c;
|
||||
}
|
||||
|
||||
.button-header:hover {
|
||||
background-color: #c2dac0 !important;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
border-bottom: 1px dashed;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||
<div class="container base">
|
||||
<span class="validationError" th:if="${Error} != null" th:text="${Error}"></span>
|
||||
<div th:if="${author} != null">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||
<div class="container base">
|
||||
<span class="validationError" th:if="${Error} != null" th:text="${Error}"></span>
|
||||
<div th:if="${book} != null">
|
||||
|
|
|
@ -1,45 +1,90 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div th:fragment="header" class="header_wrapper" >
|
||||
<div class="container" >
|
||||
<header>
|
||||
<div class="header_branding block_inner">
|
||||
<a href="/">
|
||||
<img height="65px" th:src="@{/images/s_logo.svg}" alt="Marinesco">
|
||||
</a>
|
||||
</div>
|
||||
<nav id="header_right_block" class="block">
|
||||
<div class="block_inner">
|
||||
<ul class="ul_right_block">
|
||||
<li class="li_right_block" th:if="${#authorization.expression('!isAuthenticated()')}">
|
||||
<a class="entry" href="/login" th:href="@{/login}">
|
||||
<span class="header_entry header_entry_link">Sign in</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="li_right_block" th:if="${#authorization.expression('isAuthenticated()')}">
|
||||
<a class="entry" href="/logout">
|
||||
<span class="header_entry header_entry_link">Logout</span>
|
||||
</a>
|
||||
<form style="visibility: hidden" id="form" method="post" action="#" th:action="@{/logout}"></form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="header_entry header_title">
|
||||
Marinesco
|
||||
<head></head>
|
||||
|
||||
<body>
|
||||
<div th:fragment="header-anon" class="header_wrapper">
|
||||
<div class="container">
|
||||
<header>
|
||||
<div class="header_branding block_inner">
|
||||
<img height="65px" th:src="@{/images/s_logo.svg}" alt="Marinesco">
|
||||
</div>
|
||||
<nav id="header_right_block" class="block">
|
||||
<div class="block_inner">
|
||||
<ul class="ul_right_block">
|
||||
<li class="li_header_block">
|
||||
<a class="entry" href="/login" th:href="@{/login}">
|
||||
<span class="header_entry header_entry_link">Sign in</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
</nav>
|
||||
<nav id="header_menu_block" class="header_entry">
|
||||
<ul class="ul_right_block">
|
||||
<li class="li_header_block header_title">
|
||||
Marinesco
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
</div>
|
||||
<!--
|
||||
</div>
|
||||
|
||||
<div th:fragment="header-auth" class="header_wrapper">
|
||||
<div class="container">
|
||||
<header>
|
||||
<div class="header_branding block_inner">
|
||||
<a href="/">
|
||||
<img height="65px" th:src="@{/images/s_logo.svg}" alt="Marinesco">
|
||||
</a>
|
||||
</div>
|
||||
<nav id="header_right_block" class="block">
|
||||
<div class="block_inner">
|
||||
<ul class="ul_right_block">
|
||||
<li class="li_header_block" th:if="${#authentication.principal.isAdmin()}">
|
||||
<a class="header_entry header_entry_link" href="/settings">Settings</a>
|
||||
</li>
|
||||
<li class="li_header_block">
|
||||
<a class="header_entry header_entry_link" href="/profile">Profile</a>
|
||||
</li>
|
||||
<li class="li_header_block">
|
||||
<span class="header_entry">|</span>
|
||||
</li>
|
||||
<li class="li_header_block">
|
||||
<a class="entry" href="/logout">
|
||||
<span class="header_entry header_entry_link">Logout</span>
|
||||
</a>
|
||||
<form style="visibility: hidden" id="form" method="post" action="#" th:action="@{/logout}"></form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<nav id="header_menu_block" class="header_entry">
|
||||
<ul class="ul_right_block">
|
||||
<li class="li_header_block">
|
||||
<form action="/search" method="get">
|
||||
<input type="text" name="search">
|
||||
<button class="button-header" type="submit">Search</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div th:replace="~{fragments/header :: ${#authentication.principal.isAdmin()} ? 'header-admin' : 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header'}"></div>
|
||||
-->
|
||||
<div th:fragment="header-content-admin" >
|
||||
|
||||
</div>
|
||||
<div th:fragment="header-content-admin">
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||
<div class="container base">
|
||||
<form method="POST" th:action="@{/settings/genres}" th:object="${genresHolder}">
|
||||
<div class="wrapper_centred" th:each="genre, itemStat : ${genresHolder.genres}">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: 'header-anon'}"></div>
|
||||
<div class="page">
|
||||
<div class="center">
|
||||
<div class="container base">
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header'}"></div>
|
||||
<div class="container base">
|
||||
<h1 th:text="${header_text}"></h1>
|
||||
<p>
|
||||
<div th:each="user : ${users}">
|
||||
<form method="POST" th:action="@{/manage_users/update}" th:object="${userGenerified}">
|
||||
<form method="POST" th:action="@{/settings/manage_users/update}" th:object="${userGenerified}">
|
||||
<span th:text="${user.id + '. '}"></span>
|
||||
<span th:text="${user.name}"></span>
|
||||
<input type="hidden" th:value="${user.id}" name="id" />
|
||||
|
@ -37,14 +37,14 @@
|
|||
<span th:text="${athorities.name}"></span><br />
|
||||
</div>
|
||||
|
||||
<button>Update</button><a th:href="'/manage_users/delete/' + ${user.id}">Delete</a>
|
||||
<button>Update</button><a th:href="'/settings/manage_users/delete/' + ${user.id}">Delete</a>
|
||||
</form>
|
||||
<br />
|
||||
<hr>
|
||||
</div>
|
||||
<hr>
|
||||
<b>Add user</b>
|
||||
<form method="POST" th:action="@{/manage_users}" th:object="${administatorAddUserForm}">
|
||||
<form method="POST" th:action="@{/settings/manage_users}" th:object="${administatorAddUserForm}">
|
||||
<span class="validationError" th:if="${loginOccupied} != null" th:text="${loginOccupied}">pew</span>
|
||||
<span class="validationError" th:if="${#fields.hasErrors('username')}"
|
||||
th:errors="*{username}">Error</span>
|
||||
|
|
|
@ -10,21 +10,13 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||
<div class="container base">
|
||||
<br /><a href="/login">Login</a>
|
||||
<br /><a href="/profile">/profile</a>
|
||||
<br /><a href="/manage_users">/manage_users</a>
|
||||
<br /><a href="/settings">/settings</a>
|
||||
<br /><a href="/book/59992766">/book/59992766</a>
|
||||
<br /><a href="/author/1">/author/1</a>
|
||||
<br /><a href="/h2">H2</a>
|
||||
<br />
|
||||
<br />
|
||||
<form action='/search' method='get'>
|
||||
<input type='text' name='search'>
|
||||
<button class="sign" type='submit'>Search</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div th:replace="~{fragments/footer :: 'footer'}"></div>
|
||||
|
|
|
@ -10,12 +10,8 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||
<div class="container base">
|
||||
<form action='' method='get'>
|
||||
<input type='text' name='search'>
|
||||
<button class="sign" type='submit'>Search</button>
|
||||
</form>
|
||||
<div th:if="${books} != null">
|
||||
<hr>
|
||||
<h3>Titles</h3>
|
||||
|
|
|
@ -10,14 +10,16 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||
<div class="container base">
|
||||
<span
|
||||
th:text="${'New users registration is now ' + (allowRegistration ? 'enabled. ' : 'disabled. ' )}"></span>
|
||||
<a th:href="${'/settings/allow_registration/' + !allowRegistration }"
|
||||
th:text="${'Click here to ' + (allowRegistration ? 'disable' : 'enable' )}"></a>
|
||||
<p>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<a href="/settings/manage_users">Manage users</a>
|
||||
<br />
|
||||
<span class="validationError" th:if="${rescanError} != null" th:text="${rescanError}"></span>
|
||||
<span class="validationPass" th:if="${rescanOk} != null" th:text="${rescanOk}"></span>
|
||||
<br />
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<body>
|
||||
<div class="page">
|
||||
<div th:replace="~{fragments/header :: 'header'}"></div>
|
||||
<div th:replace="~{fragments/header :: 'header-auth'}"></div>
|
||||
<div class="container base">
|
||||
<h1 th:text="${header_text}">welcome</h1>
|
||||
<form method="POST" th:action="@{/profile/settings}" th:object="${userSettingsForm}"> <!-- -->
|
||||
|
|
Loading…
Reference in a new issue