Added include to ejs files

This commit is contained in:
Akif9748 2022-03-26 23:28:10 +03:00
parent 6ca6d13078
commit f5402363f9
16 changed files with 266 additions and 454 deletions

View file

@ -210,3 +210,41 @@ img.logo {
width: 266px; width: 266px;
height: 75px; height: 75px;
} }
/*
*****************************
FOOTER
*****************************
*/
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: var(--col-8);
color: white;
text-align: center;
}
.footer p {
font-size: 16px;
color: white;
}
/*
*****************************
ADMIN TEXT
*****************************
*/
.admin {
position: fixed;
left: 0;
top: 0;
width: 100%;
background-color: var(--col-12);
color: white;
text-align: center;
}

View file

@ -1,2 +1,2 @@
const admin = () => document.getElementById("admin").innerHTML = const admin = () => document.getElementById("admin").innerHTML =
'<a href="/admin"> <h3> You are admin, and you can go your page </h3></a><br>'; '<div class="admin"><a class="admin" href="/admin"> <h3> You are admin, and you can go your page </h3></a></div><hr>';

View file

@ -1,51 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Admin panel!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Admin panel!</title>
<meta name="description" content="Admin panel of Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href=<%=user.getLink() %>>
<h1>
<%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
</a>
</div>
</div>
<hr>
<!-- Navbar end -->
<body>
<%- include("extra/navbar", {user}) %>
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1> <h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
@ -58,9 +18,11 @@
<script> <script>
if (<%= user2.admin %>) if (<%= user2.admin %>)
alert("Making admin of '<%= user2.name %>'' is success"); alert("Making admin of '<%= user2.name %>' is success");
</script> </script>
<!-- This website is powered by AKF-Forum -->
</body> <%- include("extra/footer") %>
</body>
</html> </html>

View file

@ -31,7 +31,7 @@
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

4
views/extra/footer.ejs Normal file
View file

@ -0,0 +1,4 @@
<!-- This website is powered by AKF-Forum -->
<div class="footer">
<p>This website is powered by AKF-Forum</p>
</div>

10
views/extra/header.ejs Normal file
View file

@ -0,0 +1,10 @@
<head>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= title ?? "Akf-forum" %> </title>
<meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>

31
views/extra/navbar.ejs Normal file
View file

@ -0,0 +1,31 @@
<!-- Navbar: -->
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href=<%=user.getLink() %>>
<h1>
<%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
</a>
</div>
</div>
<hr>
<!-- Navbar end -->

View file

