Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Improvements to image galery on mobile version

Roland Geidere79e28aa5df9
diff --git a/wger/exercises/templates/mobile/view.html b/wger/exercises/templates/mobile/view.html
index ccb7e768c..58399ee1f 100644
--- a/wger/exercises/templates/mobile/view.html
+++ b/wger/exercises/templates/mobile/view.html
@@ -66,7 +66,7 @@ included in the database.{% endblocktrans %}
<p>{% trans "Category" %}: <strong>{% trans exercise.category.name %}</strong></p>
-<p>{{ exercise.description|safe }}</p>
+<div>{{ exercise.description|safe }}</div>
{# #}
{# Comments #}
@@ -122,29 +122,56 @@ included in the database.{% endblocktrans %}
{% if images %}
<h4>{% trans "Images" %}</h4>
- <div class="wrap">
+ <div class="image-gallery">
{% for image in images %}
+ <div data-role="popup"
+ id="image-popup-{{image.pk}}"
+ data-overlay-theme="a"
+ class="ui-content">
+ <h3>{% trans "Download" %}</h3>
+
+ <a href="{{ image.image.url }}"
+ target="_blank"
+ class="image-link"
+ data-role="button">
+ {% trans "Full size" %}</a>
+
+ <a href="{{ image.image|thumbnail_url:'larger' }}"
+ target="_blank"
+ class="image-link"
+ data-role="button">
+ {% trans "Reduced size" %}</a>
+
+ {% if perms.exercises.change_exerciseimage %}
+ <h3>{% trans "Options" %}</h3>
+ <a href="{% url 'exerciseimage-delete' exercise.pk image.pk %}"
+ data-role="button">
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Delete' %}">
+ {% trans 'Delete' %}</a>
+
+ <a href="{% url 'exerciseimage-edit' image.pk %}"
+ data-role="button"
+ data-ajax="false">
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Edit' %}">
+ {% trans 'Edit' %}</a>
+ {% endif %}
+ </div>
+
<div class="image-box">
<div class="boxInner">
+ <a href="#image-popup-{{image.pk}}"
+ data-rel="popup"
+ data-position-to="window">
<img src="{{ image.image|thumbnail_url:'medium_cropped' }}"
alt=""
class="gallery-image">
- {% if perms.exercises.change_exerciseimage %}
- <div class="titleBox">
- <a href="{% url 'exerciseimage-delete' exercise.pk image.pk %}"
- class="modal-dialog no-hover">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="24"
- height="24"
- alt="{% trans 'Delete' %}"></a>
- <a href="{% url 'exerciseimage-edit' image.pk %}"
- class="no-hover">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="24"
- height="24"
- alt="{% trans 'Edit' %}"></a>
- </div>
- {% endif %}
+ </a>
</div>
</div>
{% endfor %}
diff --git a/wger/exercises/templates/view.html b/wger/exercises/templates/view.html
index d19043c80..6ab0dc443 100644
--- a/wger/exercises/templates/view.html
+++ b/wger/exercises/templates/view.html
@@ -77,7 +77,7 @@ included in the database.{% endblocktrans %}
{% cache cache_timeout exercise-detail-header exercise.id language.id %}
<p>{% trans "Category" %}: <strong>{% trans exercise.category.name %}</strong></p>
-<p>{{ exercise.description|safe }}</p>
+<div>{{ exercise.description|safe }}</div>
{% endcache %}
@@ -146,7 +146,7 @@ included in the database.{% endblocktrans %}
{% endwith %}
- <div class="wrap">
+ <div class="image-gallery">
{% with other_images=images|slice:"1:" %}
{% for image in other_images %}
<div class="image-box">
@@ -154,22 +154,23 @@ included in the database.{% endblocktrans %}
<img src="{{ image.image|thumbnail_url:'medium_cropped' }}"
alt=""
class="gallery-image">
- {% if perms.exercises.change_exerciseimage %}
+
<div class="titleBox">
+ <a href="{{ image.image.url }}"
+ target="_blank"
+ class=" no-hover">
+ {% trans "Download" %}</a>
+
+ {% if perms.exercises.change_exerciseimage %}
+ <br>
<a href="{% url 'exerciseimage-delete' exercise.pk image.pk %}"
class="modal-dialog no-hover">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="24"
- height="24"
- alt="{% trans 'Delete' %}"></a>
+ {% trans 'Delete' %}</a> |
<a href="{% url 'exerciseimage-edit' image.pk %}"
class="no-hover">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="24"
- height="24"
- alt="{% trans 'Edit' %}"></a>
- </div>
- {% endif %}
+ {% trans 'Edit' %}</a>
+ {% endif %}
+ </div>
</div>
</div>
{% endfor %}
diff --git a/wger/manager/static/css/workout-manager-common.css b/wger/manager/static/css/workout-manager-common.css
index 0e11300f5..e22273775 100644
--- a/wger/manager/static/css/workout-manager-common.css
+++ b/wger/manager/static/css/workout-manager-common.css
@@ -215,86 +215,93 @@ circle.color-17becf:hover
/**************************************************************
* Image gallery for exercises
**************************************************************/
-.wrap {
+.image-gallery {
overflow: hidden;
margin: 10px;
- }
- .image-box {
- float: left;
- position: relative;
- width: 20%;
- padding-bottom: 20%;
- }
- .boxInner {
- position: absolute;
- left: 10px;
- right: 10px;
- top: 10px;
- bottom: 10px;
- overflow: hidden;
- }
- .boxInner img.gallery-image {
- width: 100%;
- }
- .boxInner .titleBox {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- margin-bottom: -50px;
- background: #000;
- background: rgba(0, 0, 0, 0.8);
- color: #FFF;
- padding: 10px;
- text-align: center;
- -webkit-transition: all 0.3s ease-out;
- -moz-transition: all 0.3s ease-out;
- -o-transition: all 0.3s ease-out;
- transition: all 0.3s ease-out;
- }
- body .boxInner:hover .titleBox, body.touch .boxInner.touchFocus .titleBox {
- margin-bottom: 0;
- }
- @media only screen and (max-width : 480px) {
- /* Smartphone view: 1 tile */
- .image-box {
- width: 100%;
- padding-bottom: 100%;
- }
- }
- @media only screen and (max-width : 650px) and (min-width : 481px) {
- /* Tablet view: 2 tiles */
- .image-box {
- width: 50%;
- padding-bottom: 50%;
- }
- }
- @media only screen and (max-width : 1050px) and (min-width : 651px) {
- /* Small desktop / ipad view: 3 tiles */
- .image-box {
- width: 33.3%;
- padding-bottom: 33.3%;
- }
- }
- @media only screen and (max-width : 1290px) and (min-width : 1051px) {
- /* Medium desktop: 4 tiles */
- .image-box {
- /*
- width: 25%;
- padding-bottom: 25%;
- */
- width: 33.3%;
- padding-bottom: 33.3%;
- }
- }
- @media only screen and (min-width : 1290px) {
- /* Medium desktop: 4 tiles */
- .image-box {
- /*
- width: 25%;
- padding-bottom: 25%;
- */
- width: 33.3%;
- padding-bottom: 33.3%;
- }
- }
\ No newline at end of file
+}
+
+.image-box {
+ float: left;
+ position: relative;
+ width: 20%;
+ padding-bottom: 20%;
+}
+.boxInner {
+ position: absolute;
+ left: 10px;
+ right: 10px;
+ top: 10px;
+ bottom: 10px;
+ overflow: hidden;
+}
+.boxInner img.gallery-image {
+ width: 100%;
+}
+.boxInner .titleBox {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ margin-bottom: -60px;
+ background: #000;
+ background: rgba(0, 0, 0, 0.8);
+ color: #FFF;
+ padding: 10px;
+ text-align: center;
+ -webkit-transition: all 0.3s ease-out;
+ -moz-transition: all 0.3s ease-out;
+ -o-transition: all 0.3s ease-out;
+ transition: all 0.3s ease-out;
+}
+body .boxInner:hover .titleBox, body.touch .boxInner.touchFocus .titleBox {
+ margin-bottom: 0;
+}
+
+.titleBox a, .titleBox .ui-link {
+ color: white;
+ font-size: 80%;
+ text-shadow: none;
+}
+@media only screen and (max-width : 480px) {
+ /* Smartphone view: 1 tile */
+ .image-box {
+ width: 100%;
+ padding-bottom: 100%;
+ }
+}
+@media only screen and (max-width : 650px) and (min-width : 481px) {
+ /* Tablet view: 2 tiles */
+ .image-box {
+ width: 50%;
+ padding-bottom: 50%;
+ }
+}
+@media only screen and (max-width : 1050px) and (min-width : 651px) {
+ /* Small desktop / ipad view: 3 tiles */
+ .image-box {
+ width: 33.3%;
+ padding-bottom: 33.3%;
+ }
+}
+@media only screen and (max-width : 1290px) and (min-width : 1051px) {
+ /* Medium desktop: 4 tiles */
+ .image-box {
+ /*
+ width: 25%;
+ padding-bottom: 25%;
+ */
+ width: 33.3%;
+ padding-bottom: 33.3%;
+ }
+}
+@media only screen and (min-width : 1290px) {
+ /* Medium desktop: 4 tiles */
+ .image-box {
+ /*
+ width: 25%;
+ padding-bottom: 25%;
+ */
+ width: 33.3%;
+ padding-bottom: 33.3%;
+ }
+}
\ No newline at end of file