From 527c11d75eec5540b50aed618099f4c061b39a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ku=C5=BE=C3=ADlek?= Date: Fri, 24 Apr 2020 19:32:00 +0200 Subject: [PATCH] Tag management validation, posts - differentiate and hide pending on index, UI fixes + tag rendering in "places", post - show rating, minor cleanups --- yadc/assets/css/default.scss | 8 ++++++ yadc/bp/post.py | 3 ++ yadc/bp/user.py | 2 +- yadc/forms.py | 14 +++++++--- yadc/static/all.css | 2 +- yadc/templates/_includes.html | 16 +++++++++-- yadc/templates/post/index.html | 19 ++++--------- yadc/templates/post/post.html | 46 +++---------------------------- yadc/templates/post/upload.html | 2 -- yadc/templates/user/profile.html | 4 +-- yadc/templates/user/settings.html | 2 +- 11 files changed, 49 insertions(+), 69 deletions(-) diff --git a/yadc/assets/css/default.scss b/yadc/assets/css/default.scss index a3b1c99..a094eef 100644 --- a/yadc/assets/css/default.scss +++ b/yadc/assets/css/default.scss @@ -49,6 +49,11 @@ margin-bottom: 10px; } + h3 { + margin: 0; + margin-bottom: .5em; + } + article.tags, article.post-edit { @include media($bp-tablet) { .tag-container /*:not(.suggest-dropdown)*/ { @@ -141,6 +146,9 @@ position: relative; margin: $figure-margin; + &[data-status="pending"] { + border: 4px solid #0044ff; + } img { display: block; diff --git a/yadc/bp/post.py b/yadc/bp/post.py index 4d24a03..aa125ba 100644 --- a/yadc/bp/post.py +++ b/yadc/bp/post.py @@ -51,6 +51,8 @@ def posts(page): posts_query = posts_query.filter(~Post.id.in_(subquery)) if f_tags: posts_query = posts_query.filter(Tag.content.in_(f_tags)).having(func.count(Post.id)==len(f_tags)) + if current_user.is_anonymous or not current_user.is_moderator: + posts_query = posts_query.filter_by(status=POST_STATUS.active) posts_query = posts_query.filter(Post.rating.in_(m_ratings)).order_by(Post.created.desc()) posts = posts_query.paginate(page, current_app.config.get('POSTS_PER_PAGE')) @@ -58,6 +60,7 @@ def posts(page): return render_template( 'post/index.html', posts=posts, + # posts=[p for p in posts if p.status is POST_STATUS.active] if current_user.is_anonymous or not current_user.is_moderator else posts, tags=tags, sel_tags=[tag for tag in tags if tag.content in f_tags] or Tag.query.filter(Tag.content.in_(f_tags)) ) diff --git a/yadc/bp/user.py b/yadc/bp/user.py index 86079f5..82fe051 100644 --- a/yadc/bp/user.py +++ b/yadc/bp/user.py @@ -35,7 +35,7 @@ def settings(): pass_form=ChangePassForm(), mail_form=ChangeMailForm(), rating_form=ChangeUserRatingForm(rating=current_user.rating.name), - tags_form=ChangeTagBlacklistForm(tags=' '.join(t.content for t in current_user.tag_blacklist)), + tags_form=ChangeTagBlacklistForm(tags=' '.join(t.content for t in current_user.tag_blacklist)), tags_form_tags=current_user.tag_blacklist, delete_form=DeleteUserDataForm() ) diff --git a/yadc/forms.py b/yadc/forms.py index 62be182..eb69ed4 100644 --- a/yadc/forms.py +++ b/yadc/forms.py @@ -1,6 +1,6 @@ from wtforms import Form 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 wtforms.validators import DataRequired, InputRequired, Email, EqualTo, AnyOf, optional, StopValidation, URL, Regexp from werkzeug.utils import cached_property @@ -8,7 +8,7 @@ from flask import current_app, flash from flask_wtf.csrf import _FlaskFormCSRF from yadc.models import USER_STATUS, OP_LEVEL, RATING, POST_STATUS, TAG_CATEGORY -from yadc.models import User, Post +from yadc.models import User, Post, Tag class CSRFForm(Form): class Meta: @@ -179,10 +179,16 @@ class PostForm(EditForm): approve = SubmitField('Approve') class TagForm(EditForm): - content = StringField('Content', validators=[validate_create_required], render_kw=dict(autocomplete='off')) + content = StringField('Content', validators=[optional(), validate_create_required, Regexp('^[a-zA-Z0-9\-\_\ ]+$')], render_kw=dict(autocomplete='off')) category = SelectField('Category', choices=[(e.name, e.name.capitalize()) for e in TAG_CATEGORY], - validators=[optional()]) + validators=[optional()] + ) + + def validate_content(form, field): + if form.create.data and Tag.query.filter_by(content=field.data).first(): + raise ValidationError('Tag already exists.') + # Creation/editing only through post page class CommentForm(EditForm): diff --git a/yadc/static/all.css b/yadc/static/all.css index 9455c11..ee16aae 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-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!important}.editingable:not(.time-to-edit):hover .jsoff-show.edit{display:initial!important}.editingable:not(.time-to-edit):hover .jsoff-show.notedit{display:none!important}.editingable:not(.time-to-edit) .jsoff-hide.edit,.editingable:not(.time-to-edit) .jsoff-hide.notedit{display:none!important}.editingable.time-to-edit .notedit{display:none!important}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>input,.baseform>textarea,.baseform>div,.baseform form>input,.baseform form>textarea,.baseform form>div,.pageform>input,.pageform>textarea,.pageform>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-container{display:flex;flex-flow:row wrap}.tag-container:empty{display:none}.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-container>a .content{margin:0 .4em;flex-grow:1;flex-basis:100%;word-break:break-word;overflow-wrap:anywhere}.tag-container>a[data-tagcat="general"] .content{color:unset}.tag-container>a[data-tagcat="style"] .content{color:#ff2020}.tag-container>a[data-tagcat="circle"] .content{color:#0bb}.tag-container>a[data-tagcat="artist"] .content{color:#cc0}.tag-container>a[data-tagcat="character"] .content{color:#0a0}.tag-container>a[data-tagcat="copyright"] .content{color:#d0d}.tag-container>a .tag-icon,.tag-container>a .tag-right{align-self:center}.tag-container>a .count{font-size:.8em;margin-right:.4em}.tag-container>a>*{pointer-events:none}.tag-container>a:not(:hover) span.close{opacity:0}.tag-container>a:not(:hover) span.plus{opacity:0}.tag-container>a.tagselected{background-color:#400808ff}.tag-container>a.tag_hide{display:none}.comment-container{max-width:500px}.comment-container article.comment{overflow:hidden;margin:.4em .4em;padding:.4em .4em}.comment-container article.comment p,.comment-container article.comment textarea{margin:0}.comment-container article.comment p.deleted,.comment-container article.comment textarea.deleted{color:red}.comment-container article.comment .comment-head{display:flex;justify-content:space-between;align-items:baseline}.comment-container article.comment .comment-head h4{margin:0;padding:.4em}.comment-container article.comment .comment-head a,.comment-container article.comment .comment-head label{cursor:pointer}.comment-container article.comment .comment-head .controls{display:flex}.comment-container article.comment .comment-head .controls label>input{display:none}.comment-container article.comment .comment-editform p{padding:.5em}.comment-container article.comment .comment-editform textarea{font-size:inherit;font-family:inherit;border: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;display:flex}@media(min-width:900px){.main-wrap{flex-flow:row nowrap}}@media(max-width:899px){.main-wrap{flex-flow:column nowrap}}@media(max-width:899px){.main-wrap{overflow:visible}}.main-wrap .important-subwrap{display:flex;flex-flow:column nowrap;flex-grow:1;overflow:visible}@media(max-width:899px){.main-wrap .important-subwrap{display:contents}}.main-wrap>section.sidepanel{flex-shrink:0;padding:10px}@media(min-width:900px){.main-wrap>section.sidepanel{width:18rem}}.main-wrap>section.sidepanel article:not(:last-child){margin-bottom:10px}@media(max-width:899px){.main-wrap>section.sidepanel article.tags .tag-container,.main-wrap>section.sidepanel article.post-edit .tag-container{flex-flow:row wrap}}@media(min-width:900px){.main-wrap>section.sidepanel article.tags .tag-container,.main-wrap>section.sidepanel article.post-edit .tag-container{flex-flow:column nowrap;align-items:start}.main-wrap>section.sidepanel article.tags .suggest-dropdown,.main-wrap>section.sidepanel article.post-edit .suggest-dropdown{flex-flow:row wrap}.main-wrap>section.sidepanel article.tags .suggest-dropdown a,.main-wrap>section.sidepanel article.post-edit .suggest-dropdown a{width:100%}}.main-wrap>section.sidepanel article.rating ul{padding:0}.main-wrap>section.sidepanel article.rating ul li{list-style-type:none}.main-wrap>section.sidepanel article.post-desc{display:flex;flex-flow:column nowrap;font-size:.9em}.main-wrap>section.sidepanel article.post-desc .source>a{word-break:break-all}.main-wrap>section.sidepanel article.post-desc>img{display:block;max-width:128px}.main-wrap>section.sidepanel article.sidenav>a{display:block;padding:.3em 1em}@media(min-width:900px){.main-wrap 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}.main-wrap section.management-table{overflow-x:auto}.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}.main-wrap .user-main,.main-wrap .user-comments{flex-grow:1;flex-basis:0;padding:10px}.main-wrap section.manage-profile>.baseform{margin:0 10px;margin-bottom:15px;max-width:500px}.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-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!important}.editingable:not(.time-to-edit):hover .jsoff-show.edit{display:initial!important}.editingable:not(.time-to-edit):hover .jsoff-show.notedit{display:none!important}.editingable:not(.time-to-edit) .jsoff-hide.edit,.editingable:not(.time-to-edit) .jsoff-hide.notedit{display:none!important}.editingable.time-to-edit .notedit{display:none!important}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>input,.baseform>textarea,.baseform>div,.baseform form>input,.baseform form>textarea,.baseform form>div,.pageform>input,.pageform>textarea,.pageform>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-container{display:flex;flex-flow:row wrap}.tag-container:empty{display:none}.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-container>a .content{margin:0 .4em;flex-grow:1;flex-basis:100%;word-break:break-word;overflow-wrap:anywhere}.tag-container>a[data-tagcat="general"] .content{color:unset}.tag-container>a[data-tagcat="style"] .content{color:#ff2020}.tag-container>a[data-tagcat="circle"] .content{color:#0bb}.tag-container>a[data-tagcat="artist"] .content{color:#cc0}.tag-container>a[data-tagcat="character"] .content{color:#0a0}.tag-container>a[data-tagcat="copyright"] .content{color:#d0d}.tag-container>a .tag-icon,.tag-container>a .tag-right{align-self:center}.tag-container>a .count{font-size:.8em;margin-right:.4em}.tag-container>a>*{pointer-events:none}.tag-container>a:not(:hover) span.close{opacity:0}.tag-container>a:not(:hover) span.plus{opacity:0}.tag-container>a.tagselected{background-color:#400808ff}.tag-container>a.tag_hide{display:none}.comment-container{max-width:500px}.comment-container article.comment{overflow:hidden;margin:.4em .4em;padding:.4em .4em}.comment-container article.comment p,.comment-container article.comment textarea{margin:0}.comment-container article.comment p.deleted,.comment-container article.comment textarea.deleted{color:red}.comment-container article.comment .comment-head{display:flex;justify-content:space-between;align-items:baseline}.comment-container article.comment .comment-head h4{margin:0;padding:.4em}.comment-container article.comment .comment-head a,.comment-container article.comment .comment-head label{cursor:pointer}.comment-container article.comment .comment-head .controls{display:flex}.comment-container article.comment .comment-head .controls label>input{display:none}.comment-container article.comment .comment-editform p{padding:.5em}.comment-container article.comment .comment-editform textarea{font-size:inherit;font-family:inherit;border: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;display:flex}@media(min-width:900px){.main-wrap{flex-flow:row nowrap}}@media(max-width:899px){.main-wrap{flex-flow:column nowrap}}@media(max-width:899px){.main-wrap{overflow:visible}}.main-wrap .important-subwrap{display:flex;flex-flow:column nowrap;flex-grow:1;overflow:visible}@media(max-width:899px){.main-wrap .important-subwrap{display:contents}}.main-wrap>section.sidepanel{flex-shrink:0;padding:10px}@media(min-width:900px){.main-wrap>section.sidepanel{width:18rem}}.main-wrap>section.sidepanel article:not(:last-child){margin-bottom:10px}.main-wrap>section.sidepanel h3{margin:0;margin-bottom:.5em}@media(max-width:899px){.main-wrap>section.sidepanel article.tags .tag-container,.main-wrap>section.sidepanel article.post-edit .tag-container{flex-flow:row wrap}}@media(min-width:900px){.main-wrap>section.sidepanel article.tags .tag-container,.main-wrap>section.sidepanel article.post-edit .tag-container{flex-flow:column nowrap;align-items:start}.main-wrap>section.sidepanel article.tags .suggest-dropdown,.main-wrap>section.sidepanel article.post-edit .suggest-dropdown{flex-flow:row wrap}.main-wrap>section.sidepanel article.tags .suggest-dropdown a,.main-wrap>section.sidepanel article.post-edit .suggest-dropdown a{width:100%}}.main-wrap>section.sidepanel article.rating ul{padding:0}.main-wrap>section.sidepanel article.rating ul li{list-style-type:none}.main-wrap>section.sidepanel article.post-desc{display:flex;flex-flow:column nowrap;font-size:.9em}.main-wrap>section.sidepanel article.post-desc .source>a{word-break:break-all}.main-wrap>section.sidepanel article.post-desc>img{display:block;max-width:128px}.main-wrap>section.sidepanel article.sidenav>a{display:block;padding:.3em 1em}@media(min-width:900px){.main-wrap 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[data-status="pending"]{border:4px solid #04f}.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}.main-wrap section.management-table{overflow-x:auto}.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}.main-wrap .user-main,.main-wrap .user-comments{flex-grow:1;flex-basis:0;padding:10px}.main-wrap section.manage-profile>.baseform{margin:0 10px;margin-bottom:15px;max-width:500px}.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/_includes.html b/yadc/templates/_includes.html index a412820..3f97c89 100644 --- a/yadc/templates/_includes.html +++ b/yadc/templates/_includes.html @@ -61,7 +61,7 @@ {% endmacro %} -{% macro render_tag_input(input_field, param_dict={}) %} +{% macro render_tag_input(input_field, sel_tags=[], param_dict={}) %}
{##} @@ -69,6 +69,18 @@
-
+
+ {% for tag in sel_tags %} + + + + + {{ tag.content_deser }} + + + + + {% endfor %} +
{% endmacro %} \ No newline at end of file diff --git a/yadc/templates/post/index.html b/yadc/templates/post/index.html index b8a266b..9265ad5 100644 --- a/yadc/templates/post/index.html +++ b/yadc/templates/post/index.html @@ -6,24 +6,17 @@ {% block main_content %}
+ {% if posts.items %} {% for post in posts.items %} -
+
- +
{% endfor %} - - + {% else %} +

Ooops. No content matching your filters.

+ {% endif %}
{{ render_pagination('post.posts', posts) }}
diff --git a/yadc/templates/post/post.html b/yadc/templates/post/post.html index b56743b..dd378bc 100644 --- a/yadc/templates/post/post.html +++ b/yadc/templates/post/post.html @@ -3,8 +3,6 @@ {% block sidebar %}
- -
Id: {{ post.id }}
Author: {{ post.author.username or "Deleted Account" }}
@@ -14,7 +12,11 @@
Status: {{ post.status.name.capitalize() }}
{% endif %} +
Rating: {{ post.rating.name.capitalize() }}
Posted: {{ post.natural_created() }}
+ {#{% if post.created != post.updated %} +
Last edited: {{ post.updated.date() }}
+ {% endif %}#}
File size: {{ post.filesize_human }}
Image res: {{ post.image_resolution }}
@@ -75,46 +77,6 @@

Comments

- {#
-
- {{ comment.editform.csrf_token }} - {{ comment.editform.id() }} -
-

{{ comment.user.username or "Deleted account" }}

- - {% if current_user.is_moderator %} - {% if not comment.deleted %} - - {% else %} - - {% endif %} - {% endif %} - {% if comment.is_author %} - - - - {% endif %} - -
- -
- {% if not comment.deleted or comment.is_author or current_user.is_moderator %} -

{{ comment.content }}

- {% endif %} - {% if comment.deleted %} -

[Comment banned]

- {% endif %} - - {% if comment.is_author %} - - {{ comment.editform.content(class="edit") }} - {{ comment.editform.edit(class="edit") }} - {{ comment.editform.delete(class="edit") }} - {% endif %} -
-
-
#} - {% for comment in comments %} {{ render_comment(comment, comment.editform) }} {% endfor %} diff --git a/yadc/templates/post/upload.html b/yadc/templates/post/upload.html index 345c017..e4b95b2 100644 --- a/yadc/templates/post/upload.html +++ b/yadc/templates/post/upload.html @@ -7,14 +7,12 @@
{{ form.csrf_token }}
- {#{{ form.post_img.label }}#} {{ form.post_img() }}
{{ form.sauce() }} {{ render_tag_input(form.tags) }} -
{{ form.rating.label }} diff --git a/yadc/templates/user/profile.html b/yadc/templates/user/profile.html index 67ed4a7..d777435 100644 --- a/yadc/templates/user/profile.html +++ b/yadc/templates/user/profile.html @@ -17,8 +17,8 @@

Statistics

Uploaded posts: {{ post_count }}
+ {% if user.is_moderator %}
Approved posts: {{ approved_count }}
{% endif %}
Posted comments: {{ comment_count }}
- {% if user.is_moderator %}
Approved comments: {{ approved_count }}
{% endif %}
{% if user.tag_blacklist %} @@ -33,10 +33,8 @@ {{ tag.content_deser }} - {##} - {#{{ tag.post_ids }}#} {% endfor %}
diff --git a/yadc/templates/user/settings.html b/yadc/templates/user/settings.html index 8de8191..1420ae0 100644 --- a/yadc/templates/user/settings.html +++ b/yadc/templates/user/settings.html @@ -54,7 +54,7 @@ {{ tags_form.csrf_token }} - {{ render_tag_input(tags_form.tags) }} + {{ render_tag_input(tags_form.tags, tags_form_tags) }} {{ tags_form.tags_submit() }}