Company and user rating.

Company page with editing
remotes/origin/1203
Nazar Kotiuk 11 years ago
parent 9b73dcf320
commit 47e7f6ed4f
  1. 35
      accounts/models.py
  2. 8
      company/edit_forms.py
  3. 21
      company/edit_views.py
  4. 39
      company/models.py
  5. 21
      company/urls.py
  6. 88
      company/views.py
  7. 2
      exposition/models.py
  8. 25
      templates/client/company/companies_list.html
  9. 28
      templates/client/company/company_detail.html
  10. 581
      templates/client/includes/company/company_edit.html
  11. 10
      templates/client/includes/company/company_list.html

@ -115,7 +115,7 @@ class User(AbstractBaseUser, PermissionsMixin):
username = models.CharField(verbose_name='Email', max_length=255, unique=True, db_index=True)
first_name = models.CharField(verbose_name='First name', max_length=255)
last_name = models.CharField(verbose_name='Last name', max_length=255)
rating = models.IntegerField(default=100)# добавить индекс в базе
url = models.SlugField(blank=True)
#
is_active = models.BooleanField(default=0) # СДЕЛАТЬ проверку на емейле
@ -195,10 +195,12 @@ class User(AbstractBaseUser, PermissionsMixin):
return n
def get_permanent_url(self):
if self.url:
return self.catalog+self.url+'/'
return self.catalog+str(self.id)+'/'
if self.url:
return '/%s'%self.url
#return self.catalog+self.url+'/'
return '/%d'%self.id
#return self.catalog+str(self.id)+'/'
def get_expos(self):
"""
@ -351,6 +353,29 @@ class EventFilter(models.Model):
def calculate_rating(user):
user_rating_fields = {'position': 5, 'company': 5, 'url': 10}
profile_rating_fields = {'country': 5, 'city': 5, 'phone': 10, 'facebook': 5, 'twitter': 5, 'linkedin': 5, 'vk': 5,
'web_page': 10, 'avatar': 20, 'about': 15}
# доделать "Отметки на выставках, за каждую", "Подписка на рассылку", "Добавление фото, за каждую", "Добавление компании, за каждую опубликованную"
# base rating
rating = 100
for key, value in user_rating_fields.iteritems():
if getattr(user, key):
rating += value
for key, value in profile_rating_fields.iteritems():
if getattr(user.profile, key):
rating += value
user.rating = rating
# call to prevent recursion
post_save.disconnect(create_user_inf, sender=User)
user.save()
post_save.connect(create_user_inf, sender=User)
def create_user_inf(sender, instance, created, **kwargs):
if created:
@ -358,6 +383,8 @@ def create_user_inf(sender, instance, created, **kwargs):
Profile.objects.create(user=instance)
EventFilter.objects.create(user=instance)
calculate_rating(instance)
post_save.connect(create_user_inf, sender=User)
#need import after User Model, because User imported in "organiser.models"

@ -9,6 +9,14 @@ from company.models import Company
class BaseForm(forms.ModelForm):
translation = False
class LogoForm(BaseForm):
logo = forms.ImageField(label=_(u'Выберите файл (GIF, JPG, PNG. Размер 100 × 100 пикселей)'),
required=False, widget=forms.FileInput(attrs={'class': 'input'}))
class Meta:
model = Company
fields = ('logo',)
class NameForm(BaseForm):
name = forms.CharField(label=_(u'Введите название компании'))
translation = True

@ -1,6 +1,7 @@
import json
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.utils.translation import get_language
from sorl.thumbnail import get_thumbnail
from edit_forms import *
from accounts.views import ProfileInvalidView
@ -20,6 +21,26 @@ class BaseView(ProfileInvalidView):
return HttpResponse(json.dumps(response), content_type='application/json')
class LogoView(BaseView):
"""
instance profile. save user avatar.
if call is ajax- return json data, else redirect to profile page
"""
form_class = LogoForm
def form_valid(self, form):
company = self.request.user.company
form = self.form_class(self.request.POST, self.request.FILES, instance=company)
form.save()
if self.request.is_ajax():
im = get_thumbnail(company.logo, '100x100', crop='center')
response = {'success': True, 'url': im.url}
return HttpResponse(json.dumps(response), content_type='application/json')
else:
return HttpResponseRedirect(company.get_permanent_url())
class NameView(BaseView):
form_class = NameForm

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
import os
from django.db import models
from django.db.models.signals import post_save
from hvad.models import TranslatableModel, TranslatedFields, TranslationManager
from django.contrib.contenttypes import generic
from django.utils import translation
@ -7,7 +9,10 @@ from django.utils.translation import ugettext as _
from functions.custom_fields import LocationField
from functions.models_methods import ExpoManager
from functions.model_mixin import ExpoMixin
from functions.signal_handlers import post_save_handler
def get_storage_path(instance, filename):
return os.path.join('company', filename)
class Company(TranslatableModel, ExpoMixin):
"""
@ -57,9 +62,14 @@ class Company(TranslatableModel, ExpoMixin):
descriptions = models.CharField(max_length=255),
keywords = models.CharField(max_length=255),
)
rating = models.IntegerField(default=100) # добавить индекс в базе
#fields saves information about creating and changing model
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
logo = models.ImageField(upload_to=get_storage_path, blank=True)
class Meta:
ordering = ['-rating', 'id']
def __unicode__(self):
@ -78,8 +88,7 @@ class Company(TranslatableModel, ExpoMixin):
return '/members/'
def get_permanent_url(self):
url = '%smember-%s'%(self.catalog, self.url)
return url
return '%s%s/'%(self.catalog, self.url)
def get_expositions_number(self):
return len(self.exposition_companies.all())
@ -108,6 +117,26 @@ class Company(TranslatableModel, ExpoMixin):
return list(expositions)+ list(conferences)+list(seminars)+list(webinars)
from django.db.models.signals import post_save
from functions.signal_handlers import post_save_handler
post_save.connect(post_save_handler, sender=Company)
def calculate_rating(company):
rating_simple = {'country': 5, 'city': 5, 'address_inf': 10, 'phone': 10, 'fax': 5, 'email': 10,
'facebook': 5, 'twitter': 5, 'linkedin': 5, 'vk': 5, 'web_page': 10, #'logo': 20,
'specialization': 5, 'description':15, 'foundation': 5, 'staff_number': 5}# участие и посещение доделать
rating_methods = {'theme': 10, 'tag': 5, 'photo':5}
# base rating
rating = 100
for key, value in rating_simple.iteritems():
if getattr(company, key):
rating += value
company.rating = rating
# call to prevent recursion
post_save.disconnect(create_company, sender=Company)
company.save()
post_save.connect(create_company, sender=Company)
def create_company(sender, instance, created, **kwargs):
post_save_handler(sender, instance=instance, **kwargs)
calculate_rating(instance)
post_save.connect(create_company, sender=Company)

@ -1,15 +1,24 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from views import CompanyView, CompanySearchView
from views import CompanyView, CompanySearchView, MemberDetail, MemberList, MemberTagList, MemberThemeList
from django.contrib.auth.decorators import login_required
from edit_views import *
urlpatterns = patterns('',
url(r'members/search/$', CompanySearchView.as_view()),
url(r'members/(?P<params>.*)/(?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/$', CompanyView.as_view()),
#url(r'members/(?P<params>.*)/(?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/$', CompanyView.as_view()),
url(r'members/theme/(?P<slug>.*)/page/(?P<page>\d+)/$', MemberThemeList.as_view()),
url(r'members/theme/(?P<slug>.*)/$', MemberThemeList.as_view()),
url(r'members/tag/(?P<slug>.*)/page/(?P<page>\d+)/$', MemberTagList.as_view()),
url(r'members/tag/(?P<slug>.*)/$', MemberTagList.as_view()),
url(r'members/page/(?P<page>\d+)/$', MemberList.as_view()),
url(r'members/(?P<slug>.*)/$', MemberDetail.as_view()),
url(r'members/$', MemberList.as_view()),
#
url(r'company/create-company/$', 'company.views.create_company'),
url(r'company/get-company/$', 'company.views.get_company'),
@ -26,4 +35,6 @@ urlpatterns = patterns('',
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())),
url(r'^company/update/logo/$', login_required(LogoView.as_view())),
)

