expo-16 almost ready, need multiple select input predefined values

remotes/origin/1203
pavel 11 years ago
parent ad12fcae21
commit 131c645212
  1. 51
      templates/client/includes/accounts/current_user.html
  2. 181
      templates/client/includes/company/company_edit.html
  3. 19
      templates/client/static_client/css/main.css
  4. 2
      templates/client/static_client/css_min/main.min.css
  5. 189
      templates/client/static_client/js/_modules/page.company.js
  6. 40
      templates/client/static_client/js/_modules/page.profile.js
  7. 2
      templates/client/static_client/js_min/_modules/page.company.min.js
  8. 2
      templates/client/static_client/js_min/_modules/page.profile.min.js

@ -10,19 +10,22 @@
{# avatar #}
<aside>
<div class="form-item-wrap">
<div class="i-pict p-editable editable-wrap">
{% if request.user.profile.avatar %}
<div class="avatar-btn i-pict i-descr">
<a class="add_pic_block" title="">
<span></span>
<i>{% trans 'Добавить лого' %}</i>
<b>+20</b>
</a>
</div>
<div class="i-pict p-editable editable-wrap hidden">
<div id="pick-block" class="pic_block">
{% endif %}
{% thumbnail request.user.profile.avatar "100x100" crop="center" as im %}
<img class="user-avatar" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
{% endthumbnail %}
{% if request.user.profile.avatar %}
</div>
{% endif %}
<div class="edit-wrap">
<a class="e-btn no-refresh" href="#">{% trans 'редактировать' %}</a>
<a class="e-btn " href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" enctype="multipart/form-data" id="avatar_form"action="/profile/update/avatar/" method="post">{% csrf_token %}
<div class="ef-body">
@ -59,18 +62,18 @@
<div class="i-info ">
<header>
{# country and city #}
<div class="form-item-wrap">
<div class="form-item-wrap"> <!-- 1 -->
<div class="i-descr add_link_text ">
<a class="e-btn" href="#" title="">{% trans 'Указать' %}</a>
<div class="add_link_text_text">{% trans 'Страну и город' %}<b>+10</b></div>
</div>
<div class="i-place p-editable editable-wrap hidden">
<div class="i-place p-editable editable-wrap hidden"> <!-- 2 -->
<span class="static-value">
<span id="static-home-country">{{ home_form.instance.country }}</span>
, <span id="static-home-city">{{ home_form.instance.city }}</span>
<span class="static-value"> <!-- 3 -->
<span id="static-home-country">{{ home_form.instance.country }}</span>
, <span id="static-home-city">{{ home_form.instance.city }}</span>
</span>
</span>
<div class="edit-wrap e-left">
@ -113,7 +116,7 @@
<a class="e-btn" href="#" title="">{% trans 'Указать' %}</a>
<div class="add_link_text_text">{% trans 'имя и фамилию' %}<b>+10</b></div>
</div>
<div class="i-title p-editable editable-wrap"> <!-- 2 -->
<div class="i-title p-editable editable-wrap hidden"> <!-- 2 -->
<span id="static-name-value" class="static-value"><!-- 3 -->
{{ name_form.get_full_name }}
</span>
@ -207,9 +210,10 @@
<div class="i-contacts clearfix">
<div class="ic-buttons dd_width_4">
<div class="form-item-wrap"><!-- 1 -->
<div class="ic-buttons_text">{% trans 'Добавить профили в соц.сетях:' %}</div>
<div class="form-item-wrap"><!-- 1 -->
<div class="p-editable editable-wrap social">
<div class="i-descr add_link_text add_link_text_medium">
<div class="i-descr add_link_text add_link_text_medium soc-media-indent">
<a class="e-btn no-refresh social" href="#" title="">{% trans 'Добавить' %}</a>
<ul class="soc-media-buttons soc-media-buttons1">
@ -266,28 +270,28 @@
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-fb-w.png' %}" title="Facebook" alt="Facebook" /> {{ social_form.facebook.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.facebook }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-lin-w.png' %}" title="LinkedIn" alt="LinkedIn" /> {{ social_form.linkedin.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.linkedin }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-vk-w.png' %}" title="В контакте" alt="В контакте" /> {{ social_form.vk.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.vk }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-twit-w.png' %}" title="Twitter" alt="Twitter" /> {{ social_form.twitter.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.twitter }}
</div>
</div>
@ -513,7 +517,11 @@
descriptionClass:'i-descr',
editableClass:'editable-wrap',
closeButtonClass:'ef-close',
// text and paths for dynamically rendered selectboxes
editButtonClass:'e-btn',
avatarButtonClass:'avatar-btn',
avatarImageClass:'user-avatar',
noImageSrc:"{% static 'client/img/no-logo.png' %}",
// text and paths for dynamically rendered selectboxes
addCompanyButtonId:'add-new-company',
selectBox:[
{id:'id_country'},
@ -529,7 +537,6 @@
path:'http://{{ request.get_host }}/company/get-company/'
}
],
editButtonClass:'e-btn',
// we need this id to enable mapping library
phoneBox: 'id_phone',
// some helper text in current language

@ -6,62 +6,108 @@
<div class="item-wrap clearfix">
<aside>
<div class="i-pict">
<a class="add_pic_block" title="">
<span></span>
<i>Добавить лого</i>
<b>+20</b>
</a>
</div>
<!--!!-->
<div class="form-item-wrap">
<div class=" avatar-btn i-pict i-descr">
<a class="add_pic_block" title="">
<span></span>
<i>{% trans 'Добавить лого' %}</i>
<b>+20</b>
</a>
</div>
<div class="i-pict p-editable editable-wrap hidden">
<div id="pick-block" class="pic_block">
<img class="user-avatar {% if company.get_logo %}{% else %}no-image{% endif %}" src="{% if company.get_logo %}{{ company.get_logo.file_path.url }}
{% else %}{% static 'client/img/no-logo.png' %} {% endif %}" width="100" height="100"/>
</div>
<div class="edit-wrap">
<a class="e-btn " href="#">{% trans 'редактировать' %}</a>
<div class="e-form">
<form class="clearfix update-profile-form" enctype="multipart/form-data" id="avatar_form" action="" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ avatar_form.avatar.label }}</label>
<div class="epf-field">
<div class="input-file clearfix">
<div class="button icon-clip">{% trans 'выберите файл' %}</div>
<div class="file-text placehlder">{% trans 'Файл не выбран' %}</div>
<div class="if-field-wrap"><input id="id_avatar" type="file" name="avatar" /></div>
</div>
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
</div>
<!--!!-->
<div class="i-rating" title="Рейтинг: 551">551</div>
</aside>
<div class="i-info">
<header>
<div class="{% if home_form.instance.country and home_form.instance.city %}i-place p-editable{% else %}i-place p-editable add_link_text add_link_text_medium{% endif %}">
<span><a href="#" id="static-home-country">{{ home_form.instance.country }}</a></span>
,<span><a href="#" id="static-home-city">{{ home_form.instance.city }}</a></span>
<!--!-->
<div class="form-item-wrap">
<div class="i-descr add_link_text ">
<a class="e-btn" href="#" title="">{% trans 'Указать' %}</a>
<div class="add_link_text_text">{% trans 'город' %} <b>+5</b></div>
</div>
<div class="i-place p-editable editable-wrap hidden">
<span class="static-value">
<span><a href="#" id="static-home-country">{{ home_form.instance.country }}</a></span>
,<span><a href="#" id="static-home-city">{{ home_form.instance.city }}</a></span>
</span>
<div class="edit-wrap e-left">
{% if home_form.instance.country and home_form.instance.city %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">Указать</a>
<div class="add_link_text_text">свой город <b>+5</b></div>
{% endif %}
<form class="clearfix update-profile-form" id="home_form" action="/company/update/home/{{ company.url }}/" method="post">{% csrf_token %}
<div class="e-form">
<div class="edit-wrap e-left">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="ef-body">
<div class="e-form">
<form class="clearfix update-profile-form" id="home_form" action="/company/update/home/{{ company.url }}/" method="post">{% csrf_token %}
<div class="epfl">
<label>Страна</label>
<div class="epf-field">
{{ home_form.country }}
</div>
</div>
<div class="epfl">
<label>{% trans 'Город' %}</label>
<div class="epf-field">
{{ home_form.city }}
</div>
</div>
<div class="ef-body">
<div class="epfl">
<label>Страна</label>
<div class="epf-field">
{{ home_form.country }}
</div>
</div>
</div>
<div class="epfl">
<label>{% trans 'Город' %}</label>
<div class="epf-field">
{{ home_form.city }}
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
<a class="ef-close" href="#">закрыть</a>
</div>
</form>
</div>
</div>
<a class="ef-close" href="#">закрыть</a>
</form>
</div>
</div>
</div>
</div>
<div class="site_link">
<a href="{{ company.get_permanent_url }}" title="">
{{ company.get_permanent_url }}
@ -72,7 +118,7 @@
<a class="e-btn" href="#" title="">{% trans 'Указать' %}</a>
<div class="add_link_text_text">{% trans 'название компании' %}<b>+10</b></div>
</div>
<div class="i-title p-editable editable-wrap hidden">
<div class="i-title p-editable editable-wrap hidden required">
<span id="static-name-value" class="static-value">{{ name_form.name.value }}</span>
<div class="edit-wrap">
@ -109,7 +155,7 @@
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">краткое описание компании <b>+20</b></div>
</div>
<div class="i-position p-editable editable-wrap hidden">
<div class="i-position p-editable editable-wrap hidden required">
<span id="static-spec-value" class="static-value">{{ spec_form.specialization.value }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
@ -120,7 +166,7 @@
<div class="epf-field">
<label>{{ spec_form.specialization.label }}</label>
<div class="epf-field">
<div class="epf-field ">
{{ spec_form.specialization }}
</div>
</div>
@ -152,7 +198,7 @@
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">адрес компании <b>+15</b></div>
</div>
<div class="ic-tel p-editable editable-wrap hidden">
<div class="ic-tel p-editable editable-wrap hidden required">
<span id="static-address-value" class="static-value">{{ address_form.address_inf.value }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
@ -194,7 +240,7 @@
<div class="i-contacts clearfix">
<div class="ic-buttons ic-buttons_pos dd_width_4">
<div class="ic-buttons_text">Добавить профили в соц.сетях:</div>
<div class="ic-buttons_text">{% trans 'Добавить профили в соц.сетях:' %}</div>
<div class="form-item-wrap">
<div class="p-editable editable-wrap social">
@ -210,7 +256,7 @@
<img id="img-facebook" src="{% static 'client/img/soc-medias/sm-icon-fb.png' %}" title="Facebook" alt="Facebook" />
</a>
{% else %}
<img id="img-facebook" src="{% static 'client/img/soc-medias/icon-fb_hover.png' %}" title="Facebook" alt="Facebook" />
<img id="img-facebook" src="{% static 'client/img/soc-medias/sm-icon-fb_hover.png' %}" title="Facebook" alt="Facebook" />
{% endif %}
</li>
<li>
@ -253,30 +299,30 @@
<div class="ef-body">
<div class="epfl">
<div class="epfl ">
<label><img src="{% static 'client/img/soc-medias/sm-icon-fb-w.png' %}" title="Facebook" alt="Facebook" /> {{ social_form.facebook.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.facebook }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-lin-w.png' %}" title="LinkedIn" alt="LinkedIn" /> {{ social_form.linkedin.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.linkedin }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-vk-w.png' %}" title="В контакте" alt="В контакте" /> {{ social_form.vk.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.vk }}
</div>
</div>
<div class="epfl">
<label><img src="{% static 'client/img/soc-medias/sm-icon-twit-w.png' %}" title="Twitter" alt="Twitter" /> {{ social_form.twitter.label }}</label>
<div class="epf-field">
<div class="epf-field required">
{{ social_form.twitter }}
</div>
</div>
@ -337,7 +383,7 @@
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'email' %} <b>+15</b></div>
</div>
<div class="ic-tel p-editable editable-wrap hidden">
<div class="ic-tel p-editable editable-wrap hidden required">
<div class="ic-mail add_indent ">
<a id="static-email-value" class="icon-mail static-value" href="mailto:{{ email_form.email.value }}">{{ email_form.email.value }}</a>
@ -409,16 +455,16 @@
<hr />
<div class="i-additional">
<div class="ia-title">Дополнительная информация</div>
<div class="ia-title">{% trans 'Дополнительная информация' %}</div>
<!--!-->
<div class="form-item-wrap">
<div class="i-descr add_link_text ">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">год основания <b>+15</b></div>
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'год основания' %} <b>+15</b></div>
</div>
<div class="p-editable ic-tel ic-links editable-wrap hidden">
<p id="static-found-value" class="static-value">Год основания: <span>{{ found_form.foundation.value }}</span></p>
<p id="static-found-value">{% trans 'Год основания' %}: <span class="static-value">{% if found_form.foundation.value %}{{ found_form.foundation.value }}{% endif %}</span></p>
<div class="edit-wrap">
@ -448,14 +494,14 @@
<!--!-->
<div class="form-item-wrap">
<div class="i-descr add_link_text ">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">к-во сотрудников <b>+15</b></div>
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'к-во сотрудников' %} <b>+15</b></div>
</div>
<div class="p-editable ic-tel ic-links editable-wrap hidden">
<p id="static-staff_number-value" class="static-value">к-во сотрудников: <span id="static-staff-value">{{ staff_form.staff_number.value }}</span></p>
<p id="static-staff_number-value">{% trans 'к-во сотрудников:' %} <span class="static-value">{% if staff_form.staff_number.value %}{{ staff_form.staff_number.value }}{% endif %}</span></p>
<div class="edit-wrap">
@ -472,11 +518,11 @@
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
@ -484,8 +530,8 @@
<!--!-->
<div class="form-item-wrap">
<div class="i-descr add_link_text ">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">подробное описание компании<b>+15</b></div>
<a class="e-btn" href="#" title="">{% trans 'Добавить' %}</a>
<div class="add_link_text_text">{% trans 'подробное описание компании' %}<b>+15</b></div>
</div>
<div class="p-editable ic-tel editable-wrap hidden">
@ -514,10 +560,10 @@
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
<button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div>
</div>
</div>
@ -556,6 +602,9 @@
editableClass:'editable-wrap',
closeButtonClass:'ef-close',
editButtonClass:'e-btn',
avatarButtonClass:'avatar-btn',
avatarImageClass:'user-avatar',
noImageSrc:"{% static 'client/img/no-logo.png' %}",
// text and paths for dynamically rendered selectboxes
selectBox:[

@ -11730,7 +11730,8 @@ hr + .rq-note {
.end_reg_list li table tr td.width2 {width:88px;padding:0 9px 0 0;}
.end_reg_list li table tr td.width3 {width:185px;}
.add_pic_block {display:block;width:100px;height:80px;padding:20px 0 0 0;text-align:center;font-size:12px;color:#a2a2a2;font-weight:500;text-decoration:none;position:relative;line-height:1.0;-webkit-transition:background .3s, color .3s;-o-transition:background .3s, color .3s;transition:background .3s, color .3s;font-family:'dindisplay_pro';}
.add_pic_block {display:block;width:100px;height:80px;padding:20px 0 0 0;text-align:center;font-size:12px;color:#a2a2a2;font-weight:500;text-decoration:none;position:relative;line-height:1.0;-webkit-transition:background .3s, color .3s;-o-transition:background .3s, color .3s;transition:background .3s, color .3s;font-family:'dindisplay_pro';
cursor: pointer;}
.add_pic_block span {display:block;margin:0 auto;width:35px;height:35px;background-color:#d0d0d0;border-radius:50%;background-image:url(../img/add_pic_block_bg.png);background-position:center center;background-repeat:no-repeat;-webkit-transition:background .3s, color .3s;-o-transition:background .3s, color .3s;transition:background .3s, color .3s; position: relative;}
.add_pic_block .input { display: block; width: 100px; height: 100px; position: absolute; left: 0; top: 0; opacity: 0; cursor: pointer;}
.add_pic_block i {display:block;font-style:normal;padding:10px 0 1px 0;}
@ -12828,7 +12829,7 @@ hr + .rq-note {
display: none;
}
.edit-profile .i-info .i-descr{
margin-top: 1em;
/*margin-top: 1em;*/
}
.edit-profile .i-info .e-btn{
margin-right: 0;
@ -12887,13 +12888,17 @@ hr + .rq-note {
background: #ff6600 url(../img/sprites.png) -136px -145px no-repeat;
}
.edit-profile .i-contacts .ic-tel{
.edit-profile .i-contacts .editable-wrap.pe-current .static-value{
display: block;
height: 23px;
margin-bottom: 15px;
height: 25px;
}
/*.create-company-modal .select-input.err:before{*/
/*margin-right: 0;*/
/*}*/
.edit-profile .editable-wrap:before{
display: none;
}
.edit-profile .social .e-form .err:before{
margin-right: 9px;
}
/************************\
# страница редактирования профиля

File diff suppressed because one or more lines are too long

@ -30,6 +30,8 @@ if (EXPO.company){
type: 'POST',
url: self.ajaxPath,
data:dataToSend,
processData: false,
contentType: false,
success: function(data) {
self.pullHandler(data);
$('#wait-ajax').fadeOut();
@ -40,19 +42,23 @@ if (EXPO.company){
// check if there exists custom data manipulation handler and evaluate it
pushData: function (data, formName) {
var handler = this.pushHandler,
formDataString,
formData = data;
if(typeof formData != "string"){
this.formData =formData;
}else{
this.formData = JSON.parse('{"' + decodeURI(formData).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
}
this.formId = formName;
if(typeof handler == 'function'){
// if particular data change required
this.formData = handler(data, formName);
this.getajax(data);
$('#wait-ajax').show();
handler(data);
} else{
$('#wait-ajax').show();
this.getajax(data);
$('#wait-ajax').show();
}
formDataString = decodeURI(formData).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"').replace(/\//ig, '\\/').replace(/\\n/g, '\\n');
this.formData = JSON.parse('{"' + formDataString + '"}');
this.formId = formName;
},
pullData: function (data) {
@ -108,6 +114,8 @@ if (EXPO.company){
$('.p-editable').removeClass('pe-current');
this.refreshState();
}else{
this.$editable.addClass('err');
}
};
this.ajaxPath = path;
@ -120,6 +128,8 @@ if (EXPO.company){
$('.p-editable').removeClass('pe-current');
this.refreshState();
}else{
this.$editable.addClass('err');
}
};
this.ajaxPath = path;
@ -132,18 +142,8 @@ if (EXPO.company){
$('.p-editable').removeClass('pe-current');
this.refreshState();
}
};
this.ajaxPath = path;
};
Forms.address_form = function (path) {
this.pullHandler = function (data) {
if (data.success){
$('#static-address-value').text($('#id_address_inf').val());
$('.p-editable').removeClass('pe-current');
this.refreshState();
}else{
this.$editable.addClass('err');
}
};
this.ajaxPath = path;
@ -154,8 +154,10 @@ if (EXPO.company){
$img, imgSrc, $input, inputValue,item;
this.pullHandler = function (data) {
if (data.success){
for (item in self.formData) {
$input = $('#id_'+item);
$input.parent('.required').removeClass('err');
if($.trim(self.formData[item]) != '' && $input.length){
$img = $('#img-'+item);
if($img.length){
@ -182,7 +184,22 @@ if (EXPO.company){
}
$('.p-editable').removeClass('pe-current');
}else {
for (item in data.errors) {
$input = $('#id_' + item);
$input.parent('.required').addClass('err');
}
}
};
this.pushHandler = function (data, formName){
var formData = $('#'+formName).serialize();
return JSON.parse('{"' + decodeURI(formData).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
};
this.ajaxPath = path;
@ -206,8 +223,8 @@ if (EXPO.company){
$('#static-email-value').attr('href', 'mailto:'+mailValue).text(mailValue);
$('.p-editable').removeClass('pe-current');
this.refreshState();
}else{
this.$editable.addClass('err');
}
};
this.ajaxPath = path;
@ -245,28 +262,14 @@ if (EXPO.company){
};
Forms.found_form = function (path) {
var currValue,
$input,
$container,
$staticValue,
$staticBox,
$editButton;
$input;
this.pullHandler = function (data) {
if (data.success){
$input = $('#id_foundation');
currValue = $.trim($input.val());
$container = $input.parents('.p-editable');
$editButton = $input.parents('.edit-wrap').children('e-btn');
$staticValue = $('#static-found-value');
$staticBox = $('#static-foundation');
if(currValue == ''){
$container.removeClass('ic-tel').addClass('add_link_text add_link_text_medium');
$staticValue.hide().children('span').text('');
$staticBox.show();
}else{
$container.removeClass('add_link_text add_link_text_medium').addClass('ic-tel');
$staticValue.show().children('span').text(currValue);
$staticBox.hide();
}
this.$staticValue.text(currValue);
$('.p-editable').removeClass('pe-current');
this.refreshState();
}
@ -277,28 +280,12 @@ if (EXPO.company){
};
Forms.staff_form = function (path) {
var currValue,
$input,
$container,
$staticValue,
$staticBox,
$editButton;
$input;
this.pullHandler = function (data) {
if (data.success){
$input = $('#id_staff_number');
currValue = $.trim($input.val());
$container = $input.parents('.p-editable');
$editButton = $input.parents('.edit-wrap').children('e-btn');
$staticValue = $('#static-staff_number-value');
$staticBox = $('#static-staff_number');
if(currValue == ''){
$container.removeClass('ic-tel').addClass('add_link_text add_link_text_medium');
$staticValue.hide().children('span').text('');
$staticBox.show();
}else{
$container.removeClass('add_link_text add_link_text_medium').addClass('ic-tel');
$staticValue.show().children('span').text(currValue);
$staticBox.hide();
}
this.$staticValue.text(currValue);
$('.p-editable').removeClass('pe-current');
this.refreshState();
}
@ -309,27 +296,12 @@ if (EXPO.company){
};
Forms.description_form = function (path) {
var currValue,
$input = $('#id_description'),
$container,
$staticValue,
$staticBox,
$editButton;
$input = $('#id_description');
this.pullHandler = function (data) {
if (data.success){
currValue = $.trim($input.val());
$container = $input.parents('.p-editable');
$editButton = $input.parents('.edit-wrap').children('e-btn');
$staticValue = $('#static-description-value');
$staticBox = $('#static-description');
if(currValue == ''){
$container.removeClass('ic-tel').addClass('add_link_text add_link_text_medium');
$staticValue.hide().children('span').text('');
$staticBox.show();
}else{
$container.removeClass('add_link_text add_link_text_medium').addClass('ic-tel');
$staticValue.show().text(currValue);
$staticBox.hide();
}
this.$staticValue.text(currValue);
$('.p-editable').removeClass('pe-current');
this.refreshState();
}
@ -345,7 +317,53 @@ if (EXPO.company){
this.ajaxPath = path;
};
Forms.avatar_form = function (path) {
var self = this,
$input = $('#id_avatar'),
$editPhoto = $('#pic-edit-photo'),
$pickBlock = $('#pick-block'),
$form,
$avatar = $('img',$pickBlock);
/**
* callback after successful request to the server
* @param data -data object recieved from server
*/
this.pullHandler = function (data) {
if (data.success){
if($avatar.length){
$avatar.attr('src', data.url);
}
$('.p-editable').removeClass('pe-current');
}
};
this.pushHandler = function(data){
if(typeof data != 'string'){
self.getajax(data);
$('#wait-ajax').show();
}else{
$form = $('#'+self.formId);
$form.off('submit');
$form.trigger('submit');
}
};
$input.on('change', function () {
$(this).parents('form').submit();
});
this.ajaxPath = path;
this.refreshState = function () {
if($.trim(this.$image.attr('src')) == this.noImageSrc){
this.$editable.addClass('hidden');
this.$description.removeClass('hidden');
}else{
this.$editable.removeClass('hidden');
this.$description.addClass('hidden');
}
}
};
// methods
//инициализация общих свойств
@ -384,6 +402,7 @@ if (EXPO.company){
};
this.forms = {};
$(function () {
var $editables = $('.'+self.opt.editableClass);
//start of document.ready
$waiter = $('#wait-ajax').css({'z-index': '8012'});
/**
@ -429,7 +448,8 @@ if (EXPO.company){
}
});
// предазгрузка активных тегов
//$('#'+self.opt.selectBox[2].id).attr('data-predifined','[{"id":"1128","text":"тег1"},{"id":"3365","text":"тег2"}]');
$('#'+self.opt.selectBox[2].id).select2({
placeholder: self.opt.selectBox[2].placeholder,
width: '368px',
@ -463,6 +483,11 @@ if (EXPO.company){
}
},
initSelection : function(element, callback) {
console.log(element);
var data = [],
dataObjArr = JSON.parse(element.attr('data-predifined'));
callback(dataObjArr);
}
});
@ -478,7 +503,8 @@ if (EXPO.company){
$staticValue = $('.'+self.opt.staticValueClass, $wrapper),
$description = $('.'+self.opt.descriptionClass, $wrapper),
$editable = $('.'+self.opt.editableClass, $wrapper),
$closeButton = $('.'+self.opt.closeButtonClass, $wrapper);
$closeButton = $('.'+self.opt.closeButtonClass, $wrapper),
$image = $('.'+self.opt.avatarImageClass, $wrapper);
//make and initialize form objects
@ -494,7 +520,14 @@ if (EXPO.company){
self.forms[formName].$staticValue = $staticValue;
self.forms[formName].$description = $description;
self.forms[formName].$editable = $editable;
/**
* Send proper information if there is image. mainly for avatar editing
*/
if($image.length){
self.forms[formName].$image = $image;
self.forms[formName].noImageSrc = self.opt.noImageSrc;
}
self.forms[formName].refreshState();
@ -521,7 +554,9 @@ if (EXPO.company){
/**
* edit button
*/
$('.'+self.opt.editButtonClass, $wrapper).on('click', function () {
$('.'+self.opt.editButtonClass+', .'+self.opt.avatarButtonClass, $wrapper).on('click', function () {
$editables.removeClass(self.opt.formCurrentClass);
if(self.forms[formName].refrashable){
$editable.removeClass('hidden');
$description.addClass('hidden');

@ -31,7 +31,6 @@ if (EXPO.profile){
}
$.ajax({
type: 'POST',
// dataType: "json",
url: self.ajaxPath,
data:dataToSend,
processData: false,
@ -63,8 +62,7 @@ if (EXPO.profile){
this.getajax(data);
$('#wait-ajax').show();
}
console.log('formData type');
console.log(typeof formData);
@ -264,6 +262,8 @@ if (EXPO.profile){
for (item in self.formData) {
$input = $('#id_'+item);
$input.parent('.required').removeClass('err');
if($.trim(self.formData[item]) != '' && $input.length){
$img = $('#img-'+item);
if($img.length){
@ -291,6 +291,11 @@ if (EXPO.profile){
}
$('.p-editable').removeClass('pe-current');
}else {
for (item in data.errors) {
$input = $('#id_' + item);
$input.parent('.required').addClass('err');
}
}
};
this.pushHandler = function (data, formName){
@ -341,6 +346,17 @@ if (EXPO.profile){
});
this.ajaxPath = path;
this.refreshState = function () {
if($.trim(this.$image.attr('src')) == this.noImageSrc){
this.$editable.addClass('hidden');
this.$description.removeClass('hidden');
}else{
this.$editable.removeClass('hidden');
this.$description.addClass('hidden');
}
}
};
/**
* add new company form init
@ -411,7 +427,9 @@ if (EXPO.profile){
};
this.forms = {};
$(function () {
$waiter = $('#wait-ajax').css({'z-index': '8012'});
var $editables = $('.'+self.opt.editableClass);
$waiter = $('#wait-ajax').css({'z-index': '8012'});
/**
* <selectbox> styling with 3-rd party libs
*/
@ -508,7 +526,8 @@ if (EXPO.profile){
$staticValue = $('.'+self.opt.staticValueClass, $wrapper),
$description = $('.'+self.opt.descriptionClass, $wrapper),
$editable = $('.'+self.opt.editableClass, $wrapper),
$closeButton = $('.'+self.opt.closeButtonClass, $wrapper);
$closeButton = $('.'+self.opt.closeButtonClass, $wrapper),
$image = $('.'+self.opt.avatarImageClass, $wrapper);
//make and initialize form objects
@ -524,6 +543,14 @@ if (EXPO.profile){
self.forms[formName].$staticValue = $staticValue;
self.forms[formName].$description = $description;
self.forms[formName].$editable = $editable;
/**
* Send proper information if there is image. mainly for avatar editing
*/
if($image.length){
self.forms[formName].$image = $image;
self.forms[formName].noImageSrc = self.opt.noImageSrc;
}
self.forms[formName].refreshState();
@ -551,7 +578,8 @@ if (EXPO.profile){
/**
* edit button
*/
$('.'+self.opt.editButtonClass, $wrapper).on('click', function () {
$('.'+self.opt.editButtonClass+', .'+self.opt.avatarButtonClass, $wrapper).on('click', function () {
$editables.removeClass(self.opt.formCurrentClass);
if(self.forms[formName].refrashable){
$editable.removeClass('hidden');
$description.addClass('hidden');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save