diff --git a/apps/user/templates/user/edit_gallery.html b/apps/user/templates/user/edit-gallery.html similarity index 92% rename from apps/user/templates/user/edit_gallery.html rename to apps/user/templates/user/edit-gallery.html index 1dced8a3..85158faf 100644 --- a/apps/user/templates/user/edit_gallery.html +++ b/apps/user/templates/user/edit-gallery.html @@ -25,6 +25,7 @@ {% block content %}
+
Редактировать работы
diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index 4db6efe9..bc98a420 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -67,13 +67,13 @@
- + {% if is_author %} - {% endif %} - +
@@ -140,11 +140,23 @@
{% endif %}
- Редактировать -
- {% include 'content/blocks/gallery.html' with content=user.gallery %} +
+ + +
-
diff --git a/apps/user/views.py b/apps/user/views.py index cb420521..7e4ff5fd 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -318,4 +318,4 @@ class BonusHistoryView(TemplateView): @method_decorator(login_required, name='dispatch') class UserGalleryEditView(TemplateView): - template_name = 'user/edit_gallery.html' + template_name = 'user/edit-gallery.html' diff --git a/project/templates/blocks/lil_store_js.html b/project/templates/blocks/lil_store_js.html index 244eb875..35dacf7b 100644 --- a/project/templates/blocks/lil_store_js.html +++ b/project/templates/blocks/lil_store_js.html @@ -22,6 +22,7 @@ urls: { courses: "{% url 'courses' %}", userProfileEdit: "{% url 'user-edit-profile' %}", + userProfile: "{% url 'user-profile' %}", userBonuses: "{% url 'user-bonuses' %}", }, flags: { diff --git a/web/src/js/app.js b/web/src/js/app.js index 7a24f77a..03d81270 100644 --- a/web/src/js/app.js +++ b/web/src/js/app.js @@ -21,6 +21,7 @@ import "./modules/mixpanel"; import "../sass/app.sass"; +import $ from 'jquery'; import Vue from 'vue'; import Vuelidate from 'vuelidate'; import VueAutosize from '../components/directives/autosize' @@ -55,7 +56,14 @@ const app = new Vue({ }, mounted(){ if(this.urlIs('userProfileEdit') || this.urlIs('userBonuses')){ - profileMain(this); + profileMain(this); + } + if(this.urlIs('userProfile')){ + if(window.location.hash){ + $(document).ready(() => { + $(`[data-anchor=${window.location.hash.slice(1)}]`).click(); + }); + } } }, methods: { diff --git a/web/src/js/user-gallery-edit.js b/web/src/js/user-gallery-edit.js new file mode 100644 index 00000000..f3be7c0f --- /dev/null +++ b/web/src/js/user-gallery-edit.js @@ -0,0 +1,14 @@ +import BlockImages from '../components/blocks/BlockImages.vue'; +import $ from 'jquery'; +import {api} from "./modules/api"; + +window.LIL_STORE.components['block-images'] = BlockImages; + +$(document).ready(function () { + $('#gallery-save').click(e => { + e.preventDefault(); + api.saveUserGallery(window.LIL_STORE._user_gallery_images).then(response => { + window.location.href = '/user/profile/#works'; + }); + }); +});