remotes/origin/1203
Nazar Kotyuk 12 years ago
parent 8b3dd1ec37
commit 05ee411447
  1. 49
      accounts/edit_forms.py
  2. 4
      accounts/models.py
  3. 2
      accounts/urls.py
  4. 65
      accounts/views.py
  5. 2
      city/urls.py
  6. 19
      city/views.py
  7. 119
      company/edit_forms.py
  8. 67
      company/edit_views.py
  9. 35
      company/forms.py
  10. 18
      company/urls.py
  11. 29
      company/views.py
  12. 1
      proj/urls.py
  13. 637
      static/client/css/select2.css
  14. 9
      static/client/js/main.js
  15. 105
      static/client/js/pages/profile.js
  16. 121
      static/client/js/pages/profile_company.js
  17. 23
      static/client/js/plugins/select2.min.js
  18. 23
      static/client/js/plugins/select2_locale_ru.js
  19. 512
      templates/client/accounts/fill_company.html
  20. 61
      templates/client/accounts/new_profile.html
  21. 4
      templates/client/blank.html
  22. 37
      templates/client/popups/create_company.html
  23. 6
      theme/urls.py
  24. 18
      theme/views.py

@ -3,6 +3,8 @@ from django import forms
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from models import User, Profile from models import User, Profile
from country.models import Country from country.models import Country
from city.models import City
from company.models import Company
class AvatarForm(forms.ModelForm): class AvatarForm(forms.ModelForm):
avatar = forms.ImageField(label=_(u'Выберите файл (GIF, JPG, PNG. Размер 100 × 100 пикселей)'), avatar = forms.ImageField(label=_(u'Выберите файл (GIF, JPG, PNG. Размер 100 × 100 пикселей)'),
@ -24,36 +26,55 @@ class NameForm(forms.ModelForm):
class HomeForm(forms.ModelForm): class HomeForm(forms.ModelForm):
city = forms.ChoiceField(label='Город', required=False) city = forms.CharField(label='Город', required=False,
country = forms.ModelChoiceField(label=_(u'Страна'), queryset=Country.objects.all(), empty_label='', required=False) widget=forms.HiddenInput(attrs={'class': 'select2'}))
country = forms.ChoiceField(label=_(u'Страна'), choices=[(c.id, c.name) for c in Country.objects.all()], required=False,
widget=forms.Select(attrs={'class': 'select2'}))
def __init__(self, *args, **kwargs):
super(HomeForm, self).__init__(*args, **kwargs)
if self.instance.city:
self.fields['city'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.city.name})
class Meta: class Meta:
model = Profile model = Profile
fields = ('country', 'city') fields = ('country', 'city')
def current_country(self): def current_country(self):
return self.instance.country return self.instance.country
country = Country.objects.get(id=self.instance.country)
return country
def clean_city(self): def clean_city(self):
return None try:
return City.objects.get(id=self.cleaned_data['city'])
except City.DoesNotExist:
return None
def clean_country(self):
try:
return Country.objects.get(id=self.cleaned_data['country'])
except City.DoesNotExist:
return None
class WorkForm(forms.ModelForm): class WorkForm(forms.ModelForm):
position = forms.CharField(label=_(u'Укажите вашу должность'), position = forms.CharField(label=_(u'Укажите вашу должность'),
required=False) required=False)
work = forms.CharField(label=_(u'Место работы'),
required=False)
company = forms.CharField(label=_(u'Место работы'), widget=forms.HiddenInput(attrs={'class': 'select2'}))
def __init__(self, *args, **kwargs):
super(WorkForm, self).__init__(*args, **kwargs)
if self.instance.company:
self.fields['company'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.company.name})
class Meta: class Meta:
model = Profile model = User
fields = ('position', 'work') fields = ('position', 'company')
def get_full_work(self):
divider = _('в')
return 'dsfsdf'
return u'%s %s %s'%(self.instance.position, divider, self.instance.work)
def clean_company(self):
try:
return Company.objects.get(id=self.cleaned_data['company'])
except Company.DoesNotExist:
return None
class AboutCompanyForm(forms.ModelForm): class AboutCompanyForm(forms.ModelForm):

@ -127,6 +127,8 @@ class User(AbstractBaseUser, PermissionsMixin):
on_delete=models.PROTECT, related_name='user') on_delete=models.PROTECT, related_name='user')
company = models.ForeignKey('company.Company', blank=True, null=True, company = models.ForeignKey('company.Company', blank=True, null=True,
on_delete=models.PROTECT, related_name='users') on_delete=models.PROTECT, related_name='users')
position = models.CharField(verbose_name='Должность', max_length=255, blank=True)
objects = UserManager() objects = UserManager()
USERNAME_FIELD = 'username' USERNAME_FIELD = 'username'
@ -193,8 +195,6 @@ class Profile(models.Model):
on_delete=models.PROTECT, related_name='users') on_delete=models.PROTECT, related_name='users')
city = models.ForeignKey('city.City', verbose_name='Город', blank=True, null=True, city = models.ForeignKey('city.City', verbose_name='Город', blank=True, null=True,
on_delete=models.PROTECT) on_delete=models.PROTECT)
position = models.CharField(verbose_name='Должность', max_length=255, blank=True)
work = models.CharField(verbose_name='Работа', max_length=255, blank=True)
about_company = models.TextField(verbose_name=_(u'Описание компании'), blank=True) about_company = models.TextField(verbose_name=_(u'Описание компании'), blank=True)
phone = models.BigIntegerField(verbose_name='Телефон', blank=True, null=True) phone = models.BigIntegerField(verbose_name='Телефон', blank=True, null=True)

@ -5,8 +5,6 @@ from views import SettingsView, ProfileView, CalendarView, UserView, UserExposit
from views import NameView, HomeView, AvatarView, WorkView, AboutCompanyView, PhoneView, EmailView, WebPageView,\ from views import NameView, HomeView, AvatarView, WorkView, AboutCompanyView, PhoneView, EmailView, WebPageView,\
SocialView, AboutView, ProfileCompanyView SocialView, AboutView, ProfileCompanyView
from views import test
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^profile/$', login_required(ProfileView.as_view())), url(r'^profile/$', login_required(ProfileView.as_view())),
url(r'^profile/company/$', login_required(ProfileCompanyView.as_view())), url(r'^profile/company/$', login_required(ProfileCompanyView.as_view())),

