mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge pull request 'Cleanup post_edit_ templates' (#253) from h3ndrik/pyfedi:cleanup_templates into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/253
This commit is contained in:
commit
8299823d4a
28 changed files with 261 additions and 945 deletions
|
@ -92,10 +92,10 @@ class BanUserCommunityForm(FlaskForm):
|
||||||
submit = SubmitField(_l('Ban'))
|
submit = SubmitField(_l('Ban'))
|
||||||
|
|
||||||
|
|
||||||
class CreateDiscussionForm(FlaskForm):
|
class CreatePostForm(FlaskForm):
|
||||||
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
||||||
discussion_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
|
title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
|
||||||
discussion_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
|
body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
|
||||||
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])
|
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])
|
||||||
sticky = BooleanField(_l('Sticky'))
|
sticky = BooleanField(_l('Sticky'))
|
||||||
nsfw = BooleanField(_l('NSFW'))
|
nsfw = BooleanField(_l('NSFW'))
|
||||||
|
@ -105,19 +105,13 @@ class CreateDiscussionForm(FlaskForm):
|
||||||
submit = SubmitField(_l('Save'))
|
submit = SubmitField(_l('Save'))
|
||||||
|
|
||||||
|
|
||||||
class CreateLinkForm(FlaskForm):
|
class CreateDiscussionForm(CreatePostForm):
|
||||||
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
pass
|
||||||
link_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
|
|
||||||
link_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
|
|
||||||
|
class CreateLinkForm(CreatePostForm):
|
||||||
link_url = StringField(_l('URL'), validators=[DataRequired(), Regexp(r'^https?://', message='Submitted links need to start with "http://"" or "https://"')],
|
link_url = StringField(_l('URL'), validators=[DataRequired(), Regexp(r'^https?://', message='Submitted links need to start with "http://"" or "https://"')],
|
||||||
render_kw={'placeholder': 'https://...'})
|
render_kw={'placeholder': 'https://...'})
|
||||||
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])
|
|
||||||
sticky = BooleanField(_l('Sticky'))
|
|
||||||
nsfw = BooleanField(_l('NSFW'))
|
|
||||||
nsfl = BooleanField(_l('Gore/gross'))
|
|
||||||
notify_author = BooleanField(_l('Notify about replies'))
|
|
||||||
language_id = SelectField(_l('Language'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
submit = SubmitField(_l('Save'))
|
|
||||||
|
|
||||||
def validate(self, extra_validators=None) -> bool:
|
def validate(self, extra_validators=None) -> bool:
|
||||||
domain = domain_from_url(self.link_url.data, create=False)
|
domain = domain_from_url(self.link_url.data, create=False)
|
||||||
|
@ -127,19 +121,9 @@ class CreateLinkForm(FlaskForm):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class CreateVideoForm(FlaskForm):
|
class CreateVideoForm(CreatePostForm):
|
||||||
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
video_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
|
|
||||||
video_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
|
|
||||||
video_url = StringField(_l('URL'), validators=[DataRequired(), Regexp(r'^https?://', message='Submitted links need to start with "http://"" or "https://"')],
|
video_url = StringField(_l('URL'), validators=[DataRequired(), Regexp(r'^https?://', message='Submitted links need to start with "http://"" or "https://"')],
|
||||||
render_kw={'placeholder': 'https://...'})
|
render_kw={'placeholder': 'https://...'})
|
||||||
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])
|
|
||||||
sticky = BooleanField(_l('Sticky'))
|
|
||||||
nsfw = BooleanField(_l('NSFW'))
|
|
||||||
nsfl = BooleanField(_l('Gore/gross'))
|
|
||||||
notify_author = BooleanField(_l('Notify about replies'))
|
|
||||||
language_id = SelectField(_l('Language'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
submit = SubmitField(_l('Save'))
|
|
||||||
|
|
||||||
def validate(self, extra_validators=None) -> bool:
|
def validate(self, extra_validators=None) -> bool:
|
||||||
domain = domain_from_url(self.video_url.data, create=False)
|
domain = domain_from_url(self.video_url.data, create=False)
|
||||||
|
@ -149,19 +133,9 @@ class CreateVideoForm(FlaskForm):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class CreateImageForm(FlaskForm):
|
class CreateImageForm(CreatePostForm):
|
||||||
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
image_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
|
|
||||||
image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=1500)])
|
image_alt_text = StringField(_l('Alt text'), validators=[Optional(), Length(min=3, max=1500)])
|
||||||
image_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
|
|
||||||
image_file = FileField(_l('Image'), validators=[DataRequired()], render_kw={'accept': 'image/*'})
|
image_file = FileField(_l('Image'), validators=[DataRequired()], render_kw={'accept': 'image/*'})
|
||||||
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])
|
|
||||||
sticky = BooleanField(_l('Sticky'))
|
|
||||||
nsfw = BooleanField(_l('NSFW'))
|
|
||||||
nsfl = BooleanField(_l('Gore/gross'))
|
|
||||||
notify_author = BooleanField(_l('Notify about replies'))
|
|
||||||
language_id = SelectField(_l('Language'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
submit = SubmitField(_l('Save'))
|
|
||||||
|
|
||||||
def validate(self, extra_validators=None) -> bool:
|
def validate(self, extra_validators=None) -> bool:
|
||||||
uploaded_file = request.files['image_file']
|
uploaded_file = request.files['image_file']
|
||||||
|
@ -187,10 +161,7 @@ class CreateImageForm(FlaskForm):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class CreatePollForm(FlaskForm):
|
class CreatePollForm(CreatePostForm):
|
||||||
communities = SelectField(_l('Community'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
poll_title = StringField(_l('Title'), validators=[DataRequired(), Length(min=3, max=255)])
|
|
||||||
poll_body = TextAreaField(_l('Body'), validators=[Optional(), Length(min=3, max=5000)], render_kw={'rows': 5})
|
|
||||||
mode = SelectField(_('Mode'), validators=[DataRequired()], choices=[('single', _l('Voters choose one option')), ('multiple', _l('Voters choose many options'))], render_kw={'class': 'form-select'})
|
mode = SelectField(_('Mode'), validators=[DataRequired()], choices=[('single', _l('Voters choose one option')), ('multiple', _l('Voters choose many options'))], render_kw={'class': 'form-select'})
|
||||||
finish_choices=[
|
finish_choices=[
|
||||||
('30m', _l('30 minutes')),
|
('30m', _l('30 minutes')),
|
||||||
|
@ -213,13 +184,6 @@ class CreatePollForm(FlaskForm):
|
||||||
choice_8 = StringField('Choice')
|
choice_8 = StringField('Choice')
|
||||||
choice_9 = StringField('Choice')
|
choice_9 = StringField('Choice')
|
||||||
choice_10 = StringField('Choice')
|
choice_10 = StringField('Choice')
|
||||||
tags = StringField(_l('Tags'), validators=[Optional(), Length(min=3, max=5000)])
|
|
||||||
sticky = BooleanField(_l('Sticky'))
|
|
||||||
nsfw = BooleanField(_l('NSFW'))
|
|
||||||
nsfl = BooleanField(_l('Gore/gross'))
|
|
||||||
notify_author = BooleanField(_l('Notify about replies'))
|
|
||||||
language_id = SelectField(_l('Language'), validators=[DataRequired()], coerce=int, render_kw={'class': 'form-select'})
|
|
||||||
submit = SubmitField(_l('Save'))
|
|
||||||
|
|
||||||
def validate(self, extra_validators=None) -> bool:
|
def validate(self, extra_validators=None) -> bool:
|
||||||
choices_made = 0
|
choices_made = 0
|
||||||
|
|
|
@ -531,7 +531,7 @@ def add_discussion_post(actor):
|
||||||
if not can_create_post(current_user, community):
|
if not can_create_post(current_user, community):
|
||||||
abort(401)
|
abort(401)
|
||||||
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
||||||
save_post(form, post, 'discussion')
|
save_post(form, post, POST_TYPE_ARTICLE)
|
||||||
community.post_count += 1
|
community.post_count += 1
|
||||||
community.last_active = g.site.last_active = utcnow()
|
community.last_active = g.site.last_active = utcnow()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -597,7 +597,7 @@ def add_image_post(actor):
|
||||||
if not can_create_post(current_user, community):
|
if not can_create_post(current_user, community):
|
||||||
abort(401)
|
abort(401)
|
||||||
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
||||||
save_post(form, post, 'image')
|
save_post(form, post, POST_TYPE_IMAGE)
|
||||||
community.post_count += 1
|
community.post_count += 1
|
||||||
community.last_active = g.site.last_active = utcnow()
|
community.last_active = g.site.last_active = utcnow()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -677,7 +677,7 @@ def add_link_post(actor):
|
||||||
if not can_create_post(current_user, community):
|
if not can_create_post(current_user, community):
|
||||||
abort(401)
|
abort(401)
|
||||||
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
||||||
save_post(form, post, 'link')
|
save_post(form, post, POST_TYPE_LINK)
|
||||||
community.post_count += 1
|
community.post_count += 1
|
||||||
community.last_active = g.site.last_active = utcnow()
|
community.last_active = g.site.last_active = utcnow()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -757,7 +757,7 @@ def add_video_post(actor):
|
||||||
if not can_create_post(current_user, community):
|
if not can_create_post(current_user, community):
|
||||||
abort(401)
|
abort(401)
|
||||||
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
||||||
save_post(form, post, 'video')
|
save_post(form, post, POST_TYPE_VIDEO)
|
||||||
community.post_count += 1
|
community.post_count += 1
|
||||||
community.last_active = g.site.last_active = utcnow()
|
community.last_active = g.site.last_active = utcnow()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -837,7 +837,7 @@ def add_poll_post(actor):
|
||||||
if not can_create_post(current_user, community):
|
if not can_create_post(current_user, community):
|
||||||
abort(401)
|
abort(401)
|
||||||
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
post = Post(user_id=current_user.id, community_id=form.communities.data, instance_id=1)
|
||||||
save_post(form, post, 'poll')
|
save_post(form, post, POST_TYPE_POLL)
|
||||||
poll = Poll.query.filter_by(post_id=post.id).first()
|
poll = Poll.query.filter_by(post_id=post.id).first()
|
||||||
community.post_count += 1
|
community.post_count += 1
|
||||||
community.last_active = g.site.last_active = utcnow()
|
community.last_active = g.site.last_active = utcnow()
|
||||||
|
|
|
@ -242,7 +242,7 @@ def actor_to_community(actor) -> Community:
|
||||||
return community
|
return community
|
||||||
|
|
||||||
|
|
||||||
def save_post(form, post: Post, type: str):
|
def save_post(form, post: Post, type: int):
|
||||||
post.indexable = current_user.indexable
|
post.indexable = current_user.indexable
|
||||||
post.sticky = form.sticky.data
|
post.sticky = form.sticky.data
|
||||||
post.nsfw = form.nsfw.data
|
post.nsfw = form.nsfw.data
|
||||||
|
@ -250,15 +250,12 @@ def save_post(form, post: Post, type: str):
|
||||||
post.notify_author = form.notify_author.data
|
post.notify_author = form.notify_author.data
|
||||||
post.language_id = form.language_id.data
|
post.language_id = form.language_id.data
|
||||||
current_user.language_id = form.language_id.data
|
current_user.language_id = form.language_id.data
|
||||||
if type == '' or type == 'discussion':
|
post.title = form.title.data
|
||||||
post.title = form.discussion_title.data
|
post.body = form.body.data
|
||||||
post.body = form.discussion_body.data
|
post.body_html = markdown_to_html(post.body)
|
||||||
post.body_html = markdown_to_html(post.body)
|
if not type or type == POST_TYPE_ARTICLE:
|
||||||
post.type = POST_TYPE_ARTICLE
|
post.type = POST_TYPE_ARTICLE
|
||||||
elif type == 'link':
|
elif type == POST_TYPE_LINK:
|
||||||
post.title = form.link_title.data
|
|
||||||
post.body = form.link_body.data
|
|
||||||
post.body_html = markdown_to_html(post.body)
|
|
||||||
url_changed = post.id is None or form.link_url.data != post.url
|
url_changed = post.id is None or form.link_url.data != post.url
|
||||||
post.url = remove_tracking_from_link(form.link_url.data.strip())
|
post.url = remove_tracking_from_link(form.link_url.data.strip())
|
||||||
post.type = POST_TYPE_LINK
|
post.type = POST_TYPE_LINK
|
||||||
|
@ -297,12 +294,9 @@ def save_post(form, post: Post, type: str):
|
||||||
post.image = file
|
post.image = file
|
||||||
db.session.add(file)
|
db.session.add(file)
|
||||||
|
|
||||||
elif type == 'image':
|
elif type == POST_TYPE_IMAGE:
|
||||||
post.title = form.image_title.data
|
|
||||||
post.body = form.image_body.data
|
|
||||||
post.body_html = markdown_to_html(post.body)
|
|
||||||
post.type = POST_TYPE_IMAGE
|
post.type = POST_TYPE_IMAGE
|
||||||
alt_text = form.image_alt_text.data if form.image_alt_text.data else form.image_title.data
|
alt_text = form.image_alt_text.data if form.image_alt_text.data else form.title.data
|
||||||
uploaded_file = request.files['image_file']
|
uploaded_file = request.files['image_file']
|
||||||
if uploaded_file and uploaded_file.filename != '':
|
if uploaded_file and uploaded_file.filename != '':
|
||||||
if post.image_id:
|
if post.image_id:
|
||||||
|
@ -357,11 +351,8 @@ def save_post(form, post: Post, type: str):
|
||||||
db.session.add(file)
|
db.session.add(file)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
post.image_id = file.id
|
post.image_id = file.id
|
||||||
elif type == 'video':
|
elif type == POST_TYPE_VIDEO:
|
||||||
form.video_url.data = form.video_url.data.strip()
|
form.video_url.data = form.video_url.data.strip()
|
||||||
post.title = form.video_title.data
|
|
||||||
post.body = form.video_body.data
|
|
||||||
post.body_html = markdown_to_html(post.body)
|
|
||||||
url_changed = post.id is None or form.video_url.data != post.url
|
url_changed = post.id is None or form.video_url.data != post.url
|
||||||
post.url = remove_tracking_from_link(form.video_url.data.strip())
|
post.url = remove_tracking_from_link(form.video_url.data.strip())
|
||||||
post.type = POST_TYPE_VIDEO
|
post.type = POST_TYPE_VIDEO
|
||||||
|
@ -389,9 +380,8 @@ def save_post(form, post: Post, type: str):
|
||||||
post.image = file
|
post.image = file
|
||||||
db.session.add(file)
|
db.session.add(file)
|
||||||
|
|
||||||
elif type == 'poll':
|
elif type == POST_TYPE_POLL:
|
||||||
post.title = form.poll_title.data
|
post.body = form.title.data + '\n' + form.body.data if post.title not in form.body.data else form.body.data
|
||||||
post.body = form.poll_title.data + '\n' + form.poll_body.data if post.title not in form.poll_body.data else form.poll_body.data
|
|
||||||
post.body_html = markdown_to_html(post.body)
|
post.body_html = markdown_to_html(post.body)
|
||||||
post.type = POST_TYPE_POLL
|
post.type = POST_TYPE_POLL
|
||||||
else:
|
else:
|
||||||
|
@ -424,7 +414,7 @@ def save_post(form, post: Post, type: str):
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
# Save poll choices. NB this will delete all votes whenever a poll is edited. Partially because it's easier to code but also to stop malicious alterations to polls after people have already voted
|
# Save poll choices. NB this will delete all votes whenever a poll is edited. Partially because it's easier to code but also to stop malicious alterations to polls after people have already voted
|
||||||
if type == 'poll':
|
if type == POST_TYPE_POLL:
|
||||||
db.session.execute(text('DELETE FROM "poll_choice_vote" WHERE post_id = :post_id'), {'post_id': post.id})
|
db.session.execute(text('DELETE FROM "poll_choice_vote" WHERE post_id = :post_id'), {'post_id': post.id})
|
||||||
db.session.execute(text('DELETE FROM "poll_choice" WHERE post_id = :post_id'), {'post_id': post.id})
|
db.session.execute(text('DELETE FROM "poll_choice" WHERE post_id = :post_id'), {'post_id': post.id})
|
||||||
for i in range(1, 10):
|
for i in range(1, 10):
|
||||||
|
|
|
@ -891,91 +891,25 @@ def post_reply_options(post_id: int, comment_id: int):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/edit', methods=['GET'])
|
@bp.route('/post/<int:post_id>/edit', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def post_edit(post_id: int):
|
def post_edit(post_id: int):
|
||||||
post = Post.query.get_or_404(post_id)
|
post = Post.query.get_or_404(post_id)
|
||||||
if post.type == POST_TYPE_ARTICLE:
|
if post.type == POST_TYPE_ARTICLE:
|
||||||
return redirect(url_for('post.post_edit_discussion_post', post_id=post_id))
|
form = CreateDiscussionForm()
|
||||||
elif post.type == POST_TYPE_LINK:
|
elif post.type == POST_TYPE_LINK:
|
||||||
return redirect(url_for('post.post_edit_link_post', post_id=post_id))
|
form = CreateLinkForm()
|
||||||
elif post.type == POST_TYPE_IMAGE:
|
elif post.type == POST_TYPE_IMAGE:
|
||||||
return redirect(url_for('post.post_edit_image_post', post_id=post_id))
|
form = CreateImageForm()
|
||||||
elif post.type == POST_TYPE_VIDEO:
|
elif post.type == POST_TYPE_VIDEO:
|
||||||
return redirect(url_for('post.post_edit_video_post', post_id=post_id))
|
form = CreateVideoForm()
|
||||||
elif post.type == POST_TYPE_POLL:
|
elif post.type == POST_TYPE_POLL:
|
||||||
return redirect(url_for('post.post_edit_poll_post', post_id=post_id))
|
form = CreatePollForm()
|
||||||
|
poll = Poll.query.filter_by(post_id=post_id).first()
|
||||||
|
del form.finish_in
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/edit_discussion', methods=['GET', 'POST'])
|
|
||||||
@login_required
|
|
||||||
def post_edit_discussion_post(post_id: int):
|
|
||||||
post = Post.query.get_or_404(post_id)
|
|
||||||
form = CreateDiscussionForm()
|
|
||||||
del form.communities
|
|
||||||
|
|
||||||
mods = post.community.moderators()
|
|
||||||
if post.community.private_mods:
|
|
||||||
mod_list = []
|
|
||||||
else:
|
|
||||||
mod_user_ids = [mod.user_id for mod in mods]
|
|
||||||
mod_list = User.query.filter(User.id.in_(mod_user_ids)).all()
|
|
||||||
|
|
||||||
if post.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin():
|
|
||||||
if g.site.enable_nsfl is False:
|
|
||||||
form.nsfl.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfw:
|
|
||||||
form.nsfw.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfl:
|
|
||||||
form.nsfl.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
|
|
||||||
form.language_id.choices = languages_for_form()
|
|
||||||
|
|
||||||
if form.validate_on_submit():
|
|
||||||
save_post(form, post, 'discussion')
|
|
||||||
post.community.last_active = utcnow()
|
|
||||||
post.edited_at = utcnow()
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
flash(_('Your changes have been saved.'), 'success')
|
|
||||||
|
|
||||||
# federate edit
|
|
||||||
if not post.community.local_only:
|
|
||||||
federate_post_update(post)
|
|
||||||
federate_post_edit_to_user_followers(post)
|
|
||||||
|
|
||||||
return redirect(url_for('activitypub.post_ap', post_id=post.id))
|
|
||||||
else:
|
|
||||||
form.discussion_title.data = post.title
|
|
||||||
form.discussion_body.data = post.body
|
|
||||||
form.notify_author.data = post.notify_author
|
|
||||||
form.nsfw.data = post.nsfw
|
|
||||||
form.nsfl.data = post.nsfl
|
|
||||||
form.sticky.data = post.sticky
|
|
||||||
form.language_id.data = post.language_id
|
|
||||||
form.tags.data = tags_to_string(post)
|
|
||||||
if not (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()):
|
|
||||||
form.sticky.render_kw = {'disabled': True}
|
|
||||||
return render_template('post/post_edit_discussion.html', title=_('Edit post'), form=form, post=post,
|
|
||||||
markdown_editor=current_user.markdown_editor, mods=mod_list,
|
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
|
||||||
menu_topics=menu_topics(), site=g.site,
|
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
abort(401)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/edit_image', methods=['GET', 'POST'])
|
|
||||||
@login_required
|
|
||||||
def post_edit_image_post(post_id: int):
|
|
||||||
post = Post.query.get_or_404(post_id)
|
|
||||||
form = CreateImageForm()
|
|
||||||
del form.communities
|
del form.communities
|
||||||
|
|
||||||
mods = post.community.moderators()
|
mods = post.community.moderators()
|
||||||
|
@ -1000,10 +934,9 @@ def post_edit_image_post(post_id: int):
|
||||||
form.language_id.choices = languages_for_form()
|
form.language_id.choices = languages_for_form()
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
save_post(form, post, 'image')
|
save_post(form, post, post.type)
|
||||||
post.community.last_active = utcnow()
|
post.community.last_active = utcnow()
|
||||||
post.edited_at = utcnow()
|
post.edited_at = utcnow()
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
if post.url != old_url:
|
if post.url != old_url:
|
||||||
if post.cross_posts is not None:
|
if post.cross_posts is not None:
|
||||||
|
@ -1025,275 +958,44 @@ def post_edit_image_post(post_id: int):
|
||||||
else:
|
else:
|
||||||
post.cross_posts.append(ncp.id)
|
post.cross_posts.append(ncp.id)
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
flash(_('Your changes have been saved.'), 'success')
|
flash(_('Your changes have been saved.'), 'success')
|
||||||
# federate edit
|
|
||||||
|
|
||||||
|
# federate edit
|
||||||
if not post.community.local_only:
|
if not post.community.local_only:
|
||||||
federate_post_update(post)
|
federate_post_update(post)
|
||||||
federate_post_edit_to_user_followers(post)
|
federate_post_edit_to_user_followers(post)
|
||||||
|
|
||||||
return redirect(url_for('activitypub.post_ap', post_id=post.id))
|
return redirect(url_for('activitypub.post_ap', post_id=post.id))
|
||||||
else:
|
else:
|
||||||
form.image_title.data = post.title
|
form.title.data = post.title
|
||||||
form.image_body.data = post.body
|
form.body.data = post.body
|
||||||
form.image_alt_text.data = post.image.alt_text
|
|
||||||
form.notify_author.data = post.notify_author
|
form.notify_author.data = post.notify_author
|
||||||
form.nsfw.data = post.nsfw
|
form.nsfw.data = post.nsfw
|
||||||
form.nsfl.data = post.nsfl
|
form.nsfl.data = post.nsfl
|
||||||
form.sticky.data = post.sticky
|
form.sticky.data = post.sticky
|
||||||
form.language_id.data = post.language_id
|
form.language_id.data = post.language_id
|
||||||
form.tags.data = tags_to_string(post)
|
form.tags.data = tags_to_string(post)
|
||||||
|
if post.type == POST_TYPE_LINK:
|
||||||
|
form.link_url.data = post.url
|
||||||
|
elif post.type == POST_TYPE_IMAGE:
|
||||||
|
form.image_alt_text.data = post.image.alt_text
|
||||||
|
elif post.type == POST_TYPE_VIDEO:
|
||||||
|
form.video_url.data = post.url
|
||||||
|
elif post.type == POST_TYPE_POLL:
|
||||||
|
poll = Poll.query.filter_by(post_id=post.id).first()
|
||||||
|
form.mode.data = poll.mode
|
||||||
|
form.local_only.data = poll.local_only
|
||||||
|
i = 1
|
||||||
|
for choice in PollChoice.query.filter_by(post_id=post.id).order_by(PollChoice.sort_order).all():
|
||||||
|
form_field = getattr(form, f"choice_{i}")
|
||||||
|
form_field.data = choice.choice_text
|
||||||
|
i += 1
|
||||||
|
|
||||||
if not (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()):
|
if not (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()):
|
||||||
form.sticky.render_kw = {'disabled': True}
|
form.sticky.render_kw = {'disabled': True}
|
||||||
return render_template('post/post_edit_image.html', title=_('Edit post'), form=form, post=post,
|
return render_template('post/post_edit.html', title=_('Edit post'), form=form, post=post,
|
||||||
markdown_editor=current_user.markdown_editor, mods=mod_list,
|
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
|
||||||
menu_topics=menu_topics(), site=g.site,
|
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
abort(401)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/edit_link', methods=['GET', 'POST'])
|
|
||||||
@login_required
|
|
||||||
def post_edit_link_post(post_id: int):
|
|
||||||
post = Post.query.get_or_404(post_id)
|
|
||||||
form = CreateLinkForm()
|
|
||||||
del form.communities
|
|
||||||
|
|
||||||
mods = post.community.moderators()
|
|
||||||
if post.community.private_mods:
|
|
||||||
mod_list = []
|
|
||||||
else:
|
|
||||||
mod_user_ids = [mod.user_id for mod in mods]
|
|
||||||
mod_list = User.query.filter(User.id.in_(mod_user_ids)).all()
|
|
||||||
|
|
||||||
if post.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin():
|
|
||||||
if g.site.enable_nsfl is False:
|
|
||||||
form.nsfl.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfw:
|
|
||||||
form.nsfw.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfl:
|
|
||||||
form.nsfl.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
|
|
||||||
old_url = post.url
|
|
||||||
|
|
||||||
form.language_id.choices = languages_for_form()
|
|
||||||
|
|
||||||
if form.validate_on_submit():
|
|
||||||
save_post(form, post, 'link')
|
|
||||||
post.community.last_active = utcnow()
|
|
||||||
post.edited_at = utcnow()
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
if post.url != old_url:
|
|
||||||
if post.cross_posts is not None:
|
|
||||||
old_cross_posts = Post.query.filter(Post.id.in_(post.cross_posts)).all()
|
|
||||||
post.cross_posts.clear()
|
|
||||||
for ocp in old_cross_posts:
|
|
||||||
if ocp.cross_posts is not None:
|
|
||||||
ocp.cross_posts.remove(post.id)
|
|
||||||
|
|
||||||
new_cross_posts = Post.query.filter(Post.id != post.id, Post.url == post.url,
|
|
||||||
Post.posted_at > post.edited_at - timedelta(days=6)).all()
|
|
||||||
for ncp in new_cross_posts:
|
|
||||||
if ncp.cross_posts is None:
|
|
||||||
ncp.cross_posts = [post.id]
|
|
||||||
else:
|
|
||||||
ncp.cross_posts.append(post.id)
|
|
||||||
if post.cross_posts is None:
|
|
||||||
post.cross_posts = [ncp.id]
|
|
||||||
else:
|
|
||||||
post.cross_posts.append(ncp.id)
|
|
||||||
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
flash(_('Your changes have been saved.'), 'success')
|
|
||||||
# federate edit
|
|
||||||
|
|
||||||
if not post.community.local_only:
|
|
||||||
federate_post_update(post)
|
|
||||||
federate_post_edit_to_user_followers(post)
|
|
||||||
|
|
||||||
return redirect(url_for('activitypub.post_ap', post_id=post.id))
|
|
||||||
else:
|
|
||||||
form.link_title.data = post.title
|
|
||||||
form.link_body.data = post.body
|
|
||||||
form.link_url.data = post.url
|
|
||||||
form.notify_author.data = post.notify_author
|
|
||||||
form.nsfw.data = post.nsfw
|
|
||||||
form.nsfl.data = post.nsfl
|
|
||||||
form.sticky.data = post.sticky
|
|
||||||
form.language_id.data = post.language_id
|
|
||||||
form.tags.data = tags_to_string(post)
|
|
||||||
if not (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()):
|
|
||||||
form.sticky.render_kw = {'disabled': True}
|
|
||||||
return render_template('post/post_edit_link.html', title=_('Edit post'), form=form, post=post,
|
|
||||||
markdown_editor=current_user.markdown_editor, mods=mod_list,
|
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
|
||||||
menu_topics=menu_topics(), site=g.site,
|
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
abort(401)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/edit_video', methods=['GET', 'POST'])
|
|
||||||
@login_required
|
|
||||||
def post_edit_video_post(post_id: int):
|
|
||||||
post = Post.query.get_or_404(post_id)
|
|
||||||
form = CreateVideoForm()
|
|
||||||
del form.communities
|
|
||||||
|
|
||||||
mods = post.community.moderators()
|
|
||||||
if post.community.private_mods:
|
|
||||||
mod_list = []
|
|
||||||
else:
|
|
||||||
mod_user_ids = [mod.user_id for mod in mods]
|
|
||||||
mod_list = User.query.filter(User.id.in_(mod_user_ids)).all()
|
|
||||||
|
|
||||||
if post.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin():
|
|
||||||
if g.site.enable_nsfl is False:
|
|
||||||
form.nsfl.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfw:
|
|
||||||
form.nsfw.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfl:
|
|
||||||
form.nsfl.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
|
|
||||||
old_url = post.url
|
|
||||||
|
|
||||||
form.language_id.choices = languages_for_form()
|
|
||||||
|
|
||||||
if form.validate_on_submit():
|
|
||||||
save_post(form, post, 'video')
|
|
||||||
post.community.last_active = utcnow()
|
|
||||||
post.edited_at = utcnow()
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
if post.url != old_url:
|
|
||||||
if post.cross_posts is not None:
|
|
||||||
old_cross_posts = Post.query.filter(Post.id.in_(post.cross_posts)).all()
|
|
||||||
post.cross_posts.clear()
|
|
||||||
for ocp in old_cross_posts:
|
|
||||||
if ocp.cross_posts is not None:
|
|
||||||
ocp.cross_posts.remove(post.id)
|
|
||||||
|
|
||||||
new_cross_posts = Post.query.filter(Post.id != post.id, Post.url == post.url,
|
|
||||||
Post.posted_at > post.edited_at - timedelta(days=6)).all()
|
|
||||||
for ncp in new_cross_posts:
|
|
||||||
if ncp.cross_posts is None:
|
|
||||||
ncp.cross_posts = [post.id]
|
|
||||||
else:
|
|
||||||
ncp.cross_posts.append(post.id)
|
|
||||||
if post.cross_posts is None:
|
|
||||||
post.cross_posts = [ncp.id]
|
|
||||||
else:
|
|
||||||
post.cross_posts.append(ncp.id)
|
|
||||||
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
flash(_('Your changes have been saved.'), 'success')
|
|
||||||
# federate edit
|
|
||||||
|
|
||||||
if not post.community.local_only:
|
|
||||||
federate_post_update(post)
|
|
||||||
federate_post_edit_to_user_followers(post)
|
|
||||||
|
|
||||||
return redirect(url_for('activitypub.post_ap', post_id=post.id))
|
|
||||||
else:
|
|
||||||
form.video_title.data = post.title
|
|
||||||
form.video_body.data = post.body
|
|
||||||
form.video_url.data = post.url
|
|
||||||
form.notify_author.data = post.notify_author
|
|
||||||
form.nsfw.data = post.nsfw
|
|
||||||
form.nsfl.data = post.nsfl
|
|
||||||
form.sticky.data = post.sticky
|
|
||||||
form.language_id.data = post.language_id
|
|
||||||
form.tags.data = tags_to_string(post)
|
|
||||||
if not (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()):
|
|
||||||
form.sticky.render_kw = {'disabled': True}
|
|
||||||
return render_template('post/post_edit_video.html', title=_('Edit post'), form=form, post=post,
|
|
||||||
markdown_editor=current_user.markdown_editor, mods=mod_list,
|
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
|
||||||
menu_topics=menu_topics(), site=g.site,
|
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
abort(401)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/edit_poll', methods=['GET', 'POST'])
|
|
||||||
@login_required
|
|
||||||
def post_edit_poll_post(post_id: int):
|
|
||||||
post = Post.query.get_or_404(post_id)
|
|
||||||
poll = Poll.query.filter_by(post_id=post_id).first()
|
|
||||||
form = CreatePollForm()
|
|
||||||
del form.communities
|
|
||||||
del form.finish_in
|
|
||||||
|
|
||||||
mods = post.community.moderators()
|
|
||||||
if post.community.private_mods:
|
|
||||||
mod_list = []
|
|
||||||
else:
|
|
||||||
mod_user_ids = [mod.user_id for mod in mods]
|
|
||||||
mod_list = User.query.filter(User.id.in_(mod_user_ids)).all()
|
|
||||||
|
|
||||||
if post.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin():
|
|
||||||
if g.site.enable_nsfl is False:
|
|
||||||
form.nsfl.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfw:
|
|
||||||
form.nsfw.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
if post.community.nsfl:
|
|
||||||
form.nsfl.data = True
|
|
||||||
form.nsfw.render_kw = {'disabled': True}
|
|
||||||
|
|
||||||
form.language_id.choices = languages_for_form()
|
|
||||||
|
|
||||||
if form.validate_on_submit():
|
|
||||||
save_post(form, post, 'poll')
|
|
||||||
post.community.last_active = utcnow()
|
|
||||||
post.edited_at = utcnow()
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
flash(_('Your changes have been saved.'), 'success')
|
|
||||||
|
|
||||||
# federate edit
|
|
||||||
if not post.community.local_only and not poll.local_only:
|
|
||||||
federate_post_update(post)
|
|
||||||
federate_post_edit_to_user_followers(post)
|
|
||||||
|
|
||||||
return redirect(url_for('activitypub.post_ap', post_id=post.id))
|
|
||||||
else:
|
|
||||||
form.poll_title.data = post.title
|
|
||||||
form.poll_body.data = post.body
|
|
||||||
form.notify_author.data = post.notify_author
|
|
||||||
form.nsfw.data = post.nsfw
|
|
||||||
form.nsfl.data = post.nsfl
|
|
||||||
form.sticky.data = post.sticky
|
|
||||||
form.language_id.data = post.language_id
|
|
||||||
poll = Poll.query.filter_by(post_id=post.id).first()
|
|
||||||
form.mode.data = poll.mode
|
|
||||||
form.local_only.data = poll.local_only
|
|
||||||
i = 1
|
|
||||||
for choice in PollChoice.query.filter_by(post_id=post.id).order_by(PollChoice.sort_order).all():
|
|
||||||
form_field = getattr(form, f"choice_{i}")
|
|
||||||
form_field.data = choice.choice_text
|
|
||||||
i += 1
|
|
||||||
form.tags.data = tags_to_string(post)
|
|
||||||
if not (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()):
|
|
||||||
form.sticky.render_kw = {'disabled': True}
|
|
||||||
return render_template('post/post_edit_poll.html', title=_('Edit post'), form=form, post=post,
|
|
||||||
markdown_editor=current_user.markdown_editor, mods=mod_list,
|
markdown_editor=current_user.markdown_editor, mods=mod_list,
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
{% for community in communities.items %}
|
{% for community in communities.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/c/{{ community.link() }}">{{ community.name }}</a></td>
|
<td><a href="/c/{{ community.link() }}">{{ community.name }}</a></td>
|
||||||
<td><a href="/c/{{ community.link() }}">
|
<td>{{ render_communityname(community) }}{% if community.banned %} (banned){% endif %}</td>
|
||||||
<img src="{{ community.icon_image('tiny') }}" class="community_icon rounded-circle" loading="lazy" />
|
|
||||||
{{ community.display_name() }}{% if community.banned %} (banned){% endif %}</a></td>
|
|
||||||
<td>{{ community.topic.name }}</td>
|
<td>{{ community.topic.name }}</td>
|
||||||
<td>{{ community.post_count }}</td>
|
<td>{{ community.post_count }}</td>
|
||||||
<th>{{ '✓'|safe if community.show_home else '✗'|safe }}</th>
|
<th>{{ '✓'|safe if community.show_home else '✗'|safe }}</th>
|
||||||
|
@ -67,4 +65,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,26 +3,39 @@
|
||||||
{% if user.deleted -%}
|
{% if user.deleted -%}
|
||||||
[deleted]
|
[deleted]
|
||||||
{% else -%}
|
{% else -%}
|
||||||
{% if user.avatar_id and not low_bandwidth -%}
|
<a href="/u/{{ user.link() }}" title="{{ user.ap_id if user.ap_id != none else user.user_name }}" aria-label="{{ _('Author') }}">
|
||||||
<a href="/u/{{ user.link() }}" title="{{ user.ap_id if user.ap_id != none else user.user_name }}">
|
{% if user.avatar_id and not low_bandwidth and not collapsed -%}
|
||||||
<img src="{{ user.avatar_thumbnail() }}" alt="" loading="lazy" /></a>
|
<img src="{{ user.avatar_thumbnail() }}" alt="" loading="lazy" />
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
<a href="/u/{{ user.link() }}" title="{{ user.ap_id if user.ap_id != none else user.user_name }}">{{ user.display_name() }}</a>
|
{{ user.display_name() }}
|
||||||
|
</a>
|
||||||
{% if user.created_recently() -%}
|
{% if user.created_recently() -%}
|
||||||
<span class="fe fe-new-account" title="New account"> </span>
|
<span class="fe fe-new-account" title="New account"> </span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if user.bot -%}
|
{% if user.bot -%}
|
||||||
<span class="fe fe-bot-account" title="Bot account"> </span>
|
<span class="fe fe-bot-account" title="Bot account"> </span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if user.reputation < -10 -%}
|
{% if user.id != current_user.id -%}
|
||||||
<span class="fe fe-warning red" title="Very low reputation. Beware."> </span>
|
{% if user.reputation < -10 -%}
|
||||||
<span class="fe fe-warning red" title="Very low reputation. Beware!"> </span>
|
<span class="fe fe-warning red" title="Very low reputation. Beware."> </span>
|
||||||
{% elif user.reputation < 0 -%}
|
<span class="fe fe-warning red" title="Very low reputation. Beware!"> </span>
|
||||||
<span class="fe fe-warning orangered" title="Low reputation."> </span>
|
{% elif user.reputation < 0 -%}
|
||||||
|
<span class="fe fe-warning orangered" title="Low reputation."> </span>
|
||||||
|
{% endif -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</span>
|
</span>
|
||||||
{% endmacro -%}
|
{% endmacro -%}
|
||||||
|
{% macro render_communityname(community) -%}
|
||||||
|
<span class="render_community">
|
||||||
|
<a href="/c/{{ community.link() }}" aria-label="{{ _('Go to community %(name)s', name=community.name) }}">
|
||||||
|
{% if community.icon_id and not low_bandwidth and not collapsed -%}
|
||||||
|
<img src="{{ community.icon_image() }}" class="community_icon rounded-circle" alt="" loading="lazy" />
|
||||||
|
{% endif -%}
|
||||||
|
c/{{ community.display_name() }}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
{% endmacro -%}
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -19,22 +19,22 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ render_field(form.communities) }}
|
{{ render_field(form.communities) }}
|
||||||
{{ render_field(form.discussion_title) }}
|
{{ render_field(form.title) }}
|
||||||
{{ render_field(form.discussion_body) }}
|
{{ render_field(form.body) }}
|
||||||
{% if not low_bandwidth %}
|
{% if not low_bandwidth %}
|
||||||
{% if markdown_editor %}
|
{% if markdown_editor %}
|
||||||
<script nonce="{{ session['nonce'] }}">
|
<script nonce="{{ session['nonce'] }}">
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
var downarea = new DownArea({
|
var downarea = new DownArea({
|
||||||
elem: document.querySelector('#discussion_body'),
|
elem: document.querySelector('#body'),
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
resize: DownArea.RESIZE_VERTICAL,
|
||||||
hide: ['heading', 'bold-italic'],
|
hide: ['heading', 'bold-italic'],
|
||||||
});
|
});
|
||||||
setupAutoResize('discussion_body');
|
setupAutoResize('body');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="discussion_body">{{ _('Enable markdown editor') }}</a>
|
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ render_field(form.tags) }}
|
{{ render_field(form.tags) }}
|
||||||
|
@ -88,4 +88,4 @@
|
||||||
{% include "_inoculation_links.html" %}
|
{% include "_inoculation_links.html" %}
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -18,25 +18,25 @@
|
||||||
{% include 'community/_add_post_types.html' %}
|
{% include 'community/_add_post_types.html' %}
|
||||||
</div>
|
</div>
|
||||||
{{ render_field(form.communities) }}
|
{{ render_field(form.communities) }}
|
||||||
{{ render_field(form.image_title) }}
|
{{ render_field(form.title) }}
|
||||||
{{ render_field(form.image_file) }}
|
{{ render_field(form.image_file) }}
|
||||||
{{ render_field(form.image_alt_text) }}
|
{{ render_field(form.image_alt_text) }}
|
||||||
<small class="field_hint">{{ _('Describe the image, to help visually impaired people.') }}</small>
|
<small class="field_hint">{{ _('Describe the image, to help visually impaired people.') }}</small>
|
||||||
{{ render_field(form.image_body) }}
|
{{ render_field(form.body) }}
|
||||||
{% if not low_bandwidth %}
|
{% if not low_bandwidth %}
|
||||||
{% if markdown_editor %}
|
{% if markdown_editor %}
|
||||||
<script nonce="{{ session['nonce'] }}">
|
<script nonce="{{ session['nonce'] }}">
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
var downarea = new DownArea({
|
var downarea = new DownArea({
|
||||||
elem: document.querySelector('#image_body'),
|
elem: document.querySelector('#body'),
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
resize: DownArea.RESIZE_VERTICAL,
|
||||||
hide: ['heading', 'bold-italic'],
|
hide: ['heading', 'bold-italic'],
|
||||||
});
|
});
|
||||||
setupAutoResize('image_body');
|
setupAutoResize('body');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="image_body">{{ _('Enable markdown editor') }}</a>
|
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ render_field(form.tags) }}
|
{{ render_field(form.tags) }}
|
||||||
|
@ -90,4 +90,4 @@
|
||||||
{% include "_inoculation_links.html" %}
|
{% include "_inoculation_links.html" %}
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -19,23 +19,23 @@
|
||||||
</div>
|
</div>
|
||||||
{{ render_field(form.communities) }}
|
{{ render_field(form.communities) }}
|
||||||
|
|
||||||
{{ render_field(form.link_title) }}
|
{{ render_field(form.title) }}
|
||||||
{{ render_field(form.link_url) }}
|
{{ render_field(form.link_url) }}
|
||||||
{{ render_field(form.link_body) }}
|
{{ render_field(form.body) }}
|
||||||
{% if not low_bandwidth %}
|
{% if not low_bandwidth %}
|
||||||
{% if markdown_editor %}
|
{% if markdown_editor %}
|
||||||
<script nonce="{{ session['nonce'] }}">
|
<script nonce="{{ session['nonce'] }}">
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
var downarea = new DownArea({
|
var downarea = new DownArea({
|
||||||
elem: document.querySelector('#link_body'),
|
elem: document.querySelector('#body'),
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
resize: DownArea.RESIZE_VERTICAL,
|
||||||
hide: ['heading', 'bold-italic'],
|
hide: ['heading', 'bold-italic'],
|
||||||
});
|
});
|
||||||
setupAutoResize('link_body');
|
setupAutoResize('body');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="link_body">{{ _('Enable markdown editor') }}</a>
|
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ render_field(form.tags) }}
|
{{ render_field(form.tags) }}
|
||||||
|
@ -89,4 +89,4 @@
|
||||||
{% include "_inoculation_links.html" %}
|
{% include "_inoculation_links.html" %}
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -19,22 +19,22 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ render_field(form.communities) }}
|
{{ render_field(form.communities) }}
|
||||||
{{ render_field(form.poll_title) }}
|
{{ render_field(form.title) }}
|
||||||
{{ render_field(form.poll_body) }}
|
{{ render_field(form.body) }}
|
||||||
{% if not low_bandwidth %}
|
{% if not low_bandwidth %}
|
||||||
{% if markdown_editor %}
|
{% if markdown_editor %}
|
||||||
<script nonce="{{ session['nonce'] }}">
|
<script nonce="{{ session['nonce'] }}">
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
var downarea = new DownArea({
|
var downarea = new DownArea({
|
||||||
elem: document.querySelector('#poll_body'),
|
elem: document.querySelector('#body'),
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
resize: DownArea.RESIZE_VERTICAL,
|
||||||
hide: ['heading', 'bold-italic'],
|
hide: ['heading', 'bold-italic'],
|
||||||
});
|
});
|
||||||
setupAutoResize('discussion_body');
|
setupAutoResize('body');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="discussion_body">{{ _('Enable markdown editor') }}</a>
|
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<fieldset id="pollChoicesFieldset">
|
<fieldset id="pollChoicesFieldset">
|
||||||
|
@ -125,4 +125,4 @@
|
||||||
{% include "_inoculation_links.html" %}
|
{% include "_inoculation_links.html" %}
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
<div class="card-title">{{ _('Found a community:') }}</div>
|
<div class="card-title">{{ _('Found a community:') }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>
|
<p>
|
||||||
<a href="/c/{{ new_community.link() }}"><img src="{{ new_community.icon_image()}}" class="community_icon rounded-circle" style="width: 30px; vertical-align: middle;" /></a>
|
{{ render_communityname(new_community) }}
|
||||||
<a href="/c/{{ new_community.link() }}">{{ new_community.title }}@{{ new_community.ap_domain }}</a>
|
|
||||||
</p>
|
</p>
|
||||||
<p> {% if subscribed %}
|
<p> {% if subscribed %}
|
||||||
<a class="btn btn-primary mt-4" href="/community/{{ new_community.link() }}/unsubscribe">{{ _('Leave') }}</a>
|
<a class="btn btn-primary mt-4" href="/community/{{ new_community.link() }}/unsubscribe">{{ _('Leave') }}</a>
|
||||||
|
|
|
@ -19,24 +19,24 @@
|
||||||
</div>
|
</div>
|
||||||
{{ render_field(form.communities) }}
|
{{ render_field(form.communities) }}
|
||||||
|
|
||||||
{{ render_field(form.video_title) }}
|
{{ render_field(form.title) }}
|
||||||
{{ render_field(form.video_url) }}
|
{{ render_field(form.video_url) }}
|
||||||
<p class="small field_hint">{{ _('Provide a URL ending with .mp4 or .webm.') }}</p>
|
<p class="small field_hint">{{ _('Provide a URL ending with .mp4 or .webm.') }}</p>
|
||||||
{{ render_field(form.video_body) }}
|
{{ render_field(form.body) }}
|
||||||
{% if not low_bandwidth %}
|
{% if not low_bandwidth %}
|
||||||
{% if markdown_editor %}
|
{% if markdown_editor %}
|
||||||
<script nonce="{{ session['nonce'] }}">
|
<script nonce="{{ session['nonce'] }}">
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", function () {
|
||||||
var downarea = new DownArea({
|
var downarea = new DownArea({
|
||||||
elem: document.querySelector('#video_body'),
|
elem: document.querySelector('#body'),
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
resize: DownArea.RESIZE_VERTICAL,
|
||||||
hide: ['heading', 'bold-italic'],
|
hide: ['heading', 'bold-italic'],
|
||||||
});
|
});
|
||||||
setupAutoResize('video_body');
|
setupAutoResize('body');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="link_body">{{ _('Enable markdown editor') }}</a>
|
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ render_field(form.tags) }}
|
{{ render_field(form.tags) }}
|
||||||
|
@ -90,4 +90,4 @@
|
||||||
{% include "_inoculation_links.html" %}
|
{% include "_inoculation_links.html" %}
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -170,9 +170,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in related_communities -%}
|
{% for community in related_communities -%}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}" aria-label="{{ _('Go to community') }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" alt="" />
|
{{ render_communityname(community) }}
|
||||||
{{ community.display_name() }}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
<div class="card-title">{{ _('Found a community:') }}</div>
|
<div class="card-title">{{ _('Found a community:') }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>
|
<p>
|
||||||
<a href="/c/{{ new_community.link() }}"><img src="{{ new_community.icon_image()}}" class="community_icon rounded-circle" style="width: 30px; vertical-align: middle;" /></a>
|
{{ render_communityname(new_community) }}
|
||||||
<a href="/c/{{ new_community.link() }}">{{ new_community.title }}@{{ new_community.ap_domain }}</a>
|
|
||||||
</p>
|
</p>
|
||||||
<p> {% if subscribed %}
|
<p> {% if subscribed %}
|
||||||
<a class="btn btn-primary mt-4" href="/community/{{ new_community.link() }}/unsubscribe">{{ _('Leave') }}</a>
|
<a class="btn btn-primary mt-4" href="/community/{{ new_community.link() }}/unsubscribe">{{ _('Leave') }}</a>
|
||||||
|
|
|
@ -53,9 +53,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in active_communities %}
|
{% for community in active_communities %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" alt="" />
|
{{ render_communityname(community) }}
|
||||||
{{ community.display_name() }}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -16,30 +16,9 @@
|
||||||
<div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].author.id == post.author.id %}original_poster{% endif %}" role="treeitem">
|
<div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].author.id == post.author.id %}original_poster{% endif %}" role="treeitem">
|
||||||
<div class="limit_height">
|
<div class="limit_height">
|
||||||
<div class="comment_author">
|
<div class="comment_author">
|
||||||
{% if comment['comment'].author.deleted %}
|
{% with collapsed = comment['comment'].score < -10 -%}
|
||||||
[deleted]
|
{{ render_username(comment['comment'].author) }}
|
||||||
{% else %}
|
{% endwith -%}
|
||||||
{% if comment['comment'].author.avatar_id and comment['comment'].score > -10 and not low_bandwidth %}
|
|
||||||
<a href="/u/{{ comment['comment'].author.link() }}" title="{{ comment['comment'].author.ap_id }}">
|
|
||||||
<img src="{{ comment['comment'].author.avatar_thumbnail() }}" alt="Avatar" loading="lazy" /></a>
|
|
||||||
{% endif %}
|
|
||||||
<a href="/u/{{ comment['comment'].author.link() }}" title="{{ comment['comment'].author.link() }}">
|
|
||||||
{{ comment['comment'].author.display_name() }}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if comment['comment'].author.created_recently() %}
|
|
||||||
<span class="fe fe-new-account small" title="New account"> </span>
|
|
||||||
{% endif %}
|
|
||||||
{% if comment['comment'].author.bot %}
|
|
||||||
<span class="fe fe-bot-account small" title="Bot account"> </span>
|
|
||||||
{% endif %}
|
|
||||||
{% if comment['comment'].author.id != current_user.id %}
|
|
||||||
{% if comment['comment'].author.reputation < -10 %}
|
|
||||||
<span class="fe fe-warning red" title="Very low reputation. Beware."> </span>
|
|
||||||
<span class="fe fe-warning red" title="Very low reputation. Beware!"> </span>
|
|
||||||
{% elif comment['comment'].author.reputation < 0 %}
|
|
||||||
<span class="fe fe-warning orangered" title="Low reputation."> </span>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% if comment['comment'].author.id == post.author.id %}<span title="Submitter of original post" aria-label="submitter" class="small">[OP] </span>{% endif %}
|
{% if comment['comment'].author.id == post.author.id %}<span title="Submitter of original post" aria-label="submitter" class="small">[OP] </span>{% endif %}
|
||||||
<span class="text-muted small">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at %}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif %}</span>
|
<span class="text-muted small">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at %}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif %}</span>
|
||||||
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
||||||
|
|
|
@ -77,30 +77,9 @@
|
||||||
{% if comment['comment'].author.id == post.author.id -%}original_poster{% endif -%}" aria-level="{{ comment['comment'].depth + 1 }}" role="treeitem" aria-expanded="true" tabindex="0">
|
{% if comment['comment'].author.id == post.author.id -%}original_poster{% endif -%}" aria-level="{{ comment['comment'].depth + 1 }}" role="treeitem" aria-expanded="true" tabindex="0">
|
||||||
<div class="limit_height">{% if not comment['comment'].author.indexable -%}<!--googleoff: all-->{% endif -%}
|
<div class="limit_height">{% if not comment['comment'].author.indexable -%}<!--googleoff: all-->{% endif -%}
|
||||||
<div class="comment_author">
|
<div class="comment_author">
|
||||||
{% if comment['comment'].author.deleted -%}
|
{% with collapsed = comment['comment'].score < reply_collapse_threshold -%}
|
||||||
[deleted]
|
{{ render_username(comment['comment'].author) }}
|
||||||
{% else -%}
|
{% endwith -%}
|
||||||
{% if comment['comment'].author.avatar_id and comment['comment'].score > reply_collapse_threshold and not low_bandwidth -%}
|
|
||||||
<a href="/u/{{ comment['comment'].author.link() }}" title="{{ comment['comment'].author.ap_id }}">
|
|
||||||
<img src="{{ comment['comment'].author.avatar_thumbnail() }}" alt="" loading="lazy" /></a>
|
|
||||||
{% endif -%}
|
|
||||||
<a href="/u/{{ comment['comment'].author.link() }}" title="{{ comment['comment'].author.link() }}" aria-label="{{ _('Author') }}">
|
|
||||||
{{ comment['comment'].author.display_name() }}</a>
|
|
||||||
{% endif -%}
|
|
||||||
{% if comment['comment'].author.created_recently() -%}
|
|
||||||
<span class="fe fe-new-account small" title="New account"> </span>
|
|
||||||
{% endif -%}
|
|
||||||
{% if comment['comment'].author.bot -%}
|
|
||||||
<span class="fe fe-bot-account small" title="Bot account"> </span>
|
|
||||||
{% endif -%}
|
|
||||||
{% if comment['comment'].author.id != current_user.id -%}
|
|
||||||
{% if comment['comment'].author.reputation < -10 -%}
|
|
||||||
<span class="fe fe-warning red" title="Very low reputation. Beware."> </span>
|
|
||||||
<span class="fe fe-warning red" title="Very low reputation. Beware!"> </span>
|
|
||||||
{% elif comment['comment'].author.reputation < 0 -%}
|
|
||||||
<span class="fe fe-warning orangered" title="Low reputation."> </span>
|
|
||||||
{% endif -%}
|
|
||||||
{% endif -%}
|
|
||||||
{% if comment['comment'].author.id == post.author.id -%}<span title="Submitter of original post" aria-label="{{ _('Post creator') }}" class="small">[OP] </span>{% endif -%}
|
{% if comment['comment'].author.id == post.author.id -%}<span title="Submitter of original post" aria-label="{{ _('Post creator') }}" class="small">[OP] </span>{% endif -%}
|
||||||
<span class="text-muted small" aria_label="{{ _('When: ') }}">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at -%}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif -%}</span>
|
<span class="text-muted small" aria_label="{{ _('When: ') }}">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at -%}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif -%}</span>
|
||||||
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
||||||
|
@ -214,9 +193,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in related_communities -%}
|
{% for community in related_communities -%}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}" aria-label="{{ _('Go to community') }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" alt="" />
|
{{ render_communityname(community) }}
|
||||||
{{ community.display_name() }}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
127
app/templates/post/post_edit.html
Normal file
127
app/templates/post/post_edit.html
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
||||||
|
{% extends 'themes/' + theme() + '/base.html' %}
|
||||||
|
{% else %}
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% endif %} %}
|
||||||
|
{% from 'bootstrap/form.html' import render_form, render_field %}
|
||||||
|
|
||||||
|
{% block app_content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-8 position-relative main_pane">
|
||||||
|
<h1>{{ _('Edit post') }}</h1>
|
||||||
|
<form method="post" enctype="multipart/form-data" role="form">
|
||||||
|
{{ form.csrf_token() }}
|
||||||
|
{{ render_field(form.title) }}
|
||||||
|
{% if post.type == POST_TYPE_LINK %}
|
||||||
|
{{ render_field(form.link_url) }}
|
||||||
|
{% elif post.type == POST_TYPE_IMAGE %}
|
||||||
|
{{ render_field(form.image_file) }}
|
||||||
|
{{ render_field(form.image_alt_text) }}
|
||||||
|
<small class="field_hint">{{ _('Describe the image, to help visually impaired people.') }}</small>
|
||||||
|
{% elif post.type == POST_TYPE_VIDEO %}
|
||||||
|
{{ render_field(form.video_url) }}
|
||||||
|
{% endif %}
|
||||||
|
{{ render_field(form.body) }}
|
||||||
|
|
||||||
|
{% if markdown_editor %}
|
||||||
|
<script nonce="{{ session['nonce'] }}">
|
||||||
|
window.addEventListener("load", function () {
|
||||||
|
var downarea = new DownArea({
|
||||||
|
elem: document.querySelector('#body'),
|
||||||
|
resize: DownArea.RESIZE_VERTICAL,
|
||||||
|
hide: ['heading', 'bold-italic'],
|
||||||
|
value: {{ form.body.data | tojson | safe }},
|
||||||
|
});
|
||||||
|
setupAutoResize('body');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if post.type == POST_TYPE_POLL %}
|
||||||
|
<fieldset id="pollChoicesFieldset">
|
||||||
|
<legend>{{ _('Poll choices') }}</legend>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ form.choice_1(class_="form-control", **{"placeholder": "First choice"}) }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ form.choice_2(class_="form-control", **{"placeholder": "Second choice"}) }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="{{ 'display: none;' if form.choice_3.data == none }}">
|
||||||
|
{{ form.choice_3(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_4(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_5(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_6(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_7(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_8(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_9(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group" style="display: none;">
|
||||||
|
{{ form.choice_10(class_="form-control") }}
|
||||||
|
</div>
|
||||||
|
<button id="addPollChoice" type="button" class="btn btn-primary">{{ _('Add choice') }}</button>
|
||||||
|
</fieldset>
|
||||||
|
{{ render_field(form.mode) }}
|
||||||
|
{{ render_field(form.local_only) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ render_field(form.tags) }}
|
||||||
|
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
||||||
|
|
||||||
|
<div class="row mt-4">
|
||||||
|
<div class="col-md-3">
|
||||||
|
{{ render_field(form.notify_author) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
{{ render_field(form.sticky) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
{{ render_field(form.nsfw) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
{{ render_field(form.nsfl) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col post_language_chooser">
|
||||||
|
{{ render_field(form.language_id) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ render_field(form.submit) }}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
||||||
|
<div class="card mt-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>{{ post.community.title }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
|
||||||
|
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
|
||||||
|
{% if len(mods) > 0 and not post.community.private_mods %}
|
||||||
|
<h3>Moderators</h3>
|
||||||
|
<ul class="moderator_list">
|
||||||
|
{% for mod in mods %}
|
||||||
|
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% include "_inoculation_links.html" %}
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,77 +0,0 @@
|
||||||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
|
||||||
{% extends 'themes/' + theme() + '/base.html' %}
|
|
||||||
{% else %}
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% endif %} %}
|
|
||||||
{% from 'bootstrap/form.html' import render_form, render_field %}
|
|
||||||
|
|
||||||
{% block app_content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-8 position-relative main_pane">
|
|
||||||
<h1>{{ _('Edit post') }}</h1>
|
|
||||||
<form method="post" role="form">
|
|
||||||
{{ form.csrf_token() }}
|
|
||||||
{{ render_field(form.discussion_title) }}
|
|
||||||
{{ render_field(form.discussion_body) }}
|
|
||||||
{% if markdown_editor %}
|
|
||||||
<script nonce="{{ session['nonce'] }}">
|
|
||||||
window.addEventListener("load", function () {
|
|
||||||
var downarea = new DownArea({
|
|
||||||
elem: document.querySelector('#discussion_body'),
|
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
|
||||||
hide: ['heading', 'bold-italic'],
|
|
||||||
value: {{ form.discussion_body.data | tojson | safe }},
|
|
||||||
});
|
|
||||||
setupAutoResize('discussion_body');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
{{ render_field(form.tags) }}
|
|
||||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
|
||||||
|
|
||||||
<div class="row mt-4">
|
|
||||||
<div class="col-md-3">
|
|
||||||
{{ render_field(form.notify_author) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.sticky) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfw) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfl) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col post_language_chooser">
|
|
||||||
{{ render_field(form.language_id) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ render_field(form.submit) }}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>{{ post.community.title }}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
|
|
||||||
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
|
|
||||||
{% if len(mods) > 0 and not post.community.private_mods %}
|
|
||||||
<h3>Moderators</h3>
|
|
||||||
<ul class="moderator_list">
|
|
||||||
{% for mod in mods %}
|
|
||||||
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% include "_inoculation_links.html" %}
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -1,80 +0,0 @@
|
||||||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
|
||||||
{% extends 'themes/' + theme() + '/base.html' %}
|
|
||||||
{% else %}
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% endif %} %}
|
|
||||||
{% from 'bootstrap/form.html' import render_form, render_field %}
|
|
||||||
|
|
||||||
{% block app_content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-8 position-relative main_pane">
|
|
||||||
<h1>{{ _('Edit post') }}</h1>
|
|
||||||
<form method="post" enctype="multipart/form-data" role="form">
|
|
||||||
{{ form.csrf_token() }}
|
|
||||||
{{ render_field(form.image_title) }}
|
|
||||||
{{ render_field(form.image_file) }}
|
|
||||||
{{ render_field(form.image_alt_text) }}
|
|
||||||
<small class="field_hint">{{ _('Describe the image, to help visually impaired people.') }}</small>
|
|
||||||
{{ render_field(form.image_body) }}
|
|
||||||
{% if markdown_editor %}
|
|
||||||
<script nonce="{{ session['nonce'] }}">
|
|
||||||
window.addEventListener("load", function () {
|
|
||||||
var downarea = new DownArea({
|
|
||||||
elem: document.querySelector('#image_body'),
|
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
|
||||||
hide: ['heading', 'bold-italic'],
|
|
||||||
value: {{ form.image_body.data | tojson | safe }},
|
|
||||||
});
|
|
||||||
setupAutoResize('image_body');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
{{ render_field(form.tags) }}
|
|
||||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
|
||||||
|
|
||||||
<div class="row mt-4">
|
|
||||||
<div class="col-md-3">
|
|
||||||
{{ render_field(form.notify_author) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.sticky) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfw) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfl) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col post_language_chooser">
|
|
||||||
{{ render_field(form.language_id) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ render_field(form.submit) }}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>{{ post.community.title }}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
|
|
||||||
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
|
|
||||||
{% if len(mods) > 0 and not post.community.private_mods %}
|
|
||||||
<h3>Moderators</h3>
|
|
||||||
<ul class="moderator_list">
|
|
||||||
{% for mod in mods %}
|
|
||||||
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% include "_inoculation_links.html" %}
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -1,77 +0,0 @@
|
||||||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
|
||||||
{% extends 'themes/' + theme() + '/base.html' %}
|
|
||||||
{% else %}
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% endif %} %}
|
|
||||||
{% from 'bootstrap/form.html' import render_form, render_field %}
|
|
||||||
|
|
||||||
{% block app_content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-8 position-relative main_pane">
|
|
||||||
<h1>{{ _('Edit post') }}</h1>
|
|
||||||
<form method="post" enctype="multipart/form-data" role="form">
|
|
||||||
{{ form.csrf_token() }}
|
|
||||||
{{ render_field(form.link_title) }}
|
|
||||||
{{ render_field(form.link_url) }}
|
|
||||||
{{ render_field(form.link_body) }}
|
|
||||||
{% if markdown_editor %}
|
|
||||||
<script nonce="{{ session['nonce'] }}">
|
|
||||||
window.addEventListener("load", function () {
|
|
||||||
var downarea = new DownArea({
|
|
||||||
elem: document.querySelector('#link_body'),
|
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
|
||||||
hide: ['heading', 'bold-italic'],
|
|
||||||
value: {{ form.link_body.data | tojson | safe }},
|
|
||||||
});
|
|
||||||
setupAutoResize('link_body');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
{{ render_field(form.tags) }}
|
|
||||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
|
||||||
<div class="row mt-4">
|
|
||||||
<div class="col-md-3">
|
|
||||||
{{ render_field(form.notify_author) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.sticky) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfw) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfl) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col post_language_chooser">
|
|
||||||
{{ render_field(form.language_id) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ render_field(form.submit) }}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>{{ post.community.title }}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
|
|
||||||
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
|
|
||||||
{% if len(mods) > 0 and not post.community.private_mods %}
|
|
||||||
<h3>Moderators</h3>
|
|
||||||
<ul class="moderator_list">
|
|
||||||
{% for mod in mods %}
|
|
||||||
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% include "_inoculation_links.html" %}
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -1,113 +0,0 @@
|
||||||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
|
||||||
{% extends 'themes/' + theme() + '/base.html' %}
|
|
||||||
{% else %}
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% endif %} %}
|
|
||||||
{% from 'bootstrap/form.html' import render_form, render_field %}
|
|
||||||
|
|
||||||
{% block app_content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-8 position-relative main_pane">
|
|
||||||
<h1>{{ _('Edit post') }}</h1>
|
|
||||||
<form method="post" role="form">
|
|
||||||
{{ form.csrf_token() }}
|
|
||||||
{{ render_field(form.poll_title) }}
|
|
||||||
{{ render_field(form.poll_body) }}
|
|
||||||
{% if markdown_editor %}
|
|
||||||
<script nonce="{{ session['nonce'] }}">
|
|
||||||
window.addEventListener("load", function () {
|
|
||||||
var downarea = new DownArea({
|
|
||||||
elem: document.querySelector('#discussion_body'),
|
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
|
||||||
hide: ['heading', 'bold-italic'],
|
|
||||||
value: {{ form.discussion_body.data | tojson | safe }},
|
|
||||||
});
|
|
||||||
setupAutoResize('discussion_body');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
<fieldset id="pollChoicesFieldset">
|
|
||||||
<legend>{{ _('Poll choices') }}</legend>
|
|
||||||
<div class="form-group">
|
|
||||||
{{ form.choice_1(class_="form-control", **{"placeholder": "First choice"}) }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
{{ form.choice_2(class_="form-control", **{"placeholder": "Second choice"}) }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="{{ 'display: none;' if form.choice_3.data == none }}">
|
|
||||||
{{ form.choice_3(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_4(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_5(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_6(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_7(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_8(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_9(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="display: none;">
|
|
||||||
{{ form.choice_10(class_="form-control") }}
|
|
||||||
</div>
|
|
||||||
<button id="addPollChoice" type="button" class="btn btn-primary">{{ _('Add choice') }}</button>
|
|
||||||
</fieldset>
|
|
||||||
{{ render_field(form.mode) }}
|
|
||||||
{{ render_field(form.local_only) }}
|
|
||||||
{{ render_field(form.tags) }}
|
|
||||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
|
||||||
|
|
||||||
<div class="row mt-4">
|
|
||||||
<div class="col-md-3">
|
|
||||||
{{ render_field(form.notify_author) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.sticky) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfw) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfl) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col post_language_chooser">
|
|
||||||
{{ render_field(form.language_id) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ render_field(form.submit) }}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>{{ post.community.title }}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
|
|
||||||
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
|
|
||||||
{% if len(mods) > 0 and not post.community.private_mods %}
|
|
||||||
<h3>Moderators</h3>
|
|
||||||
<ul class="moderator_list">
|
|
||||||
{% for mod in mods %}
|
|
||||||
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% include "_inoculation_links.html" %}
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -1,77 +0,0 @@
|
||||||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
|
||||||
{% extends 'themes/' + theme() + '/base.html' %}
|
|
||||||
{% else %}
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% endif %} %}
|
|
||||||
{% from 'bootstrap/form.html' import render_form, render_field %}
|
|
||||||
|
|
||||||
{% block app_content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-8 position-relative main_pane">
|
|
||||||
<h1>{{ _('Edit post') }}</h1>
|
|
||||||
<form method="post" enctype="multipart/form-data" role="form">
|
|
||||||
{{ form.csrf_token() }}
|
|
||||||
{{ render_field(form.video_title) }}
|
|
||||||
{{ render_field(form.video_url) }}
|
|
||||||
{{ render_field(form.video_body) }}
|
|
||||||
{% if markdown_editor %}
|
|
||||||
<script nonce="{{ session['nonce'] }}">
|
|
||||||
window.addEventListener("load", function () {
|
|
||||||
var downarea = new DownArea({
|
|
||||||
elem: document.querySelector('#video_body'),
|
|
||||||
resize: DownArea.RESIZE_VERTICAL,
|
|
||||||
hide: ['heading', 'bold-italic'],
|
|
||||||
value: {{ form.link_body.data | tojson | safe }},
|
|
||||||
});
|
|
||||||
setupAutoResize('video_body');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
{{ render_field(form.tags) }}
|
|
||||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
|
||||||
<div class="row mt-4">
|
|
||||||
<div class="col-md-3">
|
|
||||||
{{ render_field(form.notify_author) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.sticky) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfw) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
{{ render_field(form.nsfl) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col post_language_chooser">
|
|
||||||
{{ render_field(form.language_id) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ render_field(form.submit) }}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>{{ post.community.title }}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
|
|
||||||
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
|
|
||||||
{% if len(mods) > 0 and not post.community.private_mods %}
|
|
||||||
<h3>Moderators</h3>
|
|
||||||
<ul class="moderator_list">
|
|
||||||
{% for mod in mods %}
|
|
||||||
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% include "_inoculation_links.html" %}
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -51,9 +51,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in active_communities %}
|
{% for community in active_communities %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" alt="" />
|
{{ render_communityname(community) }}
|
||||||
{{ community.display_name() }}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -92,9 +92,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in topic_communities %}
|
{% for community in topic_communities %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}" aria-label="{{ _('Go to community') }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" alt="" />
|
{{ render_communityname(community) }}
|
||||||
{{ community.display_name() }}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% for community in subscribed %}
|
{% for community in subscribed %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/c/{{ community.link() }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" />{{ community.display_name() }}</a>
|
{{ render_communityname(community) }}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% for community in moderates %}
|
{% for community in moderates %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/c/{{ community.link() }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" />{{ community.display_name() }}</a>
|
{{ render_communityname(community) }}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in subscribed %}
|
{% for community in subscribed %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" />{{ community.display_name() }}</a>
|
{{ render_communityname(community) }}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for community in moderates %}
|
{% for community in moderates %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="/c/{{ community.link() }}"><img src="{{ community.icon_image() }}" class="community_icon rounded-circle" loading="lazy" />{{ community.display_name() }}</a>
|
{{ render_communityname(community) }}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -8,7 +8,7 @@ from flask_login import current_user
|
||||||
from app import create_app, db, cli
|
from app import create_app, db, cli
|
||||||
import os, click
|
import os, click
|
||||||
from flask import session, g, json, request, current_app
|
from flask import session, g, json, request, current_app
|
||||||
from app.constants import POST_TYPE_LINK, POST_TYPE_IMAGE, POST_TYPE_ARTICLE, POST_TYPE_VIDEO
|
from app.constants import POST_TYPE_LINK, POST_TYPE_IMAGE, POST_TYPE_ARTICLE, POST_TYPE_VIDEO, POST_TYPE_POLL
|
||||||
from app.models import Site
|
from app.models import Site
|
||||||
from app.utils import getmtime, gibberish, shorten_string, shorten_url, digits, user_access, community_membership, \
|
from app.utils import getmtime, gibberish, shorten_string, shorten_url, digits, user_access, community_membership, \
|
||||||
can_create_post, can_upvote, can_downvote, shorten_number, ap_datetime, current_theme, community_link_to_href, \
|
can_create_post, can_upvote, can_downvote, shorten_number, ap_datetime, current_theme, community_link_to_href, \
|
||||||
|
@ -22,8 +22,8 @@ cli.register(app)
|
||||||
def app_context_processor():
|
def app_context_processor():
|
||||||
def getmtime(filename):
|
def getmtime(filename):
|
||||||
return os.path.getmtime('app/static/' + filename)
|
return os.path.getmtime('app/static/' + filename)
|
||||||
return dict(getmtime=getmtime, post_type_link=POST_TYPE_LINK, post_type_image=POST_TYPE_IMAGE,
|
return dict(getmtime=getmtime, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE,
|
||||||
post_type_article=POST_TYPE_ARTICLE, post_type_video=POST_TYPE_VIDEO)
|
POST_TYPE_ARTICLE=POST_TYPE_ARTICLE, POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL)
|
||||||
|
|
||||||
|
|
||||||
@app.shell_context_processor
|
@app.shell_context_processor
|
||||||
|
|
Loading…
Add table
Reference in a new issue