CSS Fixes.
This commit is contained in:
parent
60ca3ec791
commit
5154811b29
@ -64,10 +64,34 @@ header nav a {
|
|||||||
transition: color 0.3s;
|
transition: color 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
header nav a:hover {
|
header nav a:hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #f05a28;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-area ul {
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
li {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #f05a28;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.5em;
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
main {
|
main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -198,6 +222,16 @@ message-list {
|
|||||||
border-top: 1px solid #333;
|
border-top: 1px solid #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type="text"] {
|
||||||
|
flex: 1;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-input textarea {
|
.chat-input textarea {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
|
@ -55,9 +55,16 @@ class FancyButton extends HTMLElement {
|
|||||||
this.shadowRoot.appendChild(this.container);
|
this.shadowRoot.appendChild(this.container);
|
||||||
|
|
||||||
this.url = this.getAttribute('url');
|
this.url = this.getAttribute('url');
|
||||||
|
|
||||||
|
|
||||||
this.value = this.getAttribute('value');
|
this.value = this.getAttribute('value');
|
||||||
this.buttonElement.appendChild(document.createTextNode(this.getAttribute("text")));
|
this.buttonElement.appendChild(document.createTextNode(this.getAttribute("text")));
|
||||||
this.buttonElement.addEventListener("click", () => {
|
this.buttonElement.addEventListener("click", () => {
|
||||||
|
if(this.url == 'submit'){
|
||||||
|
this.closest('form').submit()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (this.url === "/back" || this.url === "/back/") {
|
if (this.url === "/back" || this.url === "/back/") {
|
||||||
window.history.back();
|
window.history.back();
|
||||||
} else if (this.url) {
|
} else if (this.url) {
|
||||||
@ -67,4 +74,4 @@ class FancyButton extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("fancy-button", FancyButton);
|
customElements.define("fancy-button", FancyButton);
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
<title>Snek</title>
|
<title>Snek</title>
|
||||||
<style>{{highlight_styles}}</style>
|
<style>{{highlight_styles}}</style>
|
||||||
<script src="/push.js"></script>
|
<script src="/push.js"></script>
|
||||||
|
<script src="/fancy-button.js"></script>
|
||||||
<script src="/upload-button.js"></script>
|
<script src="/upload-button.js"></script>
|
||||||
|
<script src="/generic-form.js"></script>
|
||||||
<script src="/html-frame.js"></script>
|
<script src="/html-frame.js"></script>
|
||||||
<script src="/schedule.js"></script>
|
<script src="/schedule.js"></script>
|
||||||
<script src="/app.js"></script>
|
<script src="/app.js"></script>
|
||||||
|
@ -3,6 +3,24 @@
|
|||||||
{% block title %}Search{% endblock %}
|
{% block title %}Search{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Search user</h1>
|
|
||||||
<generic-form class="center" url="/search_user.json"></generic-form>
|
<section class="chat-area">
|
||||||
|
<div class="chat-header"><h2>Search user</h2></div>
|
||||||
|
<div class="chat-messages">
|
||||||
|
<form method="get" action="/search-user.html">
|
||||||
|
<input type="text" placeholder="Username" name="query" value="{{query}}" REQUIRED></input>
|
||||||
|
<fancy-button size="auto" text="Back" url="submit"></fancy-button>
|
||||||
|
</form>
|
||||||
|
<ul>
|
||||||
|
{% for user in users %}
|
||||||
|
<li>
|
||||||
|
<a href="/user/{{user.username.value}}">{{user.username.value}}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -8,14 +8,20 @@ class SearchUserView(BaseFormView):
|
|||||||
form = SearchUserForm
|
form = SearchUserForm
|
||||||
|
|
||||||
async def get(self):
|
async def get(self):
|
||||||
if self.session.get("logged_in"):
|
#if self.session.get("logged_in"):
|
||||||
return web.HTTPFound("/web.html")
|
# return web.HTTPFound("/web.html")
|
||||||
|
users = []
|
||||||
|
query = self.request.query.get("query")
|
||||||
|
if query:
|
||||||
|
users = await self.app.services.user.search(query)
|
||||||
|
print(users,flush=True)
|
||||||
|
|
||||||
if self.request.path.endswith(".json"):
|
if self.request.path.endswith(".json"):
|
||||||
return await super().get()
|
return await super().get()
|
||||||
return await self.render_template("login.html")
|
return await self.render_template("search-user.html",dict(users=users,query=query or ''))
|
||||||
|
|
||||||
async def submit(self, form):
|
async def submit(self, form):
|
||||||
if await form.is_valid:
|
if await form.is_valid:
|
||||||
|
print("YEAAAH\n")
|
||||||
return {"redirect_url": "/search-user.html?query=" + form.query.value}
|
return {"redirect_url": "/search-user.html?query=" + form['username']}
|
||||||
return {"is_valid": False}
|
return {"is_valid": False}
|
||||||
|
Loading…
Reference in New Issue
Block a user