Commit 04c2e6cf8e46aa1f4bd04d4fe8790a3bf7ad6f55
Exists in
master
and in
5 other branches
resolve conflits
Showing
21 changed files
with
416 additions
and
128 deletions
Show diff stats
app/templates/app/base.html
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | {% block menu_top %} |
6 | 6 | <ul class="nav navbar-nav"> |
7 | 7 | <li class="active"> |
8 | - <a href="#">Home</a> | |
8 | + <a href="{% url 'home' %}">Home</a> | |
9 | 9 | </li> |
10 | 10 | <li><a href="#contact">{% trans 'The Project' %}</a></li> |
11 | 11 | <li><a href="#contact">{% trans 'CCTE Group' %}</a></li> | ... | ... |
app/templates/home.html
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | <li> <a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
88 | 88 | <li> <a href="#">{% trans 'Pending Tasks' %}</a></li> |
89 | 89 | {% if user|has_role:'student' and not user.is_staff %} |
90 | - <li> <a href="#">{% trans 'My courses' %}</a></li> | |
90 | + <li> <a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> | |
91 | 91 | {% endif %} |
92 | 92 | {% if user|has_role:'system_admin' %} |
93 | 93 | <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> | ... | ... |
app/templates/home_student.html
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | <div class="panel-body"> |
24 | 24 | <ul class="nav nav-pills nav-stacked"> |
25 | 25 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
26 | - <li><a href="javascript:void(0)">{% trans 'My Courses' %}</a></li> | |
26 | + <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> | |
27 | 27 | <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li> |
28 | 28 | </ul> |
29 | 29 | </div> | ... | ... |
app/views.py
... | ... | @@ -43,8 +43,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): |
43 | 43 | else: |
44 | 44 | self.template_name = "home_teacher_student_content.html" |
45 | 45 | |
46 | - | |
47 | - super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="/register") | |
46 | + | |
48 | 47 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) |
49 | 48 | |
50 | 49 | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-09-16 04:26 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('core', '0008_resource_link'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.RenameField( | |
16 | + model_name='resource', | |
17 | + old_name='link', | |
18 | + new_name='url', | |
19 | + ), | |
20 | + ] | ... | ... |
core/models.py
... | ... | @@ -34,7 +34,7 @@ class Resource(models.Model): |
34 | 34 | |
35 | 35 | name = models.CharField(_('Name'), max_length =100, unique=True) |
36 | 36 | created_date = models.DateField(_('Created Date'), auto_now_add=True) |
37 | - link = models.CharField(_('URL'), max_length =100, default="") | |
37 | + url = models.CharField(_('URL'), max_length =100, default="") | |
38 | 38 | |
39 | 39 | |
40 | 40 | class Meta: | ... | ... |
core/static/css/base/amadeus.css
... | ... | @@ -250,3 +250,10 @@ li.alert_li:hover{background-color:#eee} |
250 | 250 | .turn_off_alert{float:right;margin-bottom :1px} |
251 | 251 | a.alert_message{color : grey} |
252 | 252 | a.alert_message:hover{color : grey} |
253 | + | |
254 | +/*=================== Ailson - Please Don't touch*/ | |
255 | +.breadcrumb .divider{ | |
256 | + display: none; | |
257 | +} | |
258 | + | |
259 | + | ... | ... |
core/templates/base.html
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | <span class="icon-bar"></span> |
49 | 49 | <span class="icon-bar"></span> |
50 | 50 | </button> |
51 | - <a class="navbar-brand" href="javascript:void(0)"><img class="logo" src="{% static 'img/topo-amadeus.png' %}" alt="Logo"/></a> | |
51 | + <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus.png' %}" alt="Logo"/></a> | |
52 | 52 | </div> |
53 | 53 | <div class="navbar-collapse collapse navbar-responsive-collapse"> |
54 | 54 | <ul class="nav navbar-nav navbar-right notifications"> | ... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-09-16 04:26 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.conf import settings | |
6 | +from django.db import migrations, models | |
7 | +import django.db.models.deletion | |
8 | + | |
9 | + | |
10 | +class Migration(migrations.Migration): | |
11 | + | |
12 | + dependencies = [ | |
13 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | + ('core', '0009_auto_20160916_0126'), | |
15 | + ('courses', '0012_course_students'), | |
16 | + ] | |
17 | + | |
18 | + operations = [ | |
19 | + migrations.CreateModel( | |
20 | + name='Activity', | |
21 | + fields=[ | |
22 | + ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | |
23 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
24 | + ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), | |
25 | + ('grade', models.IntegerField(verbose_name='grade')), | |
26 | + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='student')), | |
27 | + ], | |
28 | + bases=('core.resource',), | |
29 | + ), | |
30 | + migrations.CreateModel( | |
31 | + name='Link', | |
32 | + fields=[ | |
33 | + ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | |
34 | + ('url_field', models.CharField(max_length=300, verbose_name='url')), | |
35 | + ], | |
36 | + bases=('core.resource',), | |
37 | + ), | |
38 | + migrations.AddField( | |
39 | + model_name='topic', | |
40 | + name='visible', | |
41 | + field=models.BooleanField(default=False, verbose_name='Visible'), | |
42 | + ), | |
43 | + migrations.AddField( | |
44 | + model_name='activity', | |
45 | + name='topic', | |
46 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic', to='courses.Topic', verbose_name='Topic'), | |
47 | + ), | |
48 | + ] | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-09-16 05:55 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('courses', '0013_auto_20160916_0001'), | |
12 | + ('courses', '0013_auto_20160916_0126'), | |
13 | + ] | |
14 | + | |
15 | + operations = [ | |
16 | + ] | ... | ... |
courses/models.py
... | ... | @@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _ |
2 | 2 | from django.db import models |
3 | 3 | from autoslug.fields import AutoSlugField |
4 | 4 | from users.models import User |
5 | +from core.models import Resource | |
5 | 6 | |
6 | 7 | class Category(models.Model): |
7 | 8 | |
... | ... | @@ -72,6 +73,7 @@ class Topic(models.Model): |
72 | 73 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
73 | 74 | subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") |
74 | 75 | owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics") |
76 | + visible = models.BooleanField(_('Visible'), default=False) | |
75 | 77 | |
76 | 78 | class Meta: |
77 | 79 | ordering = ('create_date','name') |
... | ... | @@ -80,3 +82,21 @@ class Topic(models.Model): |
80 | 82 | |
81 | 83 | def __str__(self): |
82 | 84 | return self.name |
85 | + | |
86 | +""" | |
87 | +It is one kind of possible resources available inside a Topic. | |
88 | +Activity is something that has a deadline and has to be delivered by the student | |
89 | +""" | |
90 | +class Activity(Resource): | |
91 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | |
92 | + topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name="topic") | |
93 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | |
94 | + limit_date = models.DateTimeField(_('Deliver Date')) | |
95 | + student = models.ForeignKey(User, verbose_name = _('student'), related_name="student") | |
96 | + grade = models.IntegerField(_('grade')) | |
97 | + | |
98 | +""" | |
99 | +It is one kind of possible resources available inside a Topic. | |
100 | +""" | |
101 | +class Link(Resource): | |
102 | + url_field = models.CharField(_('url'), max_length= 300) | |
83 | 103 | \ No newline at end of file | ... | ... |
courses/templates/course/view.html
... | ... | @@ -64,22 +64,24 @@ |
64 | 64 | <div class="panel panel-info"> |
65 | 65 | <div class="panel-heading"> |
66 | 66 | <div class="row"> |
67 | -<div class="col-md-10"> | |
67 | + <a href="{% url 'course:view_subject' subject.slug %}"> | |
68 | + <div class="col-md-10"> | |
68 | 69 | |
69 | - <h3 class="panel-title"><a href="{% url 'course:view_subject' subject.slug %}"></a>{{subject}}</h3> | |
70 | + <h3 class="panel-title">{{subject}}</h3> | |
70 | 71 | |
71 | - </div> | |
72 | - <div class="col-md-2 text-right"> | |
73 | - {% if user|has_role:'professor, system_admin' %} | |
74 | - <a href="{% url 'course:update_subject' subject.slug %}" style="padding: 3px; margin: 3px;" class="btn btn-sm btn-default"> | |
75 | - <span class="glyphicon glyphicon-edit"></span> | |
76 | - </a> | |
77 | - <a href="{% url 'course:delete_subject' subject.slug %}" style="padding: 3px; margin: 3px;" class="btn btn-sm btn-danger"> | |
78 | - <span class="glyphicon glyphicon-trash"></span> | |
79 | - </a> | |
80 | - {% endif %} | |
81 | - </div> | |
82 | -</div> | |
72 | + </div> | |
73 | + </a> | |
74 | + <div class="col-md-2 text-right"> | |
75 | + {% if user|has_role:'professor, system_admin' %} | |
76 | + <a href="{% url 'course:update_subject' subject.slug %}" style="padding: 3px; margin: 3px;" class="btn btn-sm btn-default"> | |
77 | + <span class="glyphicon glyphicon-edit"></span> | |
78 | + </a> | |
79 | + <a href="{% url 'course:delete_subject' subject.slug %}" style="padding: 3px; margin: 3px;" class="btn btn-sm btn-danger"> | |
80 | + <span class="glyphicon glyphicon-trash"></span> | |
81 | + </a> | |
82 | + {% endif %} | |
83 | + </div> | |
84 | + </div> | |
83 | 85 | </div> |
84 | 86 | <div class="panel-body"> |
85 | 87 | <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | ... | ... |
courses/templates/subject/form_view_student.html
1 | 1 | {% load i18n %} |
2 | 2 | |
3 | 3 | <div class="panel panel-default"> |
4 | + <a href="{% url 'course:view_topic' topic.slug %}"> | |
4 | 5 | <div class="panel-heading"> |
5 | 6 | <div class="row"> |
6 | 7 | <div class="col-md-9 col-sm-9"> |
7 | 8 | <h3>{{topic}}</h3> |
8 | 9 | </div> |
9 | 10 | </div> |
11 | + </div> | |
12 | + </a> | |
10 | 13 | </div> |
14 | + | |
11 | 15 | <div class="panel-body"> |
12 | 16 | <p>{{topic.description|linebreaks}}</p> |
13 | 17 | </div> | ... | ... |
courses/templates/subject/form_view_teacher.html
1 | 1 | {% load i18n %} |
2 | 2 | |
3 | 3 | <div class="panel panel-default"> |
4 | + <a href="{% url 'course:view_topic' topic.slug %}"> | |
4 | 5 | <div class="panel-heading"> |
5 | 6 | <div class="row"> |
6 | 7 | <div class="col-md-9 col-sm-9"> |
... | ... | @@ -11,6 +12,7 @@ |
11 | 12 | </div> |
12 | 13 | </div> |
13 | 14 | </div> |
15 | + </a> | |
14 | 16 | <div class="panel-body"> |
15 | 17 | <p>{{topic.description|linebreaks}}</p> |
16 | 18 | </div> | ... | ... |
courses/templates/subject/index.html
... | ... | @@ -7,7 +7,12 @@ |
7 | 7 | <ol class="breadcrumb"> |
8 | 8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> |
9 | 9 | <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li> |
10 | - <li class="active">{% trans 'Manage Subjects' %}</li> | |
10 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
11 | + <li class="active">{% trans 'Manage Subjects' %}</li> | |
12 | + {% else %} | |
13 | + <li class="active">{{ subject.name }}</li> | |
14 | + {% endif %} | |
15 | + | |
11 | 16 | </ol> |
12 | 17 | {% endblock %} |
13 | 18 | |
... | ... | @@ -67,8 +72,10 @@ |
67 | 72 | {% include "subject/form_view_student.html" %} |
68 | 73 | {% endif %} |
69 | 74 | {% endfor %} |
75 | + {% if user|has_role:'system_admin' or topic.owner == user%} | |
76 | + <a name="create_topic" class="btn btn-primary btn-md btn-block" href="{% url 'course:create_topic' subject.slug %}">{% trans "Create Topic" %}</a> | |
77 | + {% endif %} | |
70 | 78 | |
71 | - <a name="create_topic" class="btn btn-primary btn-md btn-block" href="{% url 'course:create_topic' subject.slug %}">{% trans "Create Topic" %}</a> | |
72 | 79 | {% endblock %} |
73 | 80 | |
74 | 81 | {% block rightbar %} | ... | ... |
... | ... | @@ -0,0 +1,89 @@ |
1 | +{% extends 'base.html' %} | |
2 | + | |
3 | +{% load static i18n permission_tags %} | |
4 | + | |
5 | +{% block breadcrumbs %} | |
6 | + | |
7 | + <ol class="breadcrumb"> | |
8 | + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
9 | + <li><a href="{% url 'course:view_subject' subject.slug %}">{{ subject }}</a></li> | |
10 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
11 | + <li class="active">{% trans 'Manage Topic' %}</li> | |
12 | + {% else %} | |
13 | + <li class="active">{{ topic.name }}</li> | |
14 | + {% endif %} | |
15 | + | |
16 | + </ol> | |
17 | +{% endblock %} | |
18 | + | |
19 | +{% block sidebar %} | |
20 | + | |
21 | + <div class="panel panel-primary"> | |
22 | + | |
23 | + <div class="panel-heading"> | |
24 | + <h3 class="panel-title">{{course}}</h3> | |
25 | + </div> | |
26 | + | |
27 | + <div class="panel-body"> | |
28 | + <!--{% for subject in subjects %} | |
29 | + <div class="row"> | |
30 | + <div class="col-md-12 col-sm-12"> | |
31 | + {{subject}} | |
32 | + </div> | |
33 | + </div> | |
34 | + {% endfor %}--> | |
35 | + </div> | |
36 | + </div> | |
37 | + | |
38 | + | |
39 | +{% endblock %} | |
40 | + | |
41 | +{% block content %} | |
42 | + <div class="panel panel-info"> | |
43 | + <div class="panel-heading"> | |
44 | + <div class="row"> | |
45 | + <div class="col-md-7 col-sm-7"> | |
46 | + <h3>{{subject}}</h3> | |
47 | + </div> | |
48 | + <div class="col-md-2 col-sm-2"> | |
49 | + {% if user|has_role:'system_admin' or user in subject.professors %} | |
50 | + <a href="{% url 'course:update_subject' subject.slug%}" class="btn">{% trans "edit" %}</a> | |
51 | + {% endif %} | |
52 | + </div> | |
53 | + <div class="col-md-3 col-sm-3"> | |
54 | + {% if user|has_role:'system_admin' or user in subject.professors %} | |
55 | + <a href="{% url 'course:delete_subject' subject.slug%}" class="btn">{% trans "delete" %}</a> | |
56 | + {% endif %} | |
57 | + </div> | |
58 | + </div> | |
59 | + </div> | |
60 | + <div class="panel-body"> | |
61 | + <p> | |
62 | + {{subject.description|linebreaks}} | |
63 | + </p> | |
64 | + </div> | |
65 | + </div> | |
66 | +<!--{% for topic in topics %} | |
67 | + {% if user|has_role:'system_admin' or topic.owner == user%} | |
68 | + {% include "subject/form_view_teacher.html" %} | |
69 | + {% else %} | |
70 | + {% include "subject/form_view_student.html" %} | |
71 | + {% endif %} | |
72 | +{% endfor %} | |
73 | + {% if user|has_role:'system_admin' or topic.owner == user%} | |
74 | + <a name="create_topic" class="btn btn-primary btn-md btn-block" href="{% url 'course:create_topic' subject.slug %}">{% trans "Create Topic" %}</a> | |
75 | + {% endif %} | |
76 | + | |
77 | +{% endblock %}--> | |
78 | + | |
79 | +{% block rightbar %} | |
80 | + | |
81 | + <div class="panel panel-warning"> | |
82 | + <div class="panel-heading"> | |
83 | + <h3 class="panel-title">{% trans "Pending Stuffs" %}</h3> | |
84 | + </div> | |
85 | + <div class="panel-body"> | |
86 | + | |
87 | + </div> | |
88 | + </div> | |
89 | +{% endblock rightbar %} | ... | ... |
courses/urls.py
... | ... | @@ -15,9 +15,10 @@ urlpatterns = [ |
15 | 15 | url(r'^categories/(?P<slug>[\w_-]+)/$', views.ViewCat.as_view(), name='view_cat'), |
16 | 16 | url(r'^categories/delete/(?P<slug>[\w_-]+)/$', views.DeleteCatView.as_view(), name='delete_cat'), |
17 | 17 | url(r'^subjects/(?P<slug>[\w_-]+)/$', views.SubjectsView.as_view(), name='view_subject'), |
18 | - url(r'^topics/create/(?P<slug>[\w_-]+)/$', views.CreateTopicView.as_view(), name='create_topic'), | |
19 | - url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), | |
20 | 18 | url(r'^subjects/create/(?P<slug>[\w_-]+)/$', views.CreateSubjectView.as_view(), name='create_subject'), |
21 | 19 | url(r'^subjects/update/(?P<slug>[\w_-]+)/$', views.UpdateSubjectView.as_view(), name='update_subject'), |
22 | 20 | url(r'^subjects/delete/(?P<slug>[\w_-]+)/$', views.DeleteSubjectView.as_view(), name='delete_subject'), |
21 | + url(r'^topics/create/(?P<slug>[\w_-]+)/$', views.CreateTopicView.as_view(), name='create_topic'), | |
22 | + url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), | |
23 | + url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic') | |
23 | 24 | ] | ... | ... |
courses/views.py
... | ... | @@ -283,6 +283,29 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): |
283 | 283 | context['topics'] = subject.topics.all() |
284 | 284 | return context |
285 | 285 | |
286 | +class TopicsView(LoginRequiredMixin, generic.ListView): | |
287 | + | |
288 | + login_url = reverse_lazy("core:home") | |
289 | + redirect_field_name = 'next' | |
290 | + template_name = 'topic/index.html' | |
291 | + context_object_name = 'topics' | |
292 | + model = Topic | |
293 | + | |
294 | + def get_queryset(self): | |
295 | + topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) | |
296 | + subject = topic.subject | |
297 | + context = subject.topics.filter(visible=True) | |
298 | + #if (self.request.user in subject.professors.all() or has_role(self.request.user,'system_admin')): | |
299 | + #context = subject.topics.all() <- Change it By Activities | |
300 | + return context | |
301 | + | |
302 | + def get_context_data(self, **kwargs): | |
303 | + topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) | |
304 | + context = super(TopicsView, self).get_context_data(**kwargs) | |
305 | + context['topic'] = topic | |
306 | + context['subject'] = topic.subject | |
307 | + return context | |
308 | + | |
286 | 309 | class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView): |
287 | 310 | |
288 | 311 | allowed_roles = ['professor', 'system_admin'] | ... | ... |
users/templates/list_users.html
1 | -{% extends 'base.html' %} | |
1 | +{% extends 'home.html' %} | |
2 | 2 | |
3 | -{% load i18n pagination %} | |
3 | +{% load i18n pagination django_bootstrap_breadcrumbs %} | |
4 | 4 | |
5 | 5 | {% block breadcrumbs %} |
6 | - <div class="row"> | |
7 | - <div class="col-md-12"> | |
8 | - <ul class="breadcrumb" style="margin-bottom: 5px;"> | |
9 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
10 | - <li class="active">{% trans 'Manage Users' %}</li> | |
11 | - </ul> | |
12 | - </div> | |
13 | - </div> | |
6 | + | |
7 | + {{ block.super }} | |
8 | + {% breadcrumb 'Manage Users' 'users:manage' %} | |
9 | + | |
14 | 10 | {% endblock %} |
15 | 11 | |
16 | 12 | {% block sidebar %} |
... | ... | @@ -52,7 +48,7 @@ |
52 | 48 | <p>{% trans 'Email' %}: {{ acc.email }}</p> |
53 | 49 | <p>{% trans 'Contact' %}: {{ acc.phone }}</p> |
54 | 50 | <div align="right"> |
55 | - <a href="javascript:void(0)" class="btn btn-raised btn-success">{% trans 'Edit' %}</a> | |
51 | + <a href="{% url 'users:update' acc.username %}" class="btn btn-raised btn-success">{% trans 'Edit' %}</a> | |
56 | 52 | <a href="javascript:void(0)" class="btn btn-raised btn-primary">{% trans 'Delete' %}</a> |
57 | 53 | </div> |
58 | 54 | </div> |
... | ... | @@ -68,3 +64,6 @@ |
68 | 64 | </div> |
69 | 65 | {% endif %} |
70 | 66 | {% endblock %} |
67 | + | |
68 | +{% block rightbar %} | |
69 | +{% endblock rightbar %} | ... | ... |
users/templates/users/create.html
1 | -{% extends 'app/base.html' %} | |
1 | +{% extends 'list_users.html' %} | |
2 | 2 | |
3 | 3 | {% load static i18n %} |
4 | 4 | {% load widget_tweaks %} |
5 | 5 | |
6 | +{% load django_bootstrap_breadcrumbs %} | |
7 | + | |
6 | 8 | {% block breadcrumbs %} |
7 | - <ol class="breadcrumb"> | |
8 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
9 | - <li class="active">{% trans 'New User' %}</li> | |
10 | - </ol> | |
11 | -{% endblock %} | |
12 | 9 | |
13 | -{% block sidebar %} | |
14 | - <div class="list-group"> | |
15 | - <a href="{% url 'users:manage' %}" class="list-group-item"> | |
16 | - {% trans 'System Users' %} | |
17 | - </a> | |
18 | - <a href="{% url 'users:create' %}" class="list-group-item active"> | |
19 | - {% trans 'New Account' %} | |
20 | - </a> | |
21 | - <a href="#" class="list-group-item"> | |
22 | - {% trans 'Send Mail' %} | |
23 | - </a> | |
24 | - </div> | |
10 | + {{ block.super }} | |
11 | + {% breadcrumb 'Add User' 'users:create' %} | |
12 | + | |
25 | 13 | {% endblock %} |
26 | 14 | |
15 | + | |
27 | 16 | {% block content %} |
28 | - <div class="alert alert-info alert-dismissible" role="alert"> | |
29 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
30 | - <span aria-hidden="true">×</span> | |
31 | - </button> | |
32 | - <p>{% trans 'All fields are required' %}</p> | |
33 | - </div> | |
17 | + {% if messages %} | |
18 | + {% for message in messages %} | |
19 | + <div class="alert alert-success alert-dismissible" role="alert"> | |
20 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
21 | + <span aria-hidden="true">×</span> | |
22 | + </button> | |
23 | + <p>{{ message }}</p> | |
24 | + </div> | |
25 | + {% endfor %} | |
26 | + {% endif %} | |
34 | 27 | |
35 | - <form method="post" action="" enctype="multipart/form-data"> | |
36 | - {% csrf_token %} | |
37 | - {% for field in form %} | |
38 | - <div class="form-group{% if form.has_error %} has-error {% endif %}"> | |
39 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
40 | - {% render_field field class='form-control input-sm' %} | |
41 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
42 | - {% if field.errors.length > 0 %} | |
43 | - <div class="alert alert-danger alert-dismissible" role="alert"> | |
44 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
45 | - <span aria-hidden="true">×</span> | |
46 | - </button> | |
47 | - <ul> | |
48 | - {% for error in field.errors %} | |
49 | - <li>{{ error }}</li> | |
50 | - {% endfor %} | |
51 | - </ul> | |
28 | + <div class="card"> | |
29 | + <div class="card-content"> | |
30 | + <div class="card-body"> | |
31 | + <form method="post" action="" enctype="multipart/form-data"> | |
32 | + {% csrf_token %} | |
33 | + {% for field in form %} | |
34 | + <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> | |
35 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
36 | + {% if field.auto_id == 'id_birth_date' %} | |
37 | + {% render_field field class='form-control input-sm' type='date' %} | |
38 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
39 | + {% elif field.auto_id == 'id_image' %} | |
40 | + {% render_field field class='form-control input-sm' %} | |
41 | + <div class="input-group"> | |
42 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your photo...' %}"> | |
43 | + <span class="input-group-btn input-group-sm"> | |
44 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
45 | + <i class="material-icons">attach_file</i> | |
46 | + </button> | |
47 | + </span> | |
48 | + </div> | |
49 | + {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | |
50 | + <div class="checkbox"> | |
51 | + <label> | |
52 | + {% render_field field type='checkbox' %} | |
53 | + </label> | |
54 | + </div> | |
55 | + {% else %} | |
56 | + {% render_field field class='form-control input-sm' %} | |
57 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
58 | + {% endif %} | |
59 | + {% if field.errors.length > 0 %} | |
60 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
61 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
62 | + <span aria-hidden="true">×</span> | |
63 | + </button> | |
64 | + <ul> | |
65 | + {% for error in field.errors %} | |
66 | + <li>{{ error }}</li> | |
67 | + {% endfor %} | |
68 | + </ul> | |
69 | + </div> | |
70 | + </div> | |
71 | + {% endif %} | |
72 | + </div> | |
73 | + {% endfor %} | |
74 | + <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> | |
75 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | |
76 | + </div> | |
77 | + <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> | |
78 | + <a href="{% url 'users:manage' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a> | |
52 | 79 | </div> |
53 | - </div> | |
54 | - {% endif %} | |
80 | + </form> | |
55 | 81 | </div> |
56 | - {% endfor %} | |
57 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | |
58 | - </form> | |
82 | + </div> | |
83 | + </div> | |
84 | + | |
59 | 85 | <br clear="all" /> |
60 | 86 | {% endblock %} | ... | ... |
users/templates/users/update.html
1 | -{% extends 'app/base.html' %} | |
1 | +{% extends 'list_users.html' %} | |
2 | 2 | |
3 | 3 | {% load static i18n %} |
4 | 4 | {% load widget_tweaks %} |
5 | 5 | |
6 | +{% load django_bootstrap_breadcrumbs %} | |
7 | + | |
6 | 8 | {% block breadcrumbs %} |
7 | - <ol class="breadcrumb"> | |
8 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
9 | - <li class="active">{% trans 'Edit user' %}</li> | |
10 | - </ol> | |
11 | -{% endblock %} | |
12 | 9 | |
13 | -{% block sidebar %} | |
14 | - <div class="list-group"> | |
15 | - <a href="{% url 'users:manage' %}" class="list-group-item"> | |
16 | - {% trans 'System Users' %} | |
17 | - </a> | |
18 | - <a href="{% url 'users:create' %}" class="list-group-item"> | |
19 | - {% trans 'New Account' %} | |
20 | - </a> | |
21 | - <a href="#" class="list-group-item"> | |
22 | - {% trans 'Send Mail' %} | |
23 | - </a> | |
24 | - </div> | |
10 | + {{ block.super }} | |
11 | + {% breadcrumb 'Update User' 'users:update' %} | |
12 | + | |
25 | 13 | {% endblock %} |
26 | 14 | |
15 | + | |
27 | 16 | {% block content %} |
28 | - <div class="alert alert-info alert-dismissible" role="alert"> | |
29 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
30 | - <span aria-hidden="true">×</span> | |
31 | - </button> | |
32 | - <p>{% trans 'All fields are required' %}</p> | |
33 | - </div> | |
17 | + {% if messages %} | |
18 | + {% for message in messages %} | |
19 | + <div class="alert alert-success alert-dismissible" role="alert"> | |
20 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
21 | + <span aria-hidden="true">×</span> | |
22 | + </button> | |
23 | + <p>{{ message }}</p> | |
24 | + </div> | |
25 | + {% endfor %} | |
26 | + {% endif %} | |
34 | 27 | |
35 | - <form method="post" action="" enctype="multipart/form-data"> | |
36 | - {% csrf_token %} | |
37 | - {% for field in form %} | |
38 | - <div class="form-group{% if form.has_error %} has-error {% endif %}"> | |
39 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
40 | - {% render_field field class='form-control input-sm' %} | |
41 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
42 | - {% if field.errors.length > 0 %} | |
43 | - <div class="alert alert-danger alert-dismissible" role="alert"> | |
44 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
45 | - <span aria-hidden="true">×</span> | |
46 | - </button> | |
47 | - <ul> | |
48 | - {% for error in field.errors %} | |
49 | - <li>{{ error }}</li> | |
50 | - {% endfor %} | |
51 | - </ul> | |
28 | + <div class="card"> | |
29 | + <div class="card-content"> | |
30 | + <div class="card-body"> | |
31 | + <form method="post" action="" enctype="multipart/form-data"> | |
32 | + {% csrf_token %} | |
33 | + {% for field in form %} | |
34 | + <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> | |
35 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
36 | + {% if field.auto_id == 'id_birth_date' %} | |
37 | + {% render_field field class='form-control input-sm' type='date' %} | |
38 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
39 | + {% elif field.auto_id == 'id_image' %} | |
40 | + {% render_field field class='form-control input-sm' %} | |
41 | + <div class="input-group"> | |
42 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your photo...' %}"> | |
43 | + <span class="input-group-btn input-group-sm"> | |
44 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
45 | + <i class="material-icons">attach_file</i> | |
46 | + </button> | |
47 | + </span> | |
48 | + </div> | |
49 | + {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | |
50 | + <div class="checkbox"> | |
51 | + <label> | |
52 | + {% render_field field type='checkbox' %} | |
53 | + </label> | |
54 | + </div> | |
55 | + {% else %} | |
56 | + {% render_field field class='form-control input-sm' %} | |
57 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
58 | + {% endif %} | |
59 | + {% if field.errors.length > 0 %} | |
60 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
61 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
62 | + <span aria-hidden="true">×</span> | |
63 | + </button> | |
64 | + <ul> | |
65 | + {% for error in field.errors %} | |
66 | + <li>{{ error }}</li> | |
67 | + {% endfor %} | |
68 | + </ul> | |
69 | + </div> | |
70 | + </div> | |
71 | + {% endif %} | |
72 | + </div> | |
73 | + {% endfor %} | |
74 | + <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> | |
75 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | |
76 | + </div> | |
77 | + <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> | |
78 | + <a href="{% url 'users:manage' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a> | |
52 | 79 | </div> |
53 | - </div> | |
54 | - {% endif %} | |
80 | + </form> | |
55 | 81 | </div> |
56 | - {% endfor %} | |
57 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | |
58 | - </form> | |
82 | + </div> | |
83 | + </div> | |
59 | 84 | <br clear="all" /> |
60 | 85 | {% endblock %} | ... | ... |