Merge remote-tracking branch 'origin/dev' into dev

remotes/origin/hasaccess
Vitaly Baev 8 years ago
commit 1ae028cf15
  1. 5
      apps/auth/views.py
  2. 9
      apps/course/models.py
  3. 92
      apps/user/templates/user/profile.html
  4. 17
      apps/user/views.py
  5. 29
      project/templates/lilcity/index.html
  6. 2
      project/urls.py
  7. 22
      web/build/css/app.css
  8. 2
      web/build/css/app.css.map
  9. 32
      web/src/sass/_common.sass

@ -11,6 +11,7 @@ from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import FormView, View
from django.views.generic.edit import BaseFormView
from django.shortcuts import redirect
from apps.notification.utils import send_email
from .forms import LearnerRegistrationForm
@ -56,9 +57,9 @@ class LearnerRegistrationView(FormView):
class LogoutView(View):
def post(self, request, *args, **kwargs):
def get(self, request, *args, **kwargs):
logout(request)
return JsonResponse({"success": True})
return redirect('/')
class LoginView(FormView):

@ -18,10 +18,13 @@ class Like(models.Model):
class Course(models.Model):
PENDING = 0
PUBLISHED = 1
ARCHIVED = 2
STATUS_CHOICES = (
(0, 'Pending'),
(1, 'Published'),
(2, 'Archived'),
(PENDING, 'Pending'),
(PUBLISHED, 'Published'),
(ARCHIVED, 'Archived'),
)
author = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
title = models.CharField('Название курса', max_length=100, db_index=True)

