diff --git a/app/post/routes.py b/app/post/routes.py index 3f6fa099..daf12fdb 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -272,7 +272,8 @@ def post_vote(post_id: int, vote_direction): current_user.recalculate_attitude() db.session.commit() post.flush_cache() - return render_template('post/_post_voting_buttons.html', post=post, community=post.community, + template = 'post/_post_voting_buttons.html' if request.args.get('style', '') == '' else 'post/_post_voting_buttons_masonry.html' + return render_template(template, post=post, community=post.community, upvoted_class=upvoted_class, downvoted_class=downvoted_class) diff --git a/app/static/structure.css b/app/static/structure.css index bf9be186..c105f452 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -671,13 +671,20 @@ fieldset legend { width: 100%; height: auto; } +.post_list_masonry .post_teaser .masonry_thumb a, .post_list_masonry_wide .post_teaser .masonry_thumb a { + border: none; +} .post_list_masonry .post_teaser .masonry_info, .post_list_masonry_wide .post_teaser .masonry_info { position: absolute; bottom: 0; - background-color: rgba(0, 0, 0, 0.2); + background-color: rgba(0, 0, 0, 0.3); width: 100%; text-align: center; } +.post_list_masonry .post_teaser .masonry_info .voting_buttons_masonry, .post_list_masonry_wide .post_teaser .masonry_info .voting_buttons_masonry { + width: 100%; + display: flex; +} .post_list_masonry .post_teaser .masonry_info p, .post_list_masonry_wide .post_teaser .masonry_info p { margin-bottom: 0; } @@ -691,6 +698,49 @@ fieldset legend { line-height: 30px; } } +.post_list_masonry .post_teaser .masonry_info .row, .post_list_masonry_wide .post_teaser .masonry_info .row { + margin-left: 0; + margin-right: 0; +} +.post_list_masonry .post_teaser .masonry_info .row .col, .post_list_masonry_wide .post_teaser .masonry_info .row .col { + padding: 0; + flex-direction: row; + display: inline-flex; +} +.post_list_masonry .post_teaser .masonry_info .row .col a, .post_list_masonry_wide .post_teaser .masonry_info .row .col a { + color: white; +} +.post_list_masonry .post_teaser .masonry_info .row .col .upvote_button, .post_list_masonry .post_teaser .masonry_info .row .col .downvote_button, .post_list_masonry_wide .post_teaser .masonry_info .row .col .upvote_button, .post_list_masonry_wide .post_teaser .masonry_info .row .col .downvote_button { + display: inline; + color: white; + padding-top: 5px; + width: 50%; + position: relative; +} +.post_list_masonry .post_teaser .masonry_info .row .col .upvote_button .htmx-indicator, .post_list_masonry .post_teaser .masonry_info .row .col .downvote_button .htmx-indicator, .post_list_masonry_wide .post_teaser .masonry_info .row .col .upvote_button .htmx-indicator, .post_list_masonry_wide .post_teaser .masonry_info .row .col .downvote_button .htmx-indicator { + position: absolute; + width: 20px; + height: 20px; + left: 7px; +} +.post_list_masonry .post_teaser .masonry_info .row .col .upvote_button.voted_up, .post_list_masonry .post_teaser .masonry_info .row .col .downvote_button.voted_up, .post_list_masonry_wide .post_teaser .masonry_info .row .col .upvote_button.voted_up, .post_list_masonry_wide .post_teaser .masonry_info .row .col .downvote_button.voted_up { + color: #00b550; +} +.post_list_masonry .post_teaser .masonry_info .row .col .upvote_button.voted_down, .post_list_masonry .post_teaser .masonry_info .row .col .downvote_button.voted_down, .post_list_masonry_wide .post_teaser .masonry_info .row .col .upvote_button.voted_down, .post_list_masonry_wide .post_teaser .masonry_info .row .col .downvote_button.voted_down { + color: red; +} +.post_list_masonry .post_teaser .masonry_info .row .col-8, .post_list_masonry_wide .post_teaser .masonry_info .row .col-8 { + justify-content: center; +} +.post_list_masonry .post_teaser .masonry_info .row .col-8 p, .post_list_masonry_wide .post_teaser .masonry_info .row .col-8 p { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.post_list_masonry .post_teaser .masonry_info .row .reply_col, .post_list_masonry_wide .post_teaser .masonry_info .row .reply_col { + justify-content: right; + padding-right: 5px; +} .post_list_masonry .post_teaser .masonry_info_no_image, .post_list_masonry_wide .post_teaser .masonry_info_no_image { background-color: rgba(0, 0, 0, 0.2); width: 100%; diff --git a/app/static/structure.scss b/app/static/structure.scss index 36b6be8b..6113086f 100644 --- a/app/static/structure.scss +++ b/app/static/structure.scss @@ -299,12 +299,21 @@ nav, etc which are used site-wide */ height: auto; } + .masonry_thumb a { + border: none; + } + .masonry_info { position: absolute; bottom: 0; - background-color: rgba(0, 0, 0, 0.2); + background-color: rgba(0, 0, 0, 0.3); width: 100%; text-align: center; + + .voting_buttons_masonry { + width: 100%; + display: flex; + } p { margin-bottom: 0; @@ -317,6 +326,55 @@ nav, etc which are used site-wide */ } } } + .row { + margin-left: 0; + margin-right: 0; + + .col { + padding: 0; + flex-direction: row; + display: inline-flex; + + a { + color: white; + } + + .upvote_button, .downvote_button { + display: inline; + color: white; + padding-top: 5px; + width: 50%; + position: relative; + + .htmx-indicator { + position: absolute; + width: 20px; + height: 20px; + left: 7px; + } + + &.voted_up { + color: $green; + } + &.voted_down { + color: red; + } + } + } + .col-8 { + justify-content: center; + p { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + } + + .reply_col { + justify-content: right; + padding-right: 5px; + } + } } .masonry_info_no_image { diff --git a/app/templates/post/_post_teaser_masonry.html b/app/templates/post/_post_teaser_masonry.html index 7af4525a..096add77 100644 --- a/app/templates/post/_post_teaser_masonry.html +++ b/app/templates/post/_post_teaser_masonry.html @@ -31,7 +31,20 @@ {% endif %}