mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Add support for locked wiki pages
This commit is contained in:
parent
5e507fbb5e
commit
eb08b51e59
3 changed files with 15 additions and 20 deletions
11
db.py
11
db.py
|
@ -1015,17 +1015,6 @@ class WikiLog(Base):
|
|||
return f"<WikiLog {self.edit_id}>"
|
||||
|
||||
|
||||
class WikiAuthorization(Base):
|
||||
__tablename__ = "wikiauthorization"
|
||||
|
||||
royal_id = Column(Integer, ForeignKey("royals.id"))
|
||||
royal = relationship("Royal", backref="profile_data", uselist=False, lazy="joined")
|
||||
page_key = Column(String, ForeignKey("wikientries.key"), nullable=False)
|
||||
page = relationship("WikiEntry", backref="edit_logs", lazy="joined")
|
||||
|
||||
__table_args__ = (PrimaryKeyConstraint("royal_id", "page_key"),)
|
||||
|
||||
|
||||
class Event(Base):
|
||||
__tablename__ = "events"
|
||||
|
||||
|
|
|
@ -870,7 +870,7 @@ img {
|
|||
|
||||
.wiki {
|
||||
|
||||
.wiki-log {
|
||||
.wiki-log, .wiki-locked {
|
||||
font-family: "Consolas", "Source Code Pro", monospace;
|
||||
font-size: small;
|
||||
margin-bottom: 12px;
|
||||
|
|
|
@ -43,14 +43,20 @@
|
|||
Ultima modifica di <span class="last-author"><a href="/profile/{{ wiki_log.editor.username }}">{{ wiki_log.editor.username }}</a></span> alle <span class="last-timestamp">{{ wiki_log.timestamp.strftime('%Y-%m-%d %H:%M:%S %Z') }}</span>{% if wiki_log.reason %}, motivo: <span class="last-reason">{{ wiki_log.reason }}</span>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if g.user and not wiki_page.locked %}
|
||||
<div class="wiki-edit">
|
||||
<h4>Modifica</h4>
|
||||
<form action="{{ url_for('page_wiki', key=key) }}" method="POST">
|
||||
<textarea oninput="newEdit()" class="content" name="content" placeholder="Inserisci il Markdown per la pagina qui.">{% if wiki_page %}{{ wiki_page.content }}{% endif %}</textarea><br>
|
||||
<input class="reason" name="reason" type="text" placeholder="Motivo per la modifica"><br>
|
||||
<input class="submit" type="submit" onmouseenter="onEnter()" onmouseleave="onExit()" value="Invia">
|
||||
</form>
|
||||
{% if not wiki_page.locked %}
|
||||
{% if g.user %}
|
||||
<div class="wiki-edit">
|
||||
<h4>Modifica</h4>
|
||||
<form action="{{ url_for('page_wiki', key=key) }}" method="POST">
|
||||
<textarea oninput="newEdit()" class="content" name="content" placeholder="Inserisci il Markdown per la pagina qui.">{% if wiki_page %}{{ wiki_page.content }}{% endif %}</textarea><br>
|
||||
<input class="reason" name="reason" type="text" placeholder="Motivo per la modifica"><br>
|
||||
<input class="submit" type="submit" onmouseenter="onEnter()" onmouseleave="onExit()" value="Invia">
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="wiki-locked">
|
||||
<span>🔒 Pagina bloccata: non possono essere effettuate ulteriori modifiche.</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue