diff --git a/assets/js/build/user_profile_edit.js b/assets/js/build/user_profile_edit.js new file mode 100644 index 0000000..d4fd163 --- /dev/null +++ b/assets/js/build/user_profile_edit.js @@ -0,0 +1,111 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _avatar_upload = __webpack_require__(27); + + $(function () { + (0, _avatar_upload.avatarUploadInit)(); + }); + +/***/ }, + +/***/ 27: +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + // Live image avatar (single) upload --------------------------------- + var LIVE_IMAGE_UPLOAD_URL = '/common/live-image-upload/create/'; + + function avatarUploadInit() { + var $container = $('.-live-image-avatar-upload-container').first(); + + var $avatarImage = $container.find('.-avatar-image').first(); + var $liveImageUpload = $container.find('.-live-image-upload').first(); + var $liveImageId = $container.find('.-live-image-id').first(); + var $liveImageDelete = $container.find('.-live-image-delete').first(); + + $avatarImage.attr('orig-src', $avatarImage.attr('src')); + + $liveImageUpload.fileupload({ + url: LIVE_IMAGE_UPLOAD_URL, + dataType: 'json', + + done: function done($evt, data) { + var image = data.result; + + $avatarImage.attr('src', image.thumbnailUrl); + $liveImageId.val(image.id); + + $liveImageDelete.data('url', image.deleteUrl); + $liveImageDelete.css('display', 'block'); + } + }); + + $liveImageDelete.on('click', function ($evt) { + var $that = $(this); + + $.post($that.data('url')).then(function (res) { + if (res.status == 'success') { + $avatarImage.attr('src', $avatarImage.attr('orig-src') || STUB_IMAGE_URL); + $liveImageId.val(''); + $that.css('display', 'none'); + } + }); + }); + } + + exports.avatarUploadInit = avatarUploadInit; + +/***/ } + +/******/ }); \ No newline at end of file diff --git a/assets/js/src/seeds/avatar_upload.js b/assets/js/src/seeds/avatar_upload.js new file mode 100644 index 0000000..5c7ba60 --- /dev/null +++ b/assets/js/src/seeds/avatar_upload.js @@ -0,0 +1,42 @@ +// Live image avatar (single) upload --------------------------------- +var LIVE_IMAGE_UPLOAD_URL = '/common/live-image-upload/create/'; + +function avatarUploadInit() { + var $container = $('.-live-image-avatar-upload-container').first(); + + var $avatarImage = $container.find('.-avatar-image').first(); + var $liveImageUpload = $container.find('.-live-image-upload').first(); + var $liveImageId = $container.find('.-live-image-id').first(); + var $liveImageDelete = $container.find('.-live-image-delete').first(); + + $avatarImage.attr('orig-src', $avatarImage.attr('src')); + + $liveImageUpload.fileupload({ + url: LIVE_IMAGE_UPLOAD_URL, + dataType: 'json', + + done: function($evt, data) { + var image = data.result; + + $avatarImage.attr('src', image.thumbnailUrl); + $liveImageId.val(image.id); + + $liveImageDelete.data('url', image.deleteUrl); + $liveImageDelete.css('display', 'block') + } + }); + + $liveImageDelete.on('click', function($evt) { + var $that = $(this); + + $.post($that.data('url')).then(function(res) { + if (res.status == 'success') { + $avatarImage.attr('src', $avatarImage.attr('orig-src') || STUB_IMAGE_URL); + $liveImageId.val(''); + $that.css('display', 'none') + } + }) + }) +} + +export {avatarUploadInit} \ No newline at end of file diff --git a/assets/js/src/user.js b/assets/js/src/user.js deleted file mode 100644 index 7e39f9b..0000000 --- a/assets/js/src/user.js +++ /dev/null @@ -1,56 +0,0 @@ - -function onBind(target, name, descriptor) { - const method = descriptor.value; - - descriptor.value = function (...args) { - let binds = []; - args = Array.from(args); - for (let arg of args.slice()) { - if (typeof arg === 'object') { - binds.push(arg); - args.splice(args.indexOf(arg), 1); - } - } - method.apply(this, args); - for (let bind of binds) { - bind.func.bind(this)(); - } - return this; - } -} - -class Base { - constructor() { - this.attr1 = 'attr1'; - console.log("Constructor") - } - - @onBind - method1(a = 1, b = 2) { - console.log("this.attr1 = ", this.attr1); - console.log("a = ", a, "b = ", b); - } - - on(methodName, func) { - this[methodName] = this[methodName].bind(this, {func}); - } -} - -let b = new Base(); - -b.on("method1", () => console.log("Another message...")); -b.on("method1", function () { - console.log("bind this.attr1 =", this.attr1); -}); - -b.method1("one", 2); -b.method1("bbb"); - -if (NODE_ENV == 'dev') { - console.log("Dev mode message") -} - - -function a({a=2, b=a+4}) { - -} \ No newline at end of file diff --git a/assets/js/src/user_profile_edit.js b/assets/js/src/user_profile_edit.js new file mode 100644 index 0000000..f4653b2 --- /dev/null +++ b/assets/js/src/user_profile_edit.js @@ -0,0 +1,5 @@ +import {avatarUploadInit} from './seeds/avatar_upload' + +$(function () { + avatarUploadInit(); +}); \ No newline at end of file diff --git a/assets/lib/proekton-components/sass/parts/_selected-container.sass b/assets/lib/proekton-components/sass/parts/_selected-container.sass index fff89f4..59e6a94 100644 --- a/assets/lib/proekton-components/sass/parts/_selected-container.sass +++ b/assets/lib/proekton-components/sass/parts/_selected-container.sass @@ -23,6 +23,7 @@ .header font-size: 7pt color: #676363 + display: block .name font-size: 11pt display: inline-block diff --git a/users/models.py b/users/models.py index 794f3b0..2f8d01e 100644 --- a/users/models.py +++ b/users/models.py @@ -171,13 +171,13 @@ class User(AbstractBaseUser, PermissionsMixin): try: return self.location.parent.parent.name except AttributeError: - return 'None' + return 'Не задан' def city(self): try: return self.location.name except AttributeError: - return 'None' + return "Не задан" # @property # def is_staff(self): # return self.is_superuser @@ -189,7 +189,8 @@ class User(AbstractBaseUser, PermissionsMixin): return self.email def get_full_name(self): - full_name = self.first_name + ' ' + self.last_name + ' ' + self.patronym + full_name = '{last_name} {first_name} {patronym}'.format(**self.__dict__) + # full_name = self.first_name + ' ' + self.last_name + ' ' + self.patronym return full_name or self.username def get_profile_image(self): diff --git a/users/static/sass/customer-profile.sass b/users/static/sass/customer-profile.sass index c4b268b..4cbd5a3 100644 --- a/users/static/sass/customer-profile.sass +++ b/users/static/sass/customer-profile.sass @@ -1,14 +1,8 @@ @import "base/variavles" @import "modules/mods" -//.avatarInset -// //width: 100% -// height: 224px -// img -// width: 100% -// height: 100% -// //padding: 10% -// background-color: #e4e4e4 +.avatar + border: 15px solid #F1F1F1 .count display: inline-block @@ -44,7 +38,6 @@ font-size: 16pt line-height: 100% - .border.add_line:before content: '' position: relative @@ -54,13 +47,14 @@ background-color: black left: 62px top: 0 - //z-index: 1 - //-webkit-transition: all 0.3s ease-out - //-moz-transition: all 0.3s ease-out - //transition: all 0.3s ease-out +//z-index: 1 +//-webkit-transition: all 0.3s ease-out +//-moz-transition: all 0.3s ease-out +//transition: all 0.3s ease-out .nav-tabs a color: #0b0b0b + table.ratings font-size: 14pt td diff --git a/users/templates/partials/inc-customer_profile-info.html b/users/templates/partials/inc-customer_profile-info.html index 195de31..9bd0387 100644 --- a/users/templates/partials/inc-customer_profile-info.html +++ b/users/templates/partials/inc-customer_profile-info.html @@ -4,20 +4,18 @@ {% load user_tags %}
- {% endif %}
-
+ {% endif %}