@ -1,53 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Main page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Main page!</title>
<meta name="description" content="Main page of Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="/js/scripts.js"></script>
</head>
<body> <body>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href=<%=user.getLink() %>>
<h1>
<%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
</a>
</div>
</div>
<hr>
<!-- Navbar end -->
<%- include("extra/navbar", {user}) %>
<h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a> <h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a>
@ -84,7 +41,8 @@
</ul> </ul>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,17 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Login page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LOGIN</title>
<meta name="description" content="Login to Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
@ -30,7 +20,7 @@
<input type="submit" value="Login"> <input type="submit" value="Login">
</form> </form>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,53 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Open Thread!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Open Thread</title>
<meta name="description" content="Open thread in Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> <body>
<%- include("extra/navbar", {user}) %>
<body>
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href=<%=user.getLink() %>>
<h1>
<%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
</a>
</div>
</div>
<hr>
<!-- Navbar end -->
@ -60,11 +18,11 @@
<textarea rows="4" cols="50" name="content"></textarea> <textarea rows="4" cols="50" name="content"></textarea>
<hr> <hr>
<button class = "buyuk" type="submit">Open Thread!</button> <button class="buyuk" type="submit">Open Thread!</button>
</form> </form>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,16 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Register</title>
<meta name="description" content="Register to Akf-forum!">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<%- include("extra/header", {title: "Register!" }) %>
<body> <body>
@ -38,7 +30,7 @@
<input type="submit" value="Register"> <input type="submit" value="Register">
</form> </form>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,40 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Main page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%= thread.title %>
</title>
<meta name="description" content="Thread page of Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> <body>
<%- include("extra/navbar", {user}) %>
<body>
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href = <%= user.getLink() %> > <h1> <%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> </h1> </a>
</div>
</div>
<hr>
<!-- Navbar end -->
<h1 style="font-size: 35px;"> <h1 style="font-size: 35px;">
<%= thread.title %> <%= thread.title %>
@ -46,7 +18,7 @@
<br> <br>
<% messages.forEach(message=>{ %> <% messages.forEach(message=>{ %>
<div id= <%= "message-" + message.id %> style="border: 2px solid #444444; padding: 5px;"> <div id=<%="message-" + message.id %> style="border: 2px solid #444444; padding: 5px;">
<h2> <h2>
<img class="yuvarlak" src=<%=message.author.avatar %> alt=<%= message.author.name %>> <img class="yuvarlak" src=<%=message.author.avatar %> alt=<%= message.author.name %>>
<a style=" color: #bcbcbc; " href=<%="/users/" + message.author.id %>> <%= message.author.name %></a>: <a style=" color: #bcbcbc; " href=<%="/users/" + message.author.id %>> <%= message.author.name %></a>:
@ -65,7 +37,8 @@
<form style="text-align:right;" action="/message/react/<%= message.id %>" method="POST"> <form style="text-align:right;" action="/message/react/<%= message.id %>" method="POST">
<h3 style="display:inline;"> <h3 style="display:inline;">
<%= Object.values(message.react).filter(Boolean).length - Object.values(message.react).filter(x=>!x).length %> <%= Object.values(message.react).filter(Boolean).length - Object.values(message.react).filter(x=>
!x).length %>
</h3> </h3>
@ -93,7 +66,7 @@
</form> </form>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,52 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Main page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Threads!</title>
<meta name="description" content="Threads' page of Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> <body>
<%- include("extra/navbar", {user}) %>
<body>
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href = <%= user.getLink() %> > <h1> <%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> </h1> </a>
</div>
</div>
<hr>
<!-- Navbar end -->
<h1>Threads:</h1> <h1>Threads:</h1>
<ul> <ul>
<% threads.forEach(thread=>{ %> <% threads.forEach(thread=>{ %>
<li> <li>
<h1><a href=<%=links[threads.indexOf(thread)] %> > <%= thread.title %> by <%= thread.author.name %></a> <h1><a href=<%=links[threads.indexOf(thread)] %> > <%= thread.title %> by <%= thread.author.name
%></a>
</h1> </h1>
</li> </li>
<% }); %> <% }); %>
</ul> </ul>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,40 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Main page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%= member.name %>
</title>
<meta name="description" content="Akf-forum user page!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> <body>
<%- include("extra/navbar", {user}) %>
<body>
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href = <%= user.getLink() %> > <h1> <%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> </h1> </a>
</div>
</div>
<hr>
<!-- Navbar end -->
<ul> <ul>
@ -81,7 +52,7 @@
</form> </form>
<% }; %> <% }; %>
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>

View file

@ -1,37 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Main page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Edit profile</title>
<meta name="description" content="Akf-forum!">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> <body>
<%- include("extra/navbar", {user}) %>
<body>
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if (<%= user.admin %>) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href = <%= user.getLink() %> > <h1> <%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> </h1> </a>
</div>
</div>
<hr>
<!-- Navbar end -->
<h1>This page is not ready.</h1> <h1>This page is not ready.</h1>
@ -48,6 +22,8 @@
<input type="submit" value="Register"> <input type="submit" value="Register">
</form> </form>
--> -->
</body> <%- include("extra/footer") %>
</body>
</html> </html>

View file

@ -1,43 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/header", {title: "Main page!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Users!</title>
<meta name="description" content="Akf-forum users!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> <body>
<%- include("extra/navbar", {user}) %>
<body>
<script src="/js/scripts.js"></script>
<div id="admin"></div>
<script> if ( <%= user.admin %> ) admin(); </script>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<div class="navbar" id="navbar">
<a href="/threads">THREADS</a>
<a href="/users">USERS</a>
<a href="/search">SEARCH</a>
<a href="/threads/open/">OPEN THREAD</a>
<div style="float: right;" class="user" id="user">
<a href = <%= user.getLink() %> > <h1> <%= user.name %><img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> </h1> </a>
</div>
</div>
<hr>
<!-- Navbar end -->
<h1>USERS:</h1> <h1>USERS:</h1>
<ul> <ul>
<% users.forEach(user=>{ %> <% users.forEach(user=>{ %>
<li> <li>
<h1><a href= <%= links[user.id] %> > <%= user.name %></a> <h1><a href=<%=links[user.id] %> > <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
</li> </li>
@ -46,7 +21,7 @@
<!-- This website is powered by AKF-Forum --> <%- include("extra/footer") %>
</body> </body>
</html> </html>