PR-49 Дополнительные инструменты

+ Обязательные поля
+ Всплывающие подсказки
remotes/origin/PR-49
booblegum 9 years ago
parent 41039288d9
commit 65682128bc
  1. 92
      assets/js/build/create_project.js
  2. 133
      assets/js/build/create_worksell.js
  3. 12
      assets/js/build/init_create_worksell.js
  4. 12
      assets/js/build/init_customer_project_create.js
  5. 6
      assets/js/src/create_worksell.js
  6. 5
      assets/js/src/customer_project_create.js
  7. 2
      assets/js/src/init_create_worksell.js
  8. 2
      assets/js/src/init_customer_project_create.js
  9. 26
      assets/js/src/seeds/image_upload.js
  10. 43
      assets/js/src/seeds/popups.js
  11. 10
      assets/js/src/seeds/scroll_on_required.js
  12. 10
      assets/lib/proekton-components/js/src/base/AbsBaseSelect.js
  13. 2
      assets/sass/common/_parts.sass
  14. 2
      projects/forms.py
  15. 21
      projects/templates/customer_project_create.html
  16. 26
      templates/partials/base.html
  17. 8
      templates/partials/inc-message-popup.html
  18. 28
      templates/partials/sass/popups.sass
  19. 24
      work_sell/templates/worksell_create.html

@ -56,7 +56,11 @@
var _only_one_checkbox = __webpack_require__(6); var _only_one_checkbox = __webpack_require__(6);
var _test_seeds = __webpack_require__(7); var _popups = __webpack_require__(7);
var _scroll_on_required = __webpack_require__(19);
var _test_seeds = __webpack_require__(8);
function showHideRealry() { function showHideRealry() {
var check = $('#checkbox-sb-realty'); var check = $('#checkbox-sb-realty');
@ -77,6 +81,9 @@
showHideRealry(); showHideRealry();
(0, _read_more.readMoreInit)(); (0, _read_more.readMoreInit)();
(0, _only_one_checkbox.onlyOneCheckboxInit)('#safe', '#by_agreement'); (0, _only_one_checkbox.onlyOneCheckboxInit)('#safe', '#by_agreement');
(0, _scroll_on_required.scrollOnRequiredInit)();
(0, _popups.showPopupsInit)();
window.addMessage = _popups.addMessage;
}); });
/***/ }, /***/ },
@ -289,6 +296,59 @@
/***/ }, /***/ },
/* 7 */ /* 7 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function showMessage(container, template, message, type) {
var $popup = $(template);
$popup.hide();
$popup.find('.message').html(message);
$popup.addClass(type);
container.append($popup);
$popup.fadeIn(1000, function () {
setTimeout(function (el) {
$(el).fadeOut(1000);
}, 2000, this);
});
}
function addMessage(message, type) {
var $popups_storage = $('#popups-storage');
var li = '<li class="' + type + '">' + message + '</li>';
$popups_storage.append(li);
}
function showPopupsInit() {
var $popups_storage = $('#popups-storage');
var $popups_container = $('#popups-container');
var $popup = $popups_container.find(".popup");
var popup_html = $popup[0].outerHTML;
$popup.remove();
if (!$popups_storage.length) return;
$.each($popups_storage.find("li"), function (key, value) {
var message = $(value).html();
var type = $(value).attr('class');
showMessage($popups_container, popup_html, message, type);
$(value).remove();
});
$popups_storage.bind("DOMNodeInserted", function () {
var $li = $(this).find('li');
var message = $li.html();
var type = $li.attr('class');
$li.remove();
showMessage($popups_container, popup_html, message, type);
});
}
exports.showPopupsInit = showPopupsInit;
exports.addMessage = addMessage;
/***/ },
/* 8 */
/***/ function(module, exports) { /***/ function(module, exports) {
"use strict"; "use strict";
@ -302,5 +362,35 @@
exports.print = print; exports.print = print;
/***/ },
/* 9 */,
/* 10 */,
/* 11 */,
/* 12 */,
/* 13 */,
/* 14 */,
/* 15 */,
/* 16 */,
/* 17 */,
/* 18 */,
/* 19 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function scrollOnRequiredInit() {
var $required = $('.required.error');
// console.log($required);
if (!$required.length) return;
$('html, body').animate({
scrollTop: $required.offset().top - 25
}, 1000);
}
exports.scrollOnRequiredInit = scrollOnRequiredInit;
/***/ } /***/ }
/******/ ]); /******/ ]);

