diff --git a/app/templates/community/post_detail.html b/app/templates/community/post_detail.html index 224a9b5..290df0a 100644 --- a/app/templates/community/post_detail.html +++ b/app/templates/community/post_detail.html @@ -85,59 +85,96 @@
-
- +
+

Adventure Story

-

Discover the journey through the author's words

+

Follow the journey step by step

-
-
- {{ post.content | safe | nl2br }} +
+
+ {% set content_sections = post.content.split('\n\n') %} + {% set section_images = post.images.filter_by(is_cover=False).all() %} + {% set images_per_section = (section_images|length / (content_sections|length))|round|int if content_sections|length > 0 else 0 %} + + {% for section in content_sections %} + {% if section.strip() %} +
+ {% set section_text = section.strip() %} + + + {% set keywords = [] %} + {% set clean_text = section_text %} + + + {% if '**' in section_text %} + {% set parts = section_text.split('**') %} + {% set clean_parts = [] %} + {% for i in range(parts|length) %} + {% if i % 2 == 1 %} + {% set _ = keywords.append(parts[i]) %} + {% set _ = clean_parts.append(parts[i]) %} + {% else %} + {% set _ = clean_parts.append(parts[i]) %} + {% endif %} + {% endfor %} + {% set clean_text = clean_parts|join('') %} + {% endif %} + + + {% if keywords %} +
+ {% for keyword in keywords %} + + + {{ keyword }} + + {% endfor %} +
+ {% endif %} + + +
+ {{ clean_text | safe | nl2br }} +
+ + + {% if section_images %} + {% set start_idx = loop.index0 * images_per_section %} + {% set end_idx = start_idx + images_per_section %} + {% set current_section_images = section_images[start_idx:end_idx] %} + + {% if current_section_images %} +
+ {% for image in current_section_images %} +
+ {{ image.description or image.original_name }} +
+ {% if image.description %} +
+ {{ image.description }} +
+ {% endif %} +
+ {% endfor %} +
+ {% endif %} + {% endif %} +
+ {% endif %} + {% endfor %}
- - - {% if post.images.count() > 0 %} -
-
-
- -
-

Photo Gallery

-

Visual highlights from this adventure

-
-
-
-
-
- {% for image in post.images %} -
- {{ image.description or image.original_name }} - {% if image.description %} -
-

{{ image.description }}

-
- {% endif %} - {% if image.is_cover %} -
- - Cover - -
- {% endif %} -
- {% endfor %} -
+
{% endif %} @@ -319,6 +356,45 @@
+ + + {% if post.images.count() > 0 %} +
+
+
+ +
+

Photo Gallery

+

{{ post.images.count() }} photos

+
+
+
+
+
+ {% for image in post.images %} +
+ {{ image.description or image.original_name }} + {% if image.is_cover %} +
+ + + +
+ {% endif %} +
+
+ {% endfor %} +
+ {% if post.images.count() > 4 %} +
+ Click any photo to view gallery +
+ {% endif %} +
+
+ {% endif %}