Compare commits
62 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
8f793fbe0e | 8 years ago |
|
|
02ec71ec28 | 8 years ago |
|
|
420a87e0a7 | 8 years ago |
|
|
3b246b66bd | 9 years ago |
|
|
366689ec2f | 9 years ago |
|
|
8041f376e0 | 9 years ago |
|
|
a2137fe6c6 | 9 years ago |
|
|
4e9d4b4445 | 9 years ago |
|
|
0deabbb46f | 9 years ago |
|
|
c355dc36e8 | 9 years ago |
|
|
ed0ca7e52b | 9 years ago |
|
|
4d2b13de5b | 9 years ago |
|
|
9891430937 | 9 years ago |
|
|
10517ac6a1 | 9 years ago |
|
|
c86f7f7eb9 | 9 years ago |
|
|
15fba79609 | 9 years ago |
|
|
ac43147966 | 9 years ago |
|
|
e4338cc035 | 9 years ago |
|
|
3738b36f1c | 9 years ago |
|
|
e9fb64a2ef | 9 years ago |
|
|
2765bb99ab | 9 years ago |
|
|
2cbb968a63 | 9 years ago |
|
|
c9f8e6f203 | 9 years ago |
|
|
e8c5998521 | 9 years ago |
|
|
d04e74d97b | 9 years ago |
|
|
805a4bc25f | 9 years ago |
|
|
cbc2f82559 | 9 years ago |
|
|
8477af64ac | 9 years ago |
|
|
b51bd32c89 | 9 years ago |
|
|
a3950bed10 | 9 years ago |
|
|
b66554d07d | 9 years ago |
|
|
93efe3243b | 9 years ago |
|
|
8a8b6defa9 | 9 years ago |
|
|
0a363e7af3 | 9 years ago |
|
|
4828da6fa1 | 9 years ago |
|
|
c4a501d153 | 9 years ago |
|
|
39929d8f4d | 9 years ago |
|
|
d2a294c243 | 9 years ago |
|
|
3cd90b8d0c | 9 years ago |
|
|
01414a171d | 9 years ago |
|
|
c3143027c5 | 9 years ago |
|
|
e99f3b011e | 9 years ago |
|
|
5b96377da4 | 9 years ago |
|
|
f5bc1754e7 | 9 years ago |
|
|
55a598f734 | 9 years ago |
|
|
c0679891d4 | 9 years ago |
|
|
7afee48c21 | 9 years ago |
|
|
35f5a6b7e0 | 9 years ago |
|
|
5ca9e32c2c | 9 years ago |
|
|
3824c26670 | 9 years ago |
|
|
b905640121 | 9 years ago |
|
|
347a5bea8d | 9 years ago |
|
|
b94c2357f9 | 9 years ago |
|
|
9b3e54a490 | 9 years ago |
|
|
b8e2ccfe26 | 9 years ago |
|
|
ab1887a16e | 9 years ago |
|
|
d7462c1b62 | 9 years ago |
|
|
f2c7c9e9c3 | 9 years ago |
|
|
e70ec89296 | 9 years ago |
|
|
886233168f | 9 years ago |
|
|
e39fd5808b | 9 years ago |
|
|
ef8b0514b0 | 9 years ago |
@ -0,0 +1,4 @@ |
||||
data |
||||
media |
||||
collected_static |
||||
node_modules |
||||
@ -0,0 +1,12 @@ |
||||
FROM expomap/django |
||||
|
||||
ENV PYTHONUNBUFFERED 1 |
||||
ENV LANG ru_RU.UTF-8 |
||||
|
||||
RUN mkdir /code |
||||
WORKDIR /code |
||||
|
||||
ADD manage.py /code/ |
||||
ADD templates /code/templates |
||||
ADD proj /code/proj |
||||
ADD apps /code/apps |
||||
@ -0,0 +1,36 @@ |
||||
FROM python:2.7.13 |
||||
|
||||
ENV PYTHONUNBUFFERED 1 |
||||
ENV LANG ru_RU.UTF-8 |
||||
|
||||
ADD ./requirements.txt / |
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \ |
||||
&& apt-get update \ |
||||
\ |
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
||||
\ |
||||
build-essential \ |
||||
libtiff5-dev \ |
||||
libjpeg62-turbo-dev \ |
||||
zlib1g-dev \ |
||||
libfreetype6-dev \ |
||||
liblcms2-dev \ |
||||
libwebp-dev \ |
||||
tcl8.5-dev \ |
||||
tk8.5-dev \ |
||||
python-tk \ |
||||
pngquant \ |
||||
gifsicle \ |
||||
libmemcached-dev \ |
||||
locales \ |
||||
uwsgi \ |
||||
\ |
||||
&& rm -rf /var/lib/apt/lists/* \ |
||||
\ |
||||
&& sed -i -e 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen \ |
||||
&& echo 'LANG="ru_RU.UTF-8"'>/etc/default/locale \ |
||||
&& dpkg-reconfigure --frontend=noninteractive locales \ |
||||
&& update-locale LANG=ru_RU.UTF-8 \ |
||||
&& pip install -r requirements.txt |
||||
|
||||
@ -0,0 +1,4 @@ |
||||
FROM nginx |
||||
|
||||
ADD ./static /expomap/app/static |
||||
|
||||
@ -0,0 +1,149 @@ |
||||
FROM ubuntu:12.04.5 |
||||
|
||||
# defines root user, to perform privileged operations |
||||
USER root |
||||
|
||||
# enable apt mirrors (best performance due to use the closest repository) |
||||
RUN readonly APT_SOURCES="/etc/apt/sources.list" \ |
||||
&& readonly UBUNTU_RELEASE_NAME="$(cat /etc/lsb-release | grep CODENAME | cut -d '=' -f2)" \ |
||||
&& sed --in-place \ |
||||
--regexp-extended \ |
||||
--expression \ |
||||
"1s/^/deb mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt "${UBUNTU_RELEASE_NAME}"-security main restricted universe multiverse\n\n/" \ |
||||
--expression \ |
||||
"1s/^/deb mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt "${UBUNTU_RELEASE_NAME}"-backports main restricted universe multiverse\n/" \ |
||||
--expression \ |
||||
"1s/^/deb mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt "${UBUNTU_RELEASE_NAME}"-updates main restricted universe multiverse\n/" \ |
||||
--expression \ |
||||
"1s/^/deb mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt "${UBUNTU_RELEASE_NAME}" main restricted universe multiverse\n/" \ |
||||
--expression \ |
||||
"1s/^/\# Enable Ubuntu mirrors and multiverse\n/" \ |
||||
"${APT_SOURCES}" |
||||
|
||||
# upgrade Ubuntu packages, install security updates and required packages |
||||
RUN readonly UBUNTU_PACKAGES=" \ |
||||
curl \ |
||||
" \ |
||||
&& apt-get update \ |
||||
&& apt-get upgrade --assume-yes \ |
||||
&& apt-get install --no-install-recommends \ |
||||
--assume-yes \ |
||||
${UBUNTU_PACKAGES} \ |
||||
# remove apt cache in order to improve Docker image size |
||||
&& apt-get clean |
||||
|
||||
## Solr |
||||
# environment variables |
||||
ENV SOLR_VERSION 3.5.0 |
||||
ENV SOLR_USER solr |
||||
ENV SOLR_UID 8983 |
||||
ENV SOLR_PORT 8983 |
||||
|
||||
# declare required packages |
||||
RUN readonly SOLR_PACKAGES=" \ |
||||
openjdk-6-jre-headless \ |
||||
tomcat6 \ |
||||
" \ |
||||
# install packages |
||||
&& apt-get install \ |
||||
--no-install-recommends \ |
||||
--assume-yes \ |
||||
${SOLR_PACKAGES} \ |
||||
# remove apt cache in order to improve Docker image size |
||||
&& apt-get clean |
||||
|
||||
# create group |
||||
RUN groupadd \ |
||||
--system \ |
||||
--gid ${SOLR_UID} \ |
||||
${SOLR_USER} \ |
||||
# create user and add to group |
||||
&& useradd \ |
||||
--system \ |
||||
--uid ${SOLR_UID} \ |
||||
--gid ${SOLR_USER} \ |
||||
${SOLR_USER} |
||||
|
||||
# create temp folder |
||||
RUN mkdir /tmp/solr \ |
||||
&& cd /tmp/solr \ |
||||
# download Solr |
||||
&& curl \ |
||||
--silent \ |
||||
--show-error \ |
||||
--location \ |
||||
--output apache-solr-${SOLR_VERSION}.tgz \ |
||||
https://archive.apache.org/dist/lucene/solr/${SOLR_VERSION}/apache-solr-${SOLR_VERSION}.tgz \ |
||||
# extract Solr |
||||
&& tar \ |
||||
--extract \ |
||||
--gunzip \ |
||||
--file \ |
||||
apache-solr-${SOLR_VERSION}.tgz \ |
||||
--directory \ |
||||
/opt \ |
||||
# link Solr folder |
||||
&& ln \ |
||||
--symbolic \ |
||||
--force \ |
||||
/opt/apache-solr-${SOLR_VERSION} \ |
||||
/opt/solr \ |
||||
# change permissions |
||||
&& chown \ |
||||
--recursive \ |
||||
${SOLR_USER}:${SOLR_USER} \ |
||||
/opt/apache-solr-${SOLR_VERSION} \ |
||||
&& chown \ |
||||
--recursive \ |
||||
${SOLR_USER}:${SOLR_USER} \ |
||||
/opt/solr \ |
||||
# purge source files |
||||
&& cd / \ |
||||
&& rm \ |
||||
--recursive \ |
||||
--force \ |
||||
/tmp/solr |
||||
|
||||
ADD schema.xml /opt/apache-solr-3.5.0/example/solr/conf/schema.xml |
||||
|
||||
## DUMB-init |
||||
# more information at: https://github.com/Yelp/dumb-init |
||||
|
||||
# environment variables |
||||
ENV DUMB_INIT_VERSION 1.2.0 |
||||
|
||||
# download |
||||
RUN mkdir \ |
||||
--parents \ |
||||
/tmp/dumb-init \ |
||||
&& cd /tmp/dumb-init \ |
||||
&& curl \ |
||||
--silent \ |
||||
--show-error \ |
||||
--location \ |
||||
--remote-name \ |
||||
https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64.deb \ |
||||
# install |
||||
&& dpkg \ |
||||
--install \ |
||||
dumb-init_${DUMB_INIT_VERSION}_amd64.deb \ |
||||
# remove temp folder |
||||
&& cd / \ |
||||
&& rm \ |
||||
--force \ |
||||
--recursive \ |
||||
/tmp/dumb-init |
||||
|
||||
## Docker specifics |
||||
# expose Solr service port |
||||
EXPOSE ${SOLR_PORT} |
||||
|
||||
# drop back to the regular Solr user - good practice |
||||
USER ${SOLR_USER} |
||||
|
||||
# change workdir to Solr folder |
||||
WORKDIR /opt/solr/example |
||||
|
||||
# docker entrypoint/cmd configuration |
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] |
||||
CMD ["java","-Xmx256m","-jar","start.jar"] |
||||
@ -1,97 +0,0 @@ |
||||
# -*- coding: utf-8 -*- |
||||
from functools import update_wrapper, partial |
||||
|
||||
from django.contrib import admin |
||||
from django.contrib.admin.util import unquote |
||||
from django.conf.urls import patterns, url |
||||
from django.core.exceptions import PermissionDenied |
||||
from django.core.urlresolvers import reverse_lazy, reverse |
||||
from django.http import Http404 |
||||
from django.utils.translation import ugettext_lazy as _ |
||||
from django.utils.html import escape |
||||
from django.utils.encoding import force_text |
||||
|
||||
from functions.admin import DefaultAdmin |
||||
from functions.http import JsonResponse |
||||
|
||||
from .models import Comment |
||||
|
||||
|
||||
class CommentAdmin(DefaultAdmin): |
||||
class Media: |
||||
js = ( |
||||
"js/jquery.truncator.js", |
||||
"admin/js/comments_manage.js", |
||||
) |
||||
# css = { |
||||
# 'all': ("admin/css/comments_manage.css",), |
||||
# } |
||||
list_display = ['text', 'ip', 'user', 'hide'] |
||||
list_select_related = True |
||||
list_filter = ('hidden', ) |
||||
date_hierarchy = 'created' |
||||
readonly_fields = ['ip', 'created', 'parent', 'user'] |
||||
fieldsets = ( |
||||
(None, |
||||
{'fields': (('created', 'hidden',), |
||||
'ip', |
||||
'user', |
||||
'text', )}), |
||||
) |
||||
|
||||
def hide(self, obj): |
||||
body = u'<img src="{url}" alt={alt}>' \ |
||||
u' <a class="action" href="{href}">{label}</a>' \ |
||||
u' | <a class="action" href="{href2}">{label2}</a>'\ |
||||
.format(**self.get_yesno_image_data(obj)) |
||||
return body |
||||
hide.short_description = _(u'Модерирование') |
||||
hide.allow_tags = True |
||||
|
||||
def urls(self): |
||||
urlpatterns = self.get_urls() |
||||
def wrap(view): |
||||
def wrapper(*args, **kwargs): |
||||
return self.admin_site.admin_view(view)(*args, **kwargs) |
||||
return update_wrapper(wrapper, view) |
||||
info = self.model._meta.app_label, self.model._meta.module_name |
||||
_urlpatterns = patterns('', |
||||
url(r'^(?P<object_id>\d+)/ajax/(?P<action>hide|show|banro|unbanro)/$', |
||||
wrap(self.ajax_view), |
||||
name='%s_%s_ajax' % info), |
||||
) |
||||
return _urlpatterns + urlpatterns |
||||
urls = property(urls) |
||||
|
||||
def get_yesno_image_data(self, obj): |
||||
return { |
||||
'url': '/static/admin/img/icon-{0}.gif'.format('no' if obj.hidden else 'yes'), |
||||
'alt': str(not obj.hidden), |
||||
'href': reverse('admin:comments_comment_ajax', args=[obj.id, 'hide' if not obj.hidden else 'show']), |
||||
'label': unicode(_(u'Опубликовать') if obj.hidden else _(u'Скрыть')), |
||||
'href2': reverse('admin:comments_comment_ajax', args=[obj.id, 'banro' if not obj.user.readonly else 'unbanro']), |
||||
'label2': unicode(_(u'Снять RO') if obj.user.readonly else _(u'Наложить RO')), |
||||
} |
||||
|
||||
def ajax_view(self, request, object_id, extra_context=None, *args, **kwargs): |
||||
"The 'change' admin view for this model." |
||||
action = kwargs.get('action') |
||||
model = self.model |
||||
opts = model._meta |
||||
obj = self.get_object(request, unquote(object_id)) |
||||
if not self.has_change_permission(request, obj) or not request.is_ajax(): |
||||
raise PermissionDenied |
||||
if obj is None: |
||||
raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_text(opts.verbose_name), 'key': escape(object_id)}) |
||||
|
||||
if action in ['hide', 'show']: |
||||
obj.hidden = True if action == 'hide' else False |
||||
obj.save() |
||||
else: |
||||
obj.user.readonly = True if action == 'banro' else False |
||||
obj.user.save() |
||||
|
||||
return JsonResponse(dict({'success': True}, **self.get_yesno_image_data(obj))) |
||||
ajax_view.csrf_exempt = True |
||||
|
||||
admin.site.register(Comment, CommentAdmin) |
||||
@ -1,22 +0,0 @@ |
||||
# -*- coding: utf-8 -*- |
||||
from django import forms |
||||
from django.utils.translation import ugettext as _ |
||||
|
||||
from functions.forms import EmptySelect |
||||
from .models import Comment |
||||
|
||||
|
||||
class CommentForm(forms.ModelForm): |
||||
class Meta: |
||||
model = Comment |
||||
fields = ['parent', 'text'] |
||||
widgets = dict(parent=EmptySelect) |
||||
|
||||
def save(self, commit=True): |
||||
obj = super(CommentForm, self).save(commit=False) |
||||
return obj |
||||
|
||||
def clean(self): |
||||
if getattr(self._user, 'readonly', True): |
||||
raise forms.ValidationError(_(u'Вы не можете оставлять комментарии. Вам выдано ограничение ReadOnly.')) |
||||
return super(CommentForm, self).clean() |
||||
@ -1,73 +0,0 @@ |
||||
# -*- encoding: utf-8 -*- |
||||
|
||||
version = "0.0.1" |
||||
version_info = (0,0,1) |
||||
""" |
||||
Модуль для поиска нецензурных слов (мата) в тексте |
||||
|
||||
Лицензия: LGPL (http://www.opensource.org/licenses/lgpl-2.1.php) |
||||
|
||||
Пример: |
||||
|
||||
from matfilter import matfilter |
||||
some_data = "любой текст для проверки" |
||||
if len(matfilter(some_data)): |
||||
print "Пожалуйста, уберите из текста нецензурные выражения." |
||||
|
||||
Источник: |
||||
https://bitbucket.org/spanasik/django-matfilter |
||||
""" |
||||
import re |
||||
|
||||
PATTERNS = (ur"(\b[сs]{1}[сsц]{0,1}[uуy](?:[ч4]{0,1}[иаakк][^ц])\w*\b)", |
||||
ur"(\b(?!пло|стра|[тл]и)(\w(?!(у|пло)))*[хx][уy](й|йа|[еeё]|и|я|ли|ю)(?!га)\w*\b)", |
||||
ur"(\b(п[oо]|[нз][аa])*[хx][eе][рp]\w*\b)", |
||||
ur"(\b[мm][уy][дd]([аa][кk]|[oо]|и)\w*\b)", |
||||
ur"(\b\w*д[рp](?:[oо][ч4]|[аa][ч4])(?!л)\w*\b)", |
||||
ur"(\b(?!(?:кило)?[тм]ет)(?!смо)[а-яa-z]*(?<!с)т[рp][аa][хx]\w*\b)", |
||||
ur"(\b[к|k][аaoо][з3z]+[eе]?ё?л\w*\b)", |
||||
ur"(\b(?!со)\w*п[еeё]р[нд](и|иc|ы|у|н|е|ы)\w*\b)", |
||||
ur"(\b\w*[бп][ссз]д\w+\b)", |
||||
ur"(\b([нnп][аa]?[оo]?[xх])\b)", |
||||
ur"(\b([аa]?[оo]?[нnпбз][аa]?[оo]?)?([cс][pр][аa][^зжбсвм])\w*\b)", |
||||
ur"(\b\w*([оo]т|вы|[рp]и|[оo]|и|[уy]){0,1}([пnрp][iиеeё]{0,1}[3zзсcs][дd])\w*\b)", |
||||
ur"(\b(вы)?у?[еeё]?би?ля[дт]?[юоo]?\w*\b)", |
||||
ur"(\b(?!вело|ски|эн)\w*[пpp][eеиi][дd][oaоаеeирp](?![цянгюсмйчв])[рp]?(?![лт])\w*\b)", |
||||
ur"(\b(?!в?[ст]{1,2}еб)(?:(?:в?[сcз3о][тяaа]?[ьъ]?|вы|п[рp][иоo]|[уy]|р[aа][з3z][ьъ]?|к[оo]н[оo])?[её]б[а-яa-z]*)|(?:[а-яa-z]*[^хлрдв][еeё]б)\b)", |
||||
ur"(\b[з3z][аaоo]л[уy]п[аaeеин]\w*\b)",) |
||||
|
||||
|
||||
def CheckMatches(matches): |
||||
if len(matches): |
||||
result = [] |
||||
for match in matches: |
||||
if type(match) == tuple: |
||||
result.append(match[0].strip()) |
||||
else: |
||||
result.append(match.strip()) |
||||
return result |
||||
return () |
||||
|
||||
|
||||
def matfilter(text, npattern=None): |
||||
"""Находит в тексте мат. |
||||
|
||||
Возвращает список найденных слов""" |
||||
text = text.replace("\r\n", " ") |
||||
text = text.replace("\n", " ") |
||||
|
||||
if npattern is not None: |
||||
result = CheckMatches(re.findall( |
||||
PATTERNS[npattern], text, |
||||
re.IGNORECASE | re.VERBOSE | re.UNICODE | re.DOTALL)) |
||||
if len(result): |
||||
return result |
||||
else: |
||||
for pattern in PATTERNS: |
||||
result = CheckMatches(re.findall( |
||||
pattern, text, |
||||
re.IGNORECASE | re.VERBOSE | re.UNICODE | re.DOTALL)) |
||||
if len(result): |
||||
return result |
||||
|
||||
return () |
||||
@ -1,37 +0,0 @@ |
||||
# -*- coding: utf-8 -*- |
||||
from django.db import models |
||||
from django.contrib.contenttypes.models import ContentType |
||||
from django.contrib.contenttypes import generic |
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
from accounts.models import User |
||||
# from core.utils import UCrypto |
||||
|
||||
|
||||
class Comment(models.Model): |
||||
|
||||
class Meta: |
||||
verbose_name = u'Комментарий' |
||||
verbose_name_plural = u'Комментарии' |
||||
get_latest_by = 'created' |
||||
|
||||
ip = models.GenericIPAddressField(_(u'IP address'), unpack_ipv4=True, blank=True, null=True) |
||||
created = models.DateTimeField(_(u'дата создания'), auto_now_add=True) |
||||
hidden = models.BooleanField(_(u'скрыть'), default=False, help_text=_(u'Будет скрыто, если отмечено')) |
||||
|
||||
parent = models.ForeignKey('self', verbose_name=_(u'Родительский комментарий'), null=True, blank=True) |
||||
user = models.ForeignKey(User, verbose_name=_(u'Пользователь')) |
||||
text = models.TextField(_(u'сообщение')) |
||||
|
||||
content_type = models.ForeignKey(ContentType) |
||||
object_id = models.PositiveIntegerField() |
||||
content_object = generic.GenericForeignKey('content_type', 'object_id') |
||||
|
||||
def get_name(self): |
||||
return self.user.get_full_name() |
||||
|
||||
def get_date(self): |
||||
return self.created.strftime('%d %B %Y %H:%M') |
||||
|
||||
def __unicode__(self): |
||||
return self.get_date() |
||||
@ -1,16 +0,0 @@ |
||||
""" |
||||
This file demonstrates writing tests using the unittest module. These will pass |
||||
when you run "manage.py test". |
||||
|
||||
Replace this with more appropriate tests for your application. |
||||
""" |
||||
|
||||
from django.test import TestCase |
||||
|
||||
|
||||
class SimpleTest(TestCase): |
||||
def test_basic_addition(self): |
||||
""" |
||||
Tests that 1 + 1 always equals 2. |
||||
""" |
||||
self.assertEqual(1 + 1, 2) |
||||
@ -1,55 +0,0 @@ |
||||
# -*- coding: utf-8 -*- |
||||
|
||||
from django.views.generic.edit import FormMixin |
||||
|
||||
from functions.http import JsonResponse |
||||
from .forms import CommentForm |
||||
|
||||
|
||||
class CommentMixin(FormMixin): |
||||
form_class = CommentForm |
||||
|
||||
def get_comment_form(self): |
||||
form_class = self.get_form_class() |
||||
form = self.get_form(form_class) |
||||
form._user = self.request.user |
||||
return form |
||||
|
||||
def post(self, request, *args, **kwargs): |
||||
self.commentform = None |
||||
if request.method == 'POST' and request.is_ajax(): |
||||
self.commentform = self.get_comment_form() |
||||
if self.commentform.is_valid(): |
||||
self.object = self.get_object() |
||||
self.save_comment() |
||||
return JsonResponse({'success': True}) |
||||
else: |
||||
return JsonResponse({'success': False, 'errors': self.commentform.errors}) |
||||
return self.get(request, *args, **kwargs) |
||||
|
||||
def save_comment(self): |
||||
comment = self.commentform.save(commit=False) |
||||
comment.user_id = self.request.user.pk |
||||
comment.content_object = self.object |
||||
comment.ip = self.request.META['REMOTE_ADDR'] |
||||
comment.save() |
||||
|
||||
def get_context_data(self, **kwargs): |
||||
context = super(CommentMixin, self).get_context_data(**kwargs) |
||||
self.commentform = self.get_comment_form() |
||||
if self.request.method == 'POST' and self.commentform.is_valid(): |
||||
self.save_comment() |
||||
context['commentform'] = self.commentform |
||||
_comments = list(self.object.comments.filter(hidden=False)) |
||||
comments = {x.pk: x for x in filter(lambda x: x.parent is None, _comments)} |
||||
for comment in filter(lambda x: x.parent is not None, _comments): |
||||
try: |
||||
p = comments[comment.parent_id] |
||||
if hasattr(p, 'childs'): |
||||
p.childs.append(comment) |
||||
else: |
||||
p.childs = [comment] |
||||
except IndexError: |
||||
pass |
||||
context['comments'] = comments.values() |
||||
return context |
||||
@ -1,13 +0,0 @@ |
||||
from django.db import models |
||||
from django.contrib.contenttypes.models import ContentType |
||||
from django.contrib.contenttypes import generic |
||||
|
||||
|
||||
class Note(models.Model): |
||||
content_type = models.ForeignKey(ContentType, null=True) |
||||
object_id = models.PositiveIntegerField() |
||||
content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") |
||||
user = models.ForeignKey('accounts.User') |
||||
text = models.TextField(verbose_name='Note') |
||||
|
||||
|
||||
@ -1,16 +0,0 @@ |
||||
""" |
||||
This file demonstrates writing tests using the unittest module. These will pass |
||||
when you run "manage.py test". |
||||
|
||||
Replace this with more appropriate tests for your application. |
||||
""" |
||||
|
||||
from django.test import TestCase |
||||
|
||||
|
||||
class SimpleTest(TestCase): |
||||
def test_basic_addition(self): |
||||
""" |
||||
Tests that 1 + 1 always equals 2. |
||||
""" |
||||
self.assertEqual(1 + 1, 2) |
||||
@ -1 +0,0 @@ |
||||
# Create your views here. |
||||
|
After Width: | Height: | Size: 507 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
@ -1,78 +1,27 @@ |
||||
var EXPO = EXPO || {}; //isolated namespace
|
||||
EXPO.exposition = EXPO.exposition || {}; |
||||
if (EXPO.exposition.list){ |
||||
console.warn('WARNING: EXPO.place.object is already defined!'); |
||||
console.warn('WARNING: EXPO.place.object is already defined!'); |
||||
}else { |
||||
|
||||
EXPO.exposition.list = (function () { |
||||
EXPO.exposition.list = (function () { |
||||
// dependencies
|
||||
var com = EXPO.common; |
||||
var com = EXPO.common; |
||||
|
||||
// variables
|
||||
var that = {}, |
||||
Note = function (it, opt) { |
||||
this.opt = opt; |
||||
this.DOMthis = it; |
||||
this.DOMbutton = it.querySelector('.'+opt.buttonClass); |
||||
this.DOMinput = it.querySelector('.'+opt.inputClass); |
||||
this.inputName = this.DOMinput.getAttribute('name'); |
||||
this.url = this.DOMbutton.getAttribute('href'); |
||||
this._controller(); |
||||
}; |
||||
Note.prototype = { |
||||
_init: function () { |
||||
|
||||
}, |
||||
_controller: function () { |
||||
var self = this; |
||||
$(this.DOMinput).on('blur', function () { |
||||
self.send(); |
||||
}); |
||||
$(this.DOMbutton).on('click', function () { |
||||
return false; |
||||
}); |
||||
}, |
||||
send: function () { |
||||
var data = {}, |
||||
response, |
||||
self = this, |
||||
handler = function (data) { |
||||
if (data.success) { |
||||
console.log('ok'); |
||||
$(self.DOMbutton).addClass('active'); |
||||
} else { |
||||
console.log('data not send'); |
||||
} |
||||
|
||||
}; |
||||
data[this.inputName] = this.DOMinput.value; |
||||
response = com.getRequest(data,this.url,handler); |
||||
} |
||||
}; |
||||
|
||||
that.opt = {}; //свойства по умолчанию
|
||||
var that = {}; |
||||
that.opt = {}; //свойства по умолчанию
|
||||
//private
|
||||
$(function () { |
||||
}); |
||||
$(function () { |
||||
}); |
||||
|
||||
// methods
|
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
$.extend(this.opt, options); |
||||
this.notes = []; |
||||
var self = this; |
||||
|
||||
$('.'+this.opt.note.wrapClass).each(function () { |
||||
var note = new Note(this,self.opt.note); |
||||
self.notes.push(note); |
||||
}); |
||||
$('.'+this.opt.note.wrapDisabledClass).on('click', function () { |
||||
$.fancybox.open('#pw-login'); |
||||
return false; |
||||
}); |
||||
com.opt.addCalendarText = this.opt.addCalendarText; |
||||
com.opt.removeCalendarText = this.opt.removeCalendarText; |
||||
}; |
||||
return that; |
||||
}()); |
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
$.extend(this.opt, options); |
||||
com.opt.addCalendarText = this.opt.addCalendarText; |
||||
com.opt.removeCalendarText = this.opt.removeCalendarText; |
||||
}; |
||||
return that; |
||||
}()); |
||||
} |
||||
|
||||
@ -1,202 +1,157 @@ |
||||
var EXPO = EXPO || {}; //isolated namespace
|
||||
EXPO.exposition = EXPO.exposition || {}; |
||||
if (EXPO.exposition.object){ |
||||
console.warn('WARNING: EXPO.exposition.object is already defined!'); |
||||
console.warn('WARNING: EXPO.exposition.object is already defined!'); |
||||
}else { |
||||
|
||||
EXPO.exposition.object = (function () { |
||||
EXPO.exposition.object = (function () { |
||||
// dependencies
|
||||
var com = EXPO.common, |
||||
$waiter; |
||||
var com = EXPO.common, |
||||
$waiter; |
||||
// variables
|
||||
var that = {}, |
||||
Note = function (it, opt) { |
||||
this.opt = opt; |
||||
this.DOMthis = it; |
||||
this.DOMbutton = it.querySelector('.'+opt.buttonClass); |
||||
this.DOMinput = it.querySelector('.'+opt.inputClass); |
||||
this.inputName = this.DOMinput.getAttribute('name'); |
||||
this.url = this.DOMbutton.getAttribute('href'); |
||||
this._controller(); |
||||
}; |
||||
Note.prototype = { |
||||
_init: function () { |
||||
|
||||
}, |
||||
_controller: function () { |
||||
var self = this; |
||||
$(this.DOMinput).on('blur', function () { |
||||
self.send(); |
||||
}); |
||||
$(this.DOMbutton).on('click', function () { |
||||
return false; |
||||
}); |
||||
}, |
||||
send: function () { |
||||
var data = {}, |
||||
response, |
||||
self = this, |
||||
handler = function (data) { |
||||
if (data.success){ |
||||
console.log('ok'); |
||||
$(self.DOMbutton).addClass('active'); |
||||
}else{ |
||||
console.log('data not send'); |
||||
} |
||||
|
||||
}; |
||||
data[this.inputName] = this.DOMinput.value; |
||||
response = com.getRequest(data,this.url,handler); |
||||
} |
||||
}; |
||||
that.opt = {}; //свойства по умолчанию
|
||||
|
||||
var that = {}; |
||||
that.opt = {}; //свойства по умолчанию
|
||||
//private
|
||||
$(function () { |
||||
$waiter = $('#wait-ajax:not(.absolute)').css({'z-index': '8031'}); |
||||
}); |
||||
$(function () { |
||||
$waiter = $('#wait-ajax:not(.absolute)').css({'z-index': '8031'}); |
||||
}); |
||||
|
||||
// methods
|
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
$.extend(this.opt, options); |
||||
var self = this, |
||||
$visitButtons = $('.'+this.opt.visit.activeClass+', .'+this.opt.visit.passiveClass); |
||||
this.notes = []; |
||||
|
||||
$('.'+this.opt.note.wrapClass).each(function () { |
||||
var note = new Note(this,self.opt.note); |
||||
self.notes.push(note); |
||||
}); |
||||
$('.'+this.opt.note.wrapDisabledClass).on('click', function () { |
||||
$.fancybox.open('#pw-login'); |
||||
return false; |
||||
}); |
||||
com.opt.addCalendarText = this.opt.addCalendarText; |
||||
com.opt.removeCalendarText = this.opt.removeCalendarText; |
||||
/** |
||||
* visit buttons |
||||
*/ |
||||
$visitButtons.off('click'); |
||||
$visitButtons.on('click', function () { |
||||
if ($(this).hasClass(self.opt.visit.activeClass)){ |
||||
|
||||
/** |
||||
* I plan to visit |
||||
*/ |
||||
$('.'+self.opt.visit.activeClass).hide().siblings('.'+self.opt.visit.passiveClass).show(); |
||||
|
||||
$('#'+self.opt.visit.visitorsListId).append(self.opt.visit.currentHtml); |
||||
$('#'+self.opt.visit.somebodyId).removeClass("hidden"); |
||||
$('#'+self.opt.visit.nobodyId).addClass("hidden"); |
||||
|
||||
|
||||
}else{ |
||||
/** |
||||
* refuse to visit |
||||
*/ |
||||
$('.'+self.opt.visit.passiveClass).hide().siblings('.'+self.opt.visit.activeClass).show(); |
||||
$('#'+self.opt.visit.visitorsListId).children(".current").remove(); |
||||
|
||||
if($('#'+self.opt.visit.visitorsListId).children().length == 0){ |
||||
|
||||
$('#'+self.opt.visit.somebodyId).addClass("hidden"); |
||||
$('#'+self.opt.visit.nobodyId).removeClass("hidden"); |
||||
} |
||||
|
||||
} |
||||
return false; |
||||
}); |
||||
/** |
||||
* advertise form validation |
||||
*/ |
||||
$('#'+this.opt.advertise.id).on("submit", function () { |
||||
var formData = $(this).serialize(), |
||||
formUrl = $(this).attr("action"), |
||||
$form = $(this), |
||||
/** |
||||
* executes after AJAX get request is complete |
||||
* @param data - data recieved from server ex
|
||||
*/ |
||||
handler = function (data) { |
||||
var clearValue = function () { |
||||
$('.err',$form).removeClass("err"); |
||||
$('.pwf-msg',$form).text(''); |
||||
}; |
||||
if (data.success != true){ |
||||
clearValue(); |
||||
for (var k in data.errors){ |
||||
if (data.errors.hasOwnProperty(k)) { |
||||
$('input[name="'+k+'"]',$form) |
||||
.closest(".required").addClass("err") |
||||
.siblings(".pwf-msg").text(data.errors[k]); |
||||
} |
||||
} |
||||
|
||||
}else{ |
||||
clearValue(); |
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
$.extend(this.opt, options); |
||||
var self = this, |
||||
$visitButtons = $('.'+this.opt.visit.activeClass+', .'+this.opt.visit.passiveClass); |
||||
|
||||
com.opt.addCalendarText = this.opt.addCalendarText; |
||||
com.opt.removeCalendarText = this.opt.removeCalendarText; |
||||
/** |
||||
* visit buttons |
||||
*/ |
||||
$visitButtons.off('click'); |
||||
$visitButtons.on('click', function () { |
||||
if (!$(this).hasClass('no_auth')) { |
||||
if ($(this).hasClass(self.opt.visit.activeClass)) { |
||||
|
||||
/** |
||||
* I plan to visit |
||||
*/ |
||||
$('.' + self.opt.visit.activeClass).hide().siblings('.' + self.opt.visit.passiveClass).show(); |
||||
|
||||
$('#' + self.opt.visit.visitorsListId).append(self.opt.visit.currentHtml); |
||||
$('#' + self.opt.visit.somebodyId).removeClass("hidden"); |
||||
$('#' + self.opt.visit.nobodyId).addClass("hidden"); |
||||
|
||||
|
||||
} else { |
||||
/** |
||||
* refuse to visit |
||||
*/ |
||||
$('.' + self.opt.visit.passiveClass).hide().siblings('.' + self.opt.visit.activeClass).show(); |
||||
$('#' + self.opt.visit.visitorsListId).children(".current").remove(); |
||||
|
||||
if ($('#' + self.opt.visit.visitorsListId).children().length == 0) { |
||||
|
||||
$('#' + self.opt.visit.somebodyId).addClass("hidden"); |
||||
$('#' + self.opt.visit.nobodyId).removeClass("hidden"); |
||||
} |
||||
|
||||
} |
||||
} |
||||
return false; |
||||
}); |
||||
/** |
||||
* advertise form validation |
||||
*/ |
||||
$('#'+this.opt.advertise.id).on("submit", function () { |
||||
var formData = $(this).serialize(), |
||||
formUrl = $(this).attr("action"), |
||||
$form = $(this), |
||||
/** |
||||
* executes after AJAX get request is complete |
||||
* @param data - data recieved from server ex |
||||
*/ |
||||
handler = function (data) { |
||||
var clearValue = function () { |
||||
$('.err',$form).removeClass("err"); |
||||
$('.pwf-msg',$form).text(''); |
||||
}; |
||||
|
||||
if (data.success !== true){ |
||||
clearValue(); |
||||
for (var k in data.errors){ |
||||
if (data.errors.hasOwnProperty(k)) { |
||||
$('input[name="'+k+'"]',$form) |
||||
.closest(".required").addClass("err") |
||||
.siblings(".pwf-msg").text(data.errors[k]); |
||||
} |
||||
} |
||||
|
||||
}else{ |
||||
clearValue(); |
||||
dataLayer.push({'event': 'advmemberform'}); |
||||
$('input:text',$form).val(''); |
||||
$.fancybox.close(); |
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
/** |
||||
* event news subscribe form validation |
||||
*/ |
||||
$('#'+this.opt.event_news_subscribe.id).on("submit", function () { |
||||
var formData = $(this).serialize(), |
||||
formUrl = $(this).attr("action"), |
||||
$form = $(this), |
||||
/** |
||||
* executes after AJAX get request is complete |
||||
* @param data - data recieved from server ex |
||||
*/ |
||||
handler = function (data) { |
||||
var clearValue = function () { |
||||
$('.err',$form).removeClass("err"); |
||||
$('.pwf-msg',$form).text(''); |
||||
}; |
||||
if (data.success != true){ |
||||
clearValue(); |
||||
for (var k in data.errors){ |
||||
console.log(data.errors.hasOwnProperty(k)); |
||||
console.log(k); |
||||
if (data.errors.hasOwnProperty(k)) { |
||||
$('input[name="'+k+'"]',$form) |
||||
.closest(".required").addClass("err") |
||||
.siblings(".pwf-msg").text(data.errors[k]); |
||||
} |
||||
} |
||||
|
||||
}else{ |
||||
clearValue(); |
||||
dataLayer.push({'event': 'event-news-subscribe-form'}); |
||||
$('input:text',$form).val(''); |
||||
$('p#success').show(); |
||||
if (data.sent == true) { |
||||
window.location = data.redirect_url; |
||||
} else { |
||||
window.setTimeout(function () { |
||||
$.fancybox.close(); |
||||
}, 1000); |
||||
} |
||||
|
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
}; |
||||
return that; |
||||
}()); |
||||
$('input:text',$form).val(''); |
||||
$.fancybox.close(); |
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
/** |
||||
* event news subscribe form validation |
||||
*/ |
||||
$(function () { |
||||
$('#'+self.opt.event_news_subscribe.id).on("submit", function () { |
||||
var formData = $(this).serialize(), |
||||
formUrl = $(this).attr("action"), |
||||
$form = $(this), |
||||
/** |
||||
* executes after AJAX get request is complete |
||||
* @param data - data recieved from server ex |
||||
*/ |
||||
handler = function (data) { |
||||
var clearValue = function () { |
||||
$('.err',$form).removeClass("err"); |
||||
$('.pwf-msg',$form).text(''); |
||||
}; |
||||
if (data.success != true){ |
||||
clearValue(); |
||||
for (var k in data.errors){ |
||||
if (data.errors.hasOwnProperty(k)) { |
||||
$('input[name="'+k+'"]',$form) |
||||
.closest(".required").addClass("err") |
||||
.siblings(".pwf-msg").text(data.errors[k]); |
||||
} |
||||
} |
||||
|
||||
} else { |
||||
clearValue(); |
||||
dataLayer.push({'event': 'event-news-subscribe-form'}); |
||||
$('input:text',$form).val(''); |
||||
$('p#success').show(); |
||||
if (data.sent == true) { |
||||
window.location = data.redirect_url; |
||||
} else { |
||||
window.setTimeout(function () { |
||||
$.fancybox.close(); |
||||
}, 1000); |
||||
} |
||||
|
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
}); |
||||
}; |
||||
return that; |
||||
}()); |
||||
} |
||||
|
||||
@ -1,74 +0,0 @@ |
||||
var EXPO = EXPO || {}; //isolated namespace
|
||||
if (EXPO.index) { |
||||
console.warn('WARNING: EXPO.eventsFeed is already defined!'); |
||||
} else { |
||||
EXPO.index = (function () { |
||||
// variables
|
||||
var that = {}; |
||||
|
||||
//default module setting
|
||||
that.opt = {}; |
||||
//dependence's
|
||||
var com = EXPO.common; |
||||
//private
|
||||
var Note = function (it, opt) { |
||||
this.opt = opt; |
||||
this.DOMthis = it; |
||||
this.DOMbutton = it.querySelector('.'+opt.buttonClass); |
||||
this.DOMinput = it.querySelector('.'+opt.inputClass); |
||||
this.inputName = this.DOMinput.getAttribute('name'); |
||||
this.url = this.DOMbutton.getAttribute('href'); |
||||
this._controller(); |
||||
}; |
||||
Note.prototype = { |
||||
_init: function () { |
||||
|
||||
}, |
||||
_controller: function () { |
||||
var self = this; |
||||
$(this.DOMinput).on('blur', function () { |
||||
self.send(); |
||||
}); |
||||
$(this.DOMbutton).on('click', function () { |
||||
return false; |
||||
}); |
||||
}, |
||||
send: function () { |
||||
var data = {}, |
||||
response, |
||||
self = this, |
||||
handler = function (data) { |
||||
if (data.success){ |
||||
console.log('ok'); |
||||
$(self.DOMbutton).addClass('active'); |
||||
}else{ |
||||
console.log('data not send'); |
||||
} |
||||
|
||||
}; |
||||
data[this.inputName] = this.DOMinput.value; |
||||
response = com.getRequest(data,this.url,handler); |
||||
} |
||||
}; |
||||
|
||||
///////////////////////////
|
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
// settings extending
|
||||
$.extend(this.opt, options); |
||||
// begin of initialization
|
||||
var self = this; |
||||
this.notes = []; |
||||
$('.'+this.opt.note.wrapClass).each(function () { |
||||
var note = new Note(this,self.opt.note); |
||||
self.notes.push(note); |
||||
}); |
||||
$('.'+this.opt.note.wrapDisabledClass).on('click', function () { |
||||
$.fancybox.open('#pw-login'); |
||||
return false; |
||||
}); |
||||
|
||||
}; |
||||
return that; |
||||
}()); |
||||
} |
||||
@ -1 +1 @@ |
||||
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.list?console.warn("WARNING: EXPO.place.object is already defined!"):EXPO.exposition.list=function(){var t=EXPO.common,n={},o=function(t,n){this.opt=n,this.DOMthis=t,this.DOMbutton=t.querySelector("."+n.buttonClass),this.DOMinput=t.querySelector("."+n.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return o.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var n,o={},i=this,e=function(t){t.success?(console.log("ok"),$(i.DOMbutton).addClass("active")):console.log("data not send")};o[this.inputName]=this.DOMinput.value,n=t.getRequest(o,this.url,e)}},n.opt={},$(function(){}),n.init=function(n){$.extend(this.opt,n),this.notes=[];var i=this;$("."+this.opt.note.wrapClass).each(function(){var t=new o(this,i.opt.note);i.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText},n}(); |
||||
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.list?console.warn("WARNING: EXPO.place.object is already defined!"):EXPO.exposition.list=function(){var t=EXPO.common,e={};return e.opt={},$(function(){}),e.init=function(e){$.extend(this.opt,e),t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText},e}(); |
||||
@ -1 +1 @@ |
||||
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.object?console.warn("WARNING: EXPO.exposition.object is already defined!"):EXPO.exposition.object=function(){var t,s=EXPO.common,i={},e=function(t,s){this.opt=s,this.DOMthis=t,this.DOMbutton=t.querySelector("."+s.buttonClass),this.DOMinput=t.querySelector("."+s.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return e.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var t,i={},e=this,o=function(t){t.success?(console.log("ok"),$(e.DOMbutton).addClass("active")):console.log("data not send")};i[this.inputName]=this.DOMinput.value,t=s.getRequest(i,this.url,o)}},i.opt={},$(function(){t=$("#wait-ajax:not(.absolute)").css({"z-index":"8031"})}),i.init=function(i){$.extend(this.opt,i);var o=this,n=$("."+this.opt.visit.activeClass+", ."+this.opt.visit.passiveClass);this.notes=[],$("."+this.opt.note.wrapClass).each(function(){var t=new e(this,o.opt.note);o.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),s.opt.addCalendarText=this.opt.addCalendarText,s.opt.removeCalendarText=this.opt.removeCalendarText,n.off("click"),n.on("click",function(){return $(this).hasClass(o.opt.visit.activeClass)?($("."+o.opt.visit.activeClass).hide().siblings("."+o.opt.visit.passiveClass).show(),$("#"+o.opt.visit.visitorsListId).append(o.opt.visit.currentHtml),$("#"+o.opt.visit.somebodyId).removeClass("hidden"),$("#"+o.opt.visit.nobodyId).addClass("hidden")):($("."+o.opt.visit.passiveClass).hide().siblings("."+o.opt.visit.activeClass).show(),$("#"+o.opt.visit.visitorsListId).children(".current").remove(),0==$("#"+o.opt.visit.visitorsListId).children().length&&($("#"+o.opt.visit.somebodyId).addClass("hidden"),$("#"+o.opt.visit.nobodyId).removeClass("hidden"))),!1}),$("#"+this.opt.advertise.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),n=function(s){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=s.success){i();for(var e in s.errors)s.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(s.errors[e])}else i(),dataLayer.push({event:"advmemberform"}),$("input:text",o).val(""),$.fancybox.close();t.hide()};return t.show(),s.postRequest(i,e,n),!1}),$("#"+this.opt.event_news_subscribe.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),n=function(s){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=s.success){i();for(var e in s.errors)console.log(s.errors.hasOwnProperty(e)),console.log(e),s.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(s.errors[e])}else i(),dataLayer.push({event:"event-news-subscribe-form"}),$("input:text",o).val(""),$("p#success").show(),1==s.sent?window.location=s.redirect_url:window.setTimeout(function(){$.fancybox.close()},1e3);t.hide()};return t.show(),s.postRequest(i,e,n),!1})},i}(); |
||||
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.object?console.warn("WARNING: EXPO.exposition.object is already defined!"):EXPO.exposition.object=function(){var s,t=EXPO.common,i={};return i.opt={},$(function(){s=$("#wait-ajax:not(.absolute)").css({"z-index":"8031"})}),i.init=function(i){$.extend(this.opt,i);var e=this,o=$("."+this.opt.visit.activeClass+", ."+this.opt.visit.passiveClass);t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText,o.off("click"),o.on("click",function(){return $(this).hasClass("no_auth")||($(this).hasClass(e.opt.visit.activeClass)?($("."+e.opt.visit.activeClass).hide().siblings("."+e.opt.visit.passiveClass).show(),$("#"+e.opt.visit.visitorsListId).append(e.opt.visit.currentHtml),$("#"+e.opt.visit.somebodyId).removeClass("hidden"),$("#"+e.opt.visit.nobodyId).addClass("hidden")):($("."+e.opt.visit.passiveClass).hide().siblings("."+e.opt.visit.activeClass).show(),$("#"+e.opt.visit.visitorsListId).children(".current").remove(),0==$("#"+e.opt.visit.visitorsListId).children().length&&($("#"+e.opt.visit.somebodyId).addClass("hidden"),$("#"+e.opt.visit.nobodyId).removeClass("hidden")))),!1}),$("#"+this.opt.advertise.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),r=function(t){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(t.success!==!0){i();for(var e in t.errors)t.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(t.errors[e])}else i(),dataLayer.push({event:"advmemberform"}),$("input:text",o).val(""),$.fancybox.close();s.hide()};return s.show(),t.postRequest(i,e,r),!1}),$(function(){$("#"+e.opt.event_news_subscribe.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),r=function(t){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=t.success){i();for(var e in t.errors)t.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(t.errors[e])}else i(),dataLayer.push({event:"event-news-subscribe-form"}),$("input:text",o).val(""),$("p#success").show(),1==t.sent?window.location=t.redirect_url:window.setTimeout(function(){$.fancybox.close()},1e3);s.hide()};return s.show(),t.postRequest(i,e,r),!1})})},i}(); |
||||
@ -1 +0,0 @@ |
||||
var EXPO=EXPO||{};EXPO.index?console.warn("WARNING: EXPO.eventsFeed is already defined!"):EXPO.index=function(){var t={};t.opt={};var n=EXPO.common,i=function(t,n){this.opt=n,this.DOMthis=t,this.DOMbutton=t.querySelector("."+n.buttonClass),this.DOMinput=t.querySelector("."+n.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return i.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var t,i={},o=this,e=function(t){t.success?(console.log("ok"),$(o.DOMbutton).addClass("active")):console.log("data not send")};i[this.inputName]=this.DOMinput.value,t=n.getRequest(i,this.url,e)}},t.init=function(t){$.extend(this.opt,t);var n=this;this.notes=[],$("."+this.opt.note.wrapClass).each(function(){var t=new i(this,n.opt.note);n.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1})},t}(); |
||||
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |