From 7d40d8f2c0683bf7f4bb641424fbdf88351b4ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ku=C5=BE=C3=ADlek?= Date: Thu, 19 Mar 2020 22:12:38 +0100 Subject: [PATCH] Parent post relation + minor form styles, image creating bugfix --- .../4b6c6a23c639_parent_child_relations.py | 31 +++++++++++++++++ yadc/assets/css/base-types.scss | 34 ++++++++++++------- yadc/bp/manage.py | 12 +++++-- yadc/bp/post.py | 1 + yadc/forms.py | 8 ++++- yadc/models.py | 7 ++-- yadc/static/all.css | 2 +- yadc/templates/layout/base.html | 6 ++-- yadc/templates/manage/posts.html | 5 +++ yadc/templates/post/post.html | 28 +++++++++++---- 10 files changed, 104 insertions(+), 30 deletions(-) create mode 100644 migrations/versions/4b6c6a23c639_parent_child_relations.py diff --git a/migrations/versions/4b6c6a23c639_parent_child_relations.py b/migrations/versions/4b6c6a23c639_parent_child_relations.py new file mode 100644 index 0000000..e1f0742 --- /dev/null +++ b/migrations/versions/4b6c6a23c639_parent_child_relations.py @@ -0,0 +1,31 @@ +"""parent child relations + +Revision ID: 4b6c6a23c639 +Revises: 71386dc42f9b +Create Date: 2020-03-18 16:17:09.512280 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utc + + +# revision identifiers, used by Alembic. +revision = '4b6c6a23c639' +down_revision = '71386dc42f9b' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('post', sa.Column('parent_id', sa.Integer(), nullable=True)) + op.create_foreign_key(None, 'post', 'post', ['parent_id'], ['id']) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint(None, 'post', type_='foreignkey') + op.drop_column('post', 'parent_id') + # ### end Alembic commands ### diff --git a/yadc/assets/css/base-types.scss b/yadc/assets/css/base-types.scss index 6fae144..e635cc2 100644 --- a/yadc/assets/css/base-types.scss +++ b/yadc/assets/css/base-types.scss @@ -64,6 +64,10 @@ h4 { margin-top: .4em; } +.oneline-space { + height: 1em; +} + .comment-form { margin-left: 10px; @@ -105,7 +109,7 @@ input[type=text], input[type=password], textarea { display: block; padding: .5em; - margin: .3em 0; + // margin: .3em 0; } input[type=text], input[type=password] { @@ -130,7 +134,6 @@ input[type=submit] { color: inherit; - padding: .4em 1.8em; } @@ -149,21 +152,27 @@ label { } input[type=submit] { - margin: .2em 0; + margin: .2em; } - form > input, form > div { + form > input, form > textarea, form > div { margin: .8em 0; } div.row { - padding: .2em; + // padding: .2em; display: flex; align-items: center; &.stretch { justify-content: space-between; } + + label { + padding: 0; + margin-left: .2em; + margin-right: .6em; + } } ul { padding: 0; @@ -191,9 +200,10 @@ label { width: 100%; position: relative; - // input[type=text] { - // width: 100%; - // } + input[type=text] { + // width: 100%; + margin: .3em 0; + } > .suggest-dropdown { display: flex; @@ -243,12 +253,12 @@ label { flex-grow: 1; flex-basis: 100%; - word-break: break-all; - word-wrap: break-word; + // word-break: break-all; + // overflow-wrap: anywhere; } - .tag-right { - + .tag-icon, .tag-right { + align-self: center; } .count { font-size: .8em; diff --git a/yadc/bp/manage.py b/yadc/bp/manage.py index 05e2380..70f1916 100644 --- a/yadc/bp/manage.py +++ b/yadc/bp/manage.py @@ -40,7 +40,9 @@ def manage_posts(page): id=post.id, rating=post.rating.name, status=post.status.name, - source=post.source) + source=post.source, + parent=post.parent_id + ) return render_template('manage/posts.html', posts=posts, elements=posts.items) @@ -131,9 +133,13 @@ def modify_post(): elif form.edit.data: if form.rating.raw_data and form.rating.data: el.rating = form.rating.data if form.status.raw_data and form.status.data: el.status = form.status.data - if form.source.raw_data and form.source.data: el.source = form.source.data + if form.source.raw_data: el.source = form.source.data - if form.tags.raw_data and form.tags.raw_data: + if form.parent.raw_data: + el.parent_id = form.parent.data + # el.parent = Post.query.get(form.parent.data) + + if form.tags.raw_data and form.tags.data: f_tags = form.tags.data.split() tags = Tag.query.filter(Tag.content.in_(f_tags)).all() el.tags = tags diff --git a/yadc/bp/post.py b/yadc/bp/post.py index b83e8f3..f2c32b7 100644 --- a/yadc/bp/post.py +++ b/yadc/bp/post.py @@ -85,6 +85,7 @@ def post_show(id): id=post.id, referer=post_show.__name__, source=post.source, + parent=post.parent_id, tags=' '.join(t.content for t in post.tags), rating=post.rating, status=post.status diff --git a/yadc/forms.py b/yadc/forms.py index 3327f55..0760b4c 100644 --- a/yadc/forms.py +++ b/yadc/forms.py @@ -1,5 +1,5 @@ from wtforms import Form -from wtforms import StringField, PasswordField, BooleanField, SubmitField, FileField, MultipleFileField, ValidationError, RadioField, TextAreaField, HiddenField, SelectField +from wtforms import StringField, PasswordField, BooleanField, SubmitField, FileField, MultipleFileField, ValidationError, RadioField, TextAreaField, HiddenField, SelectField, IntegerField from wtforms.validators import DataRequired, InputRequired, Email, EqualTo, AnyOf, optional, StopValidation, URL from werkzeug.utils import cached_property @@ -169,6 +169,12 @@ class PostForm(EditForm): validators=[optional()]) source = StringField('Source', validators=[optional(), URL()], render_kw=dict(placeholder='Source URL', autocomplete='off')) + parent = IntegerField('Parent', validators=[optional()], render_kw=dict(placeholder='Parent ID', autocomplete='off')) + + def validate_parent(form, field): + if not Post.query.get(field.data): + raise ValidationError('Enter valid parent post.') + referer = HiddenField() approve = SubmitField('Approve') diff --git a/yadc/models.py b/yadc/models.py index c65fbc4..2ede90b 100644 --- a/yadc/models.py +++ b/yadc/models.py @@ -192,8 +192,9 @@ class Post(TimestampMixin, db.Model): tags = db.relationship('Tag', secondary=post_tags, backref=db.backref('posts')) - # parent_id = db.Column(db.Integer, db.ForeignKey('post.id')) - # parent = db.relationship('Post', backref=db.backref('children', lazy=True), foreign_keys=[parent_id]) + parent_id = db.Column(db.Integer, db.ForeignKey('post.id')) + parent = db.relationship('Post', backref=db.backref('children', lazy=True), remote_side=[id]) + # children = db.relationship('Post', back_populates='parent') # def __init__(self, **kwargs): # super().__init__(**kwargs) @@ -247,7 +248,7 @@ class Post(TimestampMixin, db.Model): @property def image_files(self): return dict( - image=os.path.join(current_app.config.get('POST_UPLOADS'), IMAGE_STORE.image.value, f"{path}.{self.filetype.file_ext}"), + image=os.path.join(current_app.config.get('POST_UPLOADS'), IMAGE_STORE.image.value, f"{self.md5}.{self.filetype.file_ext}"), jpeg=(os.path.join(current_app.config.get('POST_UPLOADS'), IMAGE_STORE.jpeg.value, f"{self.md5}.jpg") if not self.filetype.is_jpeg else None), sample=os.path.join(current_app.config.get('POST_UPLOADS'), IMAGE_STORE.sample.value, f"{self.md5}.jpg"), thumb_big=os.path.join(current_app.config.get('POST_UPLOADS'), IMAGE_STORE.thumb_big.value, f"{self.md5}.jpg"), diff --git a/yadc/static/all.css b/yadc/static/all.css index 7df949f..8aa8fba 100644 --- a/yadc/static/all.css +++ b/yadc/static/all.css @@ -1 +1 @@ -.flash_msgs{display:flex;flex-flow:column-reverse nowrap;position:fixed;z-index:20;bottom:0;right:0;margin:0;padding:10px;font-size:.9em;pointer-events:none}.flash_msgs>li{width:250px;padding:10px;list-style-type:none;background-color:#000c;overflow:hidden;opacity:0;animation:fade 7s normal}.flash_msgs>li:not(:first-child){margin-bottom:10px}@keyframes fade{0%,100%{opacity:0}20%,80%{opacity:1}}.flash_msgs>li.error{background-color:#500c}h2{margin:0;margin-bottom:.5em}h3{margin:0;margin-bottom:.5em;font-size:1.3em}h4{margin:0;margin-bottom:.8em;margin-top:.4em}.comment-form{margin-left:10px;max-width:500px}.comment-form input:required{box-shadow:none}.editingable:not(.time-to-edit) .edit{display:none}.editingable.time-to-edit .notedit{display:none}input[type=text],input[type=password],textarea{background:#444a;border:1px solid #444;color:inherit;display:block;padding:.5em;margin:.3em 0}input[type=text],input[type=password]{width:100%}textarea{resize:vertical;width:100%}input[type=submit]{background:#444a;border:2px solid #666a;border-radius:4px;color:inherit;padding:.4em 1.8em}input[type=submit]:active{background:#000a;border:2px solid #444a}label{padding:.4em}.baseform input[type=text],.baseform input[type=password],.baseform textarea,.pageform input[type=text],.pageform input[type=password],.pageform textarea{width:100%}.baseform input[type=checkbox],.pageform input[type=checkbox]{margin:.5em}.baseform input[type=submit],.pageform input[type=submit]{margin:.2em 0}.baseform form>input,.baseform form>div,.pageform form>input,.pageform form>div{margin:.8em 0}.baseform div.row,.pageform div.row{padding:.2em;display:flex;align-items:center}.baseform div.row.stretch,.pageform div.row.stretch{justify-content:space-between}.baseform ul,.pageform ul{padding:0;margin:0}.baseform ul li,.pageform ul li{list-style-type:none}.pageform{padding:1em;width:300px;margin:0 auto}.tag-input .tag-suggester{width:100%;position:relative}.tag-input .tag-suggester>.suggest-dropdown{display:flex;align-items:start;width:100%;top:100%;position:absolute;z-index:10;overflow:auto;background-color:#2d2d2de0}.tag-input .tag-suggester>.suggest-dropdown:not(:empty){padding:.2em}.tag-input .tag-suggester>.suggest-dropdown>a.sug-sel{background-color:#242424}.tag-input .tag-container{display:flex;flex-flow:row wrap}.tag-input .tag-container:empty{display:none}.tag-input .tag-container>a{display:flex;justify-content:space-between;overflow:hidden;align-items:baseline;margin:.2em;padding:.35em .6em;border-radius:4px;background-color:#121212ff;cursor:pointer}.tag-input .tag-container>a .content{margin:0 .4em;flex-grow:1;flex-basis:100%;word-break:break-all;word-wrap:break-word}.tag-input .tag-container>a .count{font-size:.8em;margin-right:.4em}.tag-input .tag-container>a>*{pointer-events:none}.tag-input .tag-container>a:not(:hover) span.close{opacity:0}.tag-input .tag-container>a:not(:hover) span.plus{opacity:0}.tag-input .tag-container>a.tagselected{background-color:#400808ff}.tag-input .tag-container>a.tag_hide{display:none}header{display:flex;align-items:baseline;padding:0 10px;background-color:#222}header>a.logo{font-size:2em;margin:6px}@media(max-width:559px){header{position:relative}}header>nav{flex-grow:1;display:flex}header>nav>._overlay{display:none}@media(max-width:559px){header>nav{display:none}header>nav._drop{display:flex;flex-flow:column nowrap;position:absolute;margin:0;top:100%;left:0;right:0;z-index:10;background-color:#111d}header>nav>a,header>nav a#user-menu,header>nav .user_dropdown>a{padding:12px;padding-left:24px}header>nav>a:hover,header>nav>a:active,header>nav a#user-menu:hover,header>nav a#user-menu:active,header>nav .user_dropdown>a:hover,header>nav .user_dropdown>a:active{background-color:#333}header>nav .user::before{content:"";display:block;border-top:1px solid grey;margin:2px 12px}header>nav .user #user-menu{display:block}header>nav .user .user_dropdown{display:flex;flex-flow:column nowrap}header>nav>._overlay{display:block;position:fixed;width:100%;height:100%;z-index:-1;background-color:#0006}html.oh{overflow:hidden}}@media(min-width:560px){header>nav{margin:0 5px;align-items:center}header>nav>*{margin:0 5px;padding:6px 0}header>nav>.user{padding:0;margin-left:auto;margin-right:0;position:relative}header>nav>.user #user-menu{display:block;padding:6px 10px}header>nav>.user .user_dropdown{display:none}header>nav>.user .user_dropdown a{padding:10px}header>nav>.user .user_dropdown a:hover{background-color:#333}header>nav>.user:hover>.user_dropdown{display:flex;flex-flow:column nowrap;position:absolute;margin:0;top:100%;right:0;z-index:10;background-color:#111d}}header>#nav-menu{display:none}@media(max-width:559px){header>#nav-menu{display:block;margin:5px;margin-left:auto;padding:0 2px;align-self:center;font-size:2em;cursor:pointer}}.main-wrap{margin:0 auto;max-width:1300px;padding:8px;padding-top:0;padding-bottom:0}.main-wrap .important-subwrap{display:flex;overflow:visible}@media(max-width:899px){.main-wrap .important-subwrap{flex-flow:column nowrap}}@media(min-width:900px){.main-wrap .important-subwrap{flex-flow:row nowrap}}.main-wrap .important-subwrap>section.sidepanel{flex-shrink:0;padding:10px}@media(min-width:900px){.main-wrap .important-subwrap>section.sidepanel{width:18rem;height:0}}.main-wrap .important-subwrap>section.sidepanel article:not(:last-child){margin-bottom:10px}@media(max-width:899px){.main-wrap .important-subwrap>section.sidepanel article.tags .tag-container,.main-wrap .important-subwrap>section.sidepanel article.post-edit .tag-container{flex-flow:row wrap}}@media(min-width:900px){.main-wrap .important-subwrap>section.sidepanel article.tags .tag-container,.main-wrap .important-subwrap>section.sidepanel article.post-edit .tag-container{flex-flow:column nowrap;align-items:start}.main-wrap .important-subwrap>section.sidepanel article.tags .suggest-dropdown,.main-wrap .important-subwrap>section.sidepanel article.post-edit .suggest-dropdown{flex-flow:row wrap}.main-wrap .important-subwrap>section.sidepanel article.tags .suggest-dropdown a,.main-wrap .important-subwrap>section.sidepanel article.post-edit .suggest-dropdown a{width:100%}}.main-wrap .important-subwrap>section.sidepanel article.rating ul{padding:0}.main-wrap .important-subwrap>section.sidepanel article.rating ul li{list-style-type:none}.main-wrap .important-subwrap>section.sidepanel article.post-desc{display:flex;flex-flow:column nowrap;font-size:.9em}.main-wrap .important-subwrap>section.sidepanel article.post-desc .source>a{word-break:break-all}.main-wrap .important-subwrap>section.sidepanel article.post-desc>img{display:block;max-width:128px}.main-wrap .important-subwrap>section.sidepanel article.sidenav>a{display:block;padding:.3em 1em}@media(min-width:900px){.main-wrap .important-subwrap>section:not(.sidepanel){width:100%}}.main-wrap section.post-list{overflow:hidden}@media(max-width:559px){.main-wrap section.post-list{margin-left:-8px;margin-right:-8px}}.main-wrap section.post-list .posts{display:flex;flex-flow:row wrap}@media(max-width:899px){.main-wrap section.post-list .posts{margin-left:-8px;margin-right:-8px}}.main-wrap section.post-list .posts::after{content:"";flex:10000 0 350px}.main-wrap section.post-list .posts>figure{position:relative;margin:8px}.main-wrap section.post-list .posts>figure img{display:block;width:100%;height:100%;transition:.2s ease}.main-wrap section.post-list .posts>figure:hover img{opacity:.7}@media(min-width:900px){.main-wrap section.post-single{padding:8px}}@media(max-width:899px){.main-wrap section.post-single{order:-1;margin-bottom:8px}}@media(max-width:559px){.main-wrap section.post-single{margin-left:-8px;margin-right:-8px}}.main-wrap section.post-single img{display:block;max-width:100%}.main-wrap section.comments{padding:10px}@media(min-width:900px){.main-wrap section.comments{margin-left:18rem}}.main-wrap section.comments>.comment-container{padding:0 10px;max-width:500px}.main-wrap section.comments>.comment-container article.comment{overflow:hidden;margin-bottom:1em}.main-wrap section.comments>.comment-container article.comment p,.main-wrap section.comments>.comment-container article.comment textarea{margin:0}.main-wrap section.comments>.comment-container article.comment p.deleted,.main-wrap section.comments>.comment-container article.comment textarea.deleted{color:red}.main-wrap section.comments>.comment-container article.comment .comment-head{display:flex;justify-content:space-between}.main-wrap section.management-table table{margin:0 auto}.main-wrap section.management-table tr{background-color:#303030}.main-wrap section.management-table tr th,.main-wrap section.management-table tr td{padding:6px 10px}.main-wrap section.management-table tr th{background-color:#606060}.main-wrap section.management-table tr label>input{display:none}.main-wrap section.management-table tr .fa{padding:4px 4px;align-self:center;font-size:1.5em;cursor:pointer}@media(min-width:900px){.main-wrap section.manage-profile{margin-right:18rem}}.main-wrap .pagin{margin:10px 0;display:flex;flex-flow:row nowrap;justify-content:center}.main-wrap .pagin>a{display:block;background-color:#0005;padding:8px 12px;margin:0 2px}footer{padding:10px;text-align:center}*{box-sizing:border-box}body{margin:0;font-family:Verdana,Geneva,Tahoma,sans-serif;background-color:#222;color:#fff}a{color:#bbb;text-decoration:none}a:hover{color:#909090;text-decoration:none} \ No newline at end of file +.flash_msgs{display:flex;flex-flow:column-reverse nowrap;position:fixed;z-index:20;bottom:0;right:0;margin:0;padding:10px;font-size:.9em;pointer-events:none}.flash_msgs>li{width:250px;padding:10px;list-style-type:none;background-color:#000c;overflow:hidden;opacity:0;animation:fade 7s normal}.flash_msgs>li:not(:first-child){margin-bottom:10px}@keyframes fade{0%,100%{opacity:0}20%,80%{opacity:1}}.flash_msgs>li.error{background-color:#500c}h2{margin:0;margin-bottom:.5em}h3{margin:0;margin-bottom:.5em;font-size:1.3em}h4{margin:0;margin-bottom:.8em;margin-top:.4em}.oneline-space{height:1em}.comment-form{margin-left:10px;max-width:500px}.comment-form input:required{box-shadow:none}.editingable:not(.time-to-edit) .edit{display:none}.editingable.time-to-edit .notedit{display:none}input[type=text],input[type=password],textarea{background:#444a;border:1px solid #444;color:inherit;display:block;padding:.5em}input[type=text],input[type=password]{width:100%}textarea{resize:vertical;width:100%}input[type=submit]{background:#444a;border:2px solid #666a;border-radius:4px;color:inherit;padding:.4em 1.8em}input[type=submit]:active{background:#000a;border:2px solid #444a}label{padding:.4em}.baseform input[type=text],.baseform input[type=password],.baseform textarea,.pageform input[type=text],.pageform input[type=password],.pageform textarea{width:100%}.baseform input[type=checkbox],.pageform input[type=checkbox]{margin:.5em}.baseform input[type=submit],.pageform input[type=submit]{margin:.2em}.baseform form>input,.baseform form>textarea,.baseform form>div,.pageform form>input,.pageform form>textarea,.pageform form>div{margin:.8em 0}.baseform div.row,.pageform div.row{display:flex;align-items:center}.baseform div.row.stretch,.pageform div.row.stretch{justify-content:space-between}.baseform div.row label,.pageform div.row label{padding:0;margin-left:.2em;margin-right:.6em}.baseform ul,.pageform ul{padding:0;margin:0}.baseform ul li,.pageform ul li{list-style-type:none}.pageform{padding:1em;width:300px;margin:0 auto}.tag-input .tag-suggester{width:100%;position:relative}.tag-input .tag-suggester input[type=text]{margin:.3em 0}.tag-input .tag-suggester>.suggest-dropdown{display:flex;align-items:start;width:100%;top:100%;position:absolute;z-index:10;overflow:auto;background-color:#2d2d2de0}.tag-input .tag-suggester>.suggest-dropdown:not(:empty){padding:.2em}.tag-input .tag-suggester>.suggest-dropdown>a.sug-sel{background-color:#242424}.tag-input .tag-container{display:flex;flex-flow:row wrap}.tag-input .tag-container:empty{display:none}.tag-input .tag-container>a{display:flex;justify-content:space-between;overflow:hidden;align-items:baseline;margin:.2em;padding:.35em .6em;border-radius:4px;background-color:#121212ff;cursor:pointer}.tag-input .tag-container>a .content{margin:0 .4em;flex-grow:1;flex-basis:100%}.tag-input .tag-container>a .tag-icon,.tag-input .tag-container>a .tag-right{align-self:center}.tag-input .tag-container>a .count{font-size:.8em;margin-right:.4em}.tag-input .tag-container>a>*{pointer-events:none}.tag-input .tag-container>a:not(:hover) span.close{opacity:0}.tag-input .tag-container>a:not(:hover) span.plus{opacity:0}.tag-input .tag-container>a.tagselected{background-color:#400808ff}.tag-input .tag-container>a.tag_hide{display:none}header{display:flex;align-items:baseline;padding:0 10px;background-color:#222}header>a.logo{font-size:2em;margin:6px}@media(max-width:559px){header{position:relative}}header>nav{flex-grow:1;display:flex}header>nav>._overlay{display:none}@media(max-width:559px){header>nav{display:none}header>nav._drop{display:flex;flex-flow:column nowrap;position:absolute;margin:0;top:100%;left:0;right:0;z-index:10;background-color:#111d}header>nav>a,header>nav a#user-menu,header>nav .user_dropdown>a{padding:12px;padding-left:24px}header>nav>a:hover,header>nav>a:active,header>nav a#user-menu:hover,header>nav a#user-menu:active,header>nav .user_dropdown>a:hover,header>nav .user_dropdown>a:active{background-color:#333}header>nav .user::before{content:"";display:block;border-top:1px solid grey;margin:2px 12px}header>nav .user #user-menu{display:block}header>nav .user .user_dropdown{display:flex;flex-flow:column nowrap}header>nav>._overlay{display:block;position:fixed;width:100%;height:100%;z-index:-1;background-color:#0006}html.oh{overflow:hidden}}@media(min-width:560px){header>nav{margin:0 5px;align-items:center}header>nav>*{margin:0 5px;padding:6px 0}header>nav>.user{padding:0;margin-left:auto;margin-right:0;position:relative}header>nav>.user #user-menu{display:block;padding:6px 10px}header>nav>.user .user_dropdown{display:none}header>nav>.user .user_dropdown a{padding:10px}header>nav>.user .user_dropdown a:hover{background-color:#333}header>nav>.user:hover>.user_dropdown{display:flex;flex-flow:column nowrap;position:absolute;margin:0;top:100%;right:0;z-index:10;background-color:#111d}}header>#nav-menu{display:none}@media(max-width:559px){header>#nav-menu{display:block;margin:5px;margin-left:auto;padding:0 2px;align-self:center;font-size:2em;cursor:pointer}}.main-wrap{margin:0 auto;max-width:1300px;padding:8px;padding-top:0;padding-bottom:0}.main-wrap .important-subwrap{display:flex;overflow:visible}@media(max-width:899px){.main-wrap .important-subwrap{flex-flow:column nowrap}}@media(min-width:900px){.main-wrap .important-subwrap{flex-flow:row nowrap}}.main-wrap .important-subwrap>section.sidepanel{flex-shrink:0;padding:10px}@media(min-width:900px){.main-wrap .important-subwrap>section.sidepanel{width:18rem;height:0}}.main-wrap .important-subwrap>section.sidepanel article:not(:last-child){margin-bottom:10px}@media(max-width:899px){.main-wrap .important-subwrap>section.sidepanel article.tags .tag-container,.main-wrap .important-subwrap>section.sidepanel article.post-edit .tag-container{flex-flow:row wrap}}@media(min-width:900px){.main-wrap .important-subwrap>section.sidepanel article.tags .tag-container,.main-wrap .important-subwrap>section.sidepanel article.post-edit .tag-container{flex-flow:column nowrap;align-items:start}.main-wrap .important-subwrap>section.sidepanel article.tags .suggest-dropdown,.main-wrap .important-subwrap>section.sidepanel article.post-edit .suggest-dropdown{flex-flow:row wrap}.main-wrap .important-subwrap>section.sidepanel article.tags .suggest-dropdown a,.main-wrap .important-subwrap>section.sidepanel article.post-edit .suggest-dropdown a{width:100%}}.main-wrap .important-subwrap>section.sidepanel article.rating ul{padding:0}.main-wrap .important-subwrap>section.sidepanel article.rating ul li{list-style-type:none}.main-wrap .important-subwrap>section.sidepanel article.post-desc{display:flex;flex-flow:column nowrap;font-size:.9em}.main-wrap .important-subwrap>section.sidepanel article.post-desc .source>a{word-break:break-all}.main-wrap .important-subwrap>section.sidepanel article.post-desc>img{display:block;max-width:128px}.main-wrap .important-subwrap>section.sidepanel article.sidenav>a{display:block;padding:.3em 1em}@media(min-width:900px){.main-wrap .important-subwrap>section:not(.sidepanel){width:100%}}.main-wrap section.post-list{overflow:hidden}@media(max-width:559px){.main-wrap section.post-list{margin-left:-8px;margin-right:-8px}}.main-wrap section.post-list .posts{display:flex;flex-flow:row wrap}@media(max-width:899px){.main-wrap section.post-list .posts{margin-left:-8px;margin-right:-8px}}.main-wrap section.post-list .posts::after{content:"";flex:10000 0 350px}.main-wrap section.post-list .posts>figure{position:relative;margin:8px}.main-wrap section.post-list .posts>figure img{display:block;width:100%;height:100%;transition:.2s ease}.main-wrap section.post-list .posts>figure:hover img{opacity:.7}@media(min-width:900px){.main-wrap section.post-single{padding:8px}}@media(max-width:899px){.main-wrap section.post-single{order:-1;margin-bottom:8px}}@media(max-width:559px){.main-wrap section.post-single{margin-left:-8px;margin-right:-8px}}.main-wrap section.post-single img{display:block;max-width:100%}.main-wrap section.comments{padding:10px}@media(min-width:900px){.main-wrap section.comments{margin-left:18rem}}.main-wrap section.comments>.comment-container{padding:0 10px;max-width:500px}.main-wrap section.comments>.comment-container article.comment{overflow:hidden;margin-bottom:1em}.main-wrap section.comments>.comment-container article.comment p,.main-wrap section.comments>.comment-container article.comment textarea{margin:0}.main-wrap section.comments>.comment-container article.comment p.deleted,.main-wrap section.comments>.comment-container article.comment textarea.deleted{color:red}.main-wrap section.comments>.comment-container article.comment .comment-head{display:flex;justify-content:space-between}.main-wrap section.management-table table{margin:0 auto}.main-wrap section.management-table tr{background-color:#303030}.main-wrap section.management-table tr th,.main-wrap section.management-table tr td{padding:6px 10px}.main-wrap section.management-table tr th{background-color:#606060}.main-wrap section.management-table tr label>input{display:none}.main-wrap section.management-table tr .fa{padding:4px 4px;align-self:center;font-size:1.5em;cursor:pointer}@media(min-width:900px){.main-wrap section.manage-profile{margin-right:18rem}}.main-wrap .pagin{margin:10px 0;display:flex;flex-flow:row nowrap;justify-content:center}.main-wrap .pagin>a{display:block;background-color:#0005;padding:8px 12px;margin:0 2px}footer{padding:10px;text-align:center}*{box-sizing:border-box}body{margin:0;font-family:Verdana,Geneva,Tahoma,sans-serif;background-color:#222;color:#fff}a{color:#bbb;text-decoration:none}a:hover{color:#909090;text-decoration:none} \ No newline at end of file diff --git a/yadc/templates/layout/base.html b/yadc/templates/layout/base.html index 2c2a465..b3fce1c 100644 --- a/yadc/templates/layout/base.html +++ b/yadc/templates/layout/base.html @@ -37,12 +37,12 @@
{% if current_user.is_anonymous %} - Login + Login Register {% else %} Profile Settings - Log out + Log out {% endif%}
@@ -61,7 +61,7 @@ {% endif %} {% endwith %} -
+
{% block content %}{% endblock %}
diff --git a/yadc/templates/manage/posts.html b/yadc/templates/manage/posts.html index 0bd8a25..c35e1ba 100644 --- a/yadc/templates/manage/posts.html +++ b/yadc/templates/manage/posts.html @@ -17,6 +17,7 @@ Rating Status Source +Parent {% endblock %} {% block fields %} @@ -39,4 +40,8 @@ {% call genfield(element.editform.source) %} {{ element.source }} {% endcall %} + + {% call genfield(element.editform.parent) %} + {{ element.parent_id or '' }} + {% endcall %} {% endblock %} \ No newline at end of file diff --git a/yadc/templates/post/post.html b/yadc/templates/post/post.html index 0a5b948..7448a5a 100644 --- a/yadc/templates/post/post.html +++ b/yadc/templates/post/post.html @@ -10,9 +10,7 @@ {% if post.is_approved %}
Approved by: {{ post.approver.username }}
- {% endif %} - - {% if not post.is_approved %} + {% else %}
Status: {{ post.status.name.capitalize() }}
{% endif %} @@ -20,8 +18,21 @@
File size: {{ post.filesize_human }}
Image res: {{ post.image_resolution }}
- + {% if post.parent %} + + {% endif %} + {% if post.children %} +
+ Children: + {% for child in post.children %} + #{{child.id}} + {% endfor%} +
+ {% endif %} + +
+ {% if not post.filetype.is_jpeg %} {% endif %} @@ -39,11 +50,14 @@ {{ editform.referer() }} {{ editform.source }} +
+ {{ editform.parent.label }} + {{ editform.parent }} +
{{ render_tag_input(editform.tags, {'alt-selblock': 'section.sidepanel article.tags .tags-inpage'}) }} - {{ editform.edit() }} - {{ editform.approve() }} + {{ editform.edit() }}{{ editform.approve() }}
@@ -104,7 +118,7 @@ {% if current_user.is_authenticated %}

Reply

-
+
{{ comment_form.csrf_token }} {{ comment_form.post_id() }}