changeset 7a93fcd4c581 in www.tryton.org:default
details: https://hg.tryton.org/www.tryton.org?cmd=changeset;node=7a93fcd4c581
description:
Add link to other story at the bottom of a success story
diffstat:
app.py | 7 +++++--
templates/success_stories.html | 15 ++-------------
templates/success_stories/layout.html | 4 ++++
templates/utils.html | 15 +++++++++++++++
4 files changed, 26 insertions(+), 15 deletions(-)
diffs (96 lines):
diff -r 542f1b9018fc -r 7a93fcd4c581 app.py
--- a/app.py Thu Jul 18 22:33:29 2019 +0200
+++ b/app.py Thu Jul 18 22:48:55 2019 +0200
@@ -9,7 +9,7 @@
from functools import partial
from http import HTTPStatus
from logging.handlers import SMTPHandler
-from random import shuffle
+from random import shuffle, choice
from urllib.parse import urlparse
import requests
@@ -315,8 +315,11 @@
@app.route('/success-stories/<story>')
@cache.cached()
def success_story(story):
+ next_case = choice(
+ [case for case in CASES if case.url and case.name != story])
try:
- return render_template('success_stories/%s.html' % story)
+ return render_template(
+ 'success_stories/%s.html' % story, next_case=next_case)
except TemplateNotFound:
abort(HTTPStatus.NOT_FOUND)
diff -r 542f1b9018fc -r 7a93fcd4c581 templates/success_stories.html
--- a/templates/success_stories.html Thu Jul 18 22:33:29 2019 +0200
+++ b/templates/success_stories.html Thu Jul 18 22:48:55 2019 +0200
@@ -2,7 +2,7 @@
{% set description = "List of Tryton's success stories" %}
{% set keywords = ["sucess story", "review", "case study" ] %}
{% extends "layout.html" %}
-{% from "utils.html" import background %}
+{% from "utils.html" import background, case_card %}
{% block style %}
{{ super() }}
{{ background('banner-success-stories') }}
@@ -20,18 +20,7 @@
<div class="row">
{% for case in cases %}
<div class="col mb-gutter">
- <div class="card mx-auto shadow d-flex flex-column" style="width:
18rem; height: 100%">
- {% if case.logo %}
- <img class="card-img-top" src="{{ url_for('static',
filename=case.logo) }}" style="height: 180px" alt=""/>
- {% endif %}
- <div class="card-body">
- <h2 class="h5 card-title">{{ case.title }}</h2>
- <p class="card-text">{{ case.description }}</p>
- </div>
- <div class="card-footer text-center">
- <a href="{{ case.url }}" class="btn btn-primary btn-block
{{ 'disabled' if not case.url else '' }}" {% if not case.url
%}aria-disabled="true"{% endif %}>More<span class="sr-only">on {{ case.title
}}</span></a>
- </div>
- </div>
+ {{ case_card(case) }}
</div>
{% endfor %}
</div>
diff -r 542f1b9018fc -r 7a93fcd4c581 templates/success_stories/layout.html
--- a/templates/success_stories/layout.html Thu Jul 18 22:33:29 2019 +0200
+++ b/templates/success_stories/layout.html Thu Jul 18 22:48:55 2019 +0200
@@ -1,4 +1,5 @@
{% extends "layout.html" %}
+{% from "utils.html" import case_card %}
{% block content %}
{{ super() }}
<div class="section section-banner filter filter-primary text-center"
style="background-image:url({{ url_for('static',
filename='images/success-stories/%s' % banner) }});">
@@ -44,4 +45,7 @@
</div>
</div>
</div>
+<div class="section bg-light text-center">
+ {{ case_card(next_case) }}
+</div>
{% endblock content %}
diff -r 542f1b9018fc -r 7a93fcd4c581 templates/utils.html
--- a/templates/utils.html Thu Jul 18 22:33:29 2019 +0200
+++ b/templates/utils.html Thu Jul 18 22:48:55 2019 +0200
@@ -15,3 +15,18 @@
}
</style>
{% endmacro %}
+
+{% macro case_card(case) %}
+<div class="card mx-auto shadow d-flex flex-column" style="width: 18rem;
height: 100%">
+ {% if case.logo %}
+ <img class="card-img-top" src="{{ url_for('static', filename=case.logo)
}}" style="height: 180px" alt=""/>
+ {% endif %}
+ <div class="card-body">
+ <h2 class="h5 card-title">{{ case.title }}</h2>
+ <p class="card-text">{{ case.description }}</p>
+ </div>
+ <div class="card-footer text-center">
+ <a href="{{ case.url }}" class="btn btn-primary btn-block {{
'disabled' if not case.url else '' }}" {% if not case.url
%}aria-disabled="true"{% endif %}>More<span class="sr-only">on {{ case.title
}}</span></a>
+ </div>
+</div>
+{% endmacro %}