Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Update Shariff to latest version and make it work

Roland Geider49fe40938f87
diff --git a/package.json b/package.json
index 5eed5247d..a99f4d3a1 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"devbridge-autocomplete": "^1.4.11",
"jquery": "jquery/jquery-dist#2.x",
"metrics-graphics": "mozilla/metrics-graphics#2.15.x",
- "shariff": "heiseonline/shariff#1.24.1",
+ "shariff": "^3.2.1",
"tinymce": "tinymce/tinymce-dist#4.5.x"
},
"engines": {
diff --git a/wger/core/static/js/wger-core.js b/wger/core/static/js/wger-core.js
index fb08dad8f..5ac533be9 100644
--- a/wger/core/static/js/wger-core.js
+++ b/wger/core/static/js/wger-core.js
@@ -110,9 +110,9 @@ function setProfileField(field, newValue) {
dataDict[field] = newValue;
$.get('/api/v2/userprofile', function () {
}).done(function (userprofile) {
- console.log('Updating profile field "' + field + '" to value: ' + newValue);
+ //console.log('Updating profile field "' + field + '" to value: ' + newValue);
$.ajax({
- url: '/api/v2/userprofile/' + userprofile[0].id + '/',
+ url: '/api/v2/userprofile/' + userprofile.results[0].id + '/',
type: 'PATCH',
data: dataDict
});
@@ -131,7 +131,7 @@ function getProfileField(field) {
type: 'GET',
async: false,
success: function (userprofile) {
- result = userprofile[0][field];
+ result = userprofile.results[0][field];
}
});
return result;
@@ -189,11 +189,11 @@ function wgerToggleReadOnlyAccess() {
$shariffModal = $('#shariffModal');
if (!roAccess) {
- $shariffModal.find('.shariff').removeClass('hidden');
- $shariffModal.find('.noRoAccess').addClass('hidden');
+ $shariffModal.find('.shariff').removeClass('d-none');
+ $shariffModal.find('.noRoAccess').addClass('d-none');
} else {
- $shariffModal.find('.shariff').addClass('hidden');
- $shariffModal.find('.noRoAccess').removeClass('hidden');
+ $shariffModal.find('.shariff').addClass('d-none');
+ $shariffModal.find('.noRoAccess').removeClass('d-none');
}
});
}
diff --git a/wger/core/templates/base.html b/wger/core/templates/base.html
index 680ae97d4..29f00b3bb 100644
--- a/wger/core/templates/base.html
+++ b/wger/core/templates/base.html
@@ -33,16 +33,16 @@ browsing the site as the user "{{current_user}}", all actions are performed on h
{% block options %}
{% endblock %}
- {% if show_shariff %}
- <button type="button"
- class="btn btn-light btn-sm"
- data-toggle="modal"
- data-target="#shariffModal">
- <span class="glyphicon glyphicon-retweet"></span>
- {% trans "Share" %}
- </button>
- {% endif %}
</div>
+ {% if show_shariff %}
+ <button type="button"
+ class="btn btn-link btn-sm float-right"
+ data-toggle="modal"
+ data-target="#shariffModal"
+ title="{% trans 'Share' %}">
+ <span class="{% fa_class 'share-alt' %}"></span>
+ </button>
+ {% endif %}
</div>
</div>
diff --git a/wger/core/templates/misc/fragments/shariff_modal.html b/wger/core/templates/misc/fragments/shariff_modal.html
index 73c364ad6..1ff2f6392 100644
--- a/wger/core/templates/misc/fragments/shariff_modal.html
+++ b/wger/core/templates/misc/fragments/shariff_modal.html
@@ -1,8 +1,4 @@
{% load i18n wger_extras %}
-<style>
- .shariff li { overflow: visible; }
-</style>
-
<div class="modal fade" id="shariffModal">
<div class="modal-dialog">
<div class="modal-content">
@@ -11,10 +7,14 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
- <div class="shariff {% if is_owner and not owner_user.userprofile.ro_access %}hidden{% endif %}" data-lang="{{language.short_name}}"></div>
+ <div class="shariff {% if is_owner and not owner_user.userprofile.ro_access %}d-none{% endif %}"
+ data-lang="{{language.short_name}}"
+ data-orientation="horizontal"
+ data-button-style="icon"
+ data-services="[&quot;facebook&quot;,&quot;twitter&quot;,&quot;whatsapp&quot;,&quot;telegram&quot;,&quot;info&quot;]"></div>
{% if owner_user %}
- <div class="noRoAccess {% if user.is_authenticated and is_owner and owner_user.userprofile.ro_access %}hidden{% endif %}">
+ <div class="noRoAccess {% if user.is_authenticated and is_owner and owner_user.userprofile.ro_access %}d-none{% endif %}">
<p>{% blocktrans %}Before you share links on social media you need to allow external access.{% endblocktrans %}</p>
<p>
<a href="{% url 'core:user:preferences' %}" id="toggle-ro-access" class="btn btn-success btn-sm">
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 3ef1e9a38..81d8ef5f7 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -51,7 +51,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'yarn/bootstrap-compiled.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-custom.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'yarn/components-font-awesome/css/all.css' %}">
- <link rel="stylesheet" type="text/css" href="{% static 'yarn/shariff/build/shariff.min.css' %}">
+ <link rel="stylesheet" type="text/css" href="{% static 'yarn/shariff/dist/shariff.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'yarn/metrics-graphics/dist/metricsgraphics.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/metricsgraphics-custom.css' %}">
{% endcompress %}
@@ -212,7 +212,7 @@
</div>
</footer>
-<script src="{% static 'yarn/shariff/build/shariff.min.js' %}"></script>
+<script src="{% static 'yarn/shariff/dist/shariff.min.js' %}"></script>
</body>
{% endspaceless_config %}
</html>
diff --git a/wger/exercises/templates/exercise/view.html b/wger/exercises/templates/exercise/view.html
index 5a60fec41..a35b553b2 100644
--- a/wger/exercises/templates/exercise/view.html
+++ b/wger/exercises/templates/exercise/view.html
@@ -105,14 +105,12 @@ $(document).ready(function() {
</a>
<div class="card-body text-center">
{% if perms.exercises.change_exerciseimage %}
- <a href="{% url 'exercise:image:delete' exercise.pk image.pk %}"
- class="wger-modal-dialog btn btn-link"
- title="{% trans 'Delete' %}">
- <span class="{% fa_class 'trash' %}"></span></a>
- <a href="{% url 'exercise:image:edit' image.pk %}"
- class="btn btn-link"
- title="{% trans 'Edit' %}">
- <span class="{% fa_class 'edit' %}"></span></a>
+ <a href="{% url 'exercise:image:delete' exercise.pk image.pk %}" class="wger-modal-dialog btn btn-link">
+ <span class="{% fa_class 'trash' %}"></span>
+ </a>
+ <a href="{% url 'exercise:image:edit' image.pk %}" class="btn btn-link">
+ <span class="{% fa_class 'edit' %}"></span>
+ </a>
{% endif %}
{% if image.is_main %}
diff --git a/yarn.lock b/yarn.lock
index 429dfaa72..533ef108d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,6 +2,11 @@
# yarn lockfile v1
+"@fortawesome/fontawesome-free@^5.8.2":
+ version "5.14.0"
+ resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.14.0.tgz#a371e91029ebf265015e64f81bfbf7d228c9681f"
+ integrity sha512-OfdMsF+ZQgdKHP9jUbmDcRrP0eX90XXrsXIdyjLbkmSBzmMXPABB8eobUJtivaupucYaByz6WNe1PI1JuYm3qA==
+
"@types/jquery@^2.0.32":
version "2.0.54"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.54.tgz#d7999245f77c3fab5d84e7d32b8a6c20bfd1f072"
@@ -381,11 +386,6 @@ devbridge-autocomplete@^1.4.11:
"@types/jquery" "^2.0.32"
jquery ">=1.7"
-font-awesome@^4.3.0:
- version "4.7.0"
- resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133"
- integrity sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=
-
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@@ -393,16 +393,11 @@ [email protected]:
dependencies:
safer-buffer ">= 2.1.2 < 3"
-jquery@>=1.7:
+jquery@>=1.7, jquery@^3.4.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
-jquery@^1.11.2:
- version "1.12.4"
- resolved "https://registry.yarnpkg.com/jquery/-/jquery-1.12.4.tgz#01e1dfba290fe73deba77ceeacb0f9ba2fec9e0c"
- integrity sha1-AeHfuikP5z3rp3zurLD5ui/sngw=
-
jquery@jquery/jquery-dist#2.x:
version "2.2.4"
resolved "https://codeload.github.com/jquery/jquery-dist/tar.gz/c0185ab7c75aab88762c5aae780b9d83b80eda72"
@@ -423,12 +418,13 @@ rw@1:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
-shariff@heiseonline/shariff#1.24.1:
- version "1.24.1"
- resolved "https://codeload.github.com/heiseonline/shariff/tar.gz/51153c199b58b7684e694b0b97cf41b75bb1dda9"
+shariff@^3.2.1:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/shariff/-/shariff-3.2.1.tgz#ba517b3dd0af1499756aa844c75bb691a193c722"
+ integrity sha512-+J4RDqL5ddEsEdX/z/8OkuJsfUPkTTLwdINbTvKPJ0FAT4RuDgdA1xf8gOJMBfeK8IJnMkcNtuaUR7f8tjPNig==
dependencies:
- font-awesome "^4.3.0"
- jquery "^1.11.2"
+ "@fortawesome/fontawesome-free" "^5.8.2"
+ jquery "^3.4.1"
tinymce@tinymce/tinymce-dist#4.5.x:
version "4.5.12"