@ -40,23 +40,33 @@
/******/ return __webpack_require__(0); /******/ return __webpack_require__(0);
/******/ }) /******/ })
/************************************************************************/ /************************************************************************/
/******/ ([ /******/ ({
/* 0 */
/***/ 0:
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
'use strict'; 'use strict';
var _file_upload = __webpack_require__(1); var _file_upload = __webpack_require__(1);
var _image_upload = __webpack_require__(8); var _image_upload = __webpack_require__(20);
var _scroll_on_required = __webpack_require__(19);
var _popups = __webpack_require__(7);
$(function () { $(function () {
// fileUploadInit(); // fileUploadInit();
// previewImg();
(0, _image_upload.imageUploadInit)(); (0, _image_upload.imageUploadInit)();
(0, _scroll_on_required.scrollOnRequiredInit)();
(0, _popups.showPopupsInit)();
window.addMessage = _popups.addMessage;
}); });
/***/ }, /***/ },
/* 1 */
/***/ 1:
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
'use strict'; 'use strict';
@ -104,7 +114,8 @@
exports.fileUploadInit = fileUploadInit; exports.fileUploadInit = fileUploadInit;
/***/ }, /***/ },
/* 2 */
/***/ 2:
/***/ function(module, exports) { /***/ function(module, exports) {
'use strict'; 'use strict';
@ -148,12 +159,83 @@
exports.getCookie = getCookie; exports.getCookie = getCookie;
/***/ }, /***/ },
/* 3 */,
/* 4 */, /***/ 7:
/* 5 */, /***/ function(module, exports) {
/* 6 */,
/* 7 */, 'use strict';
/* 8 */
Object.defineProperty(exports, "__esModule", {
value: true
});
function showMessage(container, template, message, type) {
var $popup = $(template);
$popup.hide();
$popup.find('.message').html(message);
$popup.addClass(type);
container.append($popup);
$popup.fadeIn(1000, function () {
setTimeout(function (el) {
$(el).fadeOut(1000);
}, 2000, this);
});
}
function addMessage(message, type) {
var $popups_storage = $('#popups-storage');
var li = '<li class="' + type + '">' + message + '</li>';
$popups_storage.append(li);
}
function showPopupsInit() {
var $popups_storage = $('#popups-storage');
var $popups_container = $('#popups-container');
var $popup = $popups_container.find(".popup");
var popup_html = $popup[0].outerHTML;
$popup.remove();
if (!$popups_storage.length) return;
$.each($popups_storage.find("li"), function (key, value) {
var message = $(value).html();
var type = $(value).attr('class');
showMessage($popups_container, popup_html, message, type);
$(value).remove();
});
$popups_storage.bind("DOMNodeInserted", function () {
var $li = $(this).find('li');
var message = $li.html();
var type = $li.attr('class');
$li.remove();
showMessage($popups_container, popup_html, message, type);
});
}
exports.showPopupsInit = showPopupsInit;
exports.addMessage = addMessage;
/***/ },
/***/ 19:
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function scrollOnRequiredInit() {
var $required = $('.required.error');
// console.log($required);
if (!$required.length) return;
$('html, body').animate({
scrollTop: $required.offset().top - 25
}, 1000);
}
exports.scrollOnRequiredInit = scrollOnRequiredInit;
/***/ },
/***/ 20:
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
'use strict'; 'use strict';
@ -165,6 +247,26 @@
var _utils = __webpack_require__(2); var _utils = __webpack_require__(2);
// function previewImg() {
// let $fileUploadWidgets = $('.file-upload-widget');
// $.each($fileUploadWidgets, function (ind, el) {
// let $fileImg = $(el).find('img');
// let $fileInput = $(el).find('.file-upload-input');
// // console.log("$fileInput[0].files.length = ", $fileInput[0].files.length);
// // console.log("$fileInput.val() = ", $fileInput.val());
// console.log("$fileInput = ", $fileInput);
// if ($fileInput[0].files.length) {
// console.log("Попытка загрузить файл");
// let reader = new FileReader();
// reader.onload = function (e) {
// $fileImg.attr('src', e.target.result);
// };
//
// reader.readAsDataURL($fileInput[0].files[0]);
// }
// })
// }
function imageUploadInit() { function imageUploadInit() {
var $fileUploadContainer = $('#fileUploadContainer'); var $fileUploadContainer = $('#fileUploadContainer');
@ -179,7 +281,8 @@
var filePath = $fileInput.val().replace(/\\/g, '/'); var filePath = $fileInput.val().replace(/\\/g, '/');
var fileName = path.basename(filePath); var fileName = path.basename(filePath);
var fileSize = $fileInput.get(0).files && (0, _utils.humanFileSize)($fileInput.get(0).files[0].size); var fileSize = $fileInput.get(0).files && (0, _utils.humanFileSize)($fileInput.get(0).files[0].size);
console.log("file path", filePath);
console.log("file path2 ", $fileInput[0].files[0]);
if (fileName) { if (fileName) {
$fileUploadWidget.find('.file-upload-label').text(fileName + ' ' + fileSize); $fileUploadWidget.find('.file-upload-label').text(fileName + ' ' + fileSize);
@ -190,7 +293,7 @@
$fileUploadWidget.css('display', 'block'); $fileUploadWidget.css('display', 'block');
if ($fileImg) { if ($fileImg.length) {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (e) { reader.onload = function (e) {
$fileImg.attr('src', e.target.result); $fileImg.attr('src', e.target.result);
@ -207,6 +310,8 @@
}); });
} //TODO: оформить Upload'еры в виде классов } //TODO: оформить Upload'еры в виде классов
exports.imageUploadInit = imageUploadInit; exports.imageUploadInit = imageUploadInit;
// export {imageUploadInit, previewImg}
/***/ } /***/ }
/******/ ]);
/******/ });

@ -76,7 +76,7 @@
function createSpecs(url) { function createSpecs(url) {
// SPECIALIZATIONS // SPECIALIZATIONS
var sb_main = new _TreeSelect2.default($('#select-box-1'), { url: url, visible: true, required: true }); var sb_main = new _TreeSelect2.default($('#select-box-1'), { url: url, visible: true, required: true });
sb_main.setHeader("Тип готовой работы"); // sb_main.setHeader("Тип готовой работы");
var select_container = new _SelectedContainer2.default($('#selected-spec'), { var select_container = new _SelectedContainer2.default($('#selected-spec'), {
obj: sb_main obj: sb_main
}); });
@ -1049,7 +1049,7 @@
var selectBox = this.hasEditableContainer ? tmpl_selectBoxEditCont() : tmpl_selectBox(); var selectBox = this.hasEditableContainer ? tmpl_selectBoxEditCont() : tmpl_selectBox();
classes = classes ? classes.join(" ") : ""; classes = classes ? classes.join(" ") : "";
return htmlTemplate({ return htmlTemplate({
header: "TestHeader", selectBox: selectBox, required: this.required, id: this.containerId, classes: classes, header: "", selectBox: selectBox, required: this.required, id: this.containerId, classes: classes,
tmpl_selectBoxOptions: tmpl_selectBoxOptions, tmpl_selectBoxResults: tmpl_selectBoxResults tmpl_selectBoxOptions: tmpl_selectBoxOptions, tmpl_selectBoxResults: tmpl_selectBoxResults
}); });
} }
@ -1102,7 +1102,8 @@
value: function setHeader(header) { value: function setHeader(header) {
if (this.$header) { if (this.$header) {
this.$header.html(header); this.$header.find('.header').html(header);
this.$header.show();
} else { } else {
this.header = header; this.header = header;
} }
@ -1155,8 +1156,9 @@
this.$container.replaceWith(template); this.$container.replaceWith(template);
this.$selectBox = $("#" + this.containerId); this.$selectBox = $("#" + this.containerId);
this.$header = this.$selectBox.find('.select-box-header .header'); this.$header = this.$selectBox.find('.select-box-header');
this.$header.html(this.header); this.$header.find('.header').html(this.header);
if (!this.header) this.$header.hide();
this.$resultsBox = this.$selectBox.find('.select-box-results'); this.$resultsBox = this.$selectBox.find('.select-box-results');
this.$optionsBox = this.$selectBox.find('.select-box-options'); this.$optionsBox = this.$selectBox.find('.select-box-options');
this.$searchInput = this.$selectBox.find('input.select-box-search'); this.$searchInput = this.$selectBox.find('input.select-box-search');

@ -76,7 +76,7 @@
function createSpecs(url) { function createSpecs(url) {
// SPECIALIZATIONS // SPECIALIZATIONS
var sb_main = new _TreeSelect2.default($('#select-box-1'), { url: url, visible: true, required: true }); var sb_main = new _TreeSelect2.default($('#select-box-1'), { url: url, visible: true, required: true });
sb_main.setHeader("Специальность"); // sb_main.setHeader("Специальность");
var select_container = new _SelectedContainer2.default($('#selected-spec'), { var select_container = new _SelectedContainer2.default($('#selected-spec'), {
obj: sb_main, obj: sb_main,
onlyOne: true onlyOne: true
@ -1084,7 +1084,7 @@
var selectBox = this.hasEditableContainer ? tmpl_selectBoxEditCont() : tmpl_selectBox(); var selectBox = this.hasEditableContainer ? tmpl_selectBoxEditCont() : tmpl_selectBox();
classes = classes ? classes.join(" ") : ""; classes = classes ? classes.join(" ") : "";
return htmlTemplate({ return htmlTemplate({
header: "TestHeader", selectBox: selectBox, required: this.required, id: this.containerId, classes: classes, header: "", selectBox: selectBox, required: this.required, id: this.containerId, classes: classes,
tmpl_selectBoxOptions: tmpl_selectBoxOptions, tmpl_selectBoxResults: tmpl_selectBoxResults tmpl_selectBoxOptions: tmpl_selectBoxOptions, tmpl_selectBoxResults: tmpl_selectBoxResults
}); });
} }
@ -1137,7 +1137,8 @@
value: function setHeader(header) { value: function setHeader(header) {
if (this.$header) { if (this.$header) {
this.$header.html(header); this.$header.find('.header').html(header);
this.$header.show();
} else { } else {
this.header = header; this.header = header;
} }
@ -1190,8 +1191,9 @@
this.$container.replaceWith(template); this.$container.replaceWith(template);
this.$selectBox = $("#" + this.containerId); this.$selectBox = $("#" + this.containerId);
this.$header = this.$selectBox.find('.select-box-header .header'); this.$header = this.$selectBox.find('.select-box-header');
this.$header.html(this.header); this.$header.find('.header').html(this.header);
if (!this.header) this.$header.hide();
this.$resultsBox = this.$selectBox.find('.select-box-results'); this.$resultsBox = this.$selectBox.find('.select-box-results');
this.$optionsBox = this.$selectBox.find('.select-box-options'); this.$optionsBox = this.$selectBox.find('.select-box-options');
this.$searchInput = this.$selectBox.find('input.select-box-search'); this.$searchInput = this.$selectBox.find('input.select-box-search');

@ -1,7 +1,13 @@
import {fileUploadInit} from './seeds/file_upload' import {fileUploadInit} from './seeds/file_upload'
import {imageUploadInit} from './seeds/image_upload' import {imageUploadInit} from './seeds/image_upload'
import {scrollOnRequiredInit} from './seeds/scroll_on_required'
import {showPopupsInit, addMessage} from './seeds/popups'
$(function () { $(function () {
// fileUploadInit(); // fileUploadInit();
// previewImg();
imageUploadInit(); imageUploadInit();
scrollOnRequiredInit();
showPopupsInit();
window.addMessage = addMessage;
}); });

@ -3,6 +3,8 @@ import {extendedFieldInit} from './seeds/extended_field'
import {customCheckInit} from './seeds/custom_check' import {customCheckInit} from './seeds/custom_check'
import {readMoreInit} from './seeds/read_more' import {readMoreInit} from './seeds/read_more'
import {onlyOneCheckboxInit} from './seeds/only_one_checkbox' import {onlyOneCheckboxInit} from './seeds/only_one_checkbox'
import {showPopupsInit, addMessage} from './seeds/popups'
import {scrollOnRequiredInit} from './seeds/scroll_on_required'
import {print} from './seeds/test_seeds' import {print} from './seeds/test_seeds'
function showHideRealry() { function showHideRealry() {
@ -24,4 +26,7 @@ $(function () {
showHideRealry(); showHideRealry();
readMoreInit(); readMoreInit();
onlyOneCheckboxInit('#safe', '#by_agreement'); onlyOneCheckboxInit('#safe', '#by_agreement');
scrollOnRequiredInit();
showPopupsInit();
window.addMessage = addMessage;
}); });

@ -9,7 +9,7 @@ $(function () {
function createSpecs(url) { function createSpecs(url) {
// SPECIALIZATIONS // SPECIALIZATIONS
let sb_main = new TreeSelect($('#select-box-1'), {url, visible: true, required: true}); let sb_main = new TreeSelect($('#select-box-1'), {url, visible: true, required: true});
sb_main.setHeader("Тип готовой работы"); // sb_main.setHeader("Тип готовой работы");
let select_container = new SelectedContainer($('#selected-spec'), let select_container = new SelectedContainer($('#selected-spec'),
{ {
obj: sb_main, obj: sb_main,

@ -9,7 +9,7 @@ $(function () {
function createSpecs(url) { function createSpecs(url) {
// SPECIALIZATIONS // SPECIALIZATIONS
let sb_main = new TreeSelect($('#select-box-1'), {url, visible: true, required: true}); let sb_main = new TreeSelect($('#select-box-1'), {url, visible: true, required: true});
sb_main.setHeader("Специальность"); // sb_main.setHeader("Специальность");
let select_container = new SelectedContainer($('#selected-spec'), let select_container = new SelectedContainer($('#selected-spec'),
{ {
obj: sb_main, obj: sb_main,

@ -1,6 +1,26 @@
//TODO: оформить Upload'еры в виде классов //TODO: оформить Upload'еры в виде классов
import {humanFileSize} from '../utils' import {humanFileSize} from '../utils'
// function previewImg() {
// let $fileUploadWidgets = $('.file-upload-widget');
// $.each($fileUploadWidgets, function (ind, el) {
// let $fileImg = $(el).find('img');
// let $fileInput = $(el).find('.file-upload-input');
// // console.log("$fileInput[0].files.length = ", $fileInput[0].files.length);
// // console.log("$fileInput.val() = ", $fileInput.val());
// console.log("$fileInput = ", $fileInput);
// if ($fileInput[0].files.length) {
// console.log("Попытка загрузить файл");
// let reader = new FileReader();
// reader.onload = function (e) {
// $fileImg.attr('src', e.target.result);
// };
//
// reader.readAsDataURL($fileInput[0].files[0]);
// }
// })
// }
function imageUploadInit() { function imageUploadInit() {
var $fileUploadContainer = $('#fileUploadContainer'); var $fileUploadContainer = $('#fileUploadContainer');
@ -15,7 +35,8 @@ function imageUploadInit() {
var filePath = $fileInput.val().replace(/\\/g, '/'); var filePath = $fileInput.val().replace(/\\/g, '/');
var fileName = path.basename(filePath); var fileName = path.basename(filePath);
var fileSize = $fileInput.get(0).files && humanFileSize($fileInput.get(0).files[0].size); var fileSize = $fileInput.get(0).files && humanFileSize($fileInput.get(0).files[0].size);
console.log("file path", filePath);
console.log("file path2 ", $fileInput[0].files[0]);
if (fileName) { if (fileName) {
$fileUploadWidget.find('.file-upload-label').text(fileName + ' ' + fileSize); $fileUploadWidget.find('.file-upload-label').text(fileName + ' ' + fileSize);
@ -26,7 +47,7 @@ function imageUploadInit() {
$fileUploadWidget.css('display', 'block'); $fileUploadWidget.css('display', 'block');
if ($fileImg) { if ($fileImg.length) {
let reader = new FileReader(); let reader = new FileReader();
reader.onload = function (e) { reader.onload = function (e) {
$fileImg.attr('src', e.target.result); $fileImg.attr('src', e.target.result);
@ -45,3 +66,4 @@ function imageUploadInit() {
} }
export {imageUploadInit} export {imageUploadInit}
// export {imageUploadInit, previewImg}

@ -0,0 +1,43 @@
function showMessage(container, template, message, type) {
let $popup = $(template);
$popup.hide();
$popup.find('.message').html(message);
$popup.addClass(type);
container.append($popup);
$popup.fadeIn(1000, function () {
setTimeout(function (el) {
$(el).fadeOut(1000);
}, 2000, this)
});
}
function addMessage(message, type) {
const $popups_storage = $('#popups-storage');
let li = `<li class="${type}">${message}</li>`;
$popups_storage.append(li);
}
function showPopupsInit() {
const $popups_storage = $('#popups-storage');
const $popups_container = $('#popups-container');
let $popup = $popups_container.find(".popup");
let popup_html = $popup[0].outerHTML;
$popup.remove();
if (!$popups_storage.length) return;
$.each($popups_storage.find("li"), function (key, value) {
let message = $(value).html();
let type = $(value).attr('class');
showMessage($popups_container, popup_html, message, type);
$(value).remove();
});
$popups_storage.bind("DOMNodeInserted", function () {
let $li = $(this).find('li');
let message = $li.html();
let type = $li.attr('class');
$li.remove();
showMessage($popups_container, popup_html, message, type);
});
}
export {showPopupsInit, addMessage}

@ -0,0 +1,10 @@
function scrollOnRequiredInit() {
let $required = $('.required.error');
// console.log($required);
if (!$required.length) return;
$('html, body').animate({
scrollTop: $required.offset().top - 25
}, 1000);
}
export {scrollOnRequiredInit}

@ -143,7 +143,7 @@ export default class AbsBaseSelect {
let selectBox = this.hasEditableContainer ? tmpl_selectBoxEditCont() : tmpl_selectBox(); let selectBox = this.hasEditableContainer ? tmpl_selectBoxEditCont() : tmpl_selectBox();
classes = classes ? classes.join(" ") : ""; classes = classes ? classes.join(" ") : "";
return htmlTemplate({ return htmlTemplate({
header: "TestHeader", selectBox, required: this.required, id: this.containerId, classes, header: "", selectBox, required: this.required, id: this.containerId, classes,
tmpl_selectBoxOptions, tmpl_selectBoxResults tmpl_selectBoxOptions, tmpl_selectBoxResults
}) })
} }
@ -224,7 +224,8 @@ export default class AbsBaseSelect {
setHeader(header) { setHeader(header) {
if (this.$header) { if (this.$header) {
this.$header.html(header) this.$header.find('.header').html(header);
this.$header.show();
} else { } else {
this.header = header this.header = header
} }
@ -273,8 +274,9 @@ export default class AbsBaseSelect {
this.$container.replaceWith(template); this.$container.replaceWith(template);
this.$selectBox = $(`#${this.containerId}`); this.$selectBox = $(`#${this.containerId}`);
this.$header = this.$selectBox.find('.select-box-header .header'); this.$header = this.$selectBox.find('.select-box-header');
this.$header.html(this.header); this.$header.find('.header').html(this.header);
if (!this.header) this.$header.hide();
this.$resultsBox = this.$selectBox.find('.select-box-results'); this.$resultsBox = this.$selectBox.find('.select-box-results');
this.$optionsBox = this.$selectBox.find('.select-box-options'); this.$optionsBox = this.$selectBox.find('.select-box-options');
this.$searchInput = this.$selectBox.find('input.select-box-search'); this.$searchInput = this.$selectBox.find('input.select-box-search');

@ -20,3 +20,5 @@
font: font:
size: 10pt size: 10pt
color: #9f9f9f color: #9f9f9f
&.error
color: red

@ -191,7 +191,7 @@ class CustomerProjectEditFormNew(forms.ModelForm):
# self.fields['realty'].queryset = self.request.user.realties.all() # self.fields['realty'].queryset = self.request.user.realties.all()
# self.fields['budget'].required = False self.fields['text'].required = True
# self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants() # self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants()
# self.fields['specialization'].queryset = Specialization.objects # Migrate with this enabled # self.fields['specialization'].queryset = Specialization.objects # Migrate with this enabled

@ -33,8 +33,8 @@
<div class="simple-field"> <div class="simple-field">
<div class="header">Название заказа</div> <div class="header">Название заказа</div>
<i class="fa fa-question-circle-o" aria-hidden="true"></i> <i class="fa fa-question-circle-o" aria-hidden="true"></i>
<span class="required">Обязательно</span> <span class="required {% if form.name.errors %}error{% endif %}">Обязательно</span>
<input value="{{ form.name.value }}" name="{{ form.name.html_name }}" <input value="{{ form.name.value }}" name="name"
class="simple-input italic" class="simple-input italic"
placeholder="Пример: Дизайн квартиры, Армирование фундамента, Конструкции перекрытия и т.д." placeholder="Пример: Дизайн квартиры, Армирование фундамента, Конструкции перекрытия и т.д."
autocomplete="off" autocomplete="off"
@ -47,6 +47,9 @@
</div> </div>
<div class="row vertical-child mod-align-bottom"> <div class="row vertical-child mod-align-bottom">
<div class="col-lg-9"> <div class="col-lg-9">
<div class="header">Специальность</div>
<i class="fa fa-question-circle-o" aria-hidden="true"></i>
<span class="required {% if form.specialization.errors %}error{% endif %}">Обязательно</span>
<div class="" id="select-box-1"></div> <div class="" id="select-box-1"></div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
@ -89,15 +92,15 @@
<span class="select-text" id="spec-value"></span> <span class="select-text" id="spec-value"></span>
</div> </div>
<i class="fa fa-question-circle-o" aria-hidden="true" title=""></i> <i class="fa fa-question-circle-o" aria-hidden="true" title=""></i>
<span class="required">Обязательно</span> <span class="required {% if form.text.errors %}error{% endif %}">Обязательно</span>
<textarea name="{{ form.description.html_name }}" class="description" rows="6" <textarea name="text" class="description" rows="6"
placeholder= placeholder=
" Пример №1 " Пример №1
Разработать архиьектурные решения для жилого дома на основании эскизной проработки Разработать архиьектурные решения для жилого дома на основании эскизной проработки
Пример №2 Пример №2
Разработать проект по електроснабжению и освещению гаража">{{ form.description.value }}</textarea> Разработать проект по електроснабжению и освещению гаража">{{ form.text.value }}</textarea>
</div> </div>
<div class="documentsChat mod" id="fileUploadContainer"> <div class="documentsChat mod" id="fileUploadContainer">
@ -362,6 +365,14 @@
</div> <!-- content --> </div> <!-- content -->
</div> </div>
{% include 'partials/footer.html' %} {% include 'partials/footer.html' %}
<ul id="popups-storage" hidden>
{% if form.errors %}
<li class="error">Форма заполнена неполностью</li>
{% endif %}
{# <li class="info">Message-1</li>#}
{# <li class="warning">Message-1</li>#}
</ul>
{% include 'partials/inc-message-popup.html' %}
</div> </div>
{% endblock %} {% endblock %}

@ -51,25 +51,27 @@
</head> </head>
<body> <body>
{% if messages %} {% if TEMPLATE_DEBUG %}
{% if messages %}
{% for message in messages %} {% for message in messages %}
<div class="c" <div class="c"
style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div> style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div>
{% endfor %} {% endfor %}
{% endif %}
{% if TEMPLATE_DEBUG %}
<div ondblclick="$(this).css('display', 'none')"
style="position: absolute; left: 0; bottom: 0; padding: 6px; color: black; background-color: {% if request.user.is_contractor %}#BADA55{% else %}#C0FFEE{% endif %}; z-index: 50">
{{ request.user }}<br>
{% if request.user.is_authenticated %}
<b>PK:</b> {{ request.user.pk }}<br>
<b>Groups:</b> {{ request.user.groups.all }}
{% endif %} {% endif %}
</div>
{% endif %} {% endif %}
{#{% if TEMPLATE_DEBUG %}#}
{# <div ondblclick="$(this).css('display', 'none')"#}
{# style="position: absolute; left: 0; bottom: 0; padding: 6px; color: black; background-color: {% if request.user.is_contractor %}#BADA55{% else %}#C0FFEE{% endif %}; z-index: 50">#}
{# {{ request.user }}<br>#}
{##}
{# {% if request.user.is_authenticated %}#}
{# <b>PK:</b> {{ request.user.pk }}<br>#}
{# <b>Groups:</b> {{ request.user.groups.all }}#}
{# {% endif %}#}
{# </div>#}
{#{% endif %}#}
{% block content %}{% endblock %} {% block content %}{% endblock %}
{% block common_js %} {% block common_js %}

@ -0,0 +1,8 @@
{% load sass_tags %}
<link rel='stylesheet' href='{% sass_src "partials/sass/popups.sass" %}'>
<div class="popups-container" id="popups-container">
<div style="display: none" class="popup">
<div class="message">
</div>
</div>
</div>

@ -0,0 +1,28 @@
.popups-container
width: 100%
position: fixed
top: 0
left: 0
opacity: 0.8
.popup
width: 100%
min-height: 50px
background-color: #7a8529
border-radius: 20px
border: 1px solid #ffffff
display: flex
-ms-flex-align: center
-webkit-align-items: center
-webkit-box-align: center
align-items: center
//text-align: center
.message
color: white
width: 100%
text-align: center
&.warning
background-color: #ffc649
&.error
background-color: #ff4146
&.info
background-color: #4e58ff

@ -45,7 +45,7 @@
<div class="simple-field"> <div class="simple-field">
<div class="header">Название проекта</div> <div class="header">Название проекта</div>
<i class="fa fa-question-circle-o" aria-hidden="true"></i> <i class="fa fa-question-circle-o" aria-hidden="true"></i>
<span class="required">Обязательно</span> <span class="required {% if form.name.errors %}error{% endif %}">Обязательно</span>
<input value="{{ form.name.value }}" name="{{ form.name.html_name }}" <input value="{{ form.name.value }}" name="{{ form.name.html_name }}"
class="simple-input italic" class="simple-input italic"
placeholder="Пример: Дизайн проект квартиры, Армирование фундамента, Конструкции перекрытия и т.д." placeholder="Пример: Дизайн проект квартиры, Армирование фундамента, Конструкции перекрытия и т.д."
@ -67,6 +67,9 @@
</div> </div>
<div class="row vertical-child mod-align-bottom"> <div class="row vertical-child mod-align-bottom">
<div class="col-lg-9"> <div class="col-lg-9">
<div class="header">Тип готовой работы</div>
<i class="fa fa-question-circle-o" aria-hidden="true"></i>
<span class="required {% if form.specializations.errors %}error{% endif %}">Обязательно</span>
<div class="" id="select-box-1"></div> <div class="" id="select-box-1"></div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
@ -97,7 +100,7 @@
<div class="row"> <div class="row">
<div class="col-lg-12 vertical-child"> <div class="col-lg-12 vertical-child">
<div class="selected-container horizontal" id="selected-spec"> <div class="selected-container horizontal" id="selected-spec">
<input type="hidden" name="{{ form.specializations.html_name }}" <input type="hidden" name="specializations"
value="{{ form.specializations.value }}"> value="{{ form.specializations.value }}">
</div> </div>
</div> </div>
@ -109,9 +112,9 @@
<span class="select-text" id="spec-value"></span> <span class="select-text" id="spec-value"></span>
</div> </div>
<i class="fa fa-question-circle-o" aria-hidden="true" title=""></i> <i class="fa fa-question-circle-o" aria-hidden="true" title=""></i>
<span class="required">Обязательно</span> <span class="required {% if form.description.errors %}error{% endif %}">Обязательно</span>
<textarea name="{{ form.description.html_name }}" class="description" <textarea name="{{ form.description.html_name }}" class="description"
rows="8">{{ form.description.value }}></textarea> rows="8">{{ form.description.value }}</textarea>
</div> </div>
<div class="documentsChat mod" id="fileUploadContainer"> <div class="documentsChat mod" id="fileUploadContainer">
@ -130,7 +133,8 @@
<div class="preview-container"> <div class="preview-container">
<div class="file-upload-remove-img-btn"></div> <div class="file-upload-remove-img-btn"></div>
<img class="preview" src="#" alt="your image"/> <img class="preview" src="#" alt="your image"/>
<textarea name="img_description" rows="2" data-limit-rows="true" class="description"></textarea> <textarea name="img_description" rows="2" data-limit-rows="true"
class="description"></textarea>
</div> </div>
<span style="display:none" class="file-upload-label"></span> <span style="display:none" class="file-upload-label"></span>
@ -195,13 +199,23 @@
<div class="col-lg-3 col-lg-offset-6" style="text-align: center"> <div class="col-lg-3 col-lg-offset-6" style="text-align: center">
<div class="header">&nbsp;</div> <div class="header">&nbsp;</div>
<input style="width: 100%" type="button" class="btn btn-simple" <input style="width: 100%" type="button" class="btn btn-simple"
onclick="addMessage('Функционал временно не работает', 'info')"
value="ПРЕДВАРИТЕЛЬНЫЙ ПРОСМОТР"> value="ПРЕДВАРИТЕЛЬНЫЙ ПРОСМОТР">
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
{% include 'partials/footer.html' %} {% include 'partials/footer.html' %}
<ul id="popups-storage" hidden>
{% if form.errors %}
<li class="error">Форма заполнена неполностью</li>
{% endif %}
{# <li class="info">Message-1</li>#}
{# <li class="warning">Message-1</li>#}
</ul>
{% include 'partials/inc-message-popup.html' %}
</div> </div>
{% endblock %} {% endblock %}
{% block old_js %} {% block old_js %}

Loading…
Cancel
Save