@ -1,14 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _, get_language
from django.utils import timezone from django.utils import timezone
# forms # forms
from forms import ChangePasswordForm, EmailAnnouncementForm from forms import ChangePasswordForm, EmailAnnouncementForm
from company.forms import CompanyFormClient from company.forms import CompanyFormClient, CreateCompanyForm
from edit_forms import AvatarForm, NameForm, HomeForm, WorkForm, AboutCompanyForm, PhoneForm, EmailForm,\ from edit_forms import AvatarForm, NameForm, HomeForm, WorkForm, AboutCompanyForm, PhoneForm, EmailForm,\
WebPageForm, SocialForm, AboutForm WebPageForm, SocialForm, AboutForm
from models import User from models import User
@ -92,36 +90,59 @@ def get_calendar(request, year, month):
class ProfileView(TemplateView): class ProfileView(TemplateView):
template_name = 'accounts/new_profile.html' template_name = 'accounts/new_profile.html'
def post(self):
return HttpResponse(self.request.POST)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ProfileView, self).get_context_data(**kwargs) context = super(ProfileView, self).get_context_data(**kwargs)
user = self.request.user user = self.request.user
profile = user.profile profile = user.profile
profile_forms = { profile_forms = {
'avatar_form': AvatarForm(instance=profile), 'name_form': NameForm(instance=user), 'avatar_form': AvatarForm(instance=profile), 'name_form': NameForm(instance=user),
'home_form': HomeForm(instance=profile), 'work_form': WorkForm(instance=profile), 'home_form': HomeForm(instance=profile), 'work_form': WorkForm(instance=user),
'about_company_form': AboutCompanyForm(instance=profile), 'phone_form': PhoneForm(instance=profile), 'about_company_form': AboutCompanyForm(instance=profile), 'phone_form': PhoneForm(instance=profile),
'email_form': EmailForm(instance=user), 'web_page_form': WebPageForm(instance=profile), 'email_form': EmailForm(instance=user), 'web_page_form': WebPageForm(instance=profile),
'social_form': SocialForm(instance=profile), 'about_form': AboutForm(instance=profile) 'social_form': SocialForm(instance=profile), 'about_form': AboutForm(instance=profile)
} }
if not user.company:
company_form = {'company_form': CreateCompanyForm()}
context.update(company_form)
context.update(profile_forms) context.update(profile_forms)
return context return context
class ProfileCompanyView(FormView): from company.edit_forms import NameForm as CompNameForm, HomeForm as CompHomeForm, PhoneForm as CompPhoneForm,\
form_class = CompanyFormClient EmailForm as CompEmailForm, WebPageForm as CompWebPageForm, SocialForm as CompSocialForm,\
TagForm as CompTagForm, DescriptionForm as CompDescr, StaffForm as CompStaff, \
FoundationForm as CompFound, SpecializationForm as CompSpec, AddressForm as CompAddress
class ProfileCompanyView(TemplateView):
template_name = 'accounts/fill_company.html' template_name = 'accounts/fill_company.html'
success_url = '/profile/company/'
def form_valid(self, form): def get_context_data(self, **kwargs):
return HttpResponse('success') context = super(ProfileCompanyView, self).get_context_data(**kwargs)
user = self.request.user
if not user.company:
raise Http404
company = user.company
forms = {
'home_form': CompHomeForm(instance=company), 'phone_form': CompPhoneForm(instance=company),
'email_form': CompEmailForm(instance=company), 'web_page_form': CompWebPageForm(instance=company),
'social_form': CompSocialForm(instance=company), 'tag_form': CompTagForm(instance=company),
'staff_form': CompStaff(instance=company), 'found_form': CompFound(instance=company)
}
lang = get_language()
comp_transl = company.translations.get(language_code=lang)
transl_forms = {
'name_form': CompNameForm(instance=comp_transl), 'spec_form': CompSpec(instance=comp_transl),
'description_form': CompDescr(instance=comp_transl), 'address_form': CompAddress(instance=comp_transl)
}
context.update(forms)
context.update(transl_forms)
return context
def form_invalid(self, form):
return HttpResponse(form.errors)
@ -202,9 +223,17 @@ class BaseProfileView(ProfileInvalidView):
response = {'success': True} response = {'success': True}
return HttpResponse(json.dumps(response), content_type='application/json') return HttpResponse(json.dumps(response), content_type='application/json')
class WorkView(BaseProfileView): class WorkView(ProfileInvalidView):
form_class = WorkForm form_class = WorkForm
def form_valid(self, form):
user = self.request.user
form = self.form_class(self.request.POST, instance=user)
form.save()
response = {'success': True}
return HttpResponse(json.dumps(response), content_type='application/json')
class AvatarView(BaseProfileView): class AvatarView(BaseProfileView):
form_class = AvatarForm form_class = AvatarForm

@ -3,5 +3,7 @@ from django.conf.urls import patterns, url
from views import CityView from views import CityView
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'get-city/', 'city.views.get_city'),
url(r'(?P<slug>.*)', CityView.as_view()), url(r'(?P<slug>.*)', CityView.as_view()),
) )

@ -1,8 +1,25 @@
import json
from django.views.generic import DetailView from django.views.generic import DetailView
from django.http import HttpResponse
from models import City from models import City
class CityView(DetailView): class CityView(DetailView):
model = City model = City
slug_field = 'url' slug_field = 'url'
template_name = 'city/city.html' template_name = 'city/city.html'
def get_city(request):
if request.is_ajax():
country = request.GET['country']
term = request.GET['term'].capitalize()
if not term:
qs = City.objects.language().filter(country=country).order_by('translations__name')[:100]
else:
qs = City.objects.language().filter(country=country, translations__name__contains=term)
result = [{'id': city.id, 'label': city.name} for city in qs]
return HttpResponse(json.dumps(result), content_type='application/json')
else:
return HttpResponse('not ajax')

@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext as _, get_language
from country.models import Country
from city.models import City
from company.models import Company
class BaseForm(forms.ModelForm):
translation = False
class NameForm(BaseForm):
name = forms.CharField(label=_(u'Введите название компании'))
translation = True
class Meta:
model = Company._meta.translations_model
fields = ('name',)
class SpecializationForm(BaseForm):
translation = True
specialization = forms.CharField(label=_(u'Описание компании'))
class Meta:
model = Company._meta.translations_model
fields = ('specialization',)
class HomeForm(BaseForm):
city = forms.CharField(label='Город', required=False,
widget=forms.HiddenInput(attrs={'class': 'select2'}))
country = forms.ChoiceField(label=_(u'Страна'), choices=[(c.id, c.name) for c in Country.objects.all()], required=False,
widget=forms.Select(attrs={'class': 'select2'}))
def __init__(self, *args, **kwargs):
super(HomeForm, self).__init__(*args, **kwargs)
if self.instance.city:
self.fields['city'].widget = forms.HiddenInput(attrs={'class': 'select2', 'data-init-text': self.instance.city.name})
class Meta:
model = Company
fields = ('country', 'city')
def current_country(self):
return self.instance.country
def clean_city(self):
try:
return City.objects.get(id=self.cleaned_data['city'])
except City.DoesNotExist:
return None
def clean_country(self):
try:
return Country.objects.get(id=self.cleaned_data['country'])
except City.DoesNotExist:
return None
class PhoneForm(BaseForm):
phone = forms.CharField(label=_(u'Контактный телефон'), required=False)
class Meta:
model = Company
fields = ('phone',)
class EmailForm(BaseForm):
email = forms.EmailField(label=_(u'Ваш e-mail'), required=False)
class Meta:
model = Company
fields = ('email',)
class WebPageForm(BaseForm):
web_page = forms.CharField(label=_(u'Адрес вашего сайта'), required=False)
class Meta:
model = Company
fields = ('web_page',)
class SocialForm(BaseForm):
facebook = forms.CharField(label=_(u'Facebook'), required=False)
twitter = forms.CharField(label=_(u'Twitter'), required=False)
vk = forms.CharField(label=_(u'В контакте'), required=False)
linkedin = forms.CharField(label=_(u'LinkedIn'), required=False)
class Meta:
model = Company
fields = ('facebook', 'twitter', 'vk', 'linkedin')
class TagForm(BaseForm):
tag = forms.CharField(required=False, widget=forms.HiddenInput(attrs={'class': 'select2'}))
class Meta:
model = Company
fields = ('tag',)
class FoundationForm(BaseForm):
class Meta:
model = Company
fields = ('foundation',)
class StaffForm(BaseForm):
class Meta:
model = Company
fields = ('staff_number',)
class DescriptionForm(BaseForm):
translation = True
description = forms.CharField(label=_(u'Подробное описание компании'))
class Meta:
model = Company._meta.translations_model
fields = ('description',)
class AddressForm(BaseForm):
translation = True
address_inf = forms.CharField(label=_(u'Адрес компании'))
class Meta:
model = Company._meta.translations_model
fields = ('address_inf',)

