1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Wiki progress

This commit is contained in:
Steffo 2019-06-20 16:44:05 +02:00
parent a7b85ecc11
commit 87578155a8
5 changed files with 178 additions and 30 deletions

View file

@ -11,11 +11,16 @@ rp = Royalprint("wikiedit", __name__, url_prefix="/wikiedit", template_folder=tm
required_tables={Royal, WikiPage, WikiRevision}) required_tables={Royal, WikiPage, WikiRevision})
@rp.route("/<uuid:page_id>", defaults={"title": ""}) @rp.route("/<uuid:page_id>", defaults={"title": ""}, methods=["GET", "POST"])
@rp.route("/<uuid:page_id>/<title>") @rp.route("/<uuid:page_id>/<title>")
def wikiedit_by_id(page_id: uuid.UUID, title: str): def wikiedit_by_id(page_id: uuid.UUID, title: str):
alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"]
page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.page_id == page_id).one_or_none() page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.page_id == page_id).one_or_none()
if page is None: if page is None:
return "No such page", 404 return "No such page", 404
return f.render_template("wikiedit_page.html", page=page)
if f.request.method == "GET":
return f.render_template("wikiedit_page.html", page=page)
elif f.request.method == "POST":
return "Haha doesn't work yet"

View file

@ -18,39 +18,26 @@
</div> </div>
<div class="bot"> <div class="bot">
<form method="POST" class="wikiedit-form"> <form method="POST" class="wikiedit-form">
<div class="field">
<label for="wikiedit-title"> <label for="wikiedit-title">
Titolo <span class="label-text">Titolo</span>
<input id="wikiedit-title" type="text" name="title" placeholder="Titolo" value="{{ page.title }}"> <input id="wikiedit-title" type="text" name="title" placeholder="Titolo" value="{{ page.title }}">
</label> </label>
</div>
<div class="field">
<label for="wikiedit-format"> <label for="wikiedit-format">
Formato <span class="label-text">Formato</span>
<input id="wikiedit-format" type="text" name="format" placeholder="Format" disabled value="{{ page.format }}"> <input id="wikiedit-format" type="text" name="format" placeholder="Format" disabled value="{{ page.format }}">
</label> </label>
</div> <!--suppress HtmlFormInputWithoutLabel -->
<div class="field"> <textarea id="wikiedit-content" name="content">{{ page.content }}</textarea>
<label for="wikiedit-content">
Contenuto
<textarea id="wikiedit-content" name="content">{{ page.content }}</textarea>
</label>
</div>
<div class="field">
<label for="wikiedit-css"> <label for="wikiedit-css">
Tema <span class="label-text">Tema</span>
<select id="wikiedit-css" name="css"> <select id="wikiedit-css" name="css">
<option value="None" {% if page.css == None %}selected{% endif %}>Royal Games</option> <option value="None" {% if page.css == None %}selected{% endif %}>Royal Games</option>
<option value="tf2.css" {% if page.css == "tf2.css" %}selected{% endif %}>Team Fortress 2</option> <option value="tf2.css" {% if page.css == "tf2.css" %}selected{% endif %}>Team Fortress 2</option>
</select> </select>
</label> </label>
</div> <label for="wikiedit-submit">
<div class="field"> <input id="wikiedit-submit" type="submit" value="Salva">
Attenzione! Se due persone stanno modificando la stessa pagina, le modifiche di una di loro rischiano di essere annullate! </label>
</div>
<div class="field">
<input id="wikiedit-submit" type="submit" value="Applica modifica">
</div>
</form> </form>
</div> </div>
</div> </div>

View file