@ -0,0 +1,92 @@
{% extends "templates/lilcity/index.html" %} {% load static %} {% block content %}
<div class="section">
<div class="section__center center">
<div class="profile">
<a class="profile__btn profile__btn_edit btn" href="#">Редактировать</a>
{% if user.photo %}
<div class="profile__ava ava">
<img class="ava__pic" src="{{ user.photo.url }}">
</div>
{% else %}
<div class="profile__ava ava">
<img class="ava__pic" src="{% static 'img/user.jpg' %}">
</div>
{% endif %}
<div class="profile__wrap">
<div class="profile__name">{{ user.get_full_name }}</div>
<div class="profile__share share share_sm">
<div class="share__list">
{% if user.facebook %}
<a class="share__item" href="#">
<svg class="icon icon-share-facebook">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-facebook"></use>
</svg>
</a>
{% endif %} {% if user.instagram %}
<a class="share__item" href="#">
<svg class="icon icon-share-instagram">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-instagram"></use>
</svg>
</a>
{% endif %} {% if user.twitter %}
<a class="share__item" href="#">
<svg class="icon icon-share-twitter">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-twitter"></use>
</svg>
</a>
{% endif %} {% if user.google %}
<a class="share__item" href="#">
<svg class="icon icon-share-google">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-google"></use>
</svg>
</a>
{% endif %} {% if user.pinterest %}
<a class="share__item" href="#">
<svg class="icon icon-share-pinterest">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-share-pinterest"></use>
</svg>
</a>
{% endif %}
</div>
</div>
</div>
<div class="profile__content">
{{ user.about }}
</div>
<div class="profile__foot">
<a class="profile__btn btn" href="#">Изменить</a>
</div>
</div>
</div>
</div>
<div class="section section_gray section_tabs">
<div class="section__center center">
<div class="tabs js-tabs">
<div class="tabs__nav">
<button class="tabs__btn js-tabs-btn">ПРИОБРЕТЕННЫЕ
<span class="mobile-hide">КУРСЫ</span>
</button>
<button class="tabs__btn js-tabs-btn active">ОПУБЛИКОВАННЫЕ
<span class="mobile-hide">КУРСЫ</span>
</button>
</div>
<div class="tabs__container">
<div class="tabs__item js-tabs-item">
<div class="courses courses_scroll">
<div class="courses__list">
{% include "course/course_items.html" with course_items=paid %}
</div>
</div>
</div>
<div class="tabs__item js-tabs-item" style="display: block;">
<div class="courses courses_scroll">
<div class="courses__list">
{% include "course/course_items.html" with course_items=published %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

@ -1,3 +1,18 @@
from django.shortcuts import render
from django.views.generic import DetailView
from django.contrib.auth import get_user_model
# Create your views here.
from apps.course.models import Course
User = get_user_model()
class UserView(DetailView):
model = User
template_name = 'user/profile.html'
def get_context_data(self, object):
context = super().get_context_data()
context['published'] = Course.objects.filter(author=self.object, status=Course.PUBLISHED)
context['paid'] = Course.objects.none()
return context

@ -70,8 +70,8 @@
<use xlink:href={% static "img/sprite.svg" %}#icon-close></use>
</svg>
</button>
<form class="header__search search js-search" action=""><input class="search__input js-search-input"
type="text">
<form class="header__search search js-search" action="/search/">
<input name="q" class="search__input js-search-input" type="text">
<button class="search__btn js-search-btn" type="submit">
<svg class="icon icon-search">
<use xlink:href={% static "img/sprite.svg" %}#icon-search></use>
@ -122,11 +122,36 @@
<div class="header__group"><a class="header__section" href="#">БЛОГ</a></div>
</nav>
</div>
{% if user.is_authenticated %}
<div class="header__login">
{% if user.photo %}
<div class="header__ava ava"><img class="ava__pic" src="{{ user.photo.url }}"></div>
{% else %}
<div class="header__ava ava"><img class="ava__pic" src="img/user.jpg"></div>
{% endif %}
<div class="header__drop">
{% comment %} <a class="header__link header__link_border" href="#">234.120.345 руб.</a> {% endcomment %}
<a class="header__link header__link_green" href="#">
<div class="header__title">ДОБАВИТЬ КУРС</div>
</a>
<a class="header__link" href="{% url 'user' user.id %}">
<div class="header__title">ПРОФИЛЬ</div>
</a>
<a class="header__link" href="#">
<div class="header__title">НАСТРОЙКИ</div>
</a>
<a class="header__link" href="{% url 'lilcity:logout' %}">
<div class="header__title">ВЫЙТИ</div>
</a>
</div>
</div>
{% else %}
<button class="header__enter js-header-enter" data-popup=".js-popup-auth">ВХОД
<svg class="icon icon-user">
<use xlink:href={% static "img/sprite.svg" %}#icon-user></use>
</svg>
</button>
{% endif %}
</div>
</div>
</header>

@ -22,6 +22,7 @@ from apps.course.views import (
CoursesView, likes, coursecomment,
CourseView, LessonView, SearchView,
)
from apps.user.views import UserView
urlpatterns = [
path('admin/', admin.site.urls),
@ -32,6 +33,7 @@ urlpatterns = [
path('course/<int:course_id>/comment', coursecomment, name='coursecomment'),
path('lesson/<int:pk>/', LessonView.as_view(), name='lesson'),
path('search/', SearchView.as_view(), name='search'),
path('user/<int:pk>/', UserView.as_view(), name='user'),
path('', TemplateView.as_view(template_name="templates/lilcity/main.html"), name='index'),
]

@ -1119,21 +1119,21 @@ a.grey-link:hover { color: #000; border-bottom: 1px #545454 solid; }
.lock__btn { width: 220px; }
.profile { padding-bottom: 20px; }
.profile { position: relative; padding-bottom: 20px; text-align: center; }
.profile__head { display: -ms-flexbox; display: flex; margin-bottom: 30px; -ms-flex-align: start; align-items: flex-start; }
.profile__btn { padding: 10px 15px; background: transparent; border: 1px solid #A7A7A7; color: #A7A7A7; }
.profile__title { margin: 0 20px 0 0; }
.profile__btn { margin-left: auto; padding: 10px 15px; background: transparent; border: 1px solid #A7A7A7; color: #A7A7A7; }
.profile__btn_edit { position: absolute; top: 0; right: 0; }
.profile__row { display: -ms-flexbox; display: flex; margin-bottom: 25px; -ms-flex-align: center; align-items: center; }
.profile__ava { height: 120px; margin-right: 25px; -ms-flex: 0 0 120px; flex: 0 0 120px; }
.profile__ava { width: 120px; height: 120px; margin: 0 auto 20px; }
.profile__name { margin-bottom: 15px; font-size: 20px; letter-spacing: 3px; text-transform: uppercase; }
.profile__wrap { -ms-flex: 0 0 calc(100% - 145px); flex: 0 0 calc(100% - 145px); }
.profile__share { margin-bottom: 35px; }
.profile__name { margin-bottom: 25px; font-size: 20px; letter-spacing: 3px; text-transform: uppercase; }
.profile__content { max-width: 760px; margin: 0 auto; }
.profile__foot { display: none; margin-top: 30px; text-align: center; }
@ -1861,13 +1861,13 @@ a.grey-link:hover { color: #000; border-bottom: 1px #545454 solid; }
.lock__content { margin-bottom: 40px; }
.profile { padding: 0; text-align: center; }
.profile { padding: 0; }
.profile__head { display: none; }
.profile__btn_edit { display: none; }
.profile__row { display: block; margin-bottom: 30px; }
.profile__ava { width: 140px; height: 140px; margin: 0 auto 20px; }
.profile__ava { width: 140px; height: 140px; }
.profile__name { margin-bottom: 10px; font-family: 'ProximaNova-Bold', serif; font-size: 24px; letter-spacing: 0; text-transform: none; }

File diff suppressed because one or more lines are too long

@ -2618,24 +2618,22 @@ a.grey-link
width: 220px
.profile
position: relative
padding-bottom: 20px
text-align: center
+m
padding: 0
text-align: center
&__head
display: flex
margin-bottom: 30px
align-items: flex-start
+m
display: none
&__title
margin: 0 20px 0 0
&__btn
margin-left: auto
padding: 10px 15px
background: transparent
border: 1px solid $gray
color: $gray
&_edit
position: absolute
top: 0
right: 0
+m
display: none
&__row
display: flex
margin-bottom: 25px
@ -2644,17 +2642,14 @@ a.grey-link
display: block
margin-bottom: 30px
&__ava
width: 120px
height: 120px
margin-right: 25px
flex: 0 0 120px
margin: 0 auto 20px
+m
width: 140px
height: 140px
margin: 0 auto 20px
&__wrap
flex: 0 0 calc(100% - 145px)
&__name
margin-bottom: 25px
margin-bottom: 15px
font-size: 20px
letter-spacing: 3px
text-transform: uppercase
@ -2664,6 +2659,11 @@ a.grey-link
font-size: 24px
letter-spacing: 0
text-transform: none
&__share
margin-bottom: 35px
&__content
max-width: 760px
margin: 0 auto
&__foot
display: none
margin-top: 30px

Loading…
Cancel
Save