@ -0,0 +1,67 @@
import json
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.utils.translation import get_language
from edit_forms import *
from accounts.views import ProfileInvalidView
class BaseView(ProfileInvalidView):
def form_valid(self, form):
company = self.request.user.company
if self.form_class.translation:
lang = get_language()
comp_transl = company.translations.get(language_code=lang)
form = self.form_class(self.request.POST, instance=comp_transl)
else:
form = self.form_class(self.request.POST, instance=company)
form.save()
response = {'success': True}
return HttpResponse(json.dumps(response), content_type='application/json')
class NameView(BaseView):
form_class = NameForm
class HomeView(BaseView):
form_class = HomeForm
class SpecializationView(BaseView):
form_class = SpecializationForm
class PhoneView(BaseView):
form_class = PhoneForm
class EmailView(BaseView):
form_class = EmailForm
class WebPageView(BaseView):
form_class = WebPageForm
class SocialView(BaseView):
form_class = SocialForm
class TagView(BaseView):
form_class = TagForm
class FoundationView(BaseView):
form_class = FoundationForm
class StaffView(BaseView):
form_class = StaffForm
class DescriptionView(BaseView):
form_class = DescriptionForm
class AddressView(BaseView):
form_class = AddressForm

@ -255,4 +255,37 @@ class CompanyFormClient(forms.Form):
self.fields['specialization_%s' % code] = forms.CharField(label=_(u'краткое описание компании'), self.fields['specialization_%s' % code] = forms.CharField(label=_(u'краткое описание компании'),
required=False) required=False)
self.fields['address_inf_%s' % code] = forms.CharField(label=_(u'адрес компании'), self.fields['address_inf_%s' % code] = forms.CharField(label=_(u'адрес компании'),
required=False) required=False)
class CreateCompanyForm(forms.Form):
action = '/company/create-company/'
name = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'Введите название компании')}))
url = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'Введите урл')}))
theme = forms.ModelMultipleChoiceField(queryset=Theme.objects.all())
def save(self, user):
data = self.cleaned_data
company = Company(url=data['url'], creator=user)
lang = 'ru'
company.translate(lang)
company.name = data['name']
company.save()
themes = [theme.id for theme in data['theme']]
company.theme.add(*Theme.objects.filter(id__in=themes))
user.company = company
user.save()
return company
def clean_url(self):
url = self.cleaned_data.get('url')
company = Company.objects.filter(url=translit_with_separator(url))
if company:
msg = _(u'Такой урл уже занят')
raise ValidationError(msg)
return translit_with_separator(url)

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from views import CompanyView, CompanySearchView from views import CompanyView, CompanySearchView
from django.contrib.auth.decorators import login_required
from edit_views import *
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'members/search/$', CompanySearchView.as_view()), url(r'members/search/$', CompanySearchView.as_view()),
@ -8,4 +10,20 @@ urlpatterns = patterns('',
url(r'members/(?P<page>\d+)/$', CompanyView.as_view()), url(r'members/(?P<page>\d+)/$', CompanyView.as_view()),
url(r'members/(?P<params>.*)/$', CompanyView.as_view()), url(r'members/(?P<params>.*)/$', CompanyView.as_view()),
url(r'members/$', CompanyView.as_view()), url(r'members/$', CompanyView.as_view()),
#
url(r'company/create-company/$', 'company.views.create_company'),
url(r'company/get-company/$', 'company.views.get_company'),
#
url(r'company/update/name/$', login_required(NameView.as_view())),
url(r'^company/update/home/$', login_required(HomeView.as_view())),
url(r'^company/update/specialization/$', login_required(SpecializationView.as_view())),
url(r'^company/update/phone/$', login_required(PhoneView.as_view())),
url(r'^company/update/email/$', login_required(EmailView.as_view())),
url(r'^company/update/web-page/$', login_required(WebPageView.as_view())),
url(r'^company/update/social/$', login_required(SocialView.as_view())),
url(r'^company/update/tag/$', login_required(TagView.as_view())),
url(r'^company/update/foundation/$', login_required(FoundationView.as_view())),
url(r'^company/update/staff/$', login_required(StaffView.as_view())),
url(r'^company/update/description/$', login_required(DescriptionView.as_view())),
url(r'^company/update/address/$', login_required(AddressView.as_view())),
) )

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import json
from django.http import HttpResponse from django.http import HttpResponse
from models import Company
from functions.custom_views import ExpoListView from functions.custom_views import ExpoListView
from django.views.generic import ListView, FormView from django.views.generic import ListView, FormView
from haystack.query import EmptySearchQuerySet from haystack.query import EmptySearchQuerySet
import json from models import Company
from forms import CreateCompanyForm
from functions.search_forms import CompanySearchForm from functions.search_forms import CompanySearchForm
@ -63,4 +64,26 @@ class CompanyExposition(CompanyView):
company = Company.objects.safe_get(url=param.get('url')) company = Company.objects.safe_get(url=param.get('url'))
#query = exp.users #query = exp.users
self.params = params self.params = params
return company.exposition_companies.all() return company.exposition_companies.all()
def create_company(request):
response = {'success': False}
form = CreateCompanyForm(request.POST)
if form.is_valid():
form.save(request.user)
response['success'] = True
return HttpResponse(json.dumps(response), content_type='application/json')
else:
response['errors'] = form.errors
return HttpResponse(json.dumps(response), content_type='application/json')
def get_company(request):
if request.is_ajax():
term = request.GET['term']
qs = Company.objects.language().filter(translations__name__contains=term).distinct()
result = [{'id': company.id, 'label': company.name} for company in qs]
return HttpResponse(json.dumps(result), content_type='application/json')
else:
return HttpResponse('not ajax')

@ -8,6 +8,7 @@ from views import MainPageView
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', MainPageView.as_view()), url(r'^$', MainPageView.as_view()),
url(r'^theme/', include('theme.urls')),
url(r'^', include('accounts.urls')), url(r'^', include('accounts.urls')),
url(r'^', include('exposition.urls')), url(r'^', include('exposition.urls')),
url(r'^', include('conference.urls')), url(r'^', include('conference.urls')),