@ -1,12 +1,21 @@
# -*- coding: utf-8 -*-
import json
from django.http import HttpResponse
from functions.custom_views import ExpoListView
from django.views.generic import ListView, FormView
from django.conf import settings
from django.views.generic import ListView, DetailView
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _, get_language
from haystack.query import EmptySearchQuerySet
from models import Company
from theme.models import Theme, Tag
from forms import CreateCompanyForm
from functions.custom_views import ExpoListView
from functions.search_forms import CompanySearchForm
from .edit_forms import NameForm as CompNameForm, HomeForm as CompHomeForm, PhoneForm as CompPhoneForm,\
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,\
LogoForm as CompLogo
class CompanySearchView(ListView):
@ -41,6 +50,81 @@ class CompanySearchView(ListView):
return context
class MemberList(ListView):
model = Company
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/company/companies_list.html'
search_form = CompanySearchForm
catalog_url = '/members/'
def get_queryset(self):
return self.model.objects.order_by('-rating')
class MemberThemeList(ListView):
model = Company
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/company/companies_list.html'
search_form = CompanySearchForm
catalog_url = '/members/'
def get_queryset(self):
qs = super(MemberThemeList, self).get_queryset()
slug = self.kwargs.get('slug')
theme = get_object_or_404(Theme, url=slug)
qs = qs.filter(theme=theme)
return qs
class MemberTagList(ListView):
model = Company
paginate_by = settings.CLIENT_PAGINATION
template_name = 'client/company/companies_list.html'
search_form = CompanySearchForm
catalog_url = '/members/'
def get_queryset(self):
qs = super(MemberTagList, self).get_queryset()
slug = self.kwargs.get('slug')
tag = get_object_or_404(Tag, url=slug)
qs = qs.filter(tag=tag)
return qs
class MemberDetail(DetailView):
model = Company
slug_field = 'url'
template_name = 'client/company/company_detail.html'
def get_context_data(self, **kwargs):
context = super(MemberDetail, self).get_context_data(**kwargs)
company = context['object']
if self.request.user == company.creator:
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),
'logo_form': CompLogo(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
class CompanyView(ExpoListView):
paginate_by = 10
model = Company

@ -74,7 +74,7 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
blank=True, null=True, related_name='exposition_users')
photogallery = models.ForeignKey('photologue.Gallery', blank=True, null=True)
logo = models.ImageField(verbose_name='Logo', upload_to='exposition/logo/', blank=True)
rating = models.IntegerField(default=0)
rating = models.IntegerField(default=0) # добавить индекс в базе
quality_label = BitField(flags=['ufi', 'rsva', 'exporating'])
visitors = models.PositiveIntegerField(verbose_name='Посетители', blank=True, null=True)

