add admin pages
This commit is contained in:
parent
1f52c7c98c
commit
5d79915829
19
truthinquiry/routes/routes_admin.py
Normal file
19
truthinquiry/routes/routes_admin.py
Normal file
@ -0,0 +1,19 @@
|
||||
import flask
|
||||
|
||||
routes_admin = flask.Blueprint("admin", __name__)
|
||||
|
||||
@routes_admin.route("/")
|
||||
def index():
|
||||
return flask.render_template("admin/index.html")
|
||||
|
||||
@routes_admin.route("/npc/<npc_id>")
|
||||
def npc(npc_id):
|
||||
return flask.render_template("admin/npc.html")
|
||||
|
||||
@routes_admin.route("/questions")
|
||||
def questions():
|
||||
return flask.render_template("admin/questions.html", langs=["FR", "EN"])
|
||||
|
||||
@routes_admin.route("/places")
|
||||
def places():
|
||||
return flask.render_template("admin/places.html")
|
13
truthinquiry/templates/admin/index.html
Normal file
13
truthinquiry/templates/admin/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<a href="/admin/questions"> Questions </a>
|
||||
<br>
|
||||
<a href="/admin/places"> Places </a>
|
||||
<br>
|
||||
<a href="/admin/reactions"> Reactions </a>
|
||||
<section>
|
||||
<p> NPC list :</p>
|
||||
<a href="/admin/npc/1"> Diva </a>
|
||||
<br>
|
||||
<a href="/admin/npc/2"> Barron </a>
|
||||
<br>
|
||||
<a href="/admin/npc/3"> Machin </a>
|
||||
</section>
|
0
truthinquiry/templates/admin/npc.html
Normal file
0
truthinquiry/templates/admin/npc.html
Normal file
0
truthinquiry/templates/admin/places.html
Normal file
0
truthinquiry/templates/admin/places.html
Normal file
53
truthinquiry/templates/admin/questions.html
Normal file
53
truthinquiry/templates/admin/questions.html
Normal file
@ -0,0 +1,53 @@
|
||||
<select id="langs" onchange="langChangedEvent()">
|
||||
{%for lang in langs%}
|
||||
<option value="{{lang}}">{{lang}}</option>
|
||||
{%endfor%}
|
||||
</select>
|
||||
|
||||
<section id="questionsTag">
|
||||
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.questionTypeTag{
|
||||
border: thin solid red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="/static/js/api.js"></script>
|
||||
<script>
|
||||
|
||||
function save(){
|
||||
console.log("Saving")
|
||||
}
|
||||
|
||||
async function changeLang(newLang){
|
||||
console.log("Changing language to "+newLang);
|
||||
resp = await makeAPIRequest("admin/getQuestions", {"lang": newLang});
|
||||
|
||||
questionsTag.innerHTML = '';
|
||||
|
||||
for(let questionType of resp){
|
||||
|
||||
let questionTypeTag = document.createElement("section")
|
||||
questionTypeTag.className = 'questionTypeTag';
|
||||
questionsTag.appendChild(questionTypeTag);
|
||||
|
||||
for(let question of questionType){
|
||||
let questionTag = document.createElement("h1");
|
||||
questionTypeTag.appendChild(questionTag);
|
||||
|
||||
questionTag.innerHTML = question.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function langChangedEvent(){
|
||||
save();
|
||||
changeLang(langs.value)
|
||||
}
|
||||
|
||||
changeLang(langs.value);
|
||||
|
||||
|
||||
</script>
|
0
truthinquiry/templates/admin/reactions.html
Normal file
0
truthinquiry/templates/admin/reactions.html
Normal file
Loading…
Reference in New Issue
Block a user