Add shop setting to toggle product/content date visibility
Remove border-top from date metadata styling. Add show_dates boolean to Shop model (default on) with radio buttons in Branding Settings to show or hide created/updated dates on product and content pages.
This commit is contained in:
parent
875183d201
commit
726cf6eebb
7 changed files with 63 additions and 2 deletions
|
|
@ -124,6 +124,9 @@ class Shop(RBase, Base):
|
|||
# Default theme for shop visitors (0=dark, 1=light)
|
||||
default_theme = Column(BigInteger, nullable=False, default=1) # Default light mode
|
||||
|
||||
# Show created/updated dates on product and content pages
|
||||
show_dates = Column(Boolean, default=True)
|
||||
|
||||
# many to many uses association_proxy.
|
||||
users = association_proxy("shop_users", "user", creator=lambda u: UserShop(user=u))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
"""add show_dates to shop
|
||||
|
||||
Revision ID: ecb51cffd213
|
||||
Revises: 05be3044c2d2
|
||||
Create Date: 2026-02-01 11:23:33.791512
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ecb51cffd213'
|
||||
down_revision = '05be3044c2d2'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from make_post_sell.models.meta import UUIDType
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column(
|
||||
"mps_shop",
|
||||
sa.Column("show_dates", sa.Boolean(), nullable=False, server_default="1"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column("mps_shop", "show_dates")
|
||||
|
|
@ -2137,8 +2137,6 @@ img.crypto-button-icon {
|
|||
color: var(--text-muted);
|
||||
font-size: 0.8em;
|
||||
margin-top: 20px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
.original-comment-box {
|
||||
|
|
|
|||
|
|
@ -84,9 +84,11 @@
|
|||
<br/>
|
||||
{% endif %}
|
||||
|
||||
{% if request.shop.show_dates %}
|
||||
<div class="product-meta-dates">
|
||||
Created {{ product.human_created_timestamp }}{% if product.human_created_timestamp != product.human_updated_timestamp %} · Updated {{ product.human_updated_timestamp }}{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="product-comments">
|
||||
|
|
|
|||
|
|
@ -159,9 +159,11 @@
|
|||
Please make sure you have an application to open this file type.
|
||||
{% endif %}
|
||||
|
||||
{% if request.shop.show_dates %}
|
||||
<div class="product-meta-dates">
|
||||
Created {{ product.human_created_timestamp }}{% if product.human_created_timestamp != product.human_updated_timestamp %} · Updated {{ product.human_updated_timestamp }}{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="product-comments">
|
||||
|
|
|
|||
|
|
@ -727,6 +727,19 @@
|
|||
<br />
|
||||
<br />
|
||||
|
||||
<label>Product & Content Dates</label>
|
||||
<br />
|
||||
<input type="radio" name="show_dates" id="show_dates_on" value="1" {% if request.shop.show_dates %}checked{% endif %} />
|
||||
<label for="show_dates_on" class="inline-label">Show created and updated dates</label>
|
||||
<br />
|
||||
<input type="radio" name="show_dates" id="show_dates_off" value="0" {% if not request.shop.show_dates %}checked{% endif %} />
|
||||
<label for="show_dates_off" class="inline-label">Hide dates</label>
|
||||
<br />
|
||||
<small class="note-text">Show or hide the created and last updated dates on product and content pages.</small>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<input type="submit" name="submit" class="mps-submit" value="Save Settings" />
|
||||
|
||||
<br />
|
||||
|
|
|
|||
|
|
@ -592,6 +592,20 @@ def shop_settings(request):
|
|||
)
|
||||
)
|
||||
|
||||
# Handle show dates setting
|
||||
show_dates_value = request.params.get("show_dates")
|
||||
if show_dates_value is not None:
|
||||
show_dates = int(show_dates_value) == 1
|
||||
if shop.show_dates != show_dates:
|
||||
shop.show_dates = show_dates
|
||||
status = "visible" if show_dates else "hidden"
|
||||
request.session.flash(
|
||||
(
|
||||
f"Product and content dates are now {status}",
|
||||
"success",
|
||||
)
|
||||
)
|
||||
|
||||
# Handle stripe settings form
|
||||
if form_section == "stripe-settings":
|
||||
# Handle disable action
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue