Merge branch 'develop' into 'master'

Develop

See merge request skillbox/go.skillbox.ru!65
remotes/origin/pm_task_31703
Zolotarev Alexander 8 years ago
commit 4d29e18037
  1. 1
      lms/urls.py
  2. 42
      lms/views.py
  3. 5
      templates/index_menu.html
  4. 145
      templates/price.html

@ -9,7 +9,6 @@ from access.views import profile_view
urlpatterns = [
url(r'^$', views.index),
url(r'^price/$', views.price),
url(r'^oferta/', views.show_oferta),
url(r'^test/$', views.test),
url(r'^all_comments/$', views.all_comments),

@ -31,48 +31,6 @@ def access_error(request):
return {}
@response_decor(template='price.html', without_auth=True)
def price(request):
if request.user.is_authenticated() and request.user.in_role in ['M', 'S']:
return {'redirect': '/access/profile'}
journals = []
for course in Course.objects.all() if request.user.is_authenticated() and request.user.is_admin else Course.objects.filter(public=True):
do = True
if course.hidden:
if not request.user.is_authenticated():
do = False
else:
if not request.user.is_admin:
try:
Bill.objects.get(service__course=course, user=request.user, status='F')
except Bill.DoesNotExist:
do = False
if do:
journal, created = TeacherJ.objects.get_or_create(course=course, student=user_fabric(request.user))
if not journal.full and Bill.objects.filter(user=user_fabric(request.user), service__course=course, status='F').exists():
if not journal.start_date:
journal.start_date = datetime.datetime.now()
journal.save()
check_journal(journal)
journals.append(journal.get_head_face())
with open(STATIC_ROOT+'/prices.csv', mode='r') as infile:
reader = csv.reader(infile)
prices = {}
for rows in reader:
prices[int(rows[0])] = rows[1]
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
return {'courses': journals,
'prices': prices,
'directions': ({'count': i.count(), 'title': i.title, 'color': i.color} for i in MaterialDirection.objects.all() if i.count() != 0),
'bought': Bill.objects.filter(user=request.user, status='F').exists() if request.user.is_authenticated() else False}
@response_decor(template='index.html', without_auth=True)
def index(request):
if request.user.is_authenticated() and request.user.in_role in ['M', 'S']:

@ -122,11 +122,6 @@
<span><i class="glyphicon glyphicon-tree-deciduous" style="margin-right: 10px;"></i>Контакты</span>
</a>
</li>
{% if request.user.is_anonymous %}
<li style="width: 200px;">
<a href="/price/" class="btn" role="button">Цены</a>
</li>
{% endif %}
<li style="width: 200px;">
<a href="{{ DOMAIN }}/management/faq" style="background: #ebebeb;" class="btn" role="button">Помощь</a>
</li>

@ -1,145 +0,0 @@
{% extends 'base_index.html' %}
{% load static %}
{% block page_title %}Доступные курсы «{{ NAME }}»{% endblock %}
{% block title %}Доступные курсы «{{ NAME }}»{% endblock %}
{% block head %}
<script>
window.by = true;
$(document).on('change', '[name="by_radio"]', function(){
if (window.by){
$('.no_bought').fadeIn('slow');
window.by = false;
} else {
$('.no_bought').fadeOut('slow');
window.by = true;
}
});
</script>
{% if bought %}
<style>
.no_bought{
display: none;
}
</style>
{% endif %}
{% endblock %}
{% block content %}
<div class="col">
<div class="wrapper-md">
{% if bought %}
<div style=" font-size: 12px;
color: #666;
position: fixed;
right: 250px;
top: 10px;
z-index: 10000;" class="hidden-xs">
<span>Все курсы</span>
<label class="i-switch bg-success" style="top: 5px;
position: relative; margin: 0 5px;">
<input type="checkbox" checked="" name="by_radio">
<i></i>
</label><span>Мои курсы</span>
</div>
<div style=" font-size: 12px;
color: #fff;
position: absolute;
right: 100px;
top: 10px;
z-index: 13000;" class="visible-xs">
<span class="hidden-xs">Все курсы</span>
<label class="i-switch bg-success" style="top: 5px;
position: relative; margin: 0 5px;">
<input type="checkbox" checked="" name="by_radio">
<i></i>
</label><span class="hidden-xs">Мои курсы</span>
</div>
{% endif %}
{% for i in courses %}
<div class="col-lg-4 {% if i.by %}bought{% else %}no_bought{% endif %}">
{% comment %}
<a {% if i.by_flow or i.by_flow == None %}href="/courses/{{ i.slug }}"{% else %}class="flow" href="#" data-toggle="modal" data-target="#flowAccess"{% endif %}>
{% endcomment %}
<a href="/courses/{{ i.slug }}">
<div class="panel b-a course_cart " style="overflow: hidden;">
<div class="panel-heading no-border index" style="background: {{ i.level.background }};color:{{ i.level.color }};">
<span class="text-lt ">{{ i.level.title }}</span>
</div>
<div class="item m-l-n-xxs m-r-n-xxs" style="height: 290px;">
<div style="width: 100%;height: 195px;background:url({{ i.img }}) no-repeat top right;background-size: cover;"></div>
<div class="bottom wrapper bg-gd-dk text-white" style="width: 100%;padding: 0;">
<div style="color: #fff;margin-bottom: 10px;margin-left: 10px;">
{% for skill in i.skills %}
<span class="label font-normal text-white" style="background: {{ skill.color }}">{% if skill.mini_icon %}<img src="{{ skill.mini_icon.url }}" style="margin-top: -1px;width: 10px;
height: 10px;
margin-right: 5px;">{% endif %}{{ skill }}</span>
{% endfor %}
</div>
<div style="background: #fff;padding: 15px;">
<div class="text-u-c h4 m-b-none" style="text-align: left;color: #666;">{{ i.title }}</div>
<p style="color: #999;border-bottom: 1px solid #f1f1f1;margin: 5px 0 10px;padding-bottom: 10px;">{{ i.lessons }} урока(-ов)</p>
<div style="margin: 5px 5px 0;">
{{ i.material.get_html_direction|safe }}
{% if i.progress == 100 %}
<span style=" font-weight: bold;
float: right;
color: green;"><i class="glyphicon glyphicon-ok" style="margin-right: 5px;"></i> Пройдено</span>
{% endif %}
{% if i.progress != 0 and i.progress < 100 %}
<span style=" font-weight: bold;
float: right;
color: #999;"> Пройдено: {{ courses }}%</span>
<div class="chart" data-percent="{{ i.progress }}" data-scale-color="#000" style="float: right;margin-right: 5px;">
</div>
{% endif %}
{% if not bought %}
<span style=" font-weight: bold;
float: right;
color: #999;"> Стоимость курса: {{ prices|get_item:i.material.id }}₽</span>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</a>
</div>
{% endfor %}
</div>
</div>
{% include 'right_site.html' %}
<!--
<div class="panel-body">
<div class="m-b m-t text-md" style="margin-top: 0;">Новости Школы</div>
<div id="news_block"></div>
</div>
-->
<!-- aside right -->
<!-- / aside right -->
{% endblock %}
{% block js %}
<script>
$(function() {
$('.chart').easyPieChart({
rotate: 0,
lineWidth: 10,
trackColor: 'rgb(222, 229, 231)',
barColor: 'rgb(96, 179, 111)',
size: 20,
lineCap: 'butt',
animate: 3000,
scaleLength: 0
});
});
</script>
{% endblock %}
Loading…
Cancel
Save