mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
breadcrumbs
This commit is contained in:
parent
2c0fc55e35
commit
43957873de
6 changed files with 131 additions and 4 deletions
|
@ -58,6 +58,7 @@ def register(app):
|
|||
db.session.append(Settings(name='federation', value=json.dumps(True)))
|
||||
db.session.append(BannedInstances(domain='lemmygrad.ml'))
|
||||
db.session.append(BannedInstances(domain='gab.com'))
|
||||
db.session.append(BannedInstances(domain='rqd2.net'))
|
||||
db.session.append(BannedInstances(domain='exploding-heads.com'))
|
||||
db.session.append(BannedInstances(domain='hexbear.net'))
|
||||
db.session.append(BannedInstances(domain='threads.net'))
|
||||
|
|
|
@ -10,6 +10,8 @@ from werkzeug.security import generate_password_hash, check_password_hash
|
|||
from flask_babel import _, lazy_gettext as _l
|
||||
from sqlalchemy.orm import backref
|
||||
from sqlalchemy_utils.types import TSVectorType # https://sqlalchemy-searchable.readthedocs.io/en/latest/installation.html
|
||||
from flask_sqlalchemy import BaseQuery
|
||||
from sqlalchemy_searchable import SearchQueryMixin
|
||||
from app import db, login
|
||||
import jwt
|
||||
|
||||
|
@ -17,6 +19,10 @@ from app.constants import SUBSCRIPTION_NONMEMBER, SUBSCRIPTION_MEMBER, SUBSCRIPT
|
|||
SUBSCRIPTION_BANNED
|
||||
|
||||
|
||||
class FullTextSearchQuery(BaseQuery, SearchQueryMixin):
|
||||
pass
|
||||
|
||||
|
||||
class File(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
file_path = db.Column(db.String(255))
|
||||
|
@ -28,6 +34,7 @@ class File(db.Model):
|
|||
|
||||
|
||||
class Community(db.Model):
|
||||
query_class = FullTextSearchQuery
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
icon_id = db.Column(db.Integer, db.ForeignKey('file.id'))
|
||||
image_id = db.Column(db.Integer, db.ForeignKey('file.id'))
|
||||
|
@ -107,6 +114,7 @@ class Community(db.Model):
|
|||
|
||||
|
||||
class User(UserMixin, db.Model):
|
||||
query_class = FullTextSearchQuery
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
user_name = db.Column(db.String(255), unique=True, index=True)
|
||||
email = db.Column(db.String(255), index=True)
|
||||
|
@ -236,6 +244,7 @@ class ActivityLog(db.Model):
|
|||
|
||||
|
||||
class Post(db.Model):
|
||||
query_class = FullTextSearchQuery
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), index=True)
|
||||
community_id = db.Column(db.Integer, db.ForeignKey('community.id'), index=True)
|
||||
|
@ -279,6 +288,7 @@ class Post(db.Model):
|
|||
|
||||
|
||||
class PostReply(db.Model):
|
||||
query_class = FullTextSearchQuery
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), index=True)
|
||||
post_id = db.Column(db.Integer, db.ForeignKey('post.id'), index=True)
|
||||
|
|
|
@ -265,12 +265,51 @@ fieldset legend {
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
#breadcrumb_nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
#breadcrumb_nav {
|
||||
display: block;
|
||||
font-size: 87%;
|
||||
}
|
||||
#breadcrumb_nav .breadcrumb {
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
background-color: inherit;
|
||||
}
|
||||
#breadcrumb_nav .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
|
||||
content: ">";
|
||||
}
|
||||
}
|
||||
.community_header {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
background-size: cover;
|
||||
border-radius: 5px;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.community_header #breadcrumb_nav {
|
||||
padding-left: 20px;
|
||||
padding-top: 13px;
|
||||
}
|
||||
.community_header #breadcrumb_nav .breadcrumb {
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
background-color: inherit;
|
||||
}
|
||||
.community_header #breadcrumb_nav .breadcrumb .breadcrumb-item {
|
||||
color: white;
|
||||
}
|
||||
.community_header #breadcrumb_nav .breadcrumb .breadcrumb-item a {
|
||||
color: white;
|
||||
}
|
||||
.community_header #breadcrumb_nav .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
|
||||
content: ">";
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.community_header_no_background .community_icon, .community_header .community_icon {
|
||||
width: 120px;
|
||||
|
|
|
@ -51,11 +51,57 @@ nav, etc which are used site-wide */
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
#breadcrumb_nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@include breakpoint(tablet) {
|
||||
#breadcrumb_nav {
|
||||
display: block;
|
||||
font-size: 87%;
|
||||
|
||||
.breadcrumb {
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
background-color: inherit;
|
||||
|
||||
.breadcrumb-item + .breadcrumb-item::before {
|
||||
content: ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.community_header {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
background-size: cover;
|
||||
border-radius: 5px;
|
||||
|
||||
@include breakpoint(tablet) {
|
||||
#breadcrumb_nav {
|
||||
padding-left: 20px;
|
||||
padding-top: 13px;
|
||||
|
||||
.breadcrumb {
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
background-color: inherit;
|
||||
|
||||
.breadcrumb-item {
|
||||
color: white;
|
||||
a {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumb-item + .breadcrumb-item::before {
|
||||
content: ">";
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.community_header_no_background, .community_header {
|
||||
|
|
|
@ -5,7 +5,15 @@
|
|||
<div class="row">
|
||||
<div class="col-8 position-relative">
|
||||
{% if community.header_image() != '' %}
|
||||
<div class="community_header" style="height: 240px; background-image: url({{ community.header_image() }});"></div>
|
||||
<div class="community_header" style="height: 240px; background-image: url({{ community.header_image() }});">
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/communities">{{ _('Communities') }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ community.title|shorten }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
<img class="community_icon_big bump_up rounded-circle" src="{{ community.icon_image() }}" />
|
||||
<h1 class="mt-2">{{ community.title }}</h1>
|
||||
{% elif community.icon_image() != '' %}
|
||||
|
@ -18,7 +26,14 @@
|
|||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<h1 class="mt-3">{{ community.title }}</h1>
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/communities">{{ _('Communities') }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ community.title|shorten }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<h1 class="mt-2">{{ community.title }}</h1>
|
||||
{% endif %}
|
||||
<div class="post_list">
|
||||
{% for post in posts %}
|
||||
|
|
|
@ -7,7 +7,15 @@
|
|||
<div class="row">
|
||||
{% if post.image_id %}
|
||||
<div class="col-8">
|
||||
<h1 class="mt-3">{{ post.title }}</h1>
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/communities">{{ _('Communities') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/c/{{ post.community.link() }}">{{ post.community.title }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ post.title|shorten(15) }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<h1 class="mt-2">{{ post.title }}</h1>
|
||||
{% if post.url %}
|
||||
<p><small><a href="{{ post.url }}" rel="nofollow ugc">{{ post.url|shorten_url }}</a>
|
||||
{% if post.type == post_type_link %}
|
||||
|
@ -27,7 +35,15 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<h1 class="mt-3">{{ post.title }}</h1>
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/communities">{{ _('Communities') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/c/{{ post.community.link() }}">{{ post.community.title }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ post.title|shorten(15) }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<h1 class="mt-2">{{ post.title }}</h1>
|
||||
{% if post.url %}
|
||||
<p><small><a href="{{ post.url }}" rel="nofollow ugc">{{ post.url|shorten_url }}
|
||||
<img src="/static/images/external_link_black.svg" class="external_link_icon" alt="External link" /></a>
|
||||
|
|
Loading…
Reference in a new issue