diff --git a/make_post_sell/static/css/common.css b/make_post_sell/static/css/common.css index f65676c..03c3975 100644 --- a/make_post_sell/static/css/common.css +++ b/make_post_sell/static/css/common.css @@ -299,6 +299,49 @@ button.mps-button-red { opacity: 0.8; } +.mps-cancel-button, +.mps-comment-form-button { + display: inline-block; + padding: 6px 12px; + border: 1px solid #ccc; + border-radius: 4px; + background: #f9f9f9; + color: #333; + font-size: 14px; + cursor: pointer; + margin: 0; + text-decoration: none; + vertical-align: top; + box-sizing: border-box; +} + +.comment-actions { + margin-bottom: 42px; + display: grid; + grid-auto-flow: column; + grid-template-columns: repeat(auto-fit, max-content); + justify-content: start; + gap: 5px; +} + +.reply-link, +.edit-link, +.delete-link, +.moderate-link { + display: inline-block; + padding: 6px 12px; + border: 1px solid #ccc; + border-radius: 4px; + background: #f9f9f9; + color: #333; + font-size: 14px; + cursor: pointer; + margin: 0; + text-decoration: none; + vertical-align: top; + box-sizing: border-box; +} + a.product-edit-button { background-color: #98b6fa; } @@ -685,10 +728,28 @@ textarea.markup-editor-textarea { @media (max-width: 800px) { /* the two-column is stacked by default. */ section.two-column { + display: grid; + grid-template-columns: 1fr; max-width: 600px; margin-left: auto; margin-right: auto; } + + /* On mobile, show price section before description */ + section.product-left { + order: 2; + } + + section.product-right { + order: 1; + width: 100%; + } + + /* Ensure buttons get full width on mobile */ + section.product-right .mps-button { + width: 100%; + min-width: 100%; + } /* the cart-grid is stacked by default. */ section.cart-grid { @@ -725,13 +786,14 @@ textarea.markup-editor-textarea { /* We have the room to really break into 2 columns */ section.two-column { display: grid; - grid-template-columns: 1fr 1fr; - grid-auto-columns: max-content; - grid-auto-flow: dense; - gap: 0px 60px; - padding-left: 60px; - padding-right: 60px; - justify-items: center; + grid-template-columns: 2fr 1fr; + gap: 40px; + max-width: 1200px; + margin-left: auto; + margin-right: auto; + padding-left: 40px; + padding-right: 40px; + align-items: start; } /* if we have room, break markup-editor into 2 columns */ diff --git a/make_post_sell/templates/comments/edit_comment.j2 b/make_post_sell/templates/comments/edit_comment.j2 index 63e03ca..20f16f3 100644 --- a/make_post_sell/templates/comments/edit_comment.j2 +++ b/make_post_sell/templates/comments/edit_comment.j2 @@ -1,29 +1,31 @@ {% extends "base.j2" -%} -{% block content -%} - -
-
- -

Edit Comment

+{% block title %}Edit Comment{% endblock %} +{% block content %} +
+

Edit Comment

+ +
+
+ {{ comment.user.name if comment.user else "Anonymous" }} + {{ comment.ago_string }} +
+
+ {{ comment.data_html | safe }} +
+
+
- - - - -
-
- - - Cancel - -
-
- +
+ + +
+ +
+ Cancel + +
- -
-
- -{%- endblock -%} \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/make_post_sell/templates/comments/reply_comment.j2 b/make_post_sell/templates/comments/reply_comment.j2 index 2dea33a..1970cbc 100644 --- a/make_post_sell/templates/comments/reply_comment.j2 +++ b/make_post_sell/templates/comments/reply_comment.j2 @@ -19,13 +19,12 @@
- - You can use Markdown formatting. +
- - Cancel + Cancel +
diff --git a/make_post_sell/templates/content.j2 b/make_post_sell/templates/content.j2 index 93cbb81..da582c1 100644 --- a/make_post_sell/templates/content.j2 +++ b/make_post_sell/templates/content.j2 @@ -17,16 +17,7 @@ {%- endif %} - {% if product.has_product_file and signed_get_object_url is not none %} - - {% endif %} + {# Removed auto-refresh timer - better UX to let download links expire than interrupt reading #} {%- endblock append_to_head_tag_section -%} diff --git a/make_post_sell/templates/product.j2 b/make_post_sell/templates/product.j2 index 388e502..2d96609 100644 --- a/make_post_sell/templates/product.j2 +++ b/make_post_sell/templates/product.j2 @@ -17,16 +17,7 @@ {%- endif %} - {% if product.has_product_file and signed_get_object_url is not none %} - - {% endif %} + {# Removed auto-refresh timer - better UX to let download links expire than interrupt reading #} {%- endblock append_to_head_tag_section -%} {%- block call_to_action -%} @@ -41,11 +32,7 @@
-

{{ product.title }}

-

- sold by - {{ product.shop.name }} -

+

{{ product.title }} sold by {{ product.shop.name }}

{% if "thumbnail1" in product.extensions %} @@ -59,14 +46,47 @@ {% endif %} {% endfor %} +
+
+ + Description +
{{ product.description_html | safe }}
+ +
+
+ + {% if product.is_bundle %} + {% if product.products_in_this_bundle %} + Bundle Contents + + {% endif %} + {% elif product.has_product_file %} + File Type +
+ {{ product.get_content_type("product") }} {{ product_size }} +
+ Please make sure you have an application to open this file type. + {% endif %} + +
+
+ + + {% include 'snippets/comments.j2' %} + +
+ Back to shop +
-
-
-
-

${{ '{:,.2f}'.format(product.price) }}

@@ -132,46 +152,5 @@
-
- -
- - Description -
{{ product.description_html | safe }}
- -
-
- - {% if product.is_bundle %} - - {% if product.products_in_this_bundle %} - - {% endif %} - - {% elif product.has_product_file %} - File Type -
- {{ product.get_content_type("product") }} {{ product_size }} -
- Please make sure you have an application to open this file type. - - {% endif %} - -
-
- - - {% include 'snippets/comments.j2' %} - -
- Back to shop - -
{%- endblock -%} diff --git a/make_post_sell/templates/snippets/comments.j2 b/make_post_sell/templates/snippets/comments.j2 index cf37b92..5eeb784 100644 --- a/make_post_sell/templates/snippets/comments.j2 +++ b/make_post_sell/templates/snippets/comments.j2 @@ -17,30 +17,29 @@
- {% if request.user.authenticated and not comment.is_locked %} - {% set can_comment, error_msg = comment.can_user_comment(request.user, shop) %} - {% if can_comment %} - Reply + {% if request.user.authenticated and (request.user.id == comment.user_id or comment.can_user_moderate(request.user, shop)) %} + + + {% endif %} + + {% if request.user.authenticated and comment.can_user_moderate(request.user, shop) %} + {% if comment.approved %} + + + {% else %} + + {% endif %} {% endif %} {% if request.user.authenticated and (request.user.id == comment.user_id or comment.can_user_moderate(request.user, shop)) %} Edit - -
- -
{% endif %} - {% if request.user.authenticated and comment.can_user_moderate(request.user, shop) %} - {% if comment.approved %} -
- -
- {% else %} -
- -
+ {% if request.user.authenticated and not comment.is_locked %} + {% set can_comment, error_msg = comment.can_user_comment(request.user, shop) %} + {% if can_comment %} + Reply {% endif %} {% endif %}
@@ -84,7 +83,7 @@
- +
diff --git a/make_post_sell/views/comment.py b/make_post_sell/views/comment.py index 4a2ce6e..59e2fba 100644 --- a/make_post_sell/views/comment.py +++ b/make_post_sell/views/comment.py @@ -268,11 +268,23 @@ def comment_delete(request): product_url = comment.product.absolute_url(request) + # Determine which comment to anchor to after deletion + if comment.parent_id: + # For replies, anchor to the parent comment + anchor_comment_id = comment.parent_id + else: + # For root comments, just go to the product page + anchor_comment_id = None + # Soft delete using disable method comment.disable() request.session.flash(("Comment deleted successfully", "success")) - return HTTPFound(location=product_url) + + if anchor_comment_id: + return HTTPFound(location=f"{product_url}#comment-{anchor_comment_id}") + else: + return HTTPFound(location=product_url) @view_config(route_name="comment_approve", request_method="POST") @@ -294,7 +306,15 @@ def comment_approve(request): comment.stamp_updated_timestamp() request.session.flash(("Comment approved", "success")) - return HTTPFound(location=get_referer_or_home(request)) + + # Determine which comment to anchor to after approval + product_url = comment.product.absolute_url(request) + if comment.parent_id: + # For replies, anchor to the parent comment + return HTTPFound(location=f"{product_url}#comment-{comment.parent_id}") + else: + # For root comments, anchor to the comment itself + return HTTPFound(location=f"{product_url}#comment-{comment.id}") @view_config(route_name="comment_unapprove", request_method="POST") @@ -316,7 +336,15 @@ def comment_unapprove(request): comment.stamp_updated_timestamp() request.session.flash(("Comment unapproved", "success")) - return HTTPFound(location=get_referer_or_home(request)) + + # Determine which comment to anchor to after unapproval + product_url = comment.product.absolute_url(request) + if comment.parent_id: + # For replies, anchor to the parent comment + return HTTPFound(location=f"{product_url}#comment-{comment.parent_id}") + else: + # For root comments, anchor to the comment itself + return HTTPFound(location=f"{product_url}#comment-{comment.id}") @view_config(route_name="comment_undelete", request_method="POST")