Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Move exercise detail view to bootstrap 4

Roland Geider16a3004b34da
diff --git a/wger/core/static/css/workout-manager-common.css b/wger/core/static/css/workout-manager-common.css
index ec8fd74d4..b0fade79b 100644
--- a/wger/core/static/css/workout-manager-common.css
+++ b/wger/core/static/css/workout-manager-common.css
@@ -182,107 +182,6 @@ circle.color-17becf:hover {
cursor: pointer;
}
-/**************************************************************
- * Image gallery for exercises
- **************************************************************/
-.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;
- text-align: center;
-}
-
-.boxInner img.gallery-image {
- max-height: 100%;
- max-width: 100%;
-}
-
-.titleBox {
- font-size: 80%;
-}
-
-.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 {
- color: white;
- 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: 3 tiles */
- .image-box {
- width: 33.3%;
- padding-bottom: 33.3%;
- }
-}
-
-@media only screen and (min-width: 1290px) {
- /* Big desktop: 3 tiles */
- .image-box {
- width: 33.3%;
- padding-bottom: 33.3%;
- }
-}
-
/**************************************************************
* Weight log calendar
**************************************************************/
diff --git a/wger/exercises/templates/exercise/view.html b/wger/exercises/templates/exercise/view.html
index 1117a486e..0ce76e8ad 100644
--- a/wger/exercises/templates/exercise/view.html
+++ b/wger/exercises/templates/exercise/view.html
@@ -19,17 +19,6 @@
{% endblock %}
-{# #}
-{# Breadcrumbs #}
-{# #}
-{% block breadcrumbs %}
- {{ block.super }}
-
- {% breadcrumb "Exercises" "exercise:exercise:overview" %}
- {% breadcrumb exercise exercise.get_absolute_url %}
-{% endblock %}
-
-
{# #}
{# Title #}
{# #}
@@ -54,9 +43,11 @@ $(document).ready(function() {
{% block content %}
{% if exercise.status == exercise.STATUS_PENDING %}
-<div class="panel panel-default">
- <div class="panel-heading">{% trans "Exercise is pending review" %}</div>
- <div class="panel-body">
+<div class="card mb-4">
+ <div class="card-header">
+ {% trans "Exercise is pending review" %}
+ </div>
+ <div class="card-body">
<p>{% blocktrans %}This user submitted exercise is pending a decision to be
included in the database.{% endblocktrans %}
{% trans "Till then, it will not be shown in the overview or the search." %}
@@ -64,17 +55,14 @@ $(document).ready(function() {
</p>
{% if perms.exercises.add_exercise %}
- <div class="btn-group btn-group-justified" role="group">
-
- <a href="{% url 'exercise:exercise:accept' exercise.id %}" class="btn btn-default">
+ <a href="{% url 'exercise:exercise:accept' exercise.id %}" class="btn btn-secondary">
<span class="{% fa_class 'check' %}"></span>
{% trans "Accept" %}
</a>
- <a href="{% url 'exercise:exercise:decline' exercise.id %}" class="btn btn-default">
+ <a href="{% url 'exercise:exercise:decline' exercise.id %}" class="btn btn-secondary">
<span class="{% fa_class 'times' %}"></span>
{% trans "Decline" %}
</a>
- </div>
{% endif %} {# end check permissions #}
</div>
</div>
@@ -82,21 +70,21 @@ $(document).ready(function() {
-<div class="row" style="margin-top:1em;">
- <div class="col-xs-3">
+<div class="row mt-4">
+ <div class="col-3">
<strong>{% trans "Category" %}:</strong>
</div>
- <div class="col-xs-9">
+ <div class="col-9">
{% trans exercise.category.name %}
</div>
</div>
{% if exercise.equipment.all %}
-<div class="row" style="margin-top:1em;">
- <div class="col-xs-3">
+<div class="row mt-4">
+ <div class="col-3">
<strong>{% trans "Equipment" %}:</strong>
</div>
- <div class="col-xs-9">
+ <div class="col-9">
{% for equipment in exercise.equipment.all %}
{% trans equipment.name %}
{% if not forloop.last %}, {% endif %}
@@ -106,11 +94,11 @@ $(document).ready(function() {
{% endif %}
-<div class="row" style="margin-top:1em;">
- <div class="col-xs-3">
+<div class="row mt-4">
+ <div class="col-3">
<strong>{% trans "Description" %}:</strong>
</div>
- <div class="col-xs-9">
+ <div class="col-9">
{{ exercise.description|safe }}
</div>
</div>
@@ -120,8 +108,8 @@ $(document).ready(function() {
{# Images #}
{% with images=exercise.exerciseimage_set.accepted %}
{% if images or perms.exercises.change_exerciseimage %}
-<div class="row" style="margin-top:1em;">
- <div class="col-xs-3">
+<div class="row mt-4">
+ <div class="col-3">
{% if perms.exercises.change_exerciseimage %}
<p>
<a href="{% url 'exercise:image:add' exercise.id %}" class="btn btn-success btn-sm">
@@ -131,23 +119,21 @@ $(document).ready(function() {
{% endif %}
{# <strong>{% trans "Images" %}:</strong>#}
</div>
- <div class="col-xs-9">
- <div class="image-gallery">
+ <div class="col-9">
+ <div class="card-deck">
{% with other_images=images %}
{% for image in other_images %}
- <div class="image-box">
- <div class="boxInner">
- <img src="{{ image.image|thumbnail_url:'small' }}"
- alt=""
- class="gallery-image">
-
- <div class="titleBox">
- <a href="{{ image.image.url }}"
+
+ <div class="card">
+ <img class="card-img-top" src="{{ image.image|thumbnail_url:'small' }}">
+ <div class="card-body">
+ <a href="{{ image.image.url }}"
target="_blank"
class=" no-hover"
title="{% trans 'Download' %}">
- <span class="{% fa_class 'download' %}"></span></a>
- {% if perms.exercises.change_exerciseimage %}
+ <span class="{% fa_class 'download' %}"></span>
+ </a>
+ {% if perms.exercises.change_exerciseimage %}
|
<a href="{% url 'exercise:image:delete' exercise.pk image.pk %}"
class="wger-modal-dialog no-hover"
@@ -157,15 +143,14 @@ $(document).ready(function() {
class="no-hover"
title="{% trans 'Edit' %}">
<span class="{% fa_class 'pencil-square-o' %}"></span></a>
- {% endif %}
+ {% endif %}
- <br>
+ <p class="card-text">
{{image.get_license_display}}
{% if image.license_author %}
– {{image.license_author}}
{% endif %}
-
- </div>
+ </p>
</div>
</div>
{% endfor %}
@@ -180,20 +165,11 @@ $(document).ready(function() {
{% with images=exercise.exerciseimage_set.pending %}
{% if images %}
<h4>{% trans "Images pending review" %}</h4>
-<div class="list-group">
+<div class="card-deck">
{% for image in images %}
- <div class="list-group-item">
- <div class="media">
- <div style="width:60px;height:60px;" class="pull-left">
- <a href="{{image.image.url}}">
- <img alt="{{ image.exercise.name }}"
- class="media-object "
- style="max-width:100%; max-height:100%;"
- src="{{ image.image|thumbnail_url:'thumbnail' }}">
- </a>
- </div>
- <div class="media-body">
- <h4 class="media-heading">{{ image.image }}</h4>
+ <div class="card">
+ <img class="card-img-top" src="{{ image.image|thumbnail_url:'small' }}">
+ <div class="card-body">
<a href="{% url 'exercise:image:accept' image.pk %}" class="btn btn-default btn-sm">{% trans "Accept" %}</a>
<a href="{% url 'exercise:image:decline' image.pk %}" class="btn btn-default btn-sm">{% trans "Decline" %}</a>
<a href="{% url 'exercise:image:delete' exercise.pk image.pk %}" class="btn btn-danger btn-sm">{% trans "Delete" %}</a>
@@ -210,11 +186,11 @@ $(document).ready(function() {
{# Comments #}
{% with comments=exercise.exercisecomment_set.all %}
{% if comments or perms.exercises.change_exercisecomment %}
-<div class="row" style="margin-top:1em;">
- <div class="col-xs-3">
+<div class="row mt-4">
+ <div class="col-3">
<strong>{% trans "Comments for this exercise" %}:</strong>
</div>
- <div class="col-xs-9">
+ <div class="col-9">
<ul>
{% for comment in comments %}
<li>
@@ -253,11 +229,11 @@ $(document).ready(function() {
{% with muscles_secondary=exercise.muscles_secondary.all %}
{% if muscles %}
-<div class="row" style="margin-top:1em;">
- <div class="col-xs-3">
+<div class="row mt-4">
+ <div class="col-3">
<strong>{% trans "Muscles" %}:</strong>
</div>
- <div class="col-xs-9">
+ <div class="col-9">
<p>
{% trans "The diagram shows the most used muscles on this exercise" %}
</p>
@@ -270,8 +246,8 @@ $(document).ready(function() {
<div style="width:1em;height:1em;background-color:#f57900;float:left;margin-right:0.5em;"></div>
{% trans "Secondary muscles" %}
</div>
- <div class="row" style="margin-top:1em;">
- <div class="col-md-6 col-xs-6">
+ <div class="row">
+ <div class="col">
<div id="muscle-front" class="muscle-background center-block" style="background-image: {% for background in muscle_backgrounds_front %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
</div>
<ul>
@@ -288,7 +264,7 @@ $(document).ready(function() {
{% endfor %}
</ul>
</div>
- <div class="col-md-6 col-xs-6">
+ <div class="col">
<div id="muscle-back" class="muscle-background center-block" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
</div>
<ul>
@@ -314,7 +290,7 @@ $(document).ready(function() {
{% endcache %}
{% if logs %}
-<div class="row" style="margin-top:1em;">
+<div class="row mt-4">
<div class="col-xs-3">
<strong>{% trans "Weight log" %}:</strong>
</div>