Skip to content

Commit

Permalink
add chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Melevir committed Nov 23, 2023
1 parent f7d4771 commit 704e6a6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ run:
cd landing_page; DEBUG=1 python manage.py runserver
shell:
cd landing_page; DEBUG=1 python manage.py shell
migrate:
cd landing_page; DEBUG=1 python manage.py migrate
2 changes: 2 additions & 0 deletions landing_page/landing_page/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'django.contrib.sitemaps',

'memoize',
'waffle',
]

MIDDLEWARE = [
Expand All @@ -33,6 +34,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'waffle.middleware.WaffleMiddleware',
]

ROOT_URLCONF = 'landing_page.urls'
Expand Down
9 changes: 8 additions & 1 deletion landing_page/mainpage/templates/mainpage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,14 @@ <h3 class="text-center d-none d-lg-block">онлайн курс</h3>

{% include 'mainpage/include/index_faq.html' %}

{% if should_show_chat %}
<div
style=" position: fixed; bottom: 30px !important; right: 130px !important; z-index: 10;"
class="elfsight-app-7dcaa723-afe4-4ce3-9a9f-65841d5bd690"
data-elfsight-app-lazy
></div>
{% endif %}
{% include 'mainpage/include/index_footer.html' %}

</main>

{% include 'mainpage/include/index_register_popup.html' with enrollment=enrollment %}
Expand All @@ -291,5 +297,6 @@ <h3 class="text-center d-none d-lg-block">онлайн курс</h3>
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script src="https://static.elfsight.com/platform/platform.js" data-use-service-core defer></script>
</body>
</html>
2 changes: 2 additions & 0 deletions landing_page/mainpage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from waffle import switch_is_active

from .models import CourseReview, Curators, Enrollment, EnrollmentType, GraduateProjects

Expand All @@ -18,6 +19,7 @@ def index(request: HttpRequest) -> HttpResponse:
'curators_list': Curators.objects.filter(is_visible=True),
'today': date.today(),
'reviews': CourseReview.objects.filter(review_for=EnrollmentType.BASE),
'should_show_chat': switch_is_active('show_tg_chat_widget'),
}
return render(request, 'mainpage/index.html', context)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Django==4.2.4
Pillow==10.0.0
requests==2.31.0
django-memoize==2.3.1
django-waffle==4.0.0

0 comments on commit 704e6a6

Please sign in to comment.