diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 4b7de8e..bdaa9cf 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -57,6 +57,7 @@ LOCAL_APPS = [ 'chat', 'wallets', 'ratings', + # 'corsheaders', ] WAGTAIL = [ @@ -84,6 +85,7 @@ MIDDLEWARE_CLASSES = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'archilance.middlewares.LocaleMiddleware', + # 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -97,6 +99,9 @@ MIDDLEWARE_CLASSES = [ ] ROOT_URLCONF = 'archilance.urls' +# +# CORS_ORIGIN_ALLOW_ALL = True +# CORS_ALLOW_CREDENTIALS = True TEMPLATES = [ { diff --git a/assets/lib/proekton-components/bash/watchify.sh b/assets/lib/proekton-components/bash/watchify.sh index 299b0cc..1803fd0 100644 --- a/assets/lib/proekton-components/bash/watchify.sh +++ b/assets/lib/proekton-components/bash/watchify.sh @@ -2,4 +2,4 @@ echo "run watchify" cd .. source ~/venv/proekton/bin/activate -watchify ./src/init.js -t babelify -o ./build/init.js \ No newline at end of file +watchify ./js/src/init.js -t babelify -o ./js/build/init.js \ No newline at end of file diff --git a/assets/lib/proekton-components/css/editable-container.css b/assets/lib/proekton-components/css/editable-container.css index 8104369..f5187b6 100644 --- a/assets/lib/proekton-components/css/editable-container.css +++ b/assets/lib/proekton-components/css/editable-container.css @@ -10,7 +10,3 @@ position: relative; left: -30px; } - -.vertical-child { - margin-top: 30px; -} \ No newline at end of file diff --git a/assets/lib/proekton-components/css/fix-bags.css b/assets/lib/proekton-components/css/fix-bags.css deleted file mode 100644 index cb2449e..0000000 --- a/assets/lib/proekton-components/css/fix-bags.css +++ /dev/null @@ -1,16 +0,0 @@ -body { - font-size: 11pt; - font-family: Arial-MT-Regular, Arial, sans-serif; -} - -/*input[type="checkbox"] + span, input[type="checkbox"]:checked + span {*/ - /*all: initial;*/ - /*font-size: 9pt;*/ - /*color: #494546;*/ - /*cursor: pointer;*/ - /*font-family: Arial-MT-Regular, Arial, sans-serif;*/ -/*}*/ - -/*label {*/ - /*all: initial;*/ -/*}*/ diff --git a/assets/lib/proekton-components/css/other.css b/assets/lib/proekton-components/css/other.css deleted file mode 100644 index 771bc63..0000000 --- a/assets/lib/proekton-components/css/other.css +++ /dev/null @@ -1,73 +0,0 @@ -/*DEMO*/ -.wrapper { - background-color: #f2f2f2; - padding: 40px; - margin: 50px 30px; -} - -.form-container { - padding: 50px 45px; -} - -.separator { - margin-top: 35px; - margin-bottom: 5px; -} - -.custom-check{ - cursor: pointer; - display: inline-block -} - -.custom-check .checked{ - background: url("../img/rect01.png") no-repeat center; - background-size: 210px 51px; - width: 210px; - height: 51px; -} - -.custom-check .not-checked { - background: url("../img/rect02.png") no-repeat center; - background-size: 210px 51px; - width: 210px; - height: 51px; -} - -.titleResF1, div p.titleResF1 { - font-size: 12pt; -} - -.border:after { - background-color: #CFCFCF; - content: ""; - display: inline-block; - height: 1px; - position: relative; - vertical-align: middle; - width: 100%; -} - -.border:after { - left: 0.5em; - margin-right: -100%; -} - -#page-preloader { - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - background: #090909; - z-index: 100500; -} - -#page-preloader .spinner { - width: 32px; - height: 32px; - position: absolute; - left: 50%; - top: 50%; - background: url('../img/ajax-loader.gif') no-repeat 50% 50%; - margin: -16px 0 0 -16px; -} \ No newline at end of file diff --git a/assets/lib/proekton-components/css/select-box.css b/assets/lib/proekton-components/css/select-box.css index c87fec6..f7804d6 100644 --- a/assets/lib/proekton-components/css/select-box.css +++ b/assets/lib/proekton-components/css/select-box.css @@ -4,28 +4,16 @@ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; - /* Non-prefixed version, currently - not supported by any browser */ } -/*input[type="checkbox"]:checked + span {*/ -/*all: initial;*/ -/*font-size: 9pt;*/ -/*color: #494546;*/ -/*}*/ - .select-box-container { display: block; - /*margin-top: 40px;*/ - /*min-width: 200px;*/ } .select-box-header { font-size: 12pt; white-space: nowrap; word-wrap: break-word; - /*position: relative;*/ - /*top:10px;*/ } .select-box-header .header { @@ -35,13 +23,12 @@ overflow: hidden; word-wrap: break-word; max-width: 220px; - } .select-box-header .fa { color: #5e5e5e; position: relative; - top: -5px; + top: -3px; } .select-box-header .fa:hover { @@ -53,8 +40,6 @@ } .select-box-results, .select-box-options { - /*display: block;*/ - /*box-shadow: 0px 0px 10px #777, 0px 15px 10px #000;*/ position: absolute; z-index: 99999; opacity: 0.95; @@ -64,9 +49,11 @@ display: block; max-height: 200px; overflow-y: auto; - border-top: 1px solid #cccccc; + border: 1px solid #cccccc; + /*border-right: 1px solid #cccccc;*/ + /*border-left: 1px solid #cccccc;*/ background-color: #F2F2F2; - box-shadow: 5px 12px 10px -6px rgba(0, 0, 0, .2); + box-shadow: 12px 12px 10px -6px rgba(0, 0, 0, .2); } .select-box-results input[type=checkbox] { @@ -83,12 +70,17 @@ margin: 0; padding: 0; } +.select-box-options ul { + border-right: 1px solid #cccccc; +} + +.select-box-results ul:last-child{ + border-bottom: none; +} .select-box-results li, .select-box-options li { padding: 2px 10px; - border: 1px solid #cccccc; - /*border-right: 1px solid #cccccc;*/ - + border-bottom: 1px solid #cccccc; list-style: none; font-size: 9pt; color: #494546; @@ -107,13 +99,9 @@ border-left: 2px solid red; color: #0e0e0e; } - -/*.select-box-results span:hover{*/ -/*color: green;*/ -/*}*/ -/*.select-box-search{*/ -/*position: relative;*/ -/*}*/ +.select-box-search{ + position: relative; +} input.select-box-search { height: 51px; @@ -121,12 +109,16 @@ input.select-box-search { border: 1px solid #cccccc; outline: none; padding: 5px 40px 5px 20px; - background: url("../img/magnifying-glass-308581.svg") no-repeat right; + background: url("../img/zoom.svg") no-repeat right; background-size: 40px 40px; background-color: white; margin-bottom: -1px; } +input.select-box-search.active{ + border: 1px solid #FF0029; +} + input.select-box-search:-webkit-autofill, input.select-box-search:-webkit-autofill:hover, input.select-box-search:-webkit-autofill:focus, @@ -135,11 +127,11 @@ input.select-box-search:-webkit-autofill { /*-webkit-text-fill-color: black;*/ /*-webkit-box-shadow: 0 0 0 1000px transparent inset;*/ transition: background-color 5000s ease-in-out 0s; - /*background: white;*/ } .select-box-results .main-part { display: block; + border-right: 1px solid #cccccc; } .select-box-results .other-part { @@ -155,7 +147,6 @@ input.select-box-search:-webkit-autofill { /*???*/ .select-box-options .box-wrapper, .select-box-results { - /*padding: 0 10px;*/ min-width: 300px; max-width: 400px; } @@ -179,13 +170,32 @@ button.button-add { border-radius: 15px; /* IE 9, Safari 5, Chrome */ background-color: #FF0029; padding: 4px 15px 2px 15px; - /*border: none;*/ text-decoration: none; color: white; } .highlight { - color: red; + color: #FF0029; } +#component-preloader { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + background: #9fa4a4; + opacity: 0.2; + z-index: 100500; +} + +#component-preloader .spinner { + width: 32px; + height: 32px; + position: absolute; + left: 50%; + top: 50%; + background: url('../img/ajax-loader.gif') no-repeat 50% 50%; + margin: -16px 0 0 -16px; +} diff --git a/assets/lib/proekton-components/css/selected-container.css b/assets/lib/proekton-components/css/selected-container.css index 6c50261..776dde8 100644 --- a/assets/lib/proekton-components/css/selected-container.css +++ b/assets/lib/proekton-components/css/selected-container.css @@ -1,12 +1,9 @@ .selected-container { - /*display: inline-block;*/ - /*width: 100%;*/ min-height: 40px; padding-bottom: 20px; } .selected-container .selected-element { - /*display: inline-block;*/ padding: 5px 35px 5px 10px; margin-top: 8px; min-height: 45px; @@ -17,40 +14,32 @@ -webkit-border-radius: 10px; /* Safari 4 */ border-radius: 10px; /* IE 9, Safari 5, Chrome */ } -.horizontal .selected-element{ + +.horizontal .selected-element { display: inline-block; } -.selected-element .header,.name{ +.selected-element .header, .name { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; width: 100%; } - -.selected-element .header{ +.selected-element .header,.name { + max-width: 300px; +} +.selected-element .header { font-size: 7pt; color: #676363; - /*white-space: nowrap;*/ - /*text-overflow: ellipsis;*/ - /*overflow: hidden;*/ - /*word-wrap: break-word;*/ - /*width: 100%;*/ } .selected-element .name { font-size: 11pt; - /*white-space: nowrap;*/ - /*text-overflow: ellipsis;*/ - /*overflow: hidden;*/ - /*width: 100%;*/ } - -.selected-element .icon-remove{ +.selected-element .icon-remove { background-image: url('../img/cross01.png'); background-size: 20px 20px; - /*display: inline-block;*/ position: absolute; right: 5px; top: 15px; diff --git a/assets/lib/proekton-components/img/zoom.png b/assets/lib/proekton-components/img/zoom.png deleted file mode 100644 index cfd0e74..0000000 Binary files a/assets/lib/proekton-components/img/zoom.png and /dev/null differ diff --git a/assets/lib/proekton-components/img/magnifying-glass-308581.svg b/assets/lib/proekton-components/img/zoom.svg similarity index 100% rename from assets/lib/proekton-components/img/magnifying-glass-308581.svg rename to assets/lib/proekton-components/img/zoom.svg diff --git a/assets/lib/proekton-components/img/zoom1.png b/assets/lib/proekton-components/img/zoom1.png deleted file mode 100644 index 873693f..0000000 Binary files a/assets/lib/proekton-components/img/zoom1.png and /dev/null differ diff --git a/assets/lib/proekton-components/build/init.js b/assets/lib/proekton-components/js/build/init.js similarity index 71% rename from assets/lib/proekton-components/build/init.js rename to assets/lib/proekton-components/js/build/init.js index 131b7a0..0e7f01b 100644 --- a/assets/lib/proekton-components/build/init.js +++ b/assets/lib/proekton-components/js/build/init.js @@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + var _AbsBaseSelect2 = require('./base/AbsBaseSelect'); var _AbsBaseSelect3 = _interopRequireDefault(_AbsBaseSelect2); @@ -26,19 +28,28 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var NoTreeSelect = function (_AbsBaseSelect) { _inherits(NoTreeSelect, _AbsBaseSelect); - function NoTreeSelect(_ref) { - var $container = _ref.$container, - data = _ref.data; + function NoTreeSelect($container, _ref) { + var url = _ref.url, + obj = _ref.obj, + _ref$visible = _ref.visible, + visible = _ref$visible === undefined ? true : _ref$visible; _classCallCheck(this, NoTreeSelect); - var _this = _possibleConstructorReturn(this, (NoTreeSelect.__proto__ || Object.getPrototypeOf(NoTreeSelect)).call(this, { $container: $container, data: new _NoTreeData2.default(data) })); - - _this.$buttonAddOptions.hide(); - return _this; + //TODO: сделать автоматическую передачу всех параметров родителю + return _possibleConstructorReturn(this, (NoTreeSelect.__proto__ || Object.getPrototypeOf(NoTreeSelect)).call(this, $container, { url: url, obj: obj, visible: visible })); } _createClass(NoTreeSelect, [{ + key: '_buildComponents', + value: function _buildComponents(data) { + _get(NoTreeSelect.prototype.__proto__ || Object.getPrototypeOf(NoTreeSelect.prototype), '_buildComponents', this).call(this, data); + this.dataTree = this.dataTree || new _NoTreeData2.default(data.results); + this.$buttonAddOptions.hide(); + this._fillOptionsData(); + this._bindEvents(); + } + }, { key: '_onclickOptionsElement', value: function _onclickOptionsElement(e) { this.selectedEl.id = $(e.target).data("id"); @@ -92,17 +103,25 @@ var tmpl_selectedElement = function tmpl_selectedElement(header, name, id) { }; var SelectedContainer = function () { - function SelectedContainer($container, data) { - var noTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + function SelectedContainer($container, _ref) { + var _this = this; + + var obj = _ref.obj, + _ref$noTree = _ref.noTree, + noTree = _ref$noTree === undefined ? false : _ref$noTree; _classCallCheck(this, SelectedContainer); // TODO: rename variables to camelCase this.$self = $container; this.elements_id = []; // [spec_id, spec_id, ...] - this.dataTree = noTree ? new _NoTreeData2.default(data) : new _DataTree2.default(data); - this.$input = this.$self.find('input[type="hidden"]'); - this.restoreElements(); + var self = this; + + obj.dataPromise.then(function (data) { + _this.dataTree = noTree ? new _NoTreeData2.default(data.results) : new _DataTree2.default(data.results); + _this.$input = _this.$self.find('input[type="hidden"]'); + _this.restoreElements(); + }).catch(self._onLoadDataError.bind(self)); } _createClass(SelectedContainer, [{ @@ -113,7 +132,6 @@ var SelectedContainer = function () { var data = this.$input.val().split(',').filter(function (el) { return el; }); - console.log("restore data = ", data); this.elements_id = []; data.forEach(function (el) { return self.add(el); @@ -129,6 +147,11 @@ var SelectedContainer = function () { } this.$self.find('span[data-id=\'' + spec_id + '\']').parents('.selected-element').remove(); } + }, { + key: '_onLoadDataError', + value: function _onLoadDataError(error) { + console.log("Error loading data -->", error); + } }, { key: 'remove', value: function remove(e) { @@ -147,10 +170,8 @@ var SelectedContainer = function () { return self.dataTree.isChild(el, id); }); - // console.log(has_already); if (has_already.length || this.elements_id.indexOf(Number(id)) != -1) { //TODO: do popup messages - console.log("Not actually"); return; } @@ -163,9 +184,6 @@ var SelectedContainer = function () { }); var header = SelectedContainer.getHeader(this.dataTree.getSpecChain(id), "", max_len); - console.log("id = ", id); - console.log("chain = ", this.dataTree.getSpecChain(id)); - console.log("header = ", header); var name = this.dataTree.getElementById(id).name; this.elements_id.push(id); if (this.$input) this.$input.val(this.elements_id.join(',')); @@ -231,15 +249,18 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var TreeSelect = function (_AbsBaseSelect) { _inherits(TreeSelect, _AbsBaseSelect); - function TreeSelect(_ref) { - var $container = _ref.$container, - data = _ref.data, + function TreeSelect($container, _ref) { + var url = _ref.url, + obj = _ref.obj, _ref$hasEditableConta = _ref.hasEditableContainer, - hasEditableContainer = _ref$hasEditableConta === undefined ? false : _ref$hasEditableConta; + hasEditableContainer = _ref$hasEditableConta === undefined ? false : _ref$hasEditableConta, + _ref$visible = _ref.visible, + visible = _ref$visible === undefined ? hasEditableContainer : _ref$visible; _classCallCheck(this, TreeSelect); - return _possibleConstructorReturn(this, (TreeSelect.__proto__ || Object.getPrototypeOf(TreeSelect)).call(this, { $container: $container, data: new _DataTree2.default(data), hasEditableContainer: hasEditableContainer })); + //TODO: сделать автоматическую передачу всех параметров родителю + return _possibleConstructorReturn(this, (TreeSelect.__proto__ || Object.getPrototypeOf(TreeSelect)).call(this, $container, { url: url, obj: obj, hasEditableContainer: hasEditableContainer, visible: visible })); } _createClass(TreeSelect, [{ @@ -251,7 +272,6 @@ var TreeSelect = function (_AbsBaseSelect) { }, { key: 'clearAllNext', value: function clearAllNext() { - // console.log("clearAllNext"); this.clear(); if (this.nextSelectBox) { this.nextSelectBox.hide(); @@ -265,16 +285,26 @@ var TreeSelect = function (_AbsBaseSelect) { if (this.prevSelectBox) { this.clear(); this.hide(); - // this.prevSelectBox.clear(); this.prevSelectBox.clearAllPrev(); } } + }, { + key: '_buildComponents', + value: function _buildComponents(data) { + _get(TreeSelect.prototype.__proto__ || Object.getPrototypeOf(TreeSelect.prototype), '_buildComponents', this).call(this, data); + //TODO: Изменять свойство visible при show/hide + if (!this.visible) this.hide(); + if (this.hasEditableContainer) this.$editableContainer.hide(); + this.dataTree = this.dataTree || new _DataTree2.default(data.results); + this._fillOptionsData(); + this._bindEvents(); + } }, { key: '_onclickOptionsElement', value: function _onclickOptionsElement(e) { this.clearAllNext(); _get(TreeSelect.prototype.__proto__ || Object.getPrototypeOf(TreeSelect.prototype), '_onclickOptionsElement', this).call(this, e); - + if (this.prevSelectBox && this.dataTree.hasChildren(this.selectedEl.id)) this.$searchInput.removeClass('active'); if (this.nextSelectBox && this.dataTree.hasChildren(this.selectedEl.id)) { this.nextSelectBox.setParent(this.selectedEl.id); this.nextSelectBox.setHeader(this.selectedEl.value); @@ -328,61 +358,117 @@ var _createClass = function () { function defineProperties(target, props) { for function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -//TEMPLATES +//TEMPLATES ` var tmpl_selectBoxEditCont = function tmpl_selectBoxEditCont() { - return "\n