@ -176,6 +176,32 @@ input[type="submit"]:active,
color: white; color: white;
border-color: white; border-color: white;
} }
input[type="text"],
input[type="password"],
input[type="email"] {
background-color: rgba(160, 204, 255, 0.1);
color: #a0ccff;
border: none;
border-bottom: 1px dashed #a0ccff;
padding: 2px;
margin: 1px;
font-size: medium;
font-family: sans-serif;
}
select {
background-color: rgba(160, 204, 255, 0.1);
color: #a0ccff;
border: none;
border-bottom: 1px dotted #a0ccff;
padding: 2px;
margin: 1px;
font-size: medium;
font-family: sans-serif;
}
select option {
background-color: #293c61;
color: #a0ccff;
}
pre { pre {
margin: 0; margin: 0;
} }
@ -403,12 +429,28 @@ nav .nav-login-unavailable {
.spoiler:hover { .spoiler:hover {
color: #a0ccff; color: #a0ccff;
} }
.faded { .faded,
input[disabled=""],
button[disabled=""] {
opacity: 0.3; opacity: 0.3;
} }
.wikiedit-form .field { .wikiedit-form label {
margin-top: 4px; margin-top: 4px;
margin-bottom: 4px; margin-bottom: 4px;
display: flex;
}
.wikiedit-form label .label-text {
margin-right: 12px;
min-width: 60px;
}
.wikiedit-form label input {
flex-grow: 1;
}
.wikiedit-form label[for="wikiedit-title"] {
font-size: x-large;
}
.wikiedit-form label[for="wikiedit-title"] * {
font-size: x-large;
} }
.wikiedit-form .editor-toolbar, .wikiedit-form .editor-toolbar,
.wikiedit-form .editor-statusbar { .wikiedit-form .editor-statusbar {
@ -439,6 +481,36 @@ nav .nav-login-unavailable {
} }
.wikiedit-form .CodeMirror { .wikiedit-form .CodeMirror {
font-family: "Consolas", monospace !important; font-family: "Consolas", monospace !important;
border: 0; background-color: transparent;
color: #a0ccff;
border-top: 0;
border-bottom: 0;
border-left: 1px solid rgba(160, 204, 255, 0.2);
border-right: 1px solid rgba(160, 204, 255, 0.2);
border-radius: 0;
}
.wikiedit-form .CodeMirror .cm-link {
color: #7dffff !important;
}
.wikiedit-form .CodeMirror .cm-url {
color: #00caca !important;
}
.wikiedit-form .CodeMirror .cm-tag {
color: #ff7dff !important;
}
.wikiedit-form .CodeMirror .cm-strong {
color: #ffff7d !important;
}
.wikiedit-form .CodeMirror .cm-em {
color: #ffbb7d !important;
}
.wikiedit-form .CodeMirror .cm-quote {
color: #7dff7d !important;
}
.wikiedit-form .CodeMirror .cm-comment {
color: #ff7d7d !important;
}
.wikiedit-form .CodeMirror .cm-header {
color: #ffffff !important;
} }
/*# sourceMappingURL=ryg.css.map */ /*# sourceMappingURL=ryg.css.map */

File diff suppressed because one or more lines are too long

View file

@ -215,6 +215,33 @@ button, input[type="submit"], .btn {
} }
} }
input[type="text"], input[type="password"], input[type="email"] {
background-color: fade(@fg, 10%);
color: @fg;
border: none;
border-bottom: 1px dashed @fg;
padding: 2px;
margin: 1px;
font-size: medium;
font-family: sans-serif;
}
select {
background-color: fade(@fg, 10%);
color: @fg;
border: none;
border-bottom: 1px dotted @fg;
padding: 2px;
margin: 1px;
font-size: medium;
font-family: sans-serif;
option {
background-color: #293c61;
color: @fg;
}
}
pre { pre {
margin: 0; margin: 0;
} }
@ -494,15 +521,33 @@ nav {
} }
} }
.faded { .faded, input[disabled=""], button[disabled=""] {
opacity: 0.3; opacity: 0.3;
} }
.wikiedit-form { .wikiedit-form {
.field { label {
margin-top: 4px; margin-top: 4px;
margin-bottom: 4px; margin-bottom: 4px;
display: flex;
.label-text {
margin-right: 12px;
min-width: 60px;
}
input {
flex-grow: 1;
}
}
label[for="wikiedit-title"] {
font-size: x-large;
* {
font-size: x-large;
}
} }
.editor-toolbar, .editor-statusbar { .editor-toolbar, .editor-statusbar {
@ -534,6 +579,45 @@ nav {
.CodeMirror { .CodeMirror {
font-family: "Consolas", monospace !important; font-family: "Consolas", monospace !important;
border: 0; background-color: transparent;
color: @fg;
border-top: 0;
border-bottom: 0;
border-left: 1px solid fade(@fg, 20%);
border-right: 1px solid fade(@fg, 20%);
border-radius: 0;
.cm-link {
color: @pastel-cyan !important;
}
.cm-url {
color: @li !important;
}
.cm-tag {
color: @pastel-magenta !important;
}
.cm-strong {
color: @pastel-yellow !important;
}
.cm-em {
color: @pastel-orange !important;
}
.cm-quote {
color: @pastel-lime !important;
}
.cm-comment {
color: @pastel-red !important;
}
.cm-header {
color: @ec !important;
}
} }
} }