@ -0,0 +1,25 @@
{% extends 'base_catalog.html' %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<strong>{% trans 'Участники' %}</strong>
</div>
{% endblock %}
{% block page_title %}
<div class="page-title">
<h1>{% trans 'Участники' %}</h1>
</div>
{% endblock %}
{% block content_list %}
{% include 'includes/company/company_list.html' with object_list=object_list %}
{% endblock %}
{% block paginator %}
{% include 'includes/catalog_paginator.html' with page_obj=page_obj %}
{% endblock %}

@ -0,0 +1,28 @@
{% extends 'base_catalog.html' %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="/">{% trans 'Главная страница' %}</a>
<a href="{{ object.catalog }}">{% trans 'Участники' %}</a>
<strong>{{ object.name }}</strong>
</div>
{% endblock %}
{% block page_title %}
{% endblock %}
{% block content_list %}
{% if request.user == object.creator %}
{% include 'client/includes/company/company_edit.html' %}
{% else %}
{% include 'client/includes/company/company_object.html' with company=object %}
{% endif %}
{% endblock %}
{% block paginator %}
{% endblock %}

@ -0,0 +1,581 @@
{% load static %}
{% load i18n %}
{% load template_filters %}
<div class="m-article">
<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="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 %}">
{% if home_form.instance.country and home_form.instance.city %}
<span>
{% else %}
<span style="display:none;">
{% endif %}
<a href="#" id="static-home-country">{{ 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="#" id="static-home-city">{{ home_form.instance.city }}</a>
</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/" method="post">{% csrf_token %}
<div class="e-form">
<div class="ef-body">
<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>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
<a class="ef-close" href="#">закрыть</a>
</div>
</form>
</div>
</div>
<div class="site_link">
<a href="{{ request.user.company.get_permanent_url }}" title="">
{{ request.user.company.get_permanent_url }}
</a>
</div>
<div class="i-title p-editable p-editable">
<span id="static-name-value">{{ name_form.name.value }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">редактировать</a>
<div class="e-form">
<form class="clearfix update-profile-form" id="name_form" action="/company/update/name/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ name_form.name.label }}</label>
<div class="epf-field">
{{ name_form.name }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
</div>
</div>
</div>
</header>
<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 id="static-spec-value">{{ spec_form.specialization.value }}</span>
{% endif %}
<div class="edit-wrap">
{% if spec_form.specialization.value %}
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
{% else %}
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">краткое описание компании <b>+20</b></div>
{% endif %}
<div class="e-form">
<form class="clearfix update-profile-form" id="spec_form" action="/company/update/specialization/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epf-field">
<label>{{ spec_form.specialization.label }}</label>
<div class="epf-field">
{{ spec_form.specialization }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
</div>
</div>
</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="/members/theme-{{ th.url }}">{{ th.name }}</a>{% ifnotequal forloop.counter request.user.company.theme.all|length %},{% endifnotequal %}
{% endfor %}
</div>
<hr />
<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 id="static-address-value">{{ address_form.address_inf.value }}</span>
{% endif %}
<div class="edit-wrap">
{% 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">
<form class="clearfix update-profile-form" id="address_form" action="/company/update/address/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epf-field">
<label>{{ address_form.address_inf.label }}</label>
{{ address_form.address_inf }}
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
</div>
</div>
</div>
<hr />
<div class="add_link_teg">
<div class="tag-select">{{ tag_form.tag }}</div>
<b>+5</b>
</div>
<div class="clear"></div>
<hr />
<div class="i-contacts clearfix">
<div class="ic-buttons ic-buttons_pos dd_width_4">
<a class="button icon-edit icb-edit-profile" href="#">редактировать профиль</a>
<a class="button orange icon-edit icb-exit-edit" href="#">завершить редактирование</a>
<div class="ic-buttons_text">Добавить профили в соц.сетях:</div>
<div class="p-editable add_link_text add_link_text_medium soc-media-indent">
<div class="edit-wrap">
<a class="e-btn" href="#" title="">Добавить</a>
<ul class="soc-media-buttons soc-media-buttons1">
<li>
{% if social_form.facebook.value %}
<a href="{{ social_form.facebook.value }}" target="_blank">
<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" />
{% endif %}
</li>
<li>
{% if social_form.linkedin.value %}
<a href="{{ social_form.linkedin.value }}" target="_blank">
<img id="img-linkedin" src="{% static 'client/img/soc-medias/sm-icon-lin.png' %}" title="LinkedIn" alt="LinkedIn" />
</a>
{% else %}
<img id="img-linkedin" src="{% static 'client/img/soc-medias/icon-lin_hover.png' %}" title="LinkedIn" alt="LinkedIn" />
{% endif %}
<li>
{% if social_form.vk.value %}
<a href="{{ social_form.vk.value }}" target="_blank">
<img id="img-vk" src="{% static 'client/img/soc-medias/sm-icon-vk.png' %}" title="В контакте" alt="В контакте" />
</a>
{% else %}
<img id="img-vk" src="{% static 'client/img/soc-medias/sm-icon-vk_hover.png' %}" title="В контакте" alt="В контакте" />
{% endif %}
</li>
<li>
{% if social_form.twitter.value %}
<a href="{{ social_form.twitter.value }}" target="_blank">
<img id="img-twitter" src="{% static 'client/img/soc-medias/sm-icon-twit.png' %}" title="Twitter" alt="Twitter" />
</a>
{% else %}
<img id="img-twitter" src="{% static 'client/img/soc-medias/sm-icon-twit_hover.png' %}" title="Twitter" alt="Twitter" />
{% endif %}
</li>
</ul>
<div class="add_link_text_text"><b>+5 за каждый</b></div>
<div class="e-form">
<form class="clearfix update-profile-form" id="social_form" action="/company/update/social/" method="post">{% csrf_token %}
<div class="ef-body">
<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">
{{ 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">
{{ 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">
{{ 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 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="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 %}">
{% if phone_form.phone.value %}
<span id="static-phone-value">{{ phone_form.phone.value|phone }}</span>
{% endif %}
<div class="edit-wrap">
{% if phone_form.phone.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">
<form class="clearfix update-profile-form" id="phone_form" action="/company/update/phone/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ phone_form.phone.label }}</label>
<div class="epf-field">
{{ phone_form.phone }}
</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 email_form.email.value %}ic-tel p-editable{% else %}p-editable add_link_text add_link_text_medium{% endif %}">
{% if email_form.email.value %}
<div class="ic-mail add_indent ">
<a id="static-email-value" class="icon-mail" href="mailto:{{ email_form.email.value }}">{{ email_form.email.value }}</a>
</div>
{% endif %}
<div class="edit-wrap">
{% if email_form.email.value %}
<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">
<form class="clearfix update-profile-form" 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 id="static-web-page-value" 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 update-profile-form" id="web_page_form" action="/company/update/web-page/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ web_page_form.web_page.label }}</label>
<div class="epf-field">
{{ web_page_form.web_page }}
</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>
<hr />
<div class="i-additional">
<div class="ia-title">Дополнительная информация</div>
<div class="p-editable {% if found_form.foundation.value %}ic-tel ic-links {% else %}add_link_text add_link_text_medium{% endif %}">
<p id="static-found-value" style="{% if found_form.foundation.value == '' or found_form.foundation.value == None %}display:none;{% endif %}">Год основания: <span>{{ found_form.foundation.value }}</span></p>
<div class="edit-wrap">
<a class="e-btn" href="#" >{% trans 'редактировать' %}</a>
<div id="static-foundation" style="{% if found_form.foundation.value %} display:none;{% endif %}">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">год основания <b>+15</b></div>
</div>
<div class="e-form">
<form class="clearfix update-profile-form" id="found_form" action="/company/update/foundation/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ found_form.foundation.label }}</label>
<div class="epf-field">
{{ found_form.foundation }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
</div>
</div>
</div>
<div class="p-editable {% if staff_form.staff_number.value %}ic-tel ic-links {% else %}add_link_text add_link_text_medium{% endif %}">
<p id="static-staff_number-value" style="{% if staff_form.staff_number.value == '' or staff_form.staff_number.value == None %}display:none;{% endif %}">к-во сотрудников: <span id="static-staff-value">{{ staff_form.staff_number.value }}</span></p>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div id="static-staff_number" style="{% if staff_form.staff_number.value %} display:none;{% endif %}">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">к-во сотрудников <b>+15</b></div>
</div>
<div class="e-form">
<form class="clearfix update-profile-form" id="staff_form" action="/company/update/staff/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ staff_form.staff_number.label }}</label>
<div class="epf-field">
{{ staff_form.staff_number }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
</div>
</div>
</div>
<div class="p-editable {% if description_form.description.value %}ic-tel {% else %}add_link_text add_link_text_medium{% endif %}">
<span id="static-description-value" style="{% if description_form.description.value == '' or description_form.description.value == None %}display:none;{% endif %}">{{ description_form.description.value }}</span>
<div class="edit-wrap">
<a class="e-btn" href="#">{% trans 'редактировать' %}</a>
<div id="static-description" style="{% if description_form.description.value %} display:none;{% endif %}">
<a class="e-btn" href="#" title="">Добавить</a>
<div class="add_link_text_text">подробное описание компании<b>+15</b></div>
</div>
<div class="e-form">
<form class="clearfix update-profile-form" id="description_form" action="/company/update/description/" method="post">{% csrf_token %}
<div class="ef-body">
<div class="epfl">
<label>{{ description_form.description.label }}</label>
<div class="epf-field">
{{ description_form.description }}
</div>
</div>
</div>
<div class="ef-buttons">
<button type="submit" class="lnk icon-save">Сохранить</button>
</div>
</form>
<a class="ef-close" href="#">закрыть</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% 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 %}
<!-- mask select scripts-->
<script src="{% static 'client/js/plugins/inputmask/jquery.inputmask.js' %}"></script>
<script src="{% static 'client/js/plugins/inputmask/jquery.bind-first-0.2.3.min.js' %}"></script>
<script src="{% static 'client/js/plugins/inputmask/jquery.inputmask-multi.js' %}"></script>
<!-- page module-->
<script src="{% static 'client/js' %}{% if debug %}/{% else %}_min/{% endif %}_modules/page.company{% if debug %}{% else %}.min{% endif %}.js"></script>
<script>
//js module initialization
EXPO.company.init({
// class selector to identify required forms on page
updateFormClass:'update-profile-form',
// text and paths for dynamically rendered selectboxes
selectBox:[
{id:'id_country'},
{id:'id_city',
placeHolder:'Search city',
path:'http://{{ request.get_host }}/city/get-city/'
},
{id:'id_tag',
placeholder:'Выберите ключевые теги',
path:'http://{{ request.get_host }}/theme/get-tag/'
}
],
// we need this id to enable mapping library
phoneBox: 'id_phone',
// some helper text in current language
lang:{
workIn:'в'// there must be 'at' in English
}
});
</script>
{% endblock %}

@ -6,7 +6,7 @@
{% for company in object_list %}
<li class="cl-item">
<div class="cl-item-wrap clearfix">
<a href="/{{ filter|generate_url }}/member-{{ company.url }}">
<a href="{{ company.get_permanent_url }}">
<div class="cli-pict">
{% with obj=company %}
{% include 'client/includes/show_logo.html' %}
@ -16,7 +16,7 @@
<div class="cli-info">
<div class="cli-top clearfix">
<header>
<div class="cli-title"><a href="/{{ filter|generate_url }}/member-{{ company.url }}">{{ company.name|safe }}</a></div>
<div class="cli-title"><a href="{{ company.get_permanent_url }}">{{ company.name|safe }}</a></div>
</header>
<div class="cli-bot clearfix">
<div class="cli-area">
@ -37,7 +37,7 @@
</div>
<div class="cli-buttons clearfix">
<div class="cli-m-buttons">
<a class="button icon-info" href="/{{ filter|generate_url }}/member-{{ company.url }}">{% trans 'информация' %}</a>
<a class="button icon-info" href="{{ company.get_permanent_url }}">{% trans 'информация' %}</a>
{% if company.get_events %}
<a class="button blue icon-list" href="/expositions/member-{{ company.url }}">{% trans 'события' %} ({{ company.get_events_number }})</a>
{% endif %}
@ -54,9 +54,7 @@
</div>
<footer class="clearfix">
<div class="cli-tags">
{% with obj=company filter=filter %}
{% include 'includes/show_tags.html' %}
{% endwith %}
{% include 'client/includes/exposition/tags.html' with obj=company %}
</div>
</footer>
</li>

Loading…
Cancel
Save