add most mod routes
This commit is contained in:
@@ -12,10 +12,8 @@
|
||||
{%- endif -%}
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
{%- include 'common/topnav.html' -%}
|
||||
{%- block content -%}{%- endblock -%}
|
||||
{%- include 'common/footer.html' -%}
|
||||
</div>
|
||||
{%- include 'common/topnav.html' -%}
|
||||
{%- block content -%}{%- endblock -%}
|
||||
{%- include 'common/footer.html' -%}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -83,7 +83,9 @@
|
||||
|
||||
{% macro babycode_editor_component(
|
||||
placeholder='Post content',
|
||||
prefill=''
|
||||
prefill='',
|
||||
required=true,
|
||||
id='babycode-content'
|
||||
) -%}
|
||||
{%- call(idx) tabs(prefix='babycode', labels=['Write', 'Preview']) -%}
|
||||
{%- if idx == 0 -%}
|
||||
@@ -101,7 +103,7 @@
|
||||
</span>
|
||||
<a href="##">babycode help</a>
|
||||
</span>
|
||||
<textarea name="babycode_content" class="babycode-editor" placeholder="{{placeholder}}" required>{{ prefill }}</textarea>
|
||||
<textarea name="babycode_content" id="{{id}}" class="babycode-editor" placeholder="{{placeholder}}" {{'required' if required else ''}}>{{ prefill }}</textarea>
|
||||
{%- endif -%}
|
||||
{%- endcall -%}
|
||||
{%- endmacro %}
|
||||
|
||||
13
app/templates/mod/edit_topic.html
Normal file
13
app/templates/mod/edit_topic.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{%- from 'common/macros.html' import subheader -%}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}editing topic {{topic.name}}{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{{subheader('Editing topic %s' % topic.name, 'To preserve history, the URL of the topic can not be changed.')}}
|
||||
<form class="plank primary-bg full-width" method="POST">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" id="name" name="name" required value="{{topic.name}}">
|
||||
<label for="description">Description</label>
|
||||
<textarea name="description" id="description" rows="5" required>{{topic.description}}</textarea>
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
{%- endblock -%}
|
||||
13
app/templates/mod/new_topic.html
Normal file
13
app/templates/mod/new_topic.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{%- from 'common/macros.html' import subheader -%}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}creating a topic{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{{subheader('Create topic', 'The new topic will appear at the bottom of the current topic list. You can sort it later.')}}
|
||||
<form class="plank primary-bg full-width" method="POST">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" id="name" name="name" required>
|
||||
<label for="description">Description</label>
|
||||
<textarea name="description" id="description" rows="5" required></textarea>
|
||||
<input type="submit" value="Create">
|
||||
</form>
|
||||
{%- endblock -%}
|
||||
19
app/templates/threads/new_thread.html
Normal file
19
app/templates/threads/new_thread.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{%- from 'common/macros.html' import subheader, babycode_editor_component -%}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}drafting a thread{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{{subheader('New thread')}}
|
||||
<form class="plank primary-bg full-width" method="POST">
|
||||
<label for="topic">Topic</label>
|
||||
<select name="topic_id" id="topic" autocomplete="off">
|
||||
{%- for topic in topics -%}
|
||||
<option value="{{topic.id}}" {{'selected' if selected_topic == topic.id else ''}} {{'disabled' if not get_active_user().can_post_to_topic(topic) else ''}}>{{topic.name}}</option>
|
||||
{%- endfor -%}
|
||||
</select>
|
||||
<label for="title">Title</label>
|
||||
<input type="text" id="title" name="title" required>
|
||||
<label for="babycode-content">Starting post</label>
|
||||
{{ babycode_editor_component() }}
|
||||
<input type="submit" value="Create">
|
||||
</form>
|
||||
{%- endblock -%}
|
||||
@@ -1,10 +1,20 @@
|
||||
{%- from 'common/macros.html' import subheader, timestamp, pager, babycode_editor_component -%}
|
||||
{%- from 'common/macros.html' import full_post with context -%}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}{%- endblock -%}
|
||||
{%- block title -%}{{thread.title}}{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{%- set td -%}
|
||||
Started by <a href="{{url_for('users.user_page', username=started_by.username)}}">{{started_by.get_readable_name()}}</a> in topic <a href="{{url_for('topics.topic', slug=topic.slug)}}">{{topic.name}}</a>
|
||||
<ul class="horizontal">
|
||||
<li>Started by <a href="{{url_for('users.user_page', username=started_by.username)}}">{{started_by.get_readable_name()}}</a> in topic <a href="{{url_for('topics.topic', slug=topic.slug)}}">{{topic.name}}</a></li>
|
||||
{%- if thread.locked() or thread.stickied() -%}
|
||||
{%- if thread.locked() -%}
|
||||
<li class="visible">Locked</li>
|
||||
{%- endif -%}
|
||||
{%- if thread.stickied() -%}
|
||||
<li class="visible">Stickied</li>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
{%- endset -%}
|
||||
{%- call() subheader(thread.title, td) -%}
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
@@ -19,13 +29,13 @@ Started by <a href="{{url_for('users.user_page', username=started_by.username)}}
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Moderation actions</legend>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="lock" value="{{not thread.locked()}}">
|
||||
<input type="hidden" name="sticky" value="{{not thread.stickied()}}">
|
||||
<input type="hidden" name="lock" value="{{(not thread.locked()) | int}}">
|
||||
<input type="hidden" name="sticky" value="{{(not thread.stickied()) | int}}">
|
||||
<input type="submit" class="warn" value="{{'Unlock' if thread.locked() else 'Lock'}}" formaction="{{url_for('mod.lock_thread', thread_id=thread.id)}}">
|
||||
<input type="submit" class="warn" value="{{'Unsticky' if thread.stickied() else 'Sticky'}}" formaction="{{url_for('mod.sticky_thread', thread_id=thread.id)}}">
|
||||
</form>
|
||||
<form class="horizontal wrap" method="POST" action="{{url_for('mod.move_thread', thread_id=thread.id)}}">
|
||||
<select name="new_topic_id" id="new_topic_id">
|
||||
<select name="new_topic_id" id="new-topic-id">
|
||||
{%- for t in topics -%}
|
||||
<option value="{{t.id}}" {{'selected disabled' if t.id == topic.id else ''}} autocomplete="off">{{t.name}}</option>
|
||||
{%- endfor -%}
|
||||
|
||||
@@ -2,10 +2,18 @@
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}browsing topic {{topic.name}}{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{%- call() subheader(('Threads in "%s"' % topic.name), topic.description) -%}
|
||||
{%- set td -%}
|
||||
<ul class="horizontal">
|
||||
<li>{{topic.description}}</li>
|
||||
{%- if topic.locked() -%}
|
||||
<li class="visible">Locked</li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
{%- endset -%}
|
||||
{%- call() subheader(('Threads in "%s"' % topic.name), td) -%}
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Actions</legend>
|
||||
{%- if is_logged_in() -%}
|
||||
{%- if is_logged_in() and get_active_user().can_post_to_topic(topic) -%}
|
||||
<a href="{{url_for('threads.new', topic_id=topic.id)}}" class="linkbutton">New thread</a>
|
||||
{%- endif -%}
|
||||
<a href="{{url_for('topics.feed', slug=topic.slug)}}" class="linkbutton rss">Subscribe via RSS</a>
|
||||
@@ -20,13 +28,23 @@
|
||||
{%- if is_mod() -%}
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Moderation actions</legend>
|
||||
<a href="{{url_for('mod.edit_topic', topic_id=topic.id)}}" class="linkbutton">Edit</a>
|
||||
<form action="{{url_for('mod.lock_topic', topic_id=topic.id)}}" method="POST">
|
||||
<input type="hidden" value="{{(not topic.locked()) | int}}" name="lock">
|
||||
<input type="submit" class="warn" value="{{'Unlock' if topic.locked() else 'Lock'}}">
|
||||
</form>
|
||||
</fieldset>
|
||||
{%- endif -%}
|
||||
{%- if threads | length > 0 -%}
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Page</legend>
|
||||
{{- pager(page, page_count, args=request.args) -}}
|
||||
</fieldset>
|
||||
{%- endif -%}
|
||||
{%- endcall -%}
|
||||
{%- if threads | length == 0 -%}
|
||||
<div class="plank"><p>There are no threads in this topic yet.{%- if is_logged_in() and get_active_user().can_post_to_topic(topic) %} Be the first to start a discussion!{%- endif -%}</p></div>
|
||||
{%- endif -%}
|
||||
{%- for thread in threads -%}
|
||||
<div class="topic-info plank">
|
||||
<div class="title-container">
|
||||
@@ -41,10 +59,12 @@
|
||||
<span>Latest post by <a href="{{get_post_url(thread.latest_post_id, _anchor=true)}}">{{thread.latest_post_display_name if thread.latest_post_display_name else thread.latest_post_username}} on {{timestamp(thread.latest_post_created_at)}}</a>{{' (OP)' if thread.posts_count == 1 else ''}}</span>
|
||||
</div>
|
||||
{%- endfor -%}
|
||||
{%- if threads | length > 0 -%}
|
||||
<div class="plank secondary-bg">
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Page</legend>
|
||||
{{- pager(page, page_count, args=request.args) -}}
|
||||
</fieldset>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
|
||||
Reference in New Issue
Block a user