@ -0,0 +1,637 @@
/* ******************************************************* */
/* Select2 plugin styles */
/* ******************************************************* */
.select2-container {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0;
word-spacing: normal;
}
.mf-field .select2-container {
width: 100%;
}
.select2-container ul,
.select2-drop ul {
margin: 0;
padding: 0;
list-style: none;
}
.select2-container,
.select2-drop,
.select2-search,
.select2-search input {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.select2-container .select2-choice,
.select2-container .select2-choices {
position: relative;
display: block;
border: 1px solid #bdbdbd;
background: #fff;
width: 100%;
height: 40px;
padding: 5px 30px 2px 3px;
font-family: 'dindisplay_pro', sans-serif;
font-size: 15px;
line-height: 19px;
text-decoration: none;
overflow: hidden;
white-space: nowrap;
color: #464646;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: inset 0 2px 2px -2px #aaa;
-moz-box-shadow: inset 0 2px 2px -2px #aaa;
box-shadow: inset 0 2px 2px -2px #aaa;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: none;
-moz-transition: none;
-ms-transition: none;
-o-transition: none;
transition: none;
}
.select2-container .select2-choices {
height: auto;
min-height: 40px;
cursor: text;
}
.select2-container-active .select2-choice,
.select2-container-active .select2-choices {
border: 2px solid #ff6600;
outline: none;
padding: 4px 29px 1px 2px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.select2-dropdown-open .select2-choice,
.select2-dropdown-open .select2-choices {
padding: 4px 29px 3px 2px;
border: 2px solid #ff6600;
border-bottom: none;
-webkit-border-radius: 3px 3px 0 0;
-moz-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
}
.select2-dropdown-open.select2-drop-above .select2-choice,
.select2-dropdown-open.select2-drop-above .select2-choices {
padding: 6px 29px 1px 2px;
border-bottom: 2px solid #ff6600;
border-top: none;
-webkit-border-radius: 0 0 3px 3px;
-moz-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
}
.select2-container-multi .select2-choices:after {
content: " ";
display: block;
width: 8px;
height: 5px;
overflow: hidden;
background: url(../img/sprites.png) -86px -27px no-repeat;
position: absolute;
right: 12px;
top: 17px;
}
.select2-container-multi.select2-container-active .select2-choices:after {
right: 11px;
top: 16px;
}
.select2-dropdown-open.select2-drop-above .select2-choices:after {
right: 11px;
top: 18px;
}
.select2-container-multi.select2-container-disabled .select2-choices {
background: #fff;
border: 1px solid #bdbdbd;
cursor: default;
}
.select2-container.select2-allowclear .select2-choice .select2-chosen {
margin-right: 30px;
}
.select2-container .select2-choice > .select2-chosen {
display: block;
padding: 7px 0 6px 16px;
margin-right: 0;
line-height: 15px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
float: none;
width: auto;
}
.select2-search-choice-close {
display: block;
position: absolute;
right: 0;
top: 0;
width: 25px;
height: 0;
padding-top: 26px;
overflow: hidden;
background: none;
outline: none;
}
.select2-container-multi .select2-search-choice-close {
left: auto;
}
.select2-search-choice-close:before {
content: '';
display: inline-block;
width: 8px;
height: 8px;
background: url(../img/sprites.png) -134px -16px no-repeat;
position: absolute;
left: 50%;
top: 50%;
margin: -3px 0 0 -4px;
}
.select2-container .select2-choice abbr {
display: none;
width: 30px;
height: 38px;
padding-top: 0;
position: absolute;
right: 30px;
top: 0;
font-size: 1px;
text-decoration: none;
border: 0;
background: none;
cursor: pointer;
outline: 0;
}
.select2-container.select2-allowclear .select2-choice abbr {
display: block;
}
.select2-container.select2-container-active.select2-allowclear .select2-choice abbr {
height: 36px;
right: 29px;
}
.select2-dropdown-open.select2-drop-above.select2-allowclear .select2-choice abbr {
margin-top: 2px;
}
.select2-container.select2-allowclear .select2-choice abbr:before {
background-position: -74px -160px;
}
.select2-container .select2-choice abbr:hover:before {
background-position: -134px -16px;
}
.select2-container .select2-choice .select2-arrow {
display: block;
width: 29px;
height: 100%;
position: absolute;
right: 0;
top: 0;
-webkit-border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0;
border-radius: 0 3px 3px 0;
}
.select2-container.select2-container-active .select2-choice .select2-arrow {
width: 28px;
}
.select2-container .select2-choice .select2-arrow b {
display: block;
width: 8px;
height: 5px;
overflow: hidden;
background: url(../img/sprites.png) -86px -27px no-repeat;
position: absolute;
right: 12px;
top: 17px;
}
.select2-container.select2-dropdown-open.select2-drop-above .select2-choice .select2-arrow b {
top: 18px;
}
.select2-container.select2-container-active .select2-choice .select2-arrow b {
right: 11px;
top: 16px;
}
.select2-drop-mask {
position: fixed;
left: 0;
top: 0;
z-index: 9998;
height: auto;
width: auto;
min-height: 100%;
min-width: 100%;
border: 0;
margin: 0;
padding: 0;
background-color: #fff;
opacity: 0;
filter: alpha(opacity=0);
}
.select2-drop {
position: absolute;
top: 100%;
z-index: 9999;
width: 100%;
padding: 0 10px 10px;
background: #fff;
color: #000;
border: 2px solid #ff6600;
border-top: none;
font-family: 'dindisplay_pro', sans-serif;
font-size: 15px;
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
.select2-drop.select2-drop-above {
padding: 10px 10px 0;
border-top: 2px solid #ff6600;
border-bottom: 0;
border-radius: 4px 4px 0 0;
}
.select2-drop-active {
border-color: #ff6600;
}
.select2-drop-auto-width {
border-top: 1px solid #aaa;
width: auto;
}
.select2-drop-auto-width .select2-search {
padding-top: 4px;
}
.select2-drop-active:before {
content: '';
display: block;
border-top: 1px dotted #cccccc;
margin: 4px 0 5px;
}
.select2-drop.select2-drop-above.select2-drop-active:before {
content: none;
}
.select2-drop.select2-drop-above.select2-drop-active:after {
content: '';
display: block;
border-bottom: 1px dotted #cccccc;
margin: 10px 0 4px;
}
.select2-search {
display: block;
width: 100%;
min-height: 26px;
margin: 0;
padding: 0 10px 10px;
position: relative;
z-index: 10000;
white-space: nowrap;
}
.select2-search:after {
content: '';
display: block;
width: 100%;
border-bottom: 1px dotted #cccccc;
padding: 0 10px;
margin: 5px -10px 0;
}
.select2-search input[type='text'] {
position: relative;
width: 100%;
height: 26px;
border: none;
padding: 0;
margin: 0;
outline: 0;
font-family: 'dindisplay_pro', sans-serif;
font-size: 15px;
line-height: 26px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background: #fff url('../img/select2/select2.png') no-repeat 100% -22px;
}
.select2-search input:focus {
border: none;
}
.select2-search input.select2-active {
background: #fff url('../img/select2/select2-spinner.gif') no-repeat 100%;
}
.select2-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.select2-default {
color: #a2a2a2 !important;
}
/* results */
.select2-results {
max-height: 200px;
padding: 0 0 0 5px;
margin: 5px 5px 5px 0;
position: relative;
overflow-x: hidden;
overflow-y: auto;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html[dir="rtl"] .select2-results {
padding: 0 5px 0 0;
margin: 5px 0 5px 5px;
}
.select2-results ul.select2-result-sub {
margin: 0;
padding-left: 0;
}
.select2-results li {
list-style: none;
display: list-item;
background-image: none;
}
.select2-results li.select2-result-with-children > .select2-result-label {
font-weight: bold;
}
.select2-results .select2-result-label {
padding: 3px 7px 4px;
margin: 0;
cursor: pointer;
min-height: 1em;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
.select2-results .select2-highlighted {
background: none;
color: #ff6600;
}
.select2-results li em {
background: #feffde;
font-style: normal;
}
.select2-results .select2-highlighted em {
background: transparent;
}
.select2-results .select2-highlighted ul {
background: #fff;
color: #000;
}
.select2-results .select2-no-results,
.select2-results .select2-searching,
.select2-results .select2-ajax-error,
.select2-results .select2-selection-limit {
background: #f4f4f4;
display: list-item;
padding-left: 5px;
}
/*
disabled look for disabled choices in the results dropdown
*/
.select2-results .select2-disabled.select2-highlighted {
color: #666;
background: #f4f4f4;
display: list-item;
cursor: default;
}
.select2-results .select2-disabled {
background: #f4f4f4;
display: list-item;
cursor: default;
}
.select2-results .select2-selected {
display: none;
}
.select2-more-results.select2-active {
background: #f4f4f4 url('../img/select2/select2-spinner.gif') no-repeat 100%;
}
.select2-results .select2-ajax-error {
background: rgba(255, 50, 50, .2);
}
.select2-more-results {
background: #f4f4f4;
display: list-item;
}
/* disabled styles */
.select2-container.select2-container-disabled .select2-choice {
background: #ffffff;
cursor: default;
}
.select2-container.select2-container-disabled .select2-choice .select2-arrow {
background: none;
border-left: 0;
}
.select2-container.select2-container-disabled .select2-choice abbr {
display: none;
}
/* multiselect */
.select2-container-multi .select2-choices .select2-search-choice {
position: relative;
padding: 6px 25px 5px 15px;
margin: 0 3px 3px 0;
border: 1px solid #ff6600;
line-height: 15px;
color: #ff6600;
cursor: default;
background: #ffffff;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.select2-locked {
padding: 3px 5px 3px 5px !important;
}
.select2-container-multi .select2-choices li {
float: left;
list-style: none;
}
html[dir="rtl"] .select2-container-multi .select2-choices li
{
float: right;
}
.select2-container-multi .select2-choices .select2-search-field {
margin: 0;
padding: 0;
white-space: nowrap;
}
.select2-container-multi .select2-choices .select2-search-field input {
background: none !important;
border: none;
outline: none;
color: #666;
margin: 0;
padding: 0 5px;
height: 29px;
font-family: 'dindisplay_pro', sans-serif;
line-height: 27px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.select2-container-multi .select2-choices .select2-search-field:first-child input {
padding: 0 20px;
}
/* end multiselect */
.select2-result-selectable .select2-match,
.select2-result-unselectable .select2-match {
text-decoration: underline;
}
.select2-offscreen, .select2-offscreen:focus {
clip: rect(0 0 0 0) !important;
width: 1px !important;
height: 1px !important;
border: 0 !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
position: absolute !important;
outline: 0 !important;
left: 0px !important;
top: 0px !important;
}
.select2-display-none {
display: none;
}
.select2-measure-scrollbar {
position: absolute;
top: -10000px;
left: -10000px;
width: 100px;
height: 100px;
overflow: scroll;
}

@ -349,7 +349,12 @@ function addError(inputId, msg){
}); });
}; };
$("select:not([multiple])").customSelect(); $("select:not([multiple])").each(function () {
var $el = $(this);
if (!$el.hasClass('select2')) {
$el.customSelect();
}
});
/* Нестандартное оформление для поля checkbox */ /* Нестандартное оформление для поля checkbox */
$.fn.customRadioCheck = function () { $.fn.customRadioCheck = function () {
@ -1947,6 +1952,8 @@ function addError(inputId, msg){
$check.on('change', checkState); $check.on('change', checkState);
}); });
//$('select.select2').select2();
//-------------------------------------------- //--------------------------------------------
$('a.reply-msg').on('click', function () { $('a.reply-msg').on('click', function () {

@ -101,18 +101,27 @@ function handleAboutForm(data){
} }
} }
function handleCreateCompany(data){
if(data.success){
window.location = '/profile/company/'
}
console.log(data);
}
function formHandler(id, handleFunction){ function formHandler(id, handleFunction){
$(id).on('submit', function(event){ $(id).on('submit', function(event){
event.preventDefault(); event.preventDefault();
$this = $(this); $this = $(this);
var url = $this.attr('action'); var url = $this.attr('action');
var formData = $this.serialize(); var formData = $this.serialize();
$.post(url, formData, handleFunction); $.post(url, formData, handleFunction);
}); });
} }
$(document).ready(function(){ $(document).ready(function(){
formHandler('#home_form', handleHomeForm); formHandler('#home_form', handleHomeForm);
formHandler('#name_form', handleNameForm); formHandler('#name_form', handleNameForm);
formHandler('#work_form', handleWorkForm); formHandler('#work_form', handleWorkForm);
@ -122,15 +131,85 @@ $(document).ready(function(){
//formHandler('#email_form', handleEmailForm); //formHandler('#email_form', handleEmailForm);
formHandler('#web_page_form', handleWebPageForm); formHandler('#web_page_form', handleWebPageForm);
formHandler('#about_form', handleAboutForm); formHandler('#about_form', handleAboutForm);
formHandler('#create_company_form', handleCreateCompany)
// $('#id_country').on('change', function(){alert('111');})
$('#id_country').select2({
}); width: 'element'
});
$('#id_theme').select2({
width: 'element',
handleCalendar = function(data){ placeholder: 'Выберите тематику компании'
});
console.log(data);
} $('#id_city').select2({
placeholder: "Search city",
width: 'element',
ajax: {
url: "/city/get-city/",
dataType: "json",
quietMillis: 200,
data: function(term, page, country){
var country = $('#id_country').val()
return {term: term,
page: page,
country: country};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var id= $(element).val();
var text = $(element).attr('data-init-text');
callback({id: id, text:text});
}
});
$('#id_company').select2({
placeholder: "Search company",
width: 'element',
minimumInputLength: 1,
ajax: {
url: "/company/get-company/",
dataType: "json",
quietMillis: 200,
data: function(term, page, country){
return {term: term,
page: page};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var id= $(element).val();
var text = $(element).attr('data-init-text');
callback({id: id, text:text});
}
});
});

@ -0,0 +1,121 @@
function handleTest(data){
if (data.success){
location.reload();
}
}
function formHandler(id, handleFunction){
$(id).on('submit', function(event){
event.preventDefault();
$this = $(this);
var url = $this.attr('action');
var formData = $this.serialize();
$.post(url, formData, handleFunction);
});
}
$(document).ready(function(){
formHandler('#home_form', handleTest);
formHandler('#name_form', handleTest);
formHandler('#spec_form', handleTest);
formHandler('#address_form', handleTest);
formHandler('#social_form', handleTest);
formHandler('#phone_form', handleTest);
formHandler('#email_form', handleTest);
formHandler('#web_page_form', handleTest);
formHandler('#found_form', handleTest);
formHandler('#staff_form', handleTest);
formHandler('#description_form', handleTest);
$('#id_country').select2({
width: 'element'
});
$('#id_city').select2({
placeholder: "Search city",
width: 'element',
ajax: {
url: "/city/get-city/",
dataType: "json",
quietMillis: 200,
data: function(term, page, country){
var country = $('#id_country').val()
return {term: term,
page: page,
country: country};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var id= $(element).val();
var text = $(element).attr('data-init-text');
callback({id: id, text:text});
}
});
$('#id_tag').select2({
placeholder: "Выберите ключевые теги",
width: '368px',
multiple: true,
ajax: {
url: "/theme/get-tag/",
dataType: "json",
quietMillis: 200,
data: function(term, page, country){
var themes = $('#theme-inf').attr('data-theme');
themes = themes.split(',');
themes.pop();
return {term: term,
page: page,
themes: themes};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var data = [];
$(element.val().split(",")).each(function(i) {
var item = this.split(':');
data.push({
id: item[0],
text: item[1]
});
});
callback(data);
}
});
});

File diff suppressed because one or more lines are too long

@ -0,0 +1,23 @@
/**
* Select2 Russian translation.
*
* @author Uriy Efremochkin <efremochkin@uriy.me>
*/
(function ($) {
"use strict";
$.fn.select2.locales['ru'] = {
formatNoMatches: function () { return "Совпадений не найдено"; },
formatInputTooShort: function (input, min) { return "Пожалуйста, введите еще хотя бы" + character(min - input.length); },
formatInputTooLong: function (input, max) { return "Пожалуйста, введите на" + character(input.length - max) + " меньше"; },
formatSelectionTooBig: function (limit) { return "Вы можете выбрать не более " + limit + " элемент" + (limit%10 == 1 && limit%100 != 11 ? "а" : "ов"); },
formatLoadMore: function (pageNumber) { return "Загрузка данных…"; },
formatSearching: function () { return "Поиск…"; }
};
$.extend($.fn.select2.defaults, $.fn.select2.locales['ru']);
function character (n) {
return " " + n + " символ" + (n%10 < 5 && n%10 > 0 && (n%100 < 5 || n%100 > 20) ? n%10 > 1 ? "a" : "" : "ов");
}
})(jQuery);

@ -3,7 +3,16 @@
{% load i18n %} {% load i18n %}
{% load template_filters %} {% load template_filters %}
{% block style %}
<link rel="stylesheet" href="{% static 'client/css/select2.css' %}">
<style>
.add_link_teg .tag-select{
float: left;
margin: 0 13px 0 0;
min-height: 36px;
}
</style>
{% endblock %}
{% block bread_scrumbs %} {% block bread_scrumbs %}
<div class="bread-crumbs"> <div class="bread-crumbs">
@ -17,7 +26,6 @@
{% endblock %} {% endblock %}
{% block content_list %} {% block content_list %}
<form method="post" enctype="multipart/form-data" class="clearfix" action="#">{% csrf_token %}
<div class="m-article"> <div class="m-article">
<div class="item-wrap clearfix"> <div class="item-wrap clearfix">
@ -34,55 +42,81 @@
<div class="i-info"> <div class="i-info">
<header> <header>
<div class="i-place p-editable add_link_text add_link_text_medium"> <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 %}">
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
<a href="#">{{ home_form.instance.country }}</a>
</span>
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
, <a href="#">{{ home_form.instance.city }}</a>
</span>
<div class="edit-wrap e-left"> <div class="edit-wrap e-left">
<a class="e-btn" href="#" title="">Указать</a> {% if home_form.instance.country and home_form.instance.city %}
<div class="add_link_text_text">свой город <b>+5</b></div> <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" id="home_form" action="/company/update/home/" method="post">{% csrf_token %}
<div class="e-form"> <div class="e-form">
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.country.label }}</label> <label>Страна</label>
<div class="epf-field"> <div class="epf-field">
{{ form.country }} {{ home_form.country }}
</div> </div>
</div> </div>
<div class="epfl"> <div class="epfl">
<label>{{ form.city.label }}</label> <label>{% trans 'Город' %}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.city }} {{ home_form.city }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">Сохранить</button>
</div> </div>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">закрыть</a>
</div> </div>
</form>
</div> </div>
</div>
<div class="site_link">
<a href="{{ request.user.company.get_permanent_url }}" title="">{{ request.user.company.get_permanent_url }}</a>
</div> </div>
<div class="site_link"><a href="#" title="">expomap.ru/annapetrova</a></div>
<div class="i-title p-editable p-editable"> <div class="i-title p-editable p-editable">
Q.Art Media Solution {{ name_form.name.value }}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#">редактировать</a> <a class="e-btn" href="#">редактировать</a>
<div class="e-form"> <div class="e-form">
<form class="clearfix" action="#"> <form class="clearfix" id="name_form" action="/company/update/name/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.name.label }}</label> <label>{{ name_form.name.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.name }} {{ name_form.name }}
</div> </div>
</div> </div>
@ -100,22 +134,27 @@
</header> </header>
<div class="i-descr p-editable add_link_text add_link_text_top"> <div class="{% if spec_form.specialization.value %}i-position p-editable{% else %}i-descr p-editable add_link_text add_link_text_top{% endif %}">
{% if spec_form.specialization.value %}
<span>{{ spec_form.specialization.value }}</span>
{% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a> {% if spec_form.specialization.value %}
<div class="add_link_text_text">краткое описание компании <b>+20</b></div> <a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<br> <a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">краткое описание компании <b>+20</b></div>
{% endif %}
<div class="e-form"> <div class="e-form">
<form class="clearfix" id="spec_form" action="/company/update/specialization/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.specialization.label }}</label> <label>{{ spec_form.specialization.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.specialization }} {{ spec_form.specialization }}
</div> </div>
</div> </div>
@ -124,6 +163,7 @@
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">Сохранить</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">закрыть</a>
</div> </div>
@ -131,29 +171,43 @@
</div> </div>
<div class="i-area"><a href="#">Дизайн и брендинг, PR и консалтинг</a></div> <div class="i-area" id="theme-inf" data-theme="{% for th in request.user.company.theme.all %}{{ th.id }},{% endfor %}">
{% for th in request.user.company.theme.all %}
<a href="#">{{ th.name }}</a>{% ifnotequal forloop.counter request.user.company.theme.all|length %},{% endifnotequal %}
{% endfor %}
</div>
<hr /> <hr />
<div class="ic-links p-editable add_link_text add_link_text_medium"> <div class="{% if address_form.address_inf.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if address_form.address_inf.value %}
<span>{{ address_form.address_inf.value }}</span>
{% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">адрес компании <b>+15</b></div> {% if address_form.address_inf.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">адрес компании <b>+15</b></div>
{% endif %}
<div class="e-form"> <div class="e-form">
<form class="clearfix" id="address_form" action="/company/update/address/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.address_inf.label }}</label> <label>{{ address_form.address_inf.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.address_inf }} {{ address_form.address_inf }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">Сохранить</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">закрыть</a>
</div> </div>
@ -165,8 +219,8 @@
<hr /> <hr />
<div class="add_link_teg"> <div class="add_link_teg">
{{ form.theme }}<br/>
{{ form.tag }}<br/> <div class="tag-select">{{ tag_form.tag }}</div>
<b>+5</b> <b>+5</b>
</div> </div>
@ -187,54 +241,55 @@
<a class="e-btn" href="#" title="">Добавить</a> <a class="e-btn" href="#" title="">Добавить</a>
<ul class="soc-media-buttons soc-media-buttons1"> <ul class="soc-media-buttons soc-media-buttons1">
<li><img src="img/soc-medias/icon-fb_hover.png" alt=""></li> <li><img src="{% static 'client/img/soc-medias/sm-icon-fb.png' %}" title="Facebook" alt="Facebook" /></li>
<li><img src="img/soc-medias/icon-lin_hover.png" alt=""></li> <li><img src="{% static 'client/img/soc-medias/sm-icon-lin.png' %}" title="LinkedIn" alt="LinkedIn" /></li>
<li><img src="img/soc-medias/sm-icon-vk_hover.png" alt=""></li> <li><img src="{% static 'client/img/soc-medias/sm-icon-vk.png' %}" title="В контакте" alt="В контакте" /></li>
<li><img src="img/soc-medias/sm-icon-twit_hover.png" alt=""></li> <li><img src="{% static 'client/img/soc-medias/sm-icon-twit.png' %}" title="Twitter" alt="Twitter" /></li>
</ul> </ul>
<div class="add_link_text_text"><b>+5 за каждый</b></div> <div class="add_link_text_text"><b>+5 за каждый</b></div>
<div class="e-form"> <div class="e-form">
<form class="clearfix" id="social_form" action="/company/update/social/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label><img src="img/soc-medias/sm-icon-fb-w.png" title="Facebook" alt="Facebook" /> {{ form.facebook.label }}</label> <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">
{{ form.facebook }} {{ social_form.facebook }}
</div> </div>
</div> </div>
<div class="epfl"> <div class="epfl">
<label><img src="img/soc-medias/sm-icon-lin-w.png" title="LinkedIn" alt="LinkedIn" /> {{ form.vk.label }}</label> <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">
{{ form.linkedin }}
</div>
</div>
<div class="epfl">
<label><img src="img/soc-medias/sm-icon-vk-w.png" title="В контакте" alt="В контакте" /> {{ form.vk.label }}</label>
<div class="epf-field">
{{ form.vk }}
</div>
</div>
<div class="epfl">
<label><img src="img/soc-medias/sm-icon-twit-w.png" title="Twitter" alt="Twitter" /> {{ form.twitter.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.twitter }} {{ social_form.linkedin }}
</div> </div>
</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">
{{ 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">
{{ social_form.twitter }}
</div>
</div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div> </div>
</form>
<a class="ef-close" href="#">{% trans 'закрыть' %}</a>
<a class="ef-close" href="#">закрыть</a>
</div> </div>
</div> </div>
@ -244,54 +299,110 @@
<div class="ic-links ic-links_indent dd_width_5"> <div class="ic-links ic-links_indent dd_width_5">
<div class="p-editable add_link_text add_link_text_medium"> <div class="{% if phone_form.phone.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if phone_form.phone.value %}
<span>{{ phone_form.phone.value|phone }}</span>
{% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a> {% if phone_form.phone.value %}
<div class="add_link_text_text">номер телефона <b>+15</b></div> <a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form"> {% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">номер телефона <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix" id="phone_form" action="/company/update/phone/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.phone.label }}</label> <label>{{ phone_form.phone.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.phone }} {{ phone_form.phone }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div> </div>
</div> </div>
</div> </div>
<div class="ic-mail add_indent"> <div class="{% if email_form.email.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
<a class="icon-mail" href="mailto:info@qartmedia.ru">info@qartmedia.ru</a> {% if email_form.email.value %}
</div>
<div class="ic-mail add_indent">
<a class="icon-mail" href="mailto:{{ email_form.email.value }}">{{ email_form.email.value }}</a>
</div>
{% endif %}
<div class="ic-site p-editable add_link_text add_link_text_medium">
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a> {% if email_form.email.value %}
<div class="add_link_text_text">сайт <b>+5</b></div> <a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">email <b>+15</b></div>
{% endif %}
<div class="e-form"> <div class="e-form">
<form class="clearfix" id="email_form" action="/company/update/email/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ email_form.email.label }}</label>
<div class="epf-field">
{{ email_form.email }}
</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 class="{% if web_page_form.web_page.value %}ic-site p-editable{% else %}ic-site p-editable add_link_text add_link_text_medium{% endif %}">
{% if web_page_form.web_page.value %}
<a class="icon-ext-link" href="{% if web_page_form.web_page.value %}{{ web_page_form.web_page.value }}{% else %}#{% endif %}" target="_blank">
{% if web_page_form.web_page.value %}
{{ web_page_form.web_page.value }}
{% endif %}
</a>
{% endif %}
<div class="edit-wrap">
{% if web_page_form.web_page.value %}
<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 %}
<div class="e-form">
<form class="clearfix" id="web_page_form" action="/company/update/web-page/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.web_page.label }}</label> <label>{{ web_page_form.web_page.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.web_page }} {{ web_page_form.web_page }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">{% trans 'Сохранить' %}</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">{% trans 'закрыть' %}</a>
</div> </div>
</div> </div>
</div> </div>
@ -305,238 +416,121 @@
<div class="i-additional"> <div class="i-additional">
<div class="ia-title">Дополнительная информация</div> <div class="ia-title">Дополнительная информация</div>
<div class="ic-links p-editable add_link_text add_link_text_medium"> <div class="{% if found_form.foundation.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if found_form.foundation.value %}
<p>Год основания: <span>{{ found_form.foundation.value }}</span></p>
{% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a> {% if found_form.foundation.value %}
<div class="add_link_text_text">год основания <b>+15</b></div> <a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form"> {% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">год основания <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix" id="found_form" action="/company/update/foundation/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.foundation.label }}</label> <label>{{ found_form.foundation.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.foundation }} {{ found_form.foundation }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">Сохранить</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">закрыть</a>
</div> </div>
</div> </div>
</div> </div>
<div class="ic-links p-editable add_link_text add_link_text_medium"> <div class="{% if staff_form.staff_number.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if staff_form.staff_number.value %}
<p>к-во сотрудников: <span>{{ staff_form.staff_number.value }}</span></p>
{% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a> {% if staff_form.staff_number.value %}
<div class="add_link_text_text">к-во сотрудников <b>+15</b></div> <a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form"> {% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">к-во сотрудников <b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix" id="staff_form" action="/company/update/staff/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.staff_number.label }}</label> <label>{{ staff_form.staff_number.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.staff_number }} {{ staff_form.staff_number }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">Сохранить</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">закрыть</a>
</div> </div>
</div> </div>
</div> </div>
<div class="p-editable add_link_text add_link_text_medium"> <div class="{% if description_form.description.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if description_form.description.value %}
<span>{{ description_form.description.value }}</span>
{% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a> {% if description_form.description.value %}
<div class="add_link_text_text">подробное описание компании<b>+15</b></div> <a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div class="e-form"> {% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">подробное описание компании<b>+15</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix" id="description_form" action="/company/update/description/" method="post">{% csrf_token %}
<div class="ef-body"> <div class="ef-body">
<div class="epfl"> <div class="epfl">
<label>{{ form.description.label }}</label> <label>{{ description_form.description.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ form.description }} {{ description_form.description }}
</div> </div>
</div> </div>
</div> </div>
<div class="ef-buttons"> <div class="ef-buttons">
<button type="button" class="lnk icon-save">Сохранить</button> <button type="submit" class="lnk icon-save">Сохранить</button>
</div> </div>
</form>
<a class="ef-close" href="#">закрыть</a> <a class="ef-close" href="#">закрыть</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form>
{% endblock %} {% endblock %}
{% block style %}
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
<style> {% block pre_scripts %}
.select2-container-multi .select2-choices { <script src="{% static 'client/js/plugins/select2.min.js' %}"></script>
background-image: <script src="{% static 'client/js/plugins/select2_locale_ru.js' %}"></script>
border:1px solid #bdbdbd;
outline:none;
background:#fff;
padding:3px;
font-family:'dindisplay_pro', sans-serif;
font-size:15px;
line-height:19px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
-webkit-box-shadow:inset 0 2px 2px -2px #aaa;
-moz-box-shadow:inset 0 2px 2px -2px #aaa;
box-shadow:inset 0 2px 2px -2px #aaa;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
/*
{position:relative;
border:1px solid #bdbdbd;
outline:none;
background:#fff;
width:100%;
padding:3px;
font-family:'dindisplay_pro', sans-serif;
font-size:15px;
line-height:19px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
-webkit-box-shadow:inset 0 2px 2px -2px #aaa;
-moz-box-shadow:inset 0 2px 2px -2px #aaa;
box-shadow:inset 0 2px 2px -2px #aaa;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;}
*/
</style>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{% static 'client/js/pages/profile_company.js' %}"></script>
<script src="{% static 'js/select/select2.js' %}"></script> {% endblock %}
<script>
$(document).ready(function(){
$('button .lnk .icon-save').on('click', function(e){
e.preventDefault();
console.log(123);
})
$('#id_theme').select2({
width: 'element',
placeholder: "Выберите ключевые тематики",
//adaptContainerCssClass: 'test-container',
//adaptDropdownCssClass: 'TEST-DROP'
formatSelectionCssClass: function (data, container) { return "csb-selected show"; }
//formatResultCssClass: function (data, container) { return "TEST"; },
//formatContainerCssClass: function (data, container) { return "CONT____"; },
//formatDropdownCssClass: function (data, container) { return "DROP"; }
});
$('#id_tag').select2({
placeholder: "Выберите ключевые теги",
width: 'element',
multiple: true,
ajax: {
url: "/admin/theme/tag/search/",
dataType: "json",
quietMillis: 200,
multiple: true,
data: function(term, page, theme){
var theme = $('#id_theme').serialize();
return {term: term,
page: page,
theme: theme};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var data = [];
$(element.val().split(",")).each(function(i) {
var item = this.split(':');
data.push({
id: item[0],
text: item[1]
});
});
callback(data);
}
});
$('#id_country').select2({
placeholder: "Выберите страну",
width: 'element'
});
$('#id_city').select2({
placeholder: "Выберите город",
width: 'element',
ajax: {
url: "/admin/city/search/",
dataType: "json",
quietMillis: 200,
data: function(term, page, country){
var country = $('#id_country').val()
return {term: term,
page: page,
country: country};
},
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
text: item.label
});
});
return {results: results};
}
},
initSelection : function(element, callback) {
var id= $(element).val();
var text = $(element).attr('data-init-text');
callback({id: id, text:text});
}
});
});
</script>
{% endblock %}

@ -3,6 +3,10 @@
{% load i18n %} {% load i18n %}
{% load template_filters %} {% load template_filters %}
{% block style %}
<link rel="stylesheet" href="{% static 'client/css/select2.css' %}">
{% endblock %}
{% block bread_scrumbs %} {% block bread_scrumbs %}
<div class="bread-crumbs"> <div class="bread-crumbs">
@ -39,12 +43,8 @@
<div class="i-info"> <div class="i-info">
<header> <header>
<div class="{% if home_form.instance.country and home_form.instance.city %} <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 %}">
i-place p-editable {% if home_form.instance.country and home_form.instance.city %}
{% else %}
i-place p-editable add_link_text add_link_text_medium
{% endif %}">
{% if home_form.instance.country %}
<span> <span>
{% else %} {% else %}
<span style="display:none;"> <span style="display:none;">
@ -52,7 +52,7 @@
<a href="#">{{ home_form.instance.country }}</a> <a href="#">{{ home_form.instance.country }}</a>
</span> </span>
{% if home_form.instance.city %} {% if home_form.instance.country and home_form.instance.city %}
<span> <span>
{% else %} {% else %}
<span style="display:none;"> <span style="display:none;">
@ -83,9 +83,7 @@
<div class="epfl"> <div class="epfl">
<label>{% trans 'Город' %}</label> <label>{% trans 'Город' %}</label>
<div class="epf-field"> <div class="epf-field">
<select name="city"> {{ home_form.city }}
</select>
</div> </div>
</div> </div>
@ -101,7 +99,11 @@
</div> </div>
</div> </div>
<div class="site_link"><a href="{{ request.user.get_permanent_url }}" title="">{{ request.user.get_permanent_url }}</a></div> <div class="site_link">
<a href="{{ request.user.get_permanent_url }}" title="">
{{ request.user.get_permanent_url }}
</a>
</div>
<div class="i-title p-editable p-editable"> <div class="i-title p-editable p-editable">
{{ name_form.get_full_name }} {{ name_form.get_full_name }}
@ -140,19 +142,18 @@
</div> </div>
</header> </header>
{# position #} {# position #}
{% if work_form.position.value and work.form.work.value %}{% else %}{% endif %} <div class="{% if work_form.position.value and work_form.company.value %}i-position p-editable{% else %}i-descr p-editable add_link_text add_link_text_top{% endif %}">
<div class="{% if work_form.position.value and work.form.work.value %}i-position p-editable{% else %}i-descr p-editable add_link_text add_link_text_top{% endif %}"> {% if work_form.position.value and work_form.company.value %}
{% if work_form.position.value and work.form.work.value %}
<p> <p>
{{ work_form.position.value }} {{ work_form.position.value }}
{% if work_form.work.value %} {% if work_form.company.value %}
{% trans 'в' %} {{ work_form.work.value }} {% trans 'в' %} {{ request.user.company.name }}
{% endif %} {% endif %}
</p> </p>
{% endif %} {% endif %}
<div class="edit-wrap"> <div class="edit-wrap">
{% if work_form.position.value and work.form.work.value %} {% if work_form.position.value and work_form.company.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a> <a class="e-btn" href="/profile/company/">{% trans 'редактировать' %}</a>
{% else %} {% else %}
<a class="e-btn" href="#" title="">Указать</a> <a class="e-btn" href="#" title="">Указать</a>
<div class="add_link_text_text">свою должность и место работы <b>+10</b></div> <div class="add_link_text_text">свою должность и место работы <b>+10</b></div>
@ -172,13 +173,13 @@
</div> </div>
<div class="epfl"> <div class="epfl">
<label>{{ work_form.work.label }}</label> <label>{{ work_form.company.label }}</label>
<div class="epf-field"> <div class="epf-field">
{{ work_form.work }} {{ work_form.company }}
</div> </div>
</div> </div>
<!-- сделать проверку на создателя компании -->
<div class="add_company"><a href="/profile/company/" title="">{% if request.user.company %}Изменить{% else %}Добавить{% endif %} компанию</a></div> <div class="add_company"><a class="pw-open" href="{% if not company_form %}/profile/company/{% else %}#pw-company{% endif %}" title="">{% if not company_form %}Изменить{% else %}Добавить{% endif %} компанию</a></div>
</div> </div>
@ -264,7 +265,7 @@
</div> </div>
<div class="{% if phone_form.phone.value %}ic-links{% else %}ic-links ic-links_indent dd_width_5{% endif %}"> <div class="ic-links ic-links_indent dd_width_5">
<div class="{% if phone_form.phone.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}"> <div class="{% if phone_form.phone.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if phone_form.phone.value %} {% if phone_form.phone.value %}
@ -389,7 +390,17 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block popup %}
{% if company_form %}
{% include 'popups/create_company.html' with form=company_form %}
{% endif %}
{% endblock %}
{% block pre_scripts %}
<script src="{% static 'client/js/plugins/select2.min.js' %}"></script>
<script src="{% static 'client/js/plugins/select2_locale_ru.js' %}"></script>
{% endblock %}
{% block scripts %} {% block scripts %}
<script src="{% static 'client/js/profile.js' %}"></script> <script src="{% static 'client/js/pages/profile.js' %}"></script>
{% endblock %} {% endblock %}

@ -105,6 +105,7 @@ This template include basic anf main styles and js files,
{% block photogallery %} {% block photogallery %}
{% endblock %} {% endblock %}
<!-- scripts --> <!-- scripts -->
<script src="{% static 'client/js/vendor/jquery-1.10.1.min.js' %}"></script><!-- удалить эту строку и раскоментировать следующие две! --> <script src="{% static 'client/js/vendor/jquery-1.10.1.min.js' %}"></script><!-- удалить эту строку и раскоментировать следующие две! -->
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
@ -112,6 +113,7 @@ This template include basic anf main styles and js files,
<script src="{% static 'client/js/plugins.js' %}"></script> <script src="{% static 'client/js/plugins.js' %}"></script>
<script src="{% static 'client/js/jquery-ui-1.10.4.custom.min.js' %}"></script> <script src="{% static 'client/js/jquery-ui-1.10.4.custom.min.js' %}"></script>
<script src="{% static 'client/js/jquery.ui.datepicker-ru.js' %}"></script> <script src="{% static 'client/js/jquery.ui.datepicker-ru.js' %}"></script>
<script src="{% static 'client/js/jquery.mousewheel.min.js' %}"></script> <script src="{% static 'client/js/jquery.mousewheel.min.js' %}"></script>
<script src="{% static 'client/js/idangerous.swiper-2.4.min.js' %}"></script> <script src="{% static 'client/js/idangerous.swiper-2.4.min.js' %}"></script>
@ -122,6 +124,8 @@ This template include basic anf main styles and js files,
<script src="{% static 'client/js/jquery.phototag.js?nocache13 ' %}"></script> <script src="{% static 'client/js/jquery.phototag.js?nocache13 ' %}"></script>
<script src="{% static 'client/js/regions.js' %}"></script> <script src="{% static 'client/js/regions.js' %}"></script>
{% block pre_scripts %}
{% endblock %}
<script src="{% static 'client/js/main.js' %}"></script> <script src="{% static 'client/js/main.js' %}"></script>
<!-- Dimon scripts --> <!-- Dimon scripts -->

@ -0,0 +1,37 @@
{% load static %}
{% load i18n %}
<div id="pw-company" class="popup-window pw-reg">
<header class="clearfix">
<div class="pw-title">{% trans 'Создание компании' %}</div>
</header>
<div class="pw-body clearfix">
<form id="create_company_form" method="post" class="pw-form" action="{{ form.action }}">{% csrf_token %}
<div class="pwf-line">
<div class="pwf-field">
{{ form.name }}
</div>
</div>
<div class="pwf-line">
<div class="pwf-field">
{{ form.url }}
</div>
<div class="pwf-msg">
<div class="msg-help">{% trans 'результат: expomap/members/урл' %}</div>
</div>
</div>
<div class="pwf-line">
<div class="pwf-field">
{{ form.theme }}
</div>
</div>
<div class="pwf-buttons-line">
<button type="submit" class="icon-check">{% trans 'Завершить' %}</button>
</div>
</form>
</div>
</div>

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^get-tag/$', 'theme.views.get_tag'),
)

@ -0,0 +1,18 @@
import json
from django.http import HttpResponse
from theme.models import Tag
def get_tag(request):
#if request.is_ajax():
themes = request.GET.getlist('themes[]')
term = request.GET['term'].capitalize()
if not term:
qs = Tag.objects.language().filter(theme__id__in=themes).order_by('translations__name').distinct()
else:
qs = Tag.objects.language().filter(theme__id__in=themes, translations__name__contains=term).distinct()
result = [{'id': tag.id, 'label': tag.name} for tag in qs]
return HttpResponse(json.dumps(result), content_type='application/json')
#else:
# return HttpResponse('not ajax')
Loading…
Cancel
Save