Self hosted FLOSS fitness/workout, nutrition and weight tracker
Also use the image gallery in the mobile version
Roland Geider510e4f7ac2b3
diff --git a/wger/exercises/templates/mobile/view.html b/wger/exercises/templates/mobile/view.htmlindex ea19dddd0..ccb7e768c 100644--- a/wger/exercises/templates/mobile/view.html+++ b/wger/exercises/templates/mobile/view.html@@ -68,6 +68,9 @@ included in the database.{% endblocktrans %}<p>{% trans "Category" %}: <strong>{% trans exercise.category.name %}</strong></p><p>{{ exercise.description|safe }}</p>+{# #}+{# Comments #}+{# #}{% with comments=exercise.exercisecomment_set.all %}{% if comments %}<h4>{% trans "Comments for this exercise" %}</h4>@@ -112,16 +115,38 @@ included in the database.{% endblocktrans %}{% endif %}+{# #}+{# Images #}+{# #}{% with images=exercise.exerciseimage_set.all %}{% if images %}<h4>{% trans "Images" %}</h4>- <div style="width:100%; overflow-x: scroll;">+ <div class="wrap">{% for image in images %}- <img src="{{ image.image|thumbnail_url:'medium' }}"- width="200"- height="200"- class="float-left">+ <div class="image-box">+ <div class="boxInner">+ <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 %}+ </div>+ </div>{% endfor %}</div>diff --git a/wger/exercises/templates/view.html b/wger/exercises/templates/view.htmlindex 54d50dc8f..d19043c80 100644--- a/wger/exercises/templates/view.html+++ b/wger/exercises/templates/view.html@@ -19,91 +19,6 @@ function custom_modal_init()init_weight_log_datepicker();}</script>-<style type="text/css">- .wrap {- 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%;- }- }- </style>{% endblock %}<!--Title@@ -226,7 +141,7 @@ included in the database.{% endblocktrans %}{% with main_image=images|first %}<div style="text-align:center;">- <img src="{{ main_image.image|thumbnail_url:'larger' }}">+ <img src="{{ main_image.image|thumbnail_url:'larger' }}" alt=""></div>{% endwith %}@@ -237,8 +152,7 @@ included in the database.{% endblocktrans %}<div class="image-box"><div class="boxInner"><img src="{{ image.image|thumbnail_url:'medium_cropped' }}"- width="200"- height="200"+ alt=""class="gallery-image">{% if perms.exercises.change_exerciseimage %}<div class="titleBox">@@ -323,7 +237,7 @@ included in the database.{% endblocktrans %}</div><div class="ym-g50 ym-gr"><div class="ym-gbox-right">- <div id="muscle-front" class="muscle-background" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">+ <div id="muscle-back" class="muscle-background" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};"></div><ul>{% for muscle in muscles %}@@ -407,11 +321,11 @@ weight_log_chart({{json|safe}}, "{{svg_uuid}}", "{{reps}}")<p><a href="{% url 'exercise-delete' exercise.id %}"class="modal-dialog">- <img src="{% static 'images/icons/trash.svg' %}"- width="32"- height="32"- alt="{% trans 'Delete' %}">- {% trans "Delete" %}+ <img src="{% static 'images/icons/trash.svg' %}"+ width="32"+ height="32"+ alt="{% trans 'Delete' %}">+ {% trans "Delete" %}</a></p>{% endif %}diff --git a/wger/manager/static/css/workout-manager-common.css b/wger/manager/static/css/workout-manager-common.cssindex 50218e512..0e11300f5 100644--- a/wger/manager/static/css/workout-manager-common.css+++ b/wger/manager/static/css/workout-manager-common.css@@ -210,3 +210,91 @@ circle.color-17becf:hoverpadding-left: 0.3em;cursor: pointer;}+++/**************************************************************+ * Image gallery for exercises+ **************************************************************/+.wrap {+ 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