Commit f90589bf9ee699dbae2d8fe3bcf14c89f2d5da51
Exists in
master
and in
5 other branches
conflit
Showing
45 changed files
with
933 additions
and
717 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +from django import forms | |
| 2 | +from .models import EmailBackend | |
| 3 | +from django.utils.translation import ugettext_lazy as _ | |
| 4 | + | |
| 5 | +class EmailBackendForm(forms.ModelForm): | |
| 6 | + | |
| 7 | + class Meta: | |
| 8 | + model = EmailBackend | |
| 9 | + fields = ('description', 'host', 'port', 'username', 'password', 'safe_conection', 'default_from_email') | |
| 10 | + help_texts = { | |
| 11 | + 'host': _('A host name. Example: smtp.gmail.com'), | |
| 12 | + 'port': _('A port number'), | |
| 13 | + 'usermane': _('Your host username'), | |
| 14 | + 'password': _('Your host password'), | |
| 15 | + } | |
| 16 | + | |
| 17 | + | |
| 0 | 18 | \ No newline at end of file | ... | ... |
app/models.py
| 1 | 1 | from django.db import models |
| 2 | - | |
| 2 | +from django.utils.translation import ugettext_lazy as _ | |
| 3 | 3 | # Create your models here. |
| 4 | + | |
| 5 | +class EmailBackend(models.Model): | |
| 6 | + | |
| 7 | + SAFE_CONECTIONS = ( | |
| 8 | + (0, _('No')), | |
| 9 | + (1, _('TLS, if available')), | |
| 10 | + (2, 'TLS'), | |
| 11 | + (3, 'SSL'), | |
| 12 | + | |
| 13 | + ) | |
| 14 | + description = models.CharField(_('Description'), max_length=100) | |
| 15 | + host = models.URLField(_('E-mail Host')) | |
| 16 | + port = models.CharField(_('Email Port'), max_length=4, blank=True) | |
| 17 | + username = models.CharField(_('Email host username'), max_length=30) | |
| 18 | + password = models.CharField(_('Email host password'), max_length=30, blank=True) | |
| 19 | + safe_conection = models.IntegerField(_('Use safe conection'), choices=SAFE_CONECTIONS, default=0) | |
| 20 | + default_from_email = models.EmailField(_('Default from email'), blank=True) | |
| 21 | + | |
| 22 | + class Meta: | |
| 23 | + verbose_name = _('Amadeus SMTP setting') | |
| 24 | + verbose_name_plural = _('Amadeus SMTP settings') | |
| 25 | + | |
| 26 | + def __str__(self): | |
| 27 | + return _('Custom email Backend') | ... | ... |
| ... | ... | @@ -0,0 +1,135 @@ |
| 1 | +{% extends "home.html" %} | |
| 2 | + | |
| 3 | +{% load static i18n django_bootstrap_breadcrumbs permission_tags %} | |
| 4 | + | |
| 5 | +{% block breadcrumbs %} | |
| 6 | + {{ block.super }} | |
| 7 | + {% breadcrumb 'Settings' 'app:settings' %} | |
| 8 | +{% endblock %} | |
| 9 | + | |
| 10 | +{% block content %} | |
| 11 | + <!-- Nav tabs --> | |
| 12 | + <ul class="nav nav-tabs md-pills pills-ins" role="tablist"> | |
| 13 | + <li class="nav-item"> | |
| 14 | + <a class="nav-link active" data-toggle="tab" href="#panel1" role="tab"><i class="fa fa-cog"></i> System</a> | |
| 15 | + </li> | |
| 16 | + <li class="nav-item"> | |
| 17 | + <a class="nav-link" data-toggle="tab" href="#panel2" role="tab"><i class="fa fa-envelope"></i> Mail Sender</a> | |
| 18 | + </li> | |
| 19 | + <li class="nav-item"> | |
| 20 | + <a class="nav-link" data-toggle="tab" href="#panel3" role="tab"><i class="fa fa-lock"></i> Security</a> | |
| 21 | + </li> | |
| 22 | + </ul> | |
| 23 | + | |
| 24 | + <!-- Tab panels --> | |
| 25 | + <div class="tab-content"> | |
| 26 | + <!--Panel 1--> | |
| 27 | + <div class="tab-pane fade in active" id="panel1" role="tabpanel"> | |
| 28 | + <div class="panel panel-default"> | |
| 29 | + <div class="panel-body"> | |
| 30 | + <h3><b>General</b></h3> | |
| 31 | + <div class="panel panel-default"> | |
| 32 | + <div class="panel-body"> | |
| 33 | + Content | |
| 34 | + <hr> | |
| 35 | + </div> | |
| 36 | + </div> | |
| 37 | + </div> | |
| 38 | + </div> | |
| 39 | + </div> | |
| 40 | + <!--/.Panel 1--> | |
| 41 | + | |
| 42 | + <!--Panel 2--> | |
| 43 | + <div class="tab-pane fade" id="panel2" role="tabpanel"> | |
| 44 | + <div class="panel panel-default"> | |
| 45 | + <div class="panel-body"> | |
| 46 | + <h3><b>Outgoing Server (SMTP)</b></h3> | |
| 47 | + <div class="panel panel-default"> | |
| 48 | + <div class="panel-body"> | |
| 49 | + <h4><b>Settings</b></b></h4> | |
| 50 | + <hr> | |
| 51 | + <div class="form-group label-floating"> | |
| 52 | + <label class="control-label" for="focusedInput1">Description</label> | |
| 53 | + <input class="form-control" id="focusedInput1" type="text"> | |
| 54 | + </div> | |
| 55 | + <div class="form-group label-floating"> | |
| 56 | + <label class="control-label" for="focusedInput1">Server</label> | |
| 57 | + <input class="form-control" id="focusedInput1" type="text"> | |
| 58 | + </div> | |
| 59 | + <div class="form-group label-floating"> | |
| 60 | + <label for="number" class="col-md_10 control-label">Port</label> | |
| 61 | + <div class="col-md-2"> | |
| 62 | + <input type="number" class="form-control" id="inputNumber"> | |
| 63 | + </div> | |
| 64 | + <div> | |
| 65 | + <label for="number">Deafault:</label> 25 | |
| 66 | + </div> | |
| 67 | + </div> | |
| 68 | + </div> | |
| 69 | + </div> | |
| 70 | + </div> | |
| 71 | + <div class="panel-body"> | |
| 72 | + <div class="panel panel-default"> | |
| 73 | + <div class="panel-body"> | |
| 74 | + <h4><b>Security and Authentication</b></h4> | |
| 75 | + <hr> | |
| 76 | + <div class="form-group label-floating"> | |
| 77 | + <label class="control-label" for="focusedInput1">User Name</label> | |
| 78 | + <input class="form-control" id="focusedInput1" type="text"> | |
| 79 | + </div> | |
| 80 | + <div class="form-group label-floating"> | |
| 81 | + <label class="control-label" for="focusedInput1">Password</label> | |
| 82 | + <input class="form-control" id="focusedInput1" type="password"> | |
| 83 | + </div> | |
| 84 | + <div class="form-group"> | |
| 85 | + <p><b>Use safe contection</b></p> | |
| 86 | + <div class="col-md-10"> | |
| 87 | + <div class="radio radio-primary"> | |
| 88 | + <label> | |
| 89 | + <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1"> | |
| 90 | + No | |
| 91 | + </label> | |
| 92 | + <label> | |
| 93 | + <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2"> | |
| 94 | + TSL, If available | |
| 95 | + </label> | |
| 96 | + <label> | |
| 97 | + <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3"> | |
| 98 | + TSL | |
| 99 | + </label> | |
| 100 | + <label> | |
| 101 | + <input type="radio" name="optionsRadios" id="optionsRadios4" value="option4" checked=""> | |
| 102 | + SSL | |
| 103 | + </label> | |
| 104 | + </div> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | + </div> | |
| 108 | + </div> | |
| 109 | + <button type="button" class="btn btn-success btn-raised">Save changes</button> | |
| 110 | + </div> | |
| 111 | + </div> | |
| 112 | + </div> | |
| 113 | + | |
| 114 | + <!--/.Panel 2--> | |
| 115 | + | |
| 116 | + <!--Panel 3--> | |
| 117 | + <div class="tab-pane fade" id="panel3" role="tabpanel"> | |
| 118 | + <div class="panel panel-default"> | |
| 119 | + <div class="panel-body"> | |
| 120 | + <div class="togglebutton"> | |
| 121 | + <label> | |
| 122 | + <input type="checkbox" checked> <b>Allow users self-enroll.</b> | |
| 123 | + </label> | |
| 124 | + </div> | |
| 125 | + <div class="togglebutton"> | |
| 126 | + <label> | |
| 127 | + <input type="checkbox"> <b>Put the system in maintenance mode.</b> | |
| 128 | + </label> | |
| 129 | + </div> | |
| 130 | + <button type="button" class="btn btn-primary">Save changes</button> | |
| 131 | + </div> | |
| 132 | + </div> | |
| 133 | + </div> | |
| 134 | + </div> | |
| 135 | +{% endblock content %} | |
| 0 | 136 | \ No newline at end of file | ... | ... |
app/templates/home.html
| ... | ... | @@ -5,8 +5,14 @@ |
| 5 | 5 | {% block javascript %} |
| 6 | 6 | {% if page_obj %} |
| 7 | 7 | <script type="text/javascript"> |
| 8 | - var pageNum = {{ page_obj.number }}; // The latest page loaded | |
| 9 | - var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages | |
| 8 | + {% if page_obj and paginator %} | |
| 9 | + var pageNum = {{ page_obj.number }}; // The latest page loaded | |
| 10 | + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages | |
| 11 | + {% else %} | |
| 12 | + var pageNum = 0 ; // The latest page loaded | |
| 13 | + var numberPages = 0 ; // Indicates the number of pages | |
| 14 | + {% endif %} | |
| 15 | + | |
| 10 | 16 | var baseUrl = '{% url "app:index" %}'; |
| 11 | 17 | |
| 12 | 18 | // loadOnScroll handler |
| ... | ... | @@ -79,6 +85,7 @@ |
| 79 | 85 | <li><a href="{% url 'core:guest' %}">{% trans 'Courses' %}</a></li> |
| 80 | 86 | {% if user|has_role:'system_admin' %} |
| 81 | 87 | <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> |
| 88 | + <li> <a href="{% url 'app:settings' %}">{% trans 'Settings' %}</a></li> | |
| 82 | 89 | {% endif %} |
| 83 | 90 | {% if user|has_role:'system_admin' or user|has_role:'professor' %} |
| 84 | 91 | <li> | ... | ... |
app/urls.py
app/views.py
| 1 | 1 | from django.shortcuts import render |
| 2 | 2 | from django.views.generic import ListView |
| 3 | +from django.views import View | |
| 4 | +from rolepermissions.mixins import HasRoleMixin | |
| 3 | 5 | from django.contrib.auth.mixins import LoginRequiredMixin |
| 4 | 6 | from django.core.urlresolvers import reverse_lazy |
| 5 | 7 | from core.mixins import LogMixin, NotificationMixin |
| 6 | 8 | from core.models import Notification, Action, Resource, Action_Resource |
| 7 | 9 | from users.models import User |
| 10 | +from .models import EmailBackend | |
| 11 | +from .forms import EmailBackendForm | |
| 8 | 12 | from courses.models import Course |
| 9 | 13 | |
| 10 | 14 | class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): |
| ... | ... | @@ -42,4 +46,17 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): |
| 42 | 46 | |
| 43 | 47 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) |
| 44 | 48 | |
| 49 | +class AmadeusSettings(LoginRequiredMixin, HasRoleMixin, View): | |
| 50 | + allowed_roles = ['system_admin'] | |
| 51 | + login_url = reverse_lazy("core:home") | |
| 52 | + redirect_field_name = 'next' | |
| 53 | + model = EmailBackend | |
| 54 | + template_name = 'admin_settings.html' | |
| 55 | + form_class = EmailBackendForm | |
| 56 | + success_url = reverse_lazy('app:settings') | |
| 57 | + | |
| 58 | + def get(self, request): | |
| 59 | + return render(request, self.template_name, ) | |
| 60 | + | |
| 61 | + | |
| 45 | 62 | ... | ... |
core/static/css/base/amadeus.css
| ... | ... | @@ -2,6 +2,10 @@ |
| 2 | 2 | clear: both; |
| 3 | 3 | } |
| 4 | 4 | |
| 5 | +.mg-b-5m{ | |
| 6 | + margin-bottom: 5em; | |
| 7 | +} | |
| 8 | + | |
| 5 | 9 | .navbar .logo {position: absolute; top: 6px; text-align: center; height: 48px; width: 48px;} |
| 6 | 10 | |
| 7 | 11 | /* Modal */ |
| ... | ... | @@ -404,6 +408,7 @@ ul, li { |
| 404 | 408 | .dropdown-menu .pull-right { |
| 405 | 409 | right: 0; |
| 406 | 410 | } |
| 411 | + .editation{display: none} | |
| 407 | 412 | .moreAccordion{ padding-left: 0px; padding-right: 0px;} |
| 408 | 413 | .moreAccordion div button{ padding-left: 0px; padding-right: 0px;} |
| 409 | 414 | .cards-content{ padding-left: 0px; padding-right: 0px; } | ... | ... |
core/static/js/base/amadeus.js
| ... | ... | @@ -14,6 +14,7 @@ function campoNumerico(campo, evento){ |
| 14 | 14 | return true; |
| 15 | 15 | } else { |
| 16 | 16 | evento.returnValue = false; |
| 17 | + evento.preventDefault(); | |
| 17 | 18 | return false; |
| 18 | 19 | } |
| 19 | 20 | }; |
| ... | ... | @@ -28,7 +29,7 @@ function formatarCpf(campo, evento){ |
| 28 | 29 | } |
| 29 | 30 | else if( evento ) { // Firefox |
| 30 | 31 | codTecla = evento.which; |
| 31 | - } | |
| 32 | + } | |
| 32 | 33 | tamanho = campo.value.length; |
| 33 | 34 | if( (codTecla > 47 && codTecla < 58) || codTecla== 8 || codTecla == 0){ |
| 34 | 35 | if(tamanho < 14 ){ |
| ... | ... | @@ -41,8 +42,8 @@ function formatarCpf(campo, evento){ |
| 41 | 42 | } |
| 42 | 43 | }else{ |
| 43 | 44 | evento.returnValue = false; |
| 45 | + return false; | |
| 44 | 46 | } |
| 45 | - return true; | |
| 46 | 47 | } else { |
| 47 | 48 | return false; |
| 48 | 49 | } |
| ... | ... | @@ -61,30 +62,28 @@ function formatarTelefone(campo, evento){ |
| 61 | 62 | } |
| 62 | 63 | tamanho = campo.value.length; |
| 63 | 64 | |
| 64 | - if(((codTecla > 47 && codTecla < 58) || (codTecla == 8)) && tamanho < 15){ | |
| 65 | + if(((codTecla > 47 && codTecla < 58) && tamanho < 15)){ | |
| 65 | 66 | |
| 66 | 67 | if(tamanho == 0){ |
| 67 | 68 | campo.value = "(" + campo.value; |
| 68 | 69 | }else if( tamanho == 3 ){ |
| 69 | 70 | campo.value = campo.value + ") "; |
| 70 | - }else if(tamanho == 9){ | |
| 71 | + }else if(tamanho == 10){ | |
| 71 | 72 | campo.value = campo.value + "-"; |
| 72 | - }else if(tamanho == 14){ | |
| 73 | - // alert('oi'); | |
| 74 | - campo.value = campo.value.slice(0, 4) + campo.value.slice(5, 14); | |
| 75 | - campo.value = campo.value.slice(0, 8) + campo.value.slice(9, 10) + campo.value.slice(8, 9) + campo.value.slice(10, 14) | |
| 76 | 73 | } |
| 77 | 74 | return true; |
| 78 | 75 | |
| 76 | + | |
| 79 | 77 | } else if(codTecla == 0 || codTecla == 8){ |
| 80 | 78 | return true; |
| 81 | 79 | } else { |
| 82 | 80 | evento.returnValue = false; |
| 81 | + evento.preventDefault() | |
| 83 | 82 | return false; |
| 84 | 83 | } |
| 84 | + evento.preventDefault() | |
| 85 | 85 | return false; |
| 86 | -} | |
| 87 | - | |
| 86 | +}; | |
| 88 | 87 | /* |
| 89 | 88 | This functions get the next 5 notifications from the user given a "step"(an amount) of previous notifications |
| 90 | 89 | */ | ... | ... |
core/templates/base.html
| ... | ... | @@ -20,21 +20,27 @@ |
| 20 | 20 | |
| 21 | 21 | <!-- Bootstrap and themes (material) --> |
| 22 | 22 | <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}"> |
| 23 | - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}"> | |
| 24 | - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}"> | |
| 23 | + <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.css' %}"> | |
| 24 | + <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.min.css' %}"> | |
| 25 | + <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.css' %}"> | |
| 26 | + <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.min.css' %}"> | |
| 27 | + | |
| 28 | + | |
| 25 | 29 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/bootstrap-datepicker.standalone.css' %}"> |
| 26 | 30 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/alertify.min.css' %}"> |
| 27 | 31 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/themes/bootstrap.css' %}"> |
| 28 | 32 | <script type="text/javascript" src="{% static 'bootstrap-3.3.7/js/bootstrap.js' %}"></script> |
| 29 | 33 | <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script> |
| 30 | - <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script> | |
| 31 | - <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script> | |
| 34 | + <script type="text/javascript" src="{% static 'material/js/material.js' %}"></script> | |
| 35 | + <script type="text/javascript" src="{% static 'material/js/material.min.js' %}"></script> | |
| 36 | + <script type="text/javascript" src="{% static 'material/js/ripples.js' %}"></script> | |
| 37 | + <script type="text/javascript" src="{% static 'material/js/ripples.min.js' %}"></script> | |
| 32 | 38 | <script type="text/javascript" src="{% static 'js/vendor/bootstrap-datepicker.js' %}"></script> |
| 33 | 39 | |
| 34 | 40 | {% with "js/vendor/locales/bootstrap-datepicker."|add:LANGUAGE_CODE|add:".js" as locale_datepicker %} |
| 35 | 41 | <script type="text/javascript" src="{% static locale_datepicker %}"></script> |
| 36 | 42 | {% endwith %} |
| 37 | - | |
| 43 | + | |
| 38 | 44 | <script type="text/javascript" src="{% static 'js/vendor/alertify.min.js' %}"></script> |
| 39 | 45 | <script type="text/javascript" src="{% static 'js/vendor/jscookie.js' %}"></script> |
| 40 | 46 | |
| ... | ... | @@ -140,7 +146,7 @@ |
| 140 | 146 | </ul> |
| 141 | 147 | </div> |
| 142 | 148 | </div> |
| 143 | - | |
| 149 | + | |
| 144 | 150 | {% endif %} |
| 145 | 151 | {% endblock %} |
| 146 | 152 | </div> |
| ... | ... | @@ -158,6 +164,10 @@ |
| 158 | 164 | {% block script_file %} |
| 159 | 165 | |
| 160 | 166 | {% endblock script_file %} |
| 167 | + | |
| 168 | + {% block script_link %} | |
| 169 | + | |
| 170 | + {% endblock script_link %} | |
| 161 | 171 | </body> |
| 162 | 172 | |
| 163 | 173 | </html> | ... | ... |
core/templates/register_user.html
| ... | ... | @@ -6,6 +6,10 @@ |
| 6 | 6 | {% block nav %} |
| 7 | 7 | {% endblock %} |
| 8 | 8 | |
| 9 | +{% block sidebar %} | |
| 10 | + | |
| 11 | +{% endblock sidebar %} | |
| 12 | + | |
| 9 | 13 | |
| 10 | 14 | {% block content %} |
| 11 | 15 | {% if messages %} |
| ... | ... | @@ -19,85 +23,79 @@ |
| 19 | 23 | {% endfor %} |
| 20 | 24 | {% endif %} |
| 21 | 25 | <div class="row"> |
| 22 | - <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 "> | |
| 23 | - <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2"> | |
| 24 | - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus"> | |
| 25 | - </div> | |
| 26 | - </div> | |
| 26 | + <div class="col-lg-offset-4 col-lg-8 col-md-offset-4 col-md-8 col-xs-offset-4 col-xs-8 col-sm-offset-4 col-sm-8"> | |
| 27 | + <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8"> | |
| 28 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus" id="logo"> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 27 | 31 | </div> |
| 28 | 32 | |
| 29 | 33 | <div class="row"> |
| 30 | - <div class="col-md-6 col-md-offset-4 col-sm-6 col-sm-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-3"> | |
| 34 | + <div class="col-lg-8 col-lg-offset-3 col-md-8 col-md-offset-3 col-sm-8 col-sm-offset-3 col-xs-8 col-xs-offset-3"> | |
| 31 | 35 | <div class="card"> |
| 32 | - <div class="card-content"> | |
| 33 | 36 | <div class="card-body"> |
| 34 | - <form class="form-horizontal" name="registerForm" method="post" id="register-user" enctype="multipart/form-data"> | |
| 37 | + <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data"> | |
| 35 | 38 | {% csrf_token %} |
| 36 | - <h2>{% trans 'User Register' %}</h2> | |
| 37 | - <hr> | |
| 38 | - <div class="row"> | |
| 39 | - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> | |
| 40 | - {% for field in form %} | |
| 41 | - <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput block-register-inline"> | |
| 42 | - {% if field.field.required %} | |
| 43 | - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label> | |
| 44 | - {% else %} | |
| 45 | - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label> | |
| 46 | - {% endif %} | |
| 47 | - <div class="col-md-10 col-md-offset-2 col-lg-10 col-lg-offset-2 col-sm-10 | |
| 48 | - col-sm-offset-2 col-xs-10 col-xs-offset-2"> | |
| 49 | - {% if field.auto_id == 'id_birth_date' %} | |
| 50 | - {% render_field field class='form-control input-sm date-picker' %} | |
| 51 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
| 52 | - {% elif field.auto_id == 'id_image' %} | |
| 53 | - {% render_field field class='form-control input-sm' %} | |
| 54 | - <div class="input-group"> | |
| 55 | - <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | |
| 56 | - <span class="input-group-btn input-group-sm"> | |
| 57 | - <button type="button" class="btn btn-fab btn-fab-mini"> | |
| 58 | - <i class="material-icons">attach_file</i> | |
| 59 | - </button> | |
| 60 | - </span> | |
| 61 | - </div> | |
| 62 | - {% elif field.auto_id == 'id_cpf' %} | |
| 63 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | |
| 64 | - | |
| 65 | - {% elif field.auto_id == 'id_phone' %} | |
| 66 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | |
| 67 | - {% else %} | |
| 68 | - {% render_field field class='form-control' %} | |
| 69 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
| 70 | - {% endif %} | |
| 71 | - </div> | |
| 39 | + <legend>{% trans 'User Register' %}</legend> | |
| 40 | + {% for field in form %} | |
| 41 | + <div class="form-group is-empy{% if form.has_error %} has-error {% endif %} is-fileinput"> | |
| 42 | + {% if field.field.required %} | |
| 43 | + <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label> | |
| 44 | + {% else %} | |
| 45 | + <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label> | |
| 46 | + {% endif %} | |
| 47 | + <div class="col-md-8"> | |
| 48 | + {% if field.auto_id == 'id_birth_date' %} | |
| 49 | + {% render_field field class='form-control input-sm date-picker' %} | |
| 50 | + | |
| 51 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
| 52 | + {% elif field.auto_id == 'id_image' %} | |
| 53 | + {% render_field field class='form-control input-sm' %} | |
| 54 | + <div class="input-group"> | |
| 55 | + <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | |
| 56 | + <span class="input-group-btn input-group-sm"> | |
| 57 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
| 58 | + <i class="material-icons">attach_file</i> | |
| 59 | + </button> | |
| 60 | + </span> | |
| 61 | + </div> | |
| 62 | + {% elif field.auto_id == 'id_cpf' %} | |
| 63 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | |
| 72 | 64 | |
| 73 | - {% if field.errors %} | |
| 74 | - <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert"> | |
| 75 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 76 | - <span aria-hidden="true">×</span> | |
| 77 | - </button> | |
| 78 | - <ul> | |
| 79 | - {% for error in field.errors %} | |
| 80 | - <li>{{ error }}</li> | |
| 81 | - {% endfor %} | |
| 82 | - </ul> | |
| 83 | - </div> | |
| 84 | - {% endif %} | |
| 85 | - </div> | |
| 65 | + {% elif field.auto_id == 'id_phone' %} | |
| 66 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | |
| 67 | + {% else %} | |
| 68 | + {% render_field field class='form-control' %} | |
| 69 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
| 70 | + {% endif %} | |
| 71 | + </div> | |
| 72 | + | |
| 73 | + {% if field.errors %} | |
| 74 | + <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert"> | |
| 75 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 76 | + <span aria-hidden="true">×</span> | |
| 77 | + </button> | |
| 78 | + <ul> | |
| 79 | + {% for error in field.errors %} | |
| 80 | + <li>{{ error }}</li> | |
| 86 | 81 | {% endfor %} |
| 87 | - <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 col-lg-offset-1 text-center"> | |
| 88 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-success btn-raised" /> | |
| 89 | - </div> | |
| 90 | - <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 text-center"> | |
| 91 | - <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Cancel' %}</a> | |
| 92 | - </div> | |
| 82 | + </ul> | |
| 93 | 83 | </div> |
| 84 | + {% endif %} | |
| 94 | 85 | </div> |
| 86 | + {% endfor %} | |
| 87 | + <div class="col-md-offset-4 col-md-2 col-sm-2 col-xs-2"> | |
| 88 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | |
| 89 | + </div> | |
| 90 | + <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> | |
| 91 | + <a href="{% url 'core:home' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a> | |
| 92 | + </div> | |
| 93 | + | |
| 95 | 94 | </form> |
| 96 | 95 | </div> |
| 97 | - </div> | |
| 98 | 96 | </div> |
| 99 | 97 | </div> |
| 100 | 98 | </div> |
| 101 | - | |
| 99 | + | |
| 102 | 100 | <br clear="all" /> |
| 103 | 101 | {% endblock %} | ... | ... |
courses/locale/he_il/LC_MESSAGES/django.po
| ... | ... | @@ -1,229 +0,0 @@ |
| 1 | -# SOME DESCRIPTIVE TITLE. | |
| 2 | -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
| 3 | -# This file is distributed under the same license as the PACKAGE package. | |
| 4 | -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
| 5 | -# | |
| 6 | -#, fuzzy | |
| 7 | -msgid "" | |
| 8 | -msgstr "" | |
| 9 | -"Project-Id-Version: PACKAGE VERSION\n" | |
| 10 | -"Report-Msgid-Bugs-To: \n" | |
| 11 | -"POT-Creation-Date: 2016-09-16 02:41-0300\n" | |
| 12 | -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
| 13 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
| 14 | -"Language-Team: LANGUAGE <LL@li.org>\n" | |
| 15 | -"Language: \n" | |
| 16 | -"MIME-Version: 1.0\n" | |
| 17 | -"Content-Type: text/plain; charset=UTF-8\n" | |
| 18 | -"Content-Transfer-Encoding: 8bit\n" | |
| 19 | - | |
| 20 | -#: courses/templates/category/create.html:8 | |
| 21 | -#: courses/templates/category/delete.html:7 | |
| 22 | -#: courses/templates/category/index.html:7 | |
| 23 | -#: courses/templates/category/update.html:8 | |
| 24 | -#: courses/templates/category/view.html:7 | |
| 25 | -#: courses/templates/course/create.html:8 | |
| 26 | -#: courses/templates/course/delete.html:7 courses/templates/course/home.html:8 | |
| 27 | -#: courses/templates/course/update.html:8 | |
| 28 | -#: courses/templates/course/view.html:39 | |
| 29 | -#: courses/templates/subject/index.html:8 | |
| 30 | -msgid "Home" | |
| 31 | -msgstr "" | |
| 32 | - | |
| 33 | -#: courses/templates/category/create.html:9 | |
| 34 | -#: courses/templates/category/delete.html:18 | |
| 35 | -#: courses/templates/category/index.html:18 | |
| 36 | -#: courses/templates/category/view.html:18 | |
| 37 | -msgid "Create Category" | |
| 38 | -msgstr "" | |
| 39 | - | |
| 40 | -#: courses/templates/category/create.html:16 | |
| 41 | -#: courses/templates/category/delete.html:15 | |
| 42 | -#: courses/templates/category/index.html:15 | |
| 43 | -#: courses/templates/category/update.html:16 | |
| 44 | -#: courses/templates/category/view.html:15 | |
| 45 | -msgid "Categories" | |
| 46 | -msgstr "" | |
| 47 | - | |
| 48 | -#: courses/templates/category/create.html:26 | |
| 49 | -#: courses/templates/category/update.html:26 | |
| 50 | -#: courses/templates/course/create.html:26 | |
| 51 | -#: courses/templates/course/update.html:32 | |
| 52 | -msgid "All fields are required" | |
| 53 | -msgstr "" | |
| 54 | - | |
| 55 | -#: courses/templates/category/create.html:51 | |
| 56 | -#: courses/templates/category/update.html:51 | |
| 57 | -#: courses/templates/course/create.html:51 | |
| 58 | -#: courses/templates/course/update.html:57 | |
| 59 | -msgid "Save" | |
| 60 | -msgstr "" | |
| 61 | - | |
| 62 | -#: courses/templates/category/delete.html:8 | |
| 63 | -#: courses/templates/category/index.html:8 | |
| 64 | -msgid "Manage Categories" | |
| 65 | -msgstr "" | |
| 66 | - | |
| 67 | -#: courses/templates/category/delete.html:26 | |
| 68 | -#: courses/templates/subject/delete.html:11 | |
| 69 | -msgid "Are you sure you want to delete the category" | |
| 70 | -msgstr "" | |
| 71 | - | |
| 72 | -#: courses/templates/category/delete.html:27 | |
| 73 | -#: courses/templates/course/delete.html:28 | |
| 74 | -#: courses/templates/subject/delete.html:12 | |
| 75 | -msgid "Yes" | |
| 76 | -msgstr "" | |
| 77 | - | |
| 78 | -#: courses/templates/category/delete.html:28 | |
| 79 | -#: courses/templates/course/delete.html:29 | |
| 80 | -#: courses/templates/subject/delete.html:13 | |
| 81 | -msgid "No" | |
| 82 | -msgstr "" | |
| 83 | - | |
| 84 | -#: courses/templates/category/index.html:38 | |
| 85 | -msgid "Name" | |
| 86 | -msgstr "" | |
| 87 | - | |
| 88 | -#: courses/templates/category/index.html:39 | |
| 89 | -msgid "Slug" | |
| 90 | -msgstr "" | |
| 91 | - | |
| 92 | -#: courses/templates/category/index.html:40 | |
| 93 | -msgid "Actions" | |
| 94 | -msgstr "" | |
| 95 | - | |
| 96 | -#: courses/templates/category/index.html:59 | |
| 97 | -msgid "No categories found" | |
| 98 | -msgstr "" | |
| 99 | - | |
| 100 | -#: courses/templates/category/update.html:9 | |
| 101 | -#: courses/templates/category/view.html:21 | |
| 102 | -msgid "Edit Category" | |
| 103 | -msgstr "" | |
| 104 | - | |
| 105 | -#: courses/templates/category/view.html:24 | |
| 106 | -msgid "Remove Category" | |
| 107 | -msgstr "" | |
| 108 | - | |
| 109 | -#: courses/templates/category/view.html:32 | |
| 110 | -msgid "Name:" | |
| 111 | -msgstr "" | |
| 112 | - | |
| 113 | -#: courses/templates/category/view.html:33 | |
| 114 | -msgid "Slug:" | |
| 115 | -msgstr "" | |
| 116 | - | |
| 117 | -#: courses/templates/course/create.html:9 | |
| 118 | -#: courses/templates/course/delete.html:18 | |
| 119 | -#: courses/templates/course/filtered.html:11 | |
| 120 | -#: courses/templates/course/index.html:19 | |
| 121 | -msgid "Create Course" | |
| 122 | -msgstr "" | |
| 123 | - | |
| 124 | -#: courses/templates/course/create.html:16 | |
| 125 | -#: courses/templates/course/delete.html:15 | |
| 126 | -#: courses/templates/course/filtered.html:8 | |
| 127 | -#: courses/templates/course/home.html:16 | |
| 128 | -#: courses/templates/course/index.html:16 | |
| 129 | -#: courses/templates/course/update.html:16 | |
| 130 | -#: courses/templates/course/view.html:48 | |
| 131 | -msgid "Courses" | |
| 132 | -msgstr "" | |
| 133 | - | |
| 134 | -#: courses/templates/course/delete.html:27 | |
| 135 | -msgid "Are you sure you want to delete the couse" | |
| 136 | -msgstr "" | |
| 137 | - | |
| 138 | -#: courses/templates/course/filtered.html:19 | |
| 139 | -#: courses/templates/course/index.html:27 | |
| 140 | -msgid "Categories:" | |
| 141 | -msgstr "" | |
| 142 | - | |
| 143 | -#: courses/templates/course/home.html:9 | |
| 144 | -msgid "Home Course" | |
| 145 | -msgstr "" | |
| 146 | - | |
| 147 | -#: courses/templates/course/index.html:81 | |
| 148 | -msgid "students tops" | |
| 149 | -msgstr "" | |
| 150 | - | |
| 151 | -#: courses/templates/course/index.html:87 | |
| 152 | -msgid "Subscribe Period:" | |
| 153 | -msgstr "" | |
| 154 | - | |
| 155 | -#: courses/templates/course/index.html:89 | |
| 156 | -msgid "Period:" | |
| 157 | -msgstr "" | |
| 158 | - | |
| 159 | -#: courses/templates/course/index.html:105 | |
| 160 | -msgid "No courses found" | |
| 161 | -msgstr "" | |
| 162 | - | |
| 163 | -#: courses/templates/course/update.html:9 | |
| 164 | -msgid "Edit Course" | |
| 165 | -msgstr "" | |
| 166 | - | |
| 167 | -#: courses/templates/course/update.html:19 | |
| 168 | -msgid "Manage Modules" | |
| 169 | -msgstr "" | |
| 170 | - | |
| 171 | -#: courses/templates/course/update.html:22 | |
| 172 | -msgid "Participants" | |
| 173 | -msgstr "" | |
| 174 | - | |
| 175 | -#: courses/templates/course/view.html:40 | |
| 176 | -msgid "Profile" | |
| 177 | -msgstr "" | |
| 178 | - | |
| 179 | -#: courses/templates/course/view.html:62 | |
| 180 | -msgid "Subjects" | |
| 181 | -msgstr "" | |
| 182 | - | |
| 183 | -#: courses/templates/course/view.html:85 | |
| 184 | -msgid "Professor" | |
| 185 | -msgstr "" | |
| 186 | - | |
| 187 | -#: courses/templates/course/view.html:88 | |
| 188 | -msgid "Description" | |
| 189 | -msgstr "" | |
| 190 | - | |
| 191 | -#: courses/templates/course/view.html:110 | |
| 192 | -#: courses/templates/subject/index.html:78 | |
| 193 | -msgid "Pending Stuffs" | |
| 194 | -msgstr "" | |
| 195 | - | |
| 196 | -#: courses/templates/course/view.html:113 | |
| 197 | -msgid "No pending tasks at the moment." | |
| 198 | -msgstr "" | |
| 199 | - | |
| 200 | -#: courses/templates/subject/create.html:20 | |
| 201 | -#: courses/templates/topic/create.html:20 | |
| 202 | -msgid "Create" | |
| 203 | -msgstr "" | |
| 204 | - | |
| 205 | -#: courses/templates/subject/form_view_teacher.html:10 | |
| 206 | -#: courses/templates/subject/index.html:47 | |
| 207 | -msgid "edit" | |
| 208 | -msgstr "" | |
| 209 | - | |
| 210 | -#: courses/templates/subject/index.html:10 | |
| 211 | -msgid "Manage Subjects" | |
| 212 | -msgstr "" | |
| 213 | - | |
| 214 | -#: courses/templates/subject/index.html:34 | |
| 215 | -msgid "Create Subject" | |
| 216 | -msgstr "" | |
| 217 | - | |
| 218 | -#: courses/templates/subject/index.html:52 | |
| 219 | -msgid "delete" | |
| 220 | -msgstr "" | |
| 221 | - | |
| 222 | -#: courses/templates/subject/index.html:71 | |
| 223 | -msgid "Create Topic" | |
| 224 | -msgstr "" | |
| 225 | - | |
| 226 | -#: courses/templates/subject/update.html:20 | |
| 227 | -#: courses/templates/topic/update.html:20 | |
| 228 | -msgid "Update" | |
| 229 | -msgstr "" |
courses/static/js/topic_editation_presentation.js
| 1 | -$(".edit_card").on('click', function() { | |
| 2 | - $(".presentation").css('display','none'); | |
| 3 | - $(".editation").css('display','block'); | |
| 4 | -}) | |
| 5 | -$(".edit_card_end").on('click', function() { | |
| 6 | - $(".editation").css('display','none'); | |
| 7 | - $(".presentation").css('display','block'); | |
| 8 | -}) | |
| 9 | 1 | \ No newline at end of file |
| 2 | +function show_editation(id_topic){ | |
| 3 | + $("#presentation_"+ id_topic).css('display','none'); | |
| 4 | + $("#editation_"+ id_topic).css('display','block'); | |
| 5 | +} | |
| 6 | + | |
| 7 | +function show_presentation(id_topic){ | |
| 8 | + $("#editation_"+ id_topic).css('display','none'); | |
| 9 | + $("#presentation_"+ id_topic).css('display','block'); | |
| 10 | +} | |
| 10 | 11 | \ No newline at end of file | ... | ... |
courses/templates/subject/form_view_teacher.html
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> |
| 5 | 5 | <script src="{% static 'js/file.js' %}"></script> |
| 6 | 6 | <script type="text/javascript" src="{% static 'js/material.js' %}"></script> |
| 7 | - <script type = "text/javascript" src="{% static 'links.js' %}"></script> | |
| 7 | + <script type = "text/javascript" src="{% static 'js/links.js' %}"></script> | |
| 8 | 8 | {% endblock %} |
| 9 | 9 | <div class="panel panel-default cards-detail"> |
| 10 | 10 | <div class="panel-heading topic"> |
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <a role="button"> |
| 17 | 17 | <h4>{{topic}}</h4> |
| 18 | 18 | </a> |
| 19 | - </div><!--column--> | |
| 19 | + </div><!--column --> | |
| 20 | 20 | <div class="col-xs-3 col-md-2 divMoreActions"> |
| 21 | 21 | <div class="btn-group"> |
| 22 | 22 | <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible"> |
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | {% if dropdown_topic %} |
| 32 | 32 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
| 33 | 33 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> |
| 34 | - <li><a href="javascript:void(0)" class="edit_card"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | |
| 34 | + <li><a href="javascript:show_editation('{{topic.slug}}')"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | |
| 35 | 35 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeTopic"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans "Remove" %}</a></li> |
| 36 | 36 | </ul> |
| 37 | 37 | {% endif %} |
| ... | ... | @@ -39,9 +39,9 @@ |
| 39 | 39 | </div><!--column--> |
| 40 | 40 | </div><!--row--> |
| 41 | 41 | </div> |
| 42 | - <div class="panel-collapse collapseTopic-{{topic.slug}} collapse in" role="tabpanel" aria-labelledby="heading_{{topic.id}}" aria-expanded="true" aria-hidden="false"> | |
| 42 | + <div class="panel-collapse collapseTopic-{{topic.slug}} topic_{{ topic.id }} collapse in" role="tabpanel" aria-labelledby="heading_{{topic.id}}" aria-expanded="true" aria-hidden="false"> | |
| 43 | 43 | <div class="panel-body"> |
| 44 | - <div class="presentation"> | |
| 44 | + <div class="presentation" id="presentation_{{topic.slug}}"> | |
| 45 | 45 | <p> |
| 46 | 46 | <i> |
| 47 | 47 | {{topic.description|linebreaks}} |
| ... | ... | @@ -86,7 +86,7 @@ |
| 86 | 86 | </div> |
| 87 | 87 | </div> |
| 88 | 88 | </div><!--EndPresentation--> |
| 89 | - <div class="editation"> | |
| 89 | + <div class="editation topic_{{ topic.id }}" id="editation_{{topic.slug}}"> | |
| 90 | 90 | <div class="form-group"> |
| 91 | 91 | <label class="control-label" for="focusedInput2">{% trans 'Name Topic' %}</label> |
| 92 | 92 | <input type="text" class="form-control" value="{{topic}}"> |
| ... | ... | @@ -135,16 +135,12 @@ |
| 135 | 135 | </div> |
| 136 | 136 | <div class="form-group"> |
| 137 | 137 | <div class="col-md-10"> |
| 138 | - <button type="button" class="btn btn-raised btn-default edit_card_end">{% trans 'Cancel' %}</button> | |
| 139 | - <button type="submit" class="btn btn-raised btn-primary edit_card_end">{% trans 'Submit' %}</button> | |
| 138 | + <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-default">{% trans 'Cancel' %}</a> | |
| 139 | + <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a> | |
| 140 | 140 | </div> |
| 141 | 141 | </div> |
| 142 | 142 | </div><!--EndEditation--> |
| 143 | - {% professor_subject topic.subject user as professor_links %} | |
| 144 | - {% if professor_links%} | |
| 145 | - {% include "links/create_link.html" %} | |
| 146 | - {% include "links/delete_link.html" %} | |
| 147 | - {% endif %} | |
| 143 | + | |
| 148 | 144 | </div> |
| 149 | 145 | </div> |
| 150 | 146 | </div> |
| ... | ... | @@ -287,10 +283,7 @@ |
| 287 | 283 | <!--EndModal--> |
| 288 | 284 | |
| 289 | 285 | <!-- MODAL LINK EDIT--> |
| 290 | -{% professor_subject topic.subject user as links_update %} | |
| 291 | -{% if links_update%} | |
| 292 | - {% include "links/update_link.html" %} | |
| 293 | -{% endif %} | |
| 286 | + | |
| 294 | 287 | |
| 295 | 288 | <!-- EndModal --> |
| 296 | 289 | |
| ... | ... | @@ -313,5 +306,3 @@ |
| 313 | 306 | </div> |
| 314 | 307 | </div> |
| 315 | 308 | </div> |
| 316 | - | |
| 317 | - | ... | ... |
courses/templates/topic/link_topic_list.html
| 1 | 1 | {% load static i18n list_topic_foruns permission_tags %} |
| 2 | 2 | <div id="list-topic{{ topic.id }}-links"> |
| 3 | 3 | {% for link in links%} |
| 4 | - <li><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link}}</a></li> | |
| 4 | + <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link.name}}</a></li> | |
| 5 | 5 | {% endfor %} |
| 6 | 6 | </div> |
| 7 | 7 | <div class = 'row' id ="divModalLink"> | ... | ... |
courses/templates/topic/link_topic_list_edit.html
| ... | ... | @@ -2,8 +2,12 @@ |
| 2 | 2 | <div id="list-topic{{ topic.id }}-links-edit"> |
| 3 | 3 | {% for link in links%} |
| 4 | 4 | |
| 5 | - <li class="icon_edit_remove"> <a href="#" data-toggle="modal" data-target="#linksModalEdit"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="#" data-toggle="modal" data-target="#removeLink"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
| 6 | - <li><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link}}</a></li> | |
| 5 | + <li class="icon_edit_remove" id = "link_edit_icon_{{ link.slug }}"> <a href="javascript:get_modal_link('{% url 'course:links:update_link' link.slug %}', '#linksModalEdit', '#divModalLinkUpdate')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:get_modal_link('{% url 'course:links:delete_link' link.slug %}', '#linkDeleteModal', '#divModalLinkUpdate')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
| 6 | + <li id="link_edit_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link.name}}</a></li> | |
| 7 | 7 | |
| 8 | 8 | {% endfor %} |
| 9 | 9 | </div> |
| 10 | + | |
| 11 | +<div class="row" id="divModalLinkUpdate"> | |
| 12 | + | |
| 13 | +</div> | ... | ... |
exam/locale/pt_BR/LC_MESSAGES/django.po
| ... | ... | @@ -24,119 +24,119 @@ msgstr "" |
| 24 | 24 | |
| 25 | 25 | #: exam/forms.py:33 |
| 26 | 26 | msgid "Start date to resolve the exam" |
| 27 | -msgstr "" | |
| 27 | +msgstr "Data de início para resolver o exame" | |
| 28 | 28 | |
| 29 | 29 | #: exam/forms.py:35 |
| 30 | 30 | msgid "Maximum date permited to resolve the exam" |
| 31 | -msgstr "" | |
| 31 | +msgstr "Data máxima permitida para resolver o exame" | |
| 32 | 32 | |
| 33 | 33 | #: exam/models.py:9 |
| 34 | 34 | msgid "Begin of Course Date" |
| 35 | -msgstr "" | |
| 35 | +msgstr "Data de início do curso" | |
| 36 | 36 | |
| 37 | 37 | #: exam/models.py:10 |
| 38 | 38 | msgid "Exibe?" |
| 39 | -msgstr "" | |
| 39 | +msgstr "Exibir?" | |
| 40 | 40 | |
| 41 | 41 | #: exam/models.py:13 exam/models.py:35 |
| 42 | 42 | msgid "Exam" |
| 43 | -msgstr "" | |
| 43 | +msgstr "Exame" | |
| 44 | 44 | |
| 45 | 45 | #: exam/models.py:14 |
| 46 | 46 | msgid "Exams" |
| 47 | -msgstr "" | |
| 47 | +msgstr "Exames" | |
| 48 | 48 | |
| 49 | 49 | #: exam/models.py:21 exam/models.py:27 |
| 50 | 50 | msgid "Answer" |
| 51 | -msgstr "" | |
| 51 | +msgstr "Resposta" | |
| 52 | 52 | |
| 53 | 53 | #: exam/models.py:22 |
| 54 | 54 | msgid "Order" |
| 55 | -msgstr "" | |
| 55 | +msgstr "Ordem" | |
| 56 | 56 | |
| 57 | 57 | #: exam/models.py:23 exam/models.py:28 |
| 58 | 58 | msgid "Answers" |
| 59 | -msgstr "" | |
| 59 | +msgstr "Respostas" | |
| 60 | 60 | |
| 61 | 61 | #: exam/models.py:34 |
| 62 | 62 | msgid "Answered" |
| 63 | -msgstr "" | |
| 63 | +msgstr "Respondida" | |
| 64 | 64 | |
| 65 | 65 | #: exam/models.py:36 |
| 66 | 66 | msgid "Answers Students" |
| 67 | -msgstr "" | |
| 67 | +msgstr "Resposta dos estudantes" | |
| 68 | 68 | |
| 69 | 69 | #: exam/models.py:37 |
| 70 | 70 | msgid "Student" |
| 71 | -msgstr "" | |
| 71 | +msgstr "Estudante" | |
| 72 | 72 | |
| 73 | 73 | #: exam/models.py:38 |
| 74 | 74 | msgid "Answered Date" |
| 75 | -msgstr "" | |
| 75 | +msgstr "Data da resposta" | |
| 76 | 76 | |
| 77 | 77 | #: exam/models.py:41 |
| 78 | 78 | msgid "Answer Stundent" |
| 79 | -msgstr "" | |
| 79 | +msgstr "Resposta do estudante" | |
| 80 | 80 | |
| 81 | 81 | #: exam/models.py:42 |
| 82 | 82 | msgid "Answers Student" |
| 83 | -msgstr "" | |
| 83 | +msgstr "Respostas dos estudantes" | |
| 84 | 84 | |
| 85 | 85 | #: exam/templates/exam/create.html:9 |
| 86 | 86 | msgid "New Exam" |
| 87 | -msgstr "" | |
| 87 | +msgstr "Novo exame" | |
| 88 | 88 | |
| 89 | 89 | #: exam/templates/exam/create.html:14 exam/templates/exam/create.html:16 |
| 90 | 90 | msgid "Exam Name" |
| 91 | -msgstr "" | |
| 91 | +msgstr "Nome do exame" | |
| 92 | 92 | |
| 93 | 93 | #: exam/templates/exam/create.html:20 |
| 94 | 94 | msgid "Exam's begin date" |
| 95 | -msgstr "" | |
| 95 | +msgstr "Data de início do exame" | |
| 96 | 96 | |
| 97 | 97 | #: exam/templates/exam/create.html:22 |
| 98 | 98 | msgid "Begin Date" |
| 99 | -msgstr "" | |
| 99 | +msgstr "Data de início" | |
| 100 | 100 | |
| 101 | 101 | #: exam/templates/exam/create.html:26 |
| 102 | 102 | msgid "Exam's end date" |
| 103 | -msgstr "" | |
| 103 | +msgstr "Data final do exame" | |
| 104 | 104 | |
| 105 | 105 | #: exam/templates/exam/create.html:28 |
| 106 | 106 | msgid "End Date" |
| 107 | -msgstr "" | |
| 107 | +msgstr "Data final" | |
| 108 | 108 | |
| 109 | 109 | #: exam/templates/exam/create.html:35 |
| 110 | 110 | msgid "Allow submissions after deadline?" |
| 111 | -msgstr "" | |
| 111 | +msgstr "Permitir submissões após o prazo?" | |
| 112 | 112 | |
| 113 | 113 | #: exam/templates/exam/create.html:44 exam/templates/exam/create.html:47 |
| 114 | 114 | msgid "Question Type" |
| 115 | -msgstr "" | |
| 115 | +msgstr "Tipo de questão" | |
| 116 | 116 | |
| 117 | 117 | #: exam/templates/exam/create.html:48 |
| 118 | 118 | msgid "Multiple Choice" |
| 119 | -msgstr "" | |
| 119 | +msgstr "Múltipla escolha" | |
| 120 | 120 | |
| 121 | 121 | #: exam/templates/exam/create.html:49 |
| 122 | 122 | msgid "True or False" |
| 123 | -msgstr "" | |
| 123 | +msgstr "Verdadeiro ou falso" | |
| 124 | 124 | |
| 125 | 125 | #: exam/templates/exam/create.html:50 |
| 126 | 126 | msgid "Gap Filling" |
| 127 | -msgstr "" | |
| 127 | +msgstr "Preenchimento de lacunas" | |
| 128 | 128 | |
| 129 | 129 | #: exam/templates/exam/create.html:51 |
| 130 | 130 | msgid "Discursive Question" |
| 131 | -msgstr "" | |
| 131 | +msgstr "Questão discursiva" | |
| 132 | 132 | |
| 133 | 133 | #: exam/templates/exam/create.html:57 |
| 134 | 134 | msgid "add question" |
| 135 | -msgstr "" | |
| 135 | +msgstr "Adicionar questão" | |
| 136 | 136 | |
| 137 | 137 | #: exam/templates/exam/create.html:62 |
| 138 | 138 | msgid "Create" |
| 139 | -msgstr "" | |
| 139 | +msgstr "Criar" | |
| 140 | 140 | |
| 141 | 141 | #: exam/templates/exam/discursive_question.html:2 |
| 142 | 142 | #: exam/templates/exam/discursive_question.html:4 |
| ... | ... | @@ -144,24 +144,24 @@ msgstr "" |
| 144 | 144 | #: exam/templates/exam/true_or_false_question.html:20 |
| 145 | 145 | #: exam/templates/exam/true_or_false_question.html:25 |
| 146 | 146 | msgid "Question" |
| 147 | -msgstr "" | |
| 147 | +msgstr "Questão" | |
| 148 | 148 | |
| 149 | 149 | #: exam/templates/exam/gap_filling_question.html:2 |
| 150 | 150 | msgid "Gap Filling Question" |
| 151 | -msgstr "" | |
| 151 | +msgstr "Questão de preenchimento de lacunas" | |
| 152 | 152 | |
| 153 | 153 | #: exam/templates/exam/multiple_choice_question.html:15 |
| 154 | 154 | msgid "Alternatives" |
| 155 | -msgstr "" | |
| 155 | +msgstr "Alternativas" | |
| 156 | 156 | |
| 157 | 157 | #: exam/templates/exam/true_or_false_answer.html:9 |
| 158 | 158 | msgid "Write your alternative" |
| 159 | -msgstr "" | |
| 159 | +msgstr "Escreva sua alternativa" | |
| 160 | 160 | |
| 161 | 161 | #: exam/templates/exam/true_or_false_question.html:37 |
| 162 | 162 | msgid "Alternatives: T/F" |
| 163 | -msgstr "" | |
| 163 | +msgstr "Alternativas: V/F" | |
| 164 | 164 | |
| 165 | 165 | #: exam/templates/exam/true_or_false_question.html:45 |
| 166 | 166 | msgid "New Alternative" |
| 167 | -msgstr "" | |
| 167 | +msgstr "Nova alternativa" | ... | ... |
files/locale/pt_BR/LC_MESSAGES/django.po
| ... | ... | @@ -20,69 +20,69 @@ msgstr "" |
| 20 | 20 | |
| 21 | 21 | #: files/forms.py:12 files/forms.py:29 |
| 22 | 22 | msgid "File too large (Max 10MB)" |
| 23 | -msgstr "" | |
| 23 | +msgstr "Arquivo muito grande (máximo de 10MB)" | |
| 24 | 24 | |
| 25 | 25 | #: files/models.py:20 |
| 26 | 26 | msgid "Professors" |
| 27 | -msgstr "" | |
| 27 | +msgstr "Professores" | |
| 28 | 28 | |
| 29 | 29 | #: files/models.py:21 |
| 30 | 30 | msgid "Description" |
| 31 | -msgstr "" | |
| 31 | +msgstr "Descrição" | |
| 32 | 32 | |
| 33 | 33 | #: files/models.py:22 files/models.py:27 |
| 34 | 34 | msgid "File" |
| 35 | -msgstr "" | |
| 35 | +msgstr "Arquivo" | |
| 36 | 36 | |
| 37 | 37 | #: files/models.py:23 |
| 38 | 38 | msgid "Type file" |
| 39 | -msgstr "" | |
| 39 | +msgstr "Tipo de arquivo" | |
| 40 | 40 | |
| 41 | 41 | #: files/models.py:28 |
| 42 | 42 | msgid "Files" |
| 43 | -msgstr "" | |
| 43 | +msgstr "Arquivos" | |
| 44 | 44 | |
| 45 | 45 | #: files/templates/files/create_file.html:10 |
| 46 | 46 | msgid "Add File" |
| 47 | -msgstr "" | |
| 47 | +msgstr "Adicionar arquivo" | |
| 48 | 48 | |
| 49 | 49 | #: files/templates/files/create_file.html:38 |
| 50 | 50 | #: files/templates/files/update_file.html:40 |
| 51 | 51 | msgid "Choose your file..." |
| 52 | -msgstr "" | |
| 52 | +msgstr "Escolha seu arquivo..." | |
| 53 | 53 | |
| 54 | 54 | #: files/templates/files/create_file.html:68 |
| 55 | 55 | #: files/templates/files/update_file.html:73 |
| 56 | 56 | msgid "The file size shouldnt exceed 10MB" |
| 57 | -msgstr "" | |
| 57 | +msgstr "O tamanho máximo não pode exceder 10MB" | |
| 58 | 58 | |
| 59 | 59 | #: files/templates/files/create_file.html:74 |
| 60 | 60 | #: files/templates/files/delete_file.html:34 |
| 61 | 61 | #: files/templates/files/update_file.html:79 |
| 62 | 62 | msgid "Close" |
| 63 | -msgstr "" | |
| 63 | +msgstr "Fechar" | |
| 64 | 64 | |
| 65 | 65 | #: files/templates/files/create_file.html:75 |
| 66 | 66 | #: files/templates/files/update_file.html:80 |
| 67 | 67 | msgid "Submit" |
| 68 | -msgstr "" | |
| 68 | +msgstr "Enviar" | |
| 69 | 69 | |
| 70 | 70 | #: files/templates/files/delete_file.html:12 |
| 71 | 71 | msgid "Delete File" |
| 72 | -msgstr "" | |
| 72 | +msgstr "Deletar arquivo" | |
| 73 | 73 | |
| 74 | 74 | #: files/templates/files/delete_file.html:30 |
| 75 | 75 | msgid "Are you sure to delete " |
| 76 | -msgstr "" | |
| 76 | +msgstr "Tem certeza que deseja deletar " | |
| 77 | 77 | |
| 78 | 78 | #: files/templates/files/delete_file.html:35 |
| 79 | 79 | msgid "Delete" |
| 80 | -msgstr "" | |
| 80 | +msgstr "Deletar" | |
| 81 | 81 | |
| 82 | 82 | #: files/templates/files/update_file.html:12 |
| 83 | 83 | msgid "Edit File" |
| 84 | -msgstr "" | |
| 84 | +msgstr "Editar arquivo" | |
| 85 | 85 | |
| 86 | 86 | #: files/templates/files/update_file.html:48 |
| 87 | 87 | msgid "See current file" |
| 88 | -msgstr "" | |
| 88 | +msgstr "Visualizar arquivo atual" | ... | ... |
forum/locale/pt_BR/LC_MESSAGES/django.po
| ... | ... | @@ -20,88 +20,88 @@ msgstr "" |
| 20 | 20 | |
| 21 | 21 | #: forum/forms.py:11 |
| 22 | 22 | msgid "Title" |
| 23 | -msgstr "" | |
| 23 | +msgstr "Título" | |
| 24 | 24 | |
| 25 | 25 | #: forum/forms.py:12 forum/models.py:14 |
| 26 | 26 | #: forum/templates/forum/forum_list.html:23 |
| 27 | 27 | #: forum/templates/forum/forum_view.html:58 |
| 28 | 28 | #: forum/templates/forum/render_forum.html:4 |
| 29 | 29 | msgid "Description" |
| 30 | -msgstr "" | |
| 30 | +msgstr "Descrição" | |
| 31 | 31 | |
| 32 | 32 | #: forum/forms.py:13 |
| 33 | 33 | msgid "Limit Date" |
| 34 | -msgstr "" | |
| 34 | +msgstr "Data limite" | |
| 35 | 35 | |
| 36 | 36 | #: forum/forms.py:16 |
| 37 | 37 | msgid "Forum title" |
| 38 | -msgstr "" | |
| 38 | +msgstr "Título do fórum" | |
| 39 | 39 | |
| 40 | 40 | #: forum/forms.py:17 |
| 41 | 41 | msgid "What is this forum about?" |
| 42 | -msgstr "" | |
| 42 | +msgstr "Qual o assunto deste fórum?" | |
| 43 | 43 | |
| 44 | 44 | #: forum/forms.py:18 |
| 45 | 45 | msgid "Limit date for students post on this forum" |
| 46 | -msgstr "" | |
| 46 | +msgstr "Data limite para estudantes postarem neste fórum" | |
| 47 | 47 | |
| 48 | 48 | #: forum/forms.py:33 forum/forms.py:46 |
| 49 | 49 | msgid "Message" |
| 50 | -msgstr "" | |
| 50 | +msgstr "Mensagem" | |
| 51 | 51 | |
| 52 | 52 | #: forum/models.py:15 forum/models.py:33 forum/models.py:61 |
| 53 | 53 | msgid "Modification Date" |
| 54 | -msgstr "" | |
| 54 | +msgstr "Data de modificação" | |
| 55 | 55 | |
| 56 | 56 | #: forum/models.py:16 |
| 57 | 57 | msgid "Create Date" |
| 58 | -msgstr "" | |
| 58 | +msgstr "Data de criação" | |
| 59 | 59 | |
| 60 | 60 | #: forum/models.py:19 forum/models.py:35 |
| 61 | 61 | #: forum/templates/forum/forum_view.html:16 |
| 62 | 62 | #: forum/templates/forum/forum_view.html:116 |
| 63 | 63 | msgid "Forum" |
| 64 | -msgstr "" | |
| 64 | +msgstr "Fórum" | |
| 65 | 65 | |
| 66 | 66 | #: forum/models.py:20 |
| 67 | 67 | msgid "Foruns" |
| 68 | -msgstr "" | |
| 68 | +msgstr "Fóruns" | |
| 69 | 69 | |
| 70 | 70 | #: forum/models.py:31 forum/models.py:58 |
| 71 | 71 | msgid "Autor" |
| 72 | -msgstr "" | |
| 72 | +msgstr "Autor" | |
| 73 | 73 | |
| 74 | 74 | #: forum/models.py:32 |
| 75 | 75 | msgid "Post message" |
| 76 | -msgstr "" | |
| 76 | +msgstr "Postar mensagem" | |
| 77 | 77 | |
| 78 | 78 | #: forum/models.py:34 |
| 79 | 79 | msgid "Post Date" |
| 80 | -msgstr "" | |
| 80 | +msgstr "Data de postagem" | |
| 81 | 81 | |
| 82 | 82 | #: forum/models.py:38 forum/models.py:59 |
| 83 | 83 | msgid "Post" |
| 84 | -msgstr "" | |
| 84 | +msgstr "Postar" | |
| 85 | 85 | |
| 86 | 86 | #: forum/models.py:39 |
| 87 | 87 | msgid "Posts" |
| 88 | -msgstr "" | |
| 88 | +msgstr "Postagens" | |
| 89 | 89 | |
| 90 | 90 | #: forum/models.py:60 |
| 91 | 91 | msgid "Answer message" |
| 92 | -msgstr "" | |
| 92 | +msgstr "Resposta" | |
| 93 | 93 | |
| 94 | 94 | #: forum/models.py:62 |
| 95 | 95 | msgid "Answer Date" |
| 96 | -msgstr "" | |
| 96 | +msgstr "Data da resposta" | |
| 97 | 97 | |
| 98 | 98 | #: forum/models.py:65 |
| 99 | 99 | msgid "Post Answer" |
| 100 | -msgstr "" | |
| 100 | +msgstr "Postar resposta" | |
| 101 | 101 | |
| 102 | 102 | #: forum/models.py:66 |
| 103 | 103 | msgid "Post Answers" |
| 104 | -msgstr "" | |
| 104 | +msgstr "Postar respostas" | |
| 105 | 105 | |
| 106 | 106 | #: forum/templates/forum/forum_list.html:16 |
| 107 | 107 | #: forum/templates/forum/forum_view.html:44 |
| ... | ... | @@ -112,73 +112,73 @@ msgstr "" |
| 112 | 112 | #: forum/templates/post_answers/post_answer_load_more_render.html:17 |
| 113 | 113 | #: forum/templates/post_answers/post_answer_render.html:15 |
| 114 | 114 | msgid "Edit" |
| 115 | -msgstr "" | |
| 115 | +msgstr "Editar" | |
| 116 | 116 | |
| 117 | 117 | #: forum/templates/forum/forum_list.html:17 |
| 118 | 118 | #: forum/templates/forum/forum_view.html:45 |
| 119 | 119 | msgid "Are you sure you want to delete this forum?" |
| 120 | -msgstr "" | |
| 120 | +msgstr "Tem certeza que deseja deletar este fórum?" | |
| 121 | 121 | |
| 122 | 122 | #: forum/templates/forum/forum_list.html:17 |
| 123 | 123 | #: forum/templates/forum/forum_view.html:45 |
| 124 | 124 | msgid "Delete" |
| 125 | -msgstr "" | |
| 125 | +msgstr "Deletar" | |
| 126 | 126 | |
| 127 | 127 | #: forum/templates/forum/forum_list.html:24 |
| 128 | 128 | #: forum/templates/forum/forum_view.html:59 |
| 129 | 129 | #: forum/templates/forum/render_forum.html:5 |
| 130 | 130 | msgid "Opened in" |
| 131 | -msgstr "" | |
| 131 | +msgstr "Aberto em" | |
| 132 | 132 | |
| 133 | 133 | #: forum/templates/forum/forum_list.html:59 |
| 134 | 134 | #: forum/templates/forum/forum_view.html:91 |
| 135 | 135 | #: forum/templates/post_answers/post_answer_form.html:38 |
| 136 | 136 | msgid "send" |
| 137 | -msgstr "" | |
| 137 | +msgstr "Enviar" | |
| 138 | 138 | |
| 139 | 139 | #: forum/templates/forum/forum_view.html:13 |
| 140 | 140 | msgid "Home" |
| 141 | -msgstr "" | |
| 141 | +msgstr "Início" | |
| 142 | 142 | |
| 143 | 143 | #: forum/templates/forum/forum_view.html:27 |
| 144 | 144 | msgid "Menu" |
| 145 | -msgstr "" | |
| 145 | +msgstr "Menu" | |
| 146 | 146 | |
| 147 | 147 | #: forum/templates/forum/forum_view.html:31 |
| 148 | 148 | msgid "Profile" |
| 149 | -msgstr "" | |
| 149 | +msgstr "Perfil" | |
| 150 | 150 | |
| 151 | 151 | #: forum/templates/forum/forum_view.html:32 |
| 152 | 152 | msgid "My Courses" |
| 153 | -msgstr "" | |
| 153 | +msgstr "Meus cursos" | |
| 154 | 154 | |
| 155 | 155 | #: forum/templates/forum/forum_view.html:40 |
| 156 | 156 | msgid "Actions" |
| 157 | -msgstr "" | |
| 157 | +msgstr "Ações" | |
| 158 | 158 | |
| 159 | 159 | #: forum/templates/forum/forum_view.html:44 |
| 160 | 160 | msgid "Forum edited successfully!" |
| 161 | -msgstr "" | |
| 161 | +msgstr "Fórum editado com sucesso!" | |
| 162 | 162 | |
| 163 | 163 | #: forum/templates/forum/forum_view.html:124 |
| 164 | 164 | msgid "Close" |
| 165 | -msgstr "" | |
| 165 | +msgstr "Fechar" | |
| 166 | 166 | |
| 167 | 167 | #: forum/templates/forum/forum_view.html:125 |
| 168 | 168 | msgid "Update" |
| 169 | -msgstr "" | |
| 169 | +msgstr "Atualizar" | |
| 170 | 170 | |
| 171 | 171 | #: forum/templates/post/post_list.html:11 |
| 172 | 172 | #: forum/templates/post/post_load_more_render.html:11 |
| 173 | 173 | #: forum/templates/post/post_render.html:9 |
| 174 | 174 | msgid "reply" |
| 175 | -msgstr "" | |
| 175 | +msgstr "Responder" | |
| 176 | 176 | |
| 177 | 177 | #: forum/templates/post/post_list.html:20 |
| 178 | 178 | #: forum/templates/post/post_load_more_render.html:20 |
| 179 | 179 | #: forum/templates/post/post_render.html:18 |
| 180 | 180 | msgid "Post edited successfully!" |
| 181 | -msgstr "" | |
| 181 | +msgstr "Post editado com sucesso!" | |
| 182 | 182 | |
| 183 | 183 | #: forum/templates/post/post_list.html:21 |
| 184 | 184 | #: forum/templates/post/post_load_more_render.html:21 |
| ... | ... | @@ -187,7 +187,7 @@ msgstr "" |
| 187 | 187 | #: forum/templates/post_answers/post_answer_load_more_render.html:18 |
| 188 | 188 | #: forum/templates/post_answers/post_answer_render.html:16 |
| 189 | 189 | msgid "Remove" |
| 190 | -msgstr "" | |
| 190 | +msgstr "Remover" | |
| 191 | 191 | |
| 192 | 192 | #: forum/templates/post/post_list.html:30 |
| 193 | 193 | #: forum/templates/post/post_load_more_render.html:30 |
| ... | ... | @@ -196,7 +196,7 @@ msgstr "" |
| 196 | 196 | #: forum/templates/post_answers/post_answer_load_more_render.html:26 |
| 197 | 197 | #: forum/templates/post_answers/post_answer_render.html:24 |
| 198 | 198 | msgid "ago" |
| 199 | -msgstr "" | |
| 199 | +msgstr "atrás" | |
| 200 | 200 | |
| 201 | 201 | #: forum/templates/post/post_list.html:32 |
| 202 | 202 | #: forum/templates/post/post_load_more_render.html:32 |
| ... | ... | @@ -205,46 +205,46 @@ msgstr "" |
| 205 | 205 | #: forum/templates/post_answers/post_answer_load_more_render.html:28 |
| 206 | 206 | #: forum/templates/post_answers/post_answer_render.html:26 |
| 207 | 207 | msgid "Edited" |
| 208 | -msgstr "" | |
| 208 | +msgstr "Editado" | |
| 209 | 209 | |
| 210 | 210 | #: forum/templates/post/post_list.html:54 forum/views.py:196 |
| 211 | 211 | msgid "Load more posts" |
| 212 | -msgstr "" | |
| 212 | +msgstr "Carregar mais postagens" | |
| 213 | 213 | |
| 214 | 214 | #: forum/templates/post/post_update_form.html:32 |
| 215 | 215 | #: forum/templates/post_answers/post_answer_form.html:32 |
| 216 | 216 | msgid "Cancel" |
| 217 | -msgstr "" | |
| 217 | +msgstr "Cancelar" | |
| 218 | 218 | |
| 219 | 219 | #: forum/templates/post/post_update_form.html:33 |
| 220 | 220 | #: forum/templates/post_answers/post_answer_form.html:33 |
| 221 | 221 | msgid "Save changes" |
| 222 | -msgstr "" | |
| 222 | +msgstr "Salvar mudanças" | |
| 223 | 223 | |
| 224 | 224 | #: forum/templates/post_answers/post_answer_list.html:17 |
| 225 | 225 | #: forum/templates/post_answers/post_answer_load_more_render.html:17 |
| 226 | 226 | #: forum/templates/post_answers/post_answer_render.html:15 |
| 227 | 227 | msgid "Answer edited sucessfully!" |
| 228 | -msgstr "" | |
| 228 | +msgstr "Resposta editada com sucesso!" | |
| 229 | 229 | |
| 230 | 230 | #: forum/templates/post_answers/post_answer_list.html:18 |
| 231 | 231 | #: forum/templates/post_answers/post_answer_load_more_render.html:18 |
| 232 | 232 | #: forum/templates/post_answers/post_answer_render.html:16 |
| 233 | 233 | msgid "Are you sure you want to delete this answer?" |
| 234 | -msgstr "" | |
| 234 | +msgstr "Tem certeza que deseja deletar esta resposta?" | |
| 235 | 235 | |
| 236 | 236 | #: forum/templates/post_answers/post_answer_list.html:42 forum/views.py:295 |
| 237 | 237 | msgid "Load more answers" |
| 238 | -msgstr "" | |
| 238 | +msgstr "Carregar mais respostas" | |
| 239 | 239 | |
| 240 | 240 | #: forum/views.py:130 |
| 241 | 241 | msgid "Forum deleted successfully." |
| 242 | -msgstr "" | |
| 242 | +msgstr "Fórum deletado com sucesso." | |
| 243 | 243 | |
| 244 | 244 | #: forum/views.py:253 |
| 245 | 245 | msgid "Post deleted successfully." |
| 246 | -msgstr "" | |
| 246 | +msgstr "Postagem deletada com sucesso." | |
| 247 | 247 | |
| 248 | 248 | #: forum/views.py:365 |
| 249 | 249 | msgid "Post answer deleted successfully." |
| 250 | -msgstr "" | |
| 250 | +msgstr "Resposta deletada com sucesso." | ... | ... |
forum/static/js/forum.js
| ... | ... | @@ -47,7 +47,7 @@ function createForum(url, topic) { |
| 47 | 47 | $(".forum_form").html(data); |
| 48 | 48 | $("#id_topic").val(topic); |
| 49 | 49 | |
| 50 | - setForumCreateFormSubmit(); | |
| 50 | + setForumCreateFormSubmit(topic); | |
| 51 | 51 | } |
| 52 | 52 | }); |
| 53 | 53 | |
| ... | ... | @@ -59,7 +59,7 @@ function createForum(url, topic) { |
| 59 | 59 | * Function to set the forum's create form submit function |
| 60 | 60 | * |
| 61 | 61 | */ |
| 62 | -function setForumCreateFormSubmit() { | |
| 62 | +function setForumCreateFormSubmit(topic) { | |
| 63 | 63 | $('.date-picker').datepicker({ |
| 64 | 64 | language: locale, |
| 65 | 65 | }); |
| ... | ... | @@ -72,13 +72,13 @@ function setForumCreateFormSubmit() { |
| 72 | 72 | data: frm.serialize(), |
| 73 | 73 | dataType: "json", |
| 74 | 74 | success: function (data) { |
| 75 | - $('.foruns_list').append("<li><i class='fa fa-commenting' aria-hidden='true'></i> <a id='forum_"+data.forum_id+"' href='"+data.url+"'> "+data.name+"</a></li>"); | |
| 75 | + $(".topic_" + topic).find('.foruns_list').append("<li><i class='fa fa-commenting' aria-hidden='true'></i> <a id='forum_"+data.forum_id+"' href='"+data.url+"'> "+data.name+"</a></li>"); | |
| 76 | 76 | |
| 77 | 77 | $("#createForum").modal('hide'); |
| 78 | 78 | }, |
| 79 | 79 | error: function(data) { |
| 80 | 80 | $(".forum_form").html(data.responseText); |
| 81 | - setForumCreateFormSubmit(); | |
| 81 | + setForumCreateFormSubmit(topic); | |
| 82 | 82 | } |
| 83 | 83 | }); |
| 84 | 84 | return false; | ... | ... |
forum/tests/test_view_forum.py
| ... | ... | @@ -120,22 +120,16 @@ class ForumViewTestCase (TestCase): |
| 120 | 120 | self.assertEquals(response.status_code, 200) |
| 121 | 121 | |
| 122 | 122 | response = self.client_professor.get(url) |
| 123 | - self.assertEquals(response.status_code, 200) | |
| 123 | + self.assertEquals(response.status_code, 302) | |
| 124 | 124 | |
| 125 | 125 | response = self.client_student.get(url) |
| 126 | - self.assertEquals(response.status_code, 200) | |
| 126 | + self.assertEquals(response.status_code, 302) | |
| 127 | 127 | |
| 128 | 128 | def test_ForumDetail_context(self): |
| 129 | 129 | url = reverse('course:forum:view', kwargs={'slug':self.forum.slug}) |
| 130 | 130 | |
| 131 | 131 | response = self.client.get(url) |
| 132 | - self.assertTrue('forum' in response.context) | |
| 133 | - | |
| 134 | - response = self.client_professor.get(url) | |
| 135 | - self.assertTrue('forum' in response.context) | |
| 136 | - | |
| 137 | - response = self.client_student.get(url) | |
| 138 | - self.assertTrue('forum' in response.context) | |
| 132 | + self.assertTrue('form' in response.context) | |
| 139 | 133 | |
| 140 | 134 | |
| 141 | 135 | ######################### CreateForumView ######################### | ... | ... |
links/admin.py
| ... | ... | @@ -3,8 +3,8 @@ from django.contrib import admin |
| 3 | 3 | from .models import Link |
| 4 | 4 | |
| 5 | 5 | class LinkAdmin(admin.ModelAdmin): |
| 6 | - list_display = ['name', 'link_url','link_description'] | |
| 7 | - search_fields = ['name', 'link_url','link_description'] | |
| 6 | + list_display = ['name', 'slug','link_url','link_description'] | |
| 7 | + search_fields = ['name','slug' ,'link_url','link_description'] | |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | admin.site.register(Link, LinkAdmin) | ... | ... |
links/forms.py
| 1 | 1 | from django import forms |
| 2 | 2 | from .models import Link |
| 3 | -import validators | |
| 3 | +from django.utils.translation import ugettext_lazy as _ | |
| 4 | +from django.core.exceptions import ValidationError, FieldError | |
| 5 | +import requests | |
| 4 | 6 | |
| 5 | 7 | class CreateLinkForm(forms.ModelForm): |
| 6 | 8 | |
| 7 | - def clean_link(self): | |
| 9 | + def clean_link_url(self): | |
| 8 | 10 | link_url = self.cleaned_data['link_url'] |
| 9 | - if not validators.url(link_url): | |
| 10 | - raise forms.ValidationError(_('Please enter a valid URL')) | |
| 11 | + try: | |
| 12 | + response = requests.head(link_url) | |
| 13 | + if response.status_code >= 400: | |
| 14 | + raise forms.ValidationError(_('Invalid url!')) | |
| 15 | + except requests.ConnectionError: | |
| 16 | + raise forms.ValidationError(_('Invalid url!')) | |
| 11 | 17 | return link_url |
| 12 | 18 | |
| 13 | 19 | class Meta: |
| ... | ... | @@ -15,6 +21,15 @@ class CreateLinkForm(forms.ModelForm): |
| 15 | 21 | fields = ['name','link_url','link_description'] |
| 16 | 22 | |
| 17 | 23 | class UpdateLinkForm(forms.ModelForm): |
| 24 | + def clean_link_url(self): | |
| 25 | + link_url = self.cleaned_data['link_url'] | |
| 26 | + try: | |
| 27 | + resposta = requests.head(link_url) | |
| 28 | + if resposta.status_code >= 400: | |
| 29 | + raise forms.ValidationError(_('Invalid url!')) | |
| 30 | + except requests.ConnectionError: | |
| 31 | + raise forms.ValidationError(_('Invalid url!')) | |
| 32 | + return link_url | |
| 18 | 33 | class Meta: |
| 19 | 34 | model = Link |
| 20 | 35 | fields = ['name','link_url','link_description'] | ... | ... |
links/image-crawler.py
| ... | ... | @@ -1,53 +0,0 @@ |
| 1 | -from bs4 import BeautifulSoup | |
| 2 | -from urllib.request import urlopen | |
| 3 | -import urllib.request | |
| 4 | - | |
| 5 | - | |
| 6 | -def make_soup(url): | |
| 7 | - try: | |
| 8 | - html = urlopen(url).read() | |
| 9 | - return BeautifulSoup(html,"lxml") | |
| 10 | - except urllib.error.HTTPError as e: | |
| 11 | - return "Use default image" | |
| 12 | - | |
| 13 | -def get_images(url): | |
| 14 | - try: | |
| 15 | - soup = make_soup(url) | |
| 16 | - except: | |
| 17 | - return("Use default image") | |
| 18 | - if soup == None or type(soup) == str: | |
| 19 | - return "Use default image" | |
| 20 | - images = [img for img in soup.findAll('img')] | |
| 21 | - image_links = [each.get('src') for each in images] | |
| 22 | - contador = 0 | |
| 23 | - for each in image_links: | |
| 24 | - booleano = False | |
| 25 | - if each != "": | |
| 26 | - if each == None: | |
| 27 | - continue | |
| 28 | - if 'jpg' in each: | |
| 29 | - booleano = True | |
| 30 | - pos = each.index("jpg") | |
| 31 | - each = each[0:pos+3] | |
| 32 | - elif 'png' in each: | |
| 33 | - booleano = True | |
| 34 | - pos = each.index("png") | |
| 35 | - each = each[0:pos+3] | |
| 36 | - elif 'jpeg' in each: | |
| 37 | - booleano = True | |
| 38 | - pos = each.index('jpeg') | |
| 39 | - each = each[0:pos+4] | |
| 40 | - if not booleano: | |
| 41 | - continue | |
| 42 | - | |
| 43 | - if each[0] + each[1] == '//' or each[0] == '/': | |
| 44 | - each = 'http:'+each | |
| 45 | - if each[0:4] != 'http' and each[0:5] != 'https': | |
| 46 | - each = url[0:url.index('/',8)] + each | |
| 47 | - contador += 1 | |
| 48 | - caminho = "" | |
| 49 | - filename=each.split('/')[-1] | |
| 50 | - try: | |
| 51 | - urllib.request.urlretrieve(each,"%s"%(caminho)+str(contador)+filename) | |
| 52 | - except Exception: | |
| 53 | - continue |
| ... | ... | @@ -0,0 +1,60 @@ |
| 1 | +from bs4 import BeautifulSoup | |
| 2 | +from urllib.request import urlopen | |
| 3 | +import urllib.request | |
| 4 | + | |
| 5 | +def make_soup(url): | |
| 6 | + try: | |
| 7 | + html = urlopen(url).read() | |
| 8 | + return BeautifulSoup(html,"lxml") | |
| 9 | + | |
| 10 | + except urllib.error.HTTPError as e: | |
| 11 | + return "Use default image" | |
| 12 | + | |
| 13 | +def get_images(url,slug): | |
| 14 | + downloaded = False | |
| 15 | + try: | |
| 16 | + soup = make_soup(url) | |
| 17 | + except: | |
| 18 | + return("Use default image",downloaded) | |
| 19 | + if soup == None or type(soup) == str: | |
| 20 | + return ("Use default image",downloaded) | |
| 21 | + images = [img for img in soup.findAll('img')] | |
| 22 | + image_links = [each.get('src') for each in images] | |
| 23 | + link_slug = slug | |
| 24 | + filename = '' | |
| 25 | + for each in image_links: | |
| 26 | + if downloaded: | |
| 27 | + break | |
| 28 | + booleano = False | |
| 29 | + if each != "": | |
| 30 | + if each == None: | |
| 31 | + continue | |
| 32 | + if 'jpg' in each: | |
| 33 | + booleano = True | |
| 34 | + pos = each.index("jpg") | |
| 35 | + each = each[0:pos+3] | |
| 36 | + filename = '.jpg' | |
| 37 | + elif 'png' in each: | |
| 38 | + booleano = True | |
| 39 | + pos = each.index("png") | |
| 40 | + each = each[0:pos+3] | |
| 41 | + filename = '.png' | |
| 42 | + elif 'jpeg' in each: | |
| 43 | + booleano = True | |
| 44 | + pos = each.index('jpeg') | |
| 45 | + each = each[0:pos+4] | |
| 46 | + filename = '.jpeg' | |
| 47 | + if not booleano: | |
| 48 | + continue | |
| 49 | + | |
| 50 | + if each[0] + each[1] == '//' or each[0] == '/': | |
| 51 | + each = 'http:'+each | |
| 52 | + if each[0:4] != 'http' and each[0:5] != 'https': | |
| 53 | + each = url[0:url.index('/',8)] + each | |
| 54 | + caminho = "links/static/images/" | |
| 55 | + try: | |
| 56 | + urllib.request.urlretrieve(each,"%s"%(caminho)+str(link_slug)+filename) | |
| 57 | + downloaded = True | |
| 58 | + except Exception: | |
| 59 | + continue | |
| 60 | + return filename,downloaded | ... | ... |
links/locale/pt_BR/LC_MESSAGES/django.po
| ... | ... | @@ -8,7 +8,7 @@ msgid "" |
| 8 | 8 | msgstr "" |
| 9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
| 10 | 10 | "Report-Msgid-Bugs-To: \n" |
| 11 | -"POT-Creation-Date: 2016-10-26 14:47-0300\n" | |
| 11 | +"POT-Creation-Date: 2016-10-27 23:54-0300\n" | |
| 12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
| ... | ... | @@ -18,64 +18,63 @@ msgstr "" |
| 18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
| 19 | 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
| 20 | 20 | |
| 21 | -#: links/forms.py:10 | |
| 22 | -msgid "Please enter a valid URL" | |
| 23 | -msgstr "" | |
| 21 | +#: .\forms.py:16 .\forms.py:22 | |
| 22 | +msgid "Invalid url!" | |
| 23 | +msgstr "Url inválida!" | |
| 24 | 24 | |
| 25 | -#: links/templates/links/create_link.html:9 | |
| 25 | +#: .\templates\links\create_link.html:9 | |
| 26 | 26 | msgid "Create a New Link" |
| 27 | -msgstr "" | |
| 27 | +msgstr "Criar um novo link" | |
| 28 | 28 | |
| 29 | -#: links/templates/links/create_link.html:34 | |
| 30 | -#: links/templates/links/delete_link.html:15 | |
| 31 | -#: links/templates/links/update_link.html:25 | |
| 29 | +#: .\templates\links\create_link.html:46 .\templates\links\delete_link.html:15 | |
| 30 | +#: .\templates\links\update_link.html:25 | |
| 32 | 31 | msgid "Cancel" |
| 33 | -msgstr "" | |
| 32 | +msgstr "Cancelar" | |
| 34 | 33 | |
| 35 | -#: links/templates/links/delete_link.html:11 | |
| 34 | +#: .\templates\links\delete_link.html:11 | |
| 36 | 35 | msgid "Do you really want to delete this link?" |
| 37 | -msgstr "" | |
| 36 | +msgstr "Você realmente deseja apagar este link?" | |
| 38 | 37 | |
| 39 | -#: links/templates/links/delete_link.html:16 | |
| 38 | +#: .\templates\links\delete_link.html:16 | |
| 40 | 39 | msgid "Confirm" |
| 41 | -msgstr "" | |
| 40 | +msgstr "Confirmar" | |
| 42 | 41 | |
| 43 | -#: links/templates/links/update_link.html:8 | |
| 42 | +#: .\templates\links\update_link.html:8 | |
| 44 | 43 | msgid "Links" |
| 45 | -msgstr "" | |
| 44 | +msgstr "Links" | |
| 46 | 45 | |
| 47 | -#: links/templates/links/update_link.html:13 | |
| 46 | +#: .\templates\links\update_link.html:13 | |
| 48 | 47 | msgid "Name" |
| 49 | -msgstr "" | |
| 48 | +msgstr "Nome" | |
| 50 | 49 | |
| 51 | -#: links/templates/links/update_link.html:17 | |
| 50 | +#: .\templates\links\update_link.html:17 | |
| 52 | 51 | msgid "URL" |
| 53 | -msgstr "" | |
| 52 | +msgstr "URL" | |
| 54 | 53 | |
| 55 | -#: links/templates/links/update_link.html:21 | |
| 56 | -msgid "Descrição" | |
| 57 | -msgstr "" | |
| 54 | +#: .\templates\links\update_link.html:21 | |
| 55 | +msgid "Description" | |
| 56 | +msgstr "Descrição" | |
| 58 | 57 | |
| 59 | -#: links/templates/links/update_link.html:26 | |
| 58 | +#: .\templates\links\update_link.html:26 | |
| 60 | 59 | msgid "Submit" |
| 61 | -msgstr "" | |
| 60 | +msgstr "Enviar" | |
| 62 | 61 | |
| 63 | -#: links/templates/links/view_link.html:8 | |
| 62 | +#: .\templates\links\view_link.html:8 | |
| 64 | 63 | msgid "Link" |
| 65 | -msgstr "" | |
| 64 | +msgstr "Link" | |
| 66 | 65 | |
| 67 | -#: links/templates/links/view_link.html:17 | |
| 66 | +#: .\templates\links\view_link.html:17 | |
| 68 | 67 | msgid "Read more" |
| 69 | -msgstr "" | |
| 68 | +msgstr "Ler mais" | |
| 70 | 69 | |
| 71 | -#: links/views.py:28 | |
| 70 | +#: .\views.py:28 | |
| 72 | 71 | msgid "Link created successfully!" |
| 73 | -msgstr "" | |
| 72 | +msgstr "Link criado com sucesso!" | |
| 74 | 73 | |
| 75 | -#: links/views.py:50 | |
| 74 | +#: .\views.py:50 | |
| 76 | 75 | msgid "Link deleted Successfully!" |
| 77 | -msgstr "" | |
| 76 | +msgstr "Link apagado com sucesso!" | |
| 78 | 77 | |
| 79 | -#: links/views.py:69 | |
| 78 | +#: .\views.py:69 | |
| 80 | 79 | msgid "Link updated successfully!" |
| 81 | -msgstr "" | |
| 80 | +msgstr "Link atualizado com sucesso!" | ... | ... |
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-10-28 18:34 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | + ('links', '0001_initial'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AddField( | |
| 16 | + model_name='link', | |
| 17 | + name='image', | |
| 18 | + field=models.ImageField(blank=True, upload_to='links/'), | |
| 19 | + ), | |
| 20 | + ] | ... | ... |
links/models.py
| ... | ... | @@ -5,6 +5,7 @@ from autoslug.fields import AutoSlugField |
| 5 | 5 | class Link(Material): |
| 6 | 6 | link_url = models.URLField() |
| 7 | 7 | link_description = models.CharField(max_length=200) |
| 8 | + image = models.ImageField(upload_to = 'links/',blank = True) | |
| 8 | 9 | class Meta: |
| 9 | 10 | verbose_name = 'Link' |
| 10 | 11 | verbose_name_plural = "Links" | ... | ... |
19.5 KB
links/templates/links/create_link.html
| ... | ... | @@ -12,27 +12,29 @@ |
| 12 | 12 | <!-- Card --> |
| 13 | 13 | <form method="post" action="" id="form-link" enctype="multipart/form-data"> |
| 14 | 14 | {% csrf_token %} |
| 15 | - {% if messages %} | |
| 16 | - {% for message in messages %} | |
| 17 | - <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert"> | |
| 18 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 19 | - <span aria-hidden="true">×</span> | |
| 20 | - </button> | |
| 21 | - <p>{{ message }}</p> | |
| 22 | - </div> | |
| 23 | - {% endfor %} | |
| 24 | - {% endif %} | |
| 25 | 15 | {% for field in form %} |
| 16 | + <div class ="form-group"> | |
| 26 | 17 | {% if field.field.required %} |
| 27 | 18 | <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label> |
| 28 | - {% else %} | |
| 29 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
| 30 | 19 | {% endif %} |
| 31 | - {% render_field field class='form-control' %} | |
| 20 | + {% render_field field class='form-control input-sm' %} | |
| 21 | + {% if field.errors %} | |
| 22 | + <div class="alert alert-danger alert-dismissible clearfix" role="alert"> | |
| 23 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 24 | + <span aria-hidden="true">×</span> | |
| 25 | + </button> | |
| 26 | + <ul> | |
| 27 | + {% for error in field.errors %} | |
| 28 | + <li>{{ error }}</li> | |
| 29 | + {% endfor %} | |
| 30 | + </ul> | |
| 31 | + </div> | |
| 32 | + {% endif %} | |
| 33 | + </div> | |
| 32 | 34 | {% endfor %} |
| 33 | 35 | <div class="form-group"> |
| 34 | - <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">{% trans 'Cancel' %}</a> | |
| 35 | - <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %]</button> | |
| 36 | + <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Cancel" %}</button> | |
| 37 | + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button> | |
| 36 | 38 | </div> |
| 37 | 39 | <!-- .end Card --> |
| 38 | 40 | </div> |
| ... | ... | @@ -40,29 +42,32 @@ |
| 40 | 42 | </div> |
| 41 | 43 | </div> |
| 42 | 44 | <!-- EndModal --> |
| 43 | - | |
| 44 | -{# // <script src="{% static '/links.js' %}"></script> #} | |
| 45 | -<script type="text/javascript"> | |
| 46 | - $("#form-link").submit(function(event) { | |
| 47 | - var data = new FormData($('#form-link').get(0)); | |
| 48 | - $.ajax({ | |
| 49 | - url: "{% url 'course:links:create_link' topic.slug %}", | |
| 50 | - type: $("#form-link").attr('method'), | |
| 51 | - data: data, | |
| 52 | - cache: false, | |
| 53 | - processData: false, | |
| 54 | - contentType: false, | |
| 55 | - success: function(data) { | |
| 56 | - $('#createLinksModal').modal('hide'); | |
| 57 | - $('#list-topic{{ topic.id }}-links').append(data); | |
| 58 | - $('#list-topic{{ topic.id }}-links-edit').append(data); | |
| 59 | - }, | |
| 60 | - error: function(data){ | |
| 61 | - $('.erro').html(data.responseText); | |
| 62 | - $('.modal-backdrop').remove(); | |
| 63 | - $('#createLinksModal').modal(); | |
| 64 | - } | |
| 65 | - }); | |
| 66 | - event.preventDefault(); | |
| 67 | - }); | |
| 68 | -</script> | |
| 45 | +{% block script_link %} | |
| 46 | + {# // <script src="{% static 'js/links.js' %}"></script> #} | |
| 47 | + <script type="text/javascript"> | |
| 48 | + $("#form-link").submit(function(event) { | |
| 49 | + var data = new FormData($('#form-link').get(0)); | |
| 50 | + $.ajax({ | |
| 51 | + url: "{% url 'course:links:create_link' topic.slug %}", | |
| 52 | + type: $("#form-link").attr('method'), | |
| 53 | + data: data, | |
| 54 | + cache: false, | |
| 55 | + processData: false, | |
| 56 | + contentType: false, | |
| 57 | + success: function(data) { | |
| 58 | + $('#createLinksModal').modal('hide'); | |
| 59 | + $('#list-topic{{ topic.id }}-links').append(data); | |
| 60 | + $('#list-topic{{ topic.id }}-links-edit').append(data); | |
| 61 | + alertify.alert('Link successfully created!') | |
| 62 | + }, | |
| 63 | + error: function(data){ | |
| 64 | + $('.erro').html(data.responseText); | |
| 65 | + $('.modal-backdrop').remove(); | |
| 66 | + $('#createLinksModal').modal(); | |
| 67 | + alertify.alert('Invalid link, insert a valid one!'); | |
| 68 | + } | |
| 69 | + }); | |
| 70 | + event.preventDefault(); | |
| 71 | + }); | |
| 72 | + </script> | |
| 73 | +{% endblock script_link %} | ... | ... |
links/templates/links/delete_link.html
| 1 | -{% load widget_tweaks i18n %} | |
| 2 | -<!-- MODAL REMOVE LINK --> | |
| 3 | -<div class="modal" id="removeLink"> | |
| 4 | - <div class="modal-dialog"> | |
| 5 | - <div class="modal-content"> | |
| 6 | - <div class="modal-header"> | |
| 7 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button> | |
| 8 | - <h4 class="modal-title"></h4> | |
| 9 | - </div> | |
| 10 | - <div class="modal-body"> | |
| 11 | - <p>{% trans 'Do you really want to delete this link?' %}</p> | |
| 12 | - </div> | |
| 13 | - <div class="modal-footer"> | |
| 14 | - <!-- --> | |
| 15 | - <button type="button" class="btn btn-primary btn-default" data-dismiss="modal">{% trans 'Cancel' %}</button> | |
| 16 | - <a href="http://www.google.com" target="_self"><button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">{% trans 'Confirm' %}</button></a> | |
| 1 | +{% load static widget_tweaks i18n %} | |
| 17 | 2 | |
| 18 | - </div> | |
| 3 | +<!-- MODAL DELETE LINK --> | |
| 4 | +<link rel="stylesheet" type="text/css" href="{% static 'css/link.css' %}"> | |
| 5 | + | |
| 6 | +<div class="erro-update"> | |
| 7 | + <div class="modal fade" id="linkDeleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteLinkLabel" style="z-index: 10"> | |
| 8 | + <div class="modal-dialog" role="document"> | |
| 9 | + <div class="modal-content"> | |
| 10 | + <div class="modal-header"> | |
| 11 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 12 | + <h4 class="modal-title" id="deleteLinkLabel">{% trans 'Delete Link' %}</h4> | |
| 13 | + </div> | |
| 14 | + <div class="modal-body"> | |
| 15 | + <!-- Card --> | |
| 16 | + <form class="form-horizontal" method="post" id="form-delete-link" enctype="multipart/form-data"> | |
| 17 | + {% csrf_token %} | |
| 18 | + <fieldset> | |
| 19 | + <div class="col-md-12"> | |
| 20 | + {% trans "Are you sure to delete the link " %} <strong>"{{ link.name }}"</strong> </a> of {{ link.topic.name }}? | |
| 21 | + </div> | |
| 22 | + <div class="form-group"> | |
| 23 | + <div class="col-md-12"> | |
| 24 | + <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button> | |
| 25 | + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Delete' %}</button> | |
| 26 | + </div> | |
| 27 | + </div> | |
| 28 | + </fieldset> | |
| 29 | + </form> | |
| 30 | + <!-- .end Card --> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + </div> | |
| 19 | 34 | </div> |
| 20 | - </div> | |
| 21 | 35 | </div> |
| 22 | -<!-- END --> | |
| 36 | + | |
| 37 | +{% block script_link %} | |
| 38 | + | |
| 39 | + {# // <script src="{% static 'js/link.js' %}"></script> #} | |
| 40 | + <script type="text/javascript"> | |
| 41 | + $("#form-delete-link").submit(function(event) { | |
| 42 | + var data = new FormData($('#form-delete-link').get(0)); | |
| 43 | + $.ajax({ | |
| 44 | + url: "{% url 'course:links:delete_link' link.slug %}", | |
| 45 | + type: $("#form-delete-link").attr('method'), | |
| 46 | + data: data, | |
| 47 | + cache: false, | |
| 48 | + processData: false, | |
| 49 | + contentType: false, | |
| 50 | + success: function(data) { | |
| 51 | + $('#linkDeleteModal').modal('hide'); | |
| 52 | + $('#link_{{ link.slug }}').remove(); | |
| 53 | + $('#link_edit_icon_{{ link.slug }}').remove(); | |
| 54 | + $('#link_edit_{{ link.slug }}').remove(); | |
| 55 | + alertify.alert('Link successfully deleted!') | |
| 56 | + }, | |
| 57 | + error: function(data){ | |
| 58 | + // $('.erro-update').html(data.responseText); | |
| 59 | + $('.modal-backdrop').remove(); | |
| 60 | + $('#linkDeteleModal').modal(); | |
| 61 | + alertify.alert('Error when trying to delete.'); | |
| 62 | + } | |
| 63 | + }); | |
| 64 | + event.preventDefault(); | |
| 65 | + }); | |
| 66 | + </script> | |
| 67 | +{% endblock script_link %} | |
| 68 | +<!-- EndModal --> | ... | ... |
links/templates/links/render_link.html
| 1 | -<li><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link}}</a></li> | |
| 1 | +<li id="link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link.name}}</a></li> | ... | ... |
links/templates/links/update_link.html
| ... | ... | @@ -5,29 +5,73 @@ |
| 5 | 5 | <div class="modal-content"> |
| 6 | 6 | <div class="modal-header"> |
| 7 | 7 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 8 | - <h4 class="modal-title" id="myModalLabel">{% trans 'Links' %}</h4> | |
| 8 | + <h4 class="modal-title" id="myModalLabel">{% trans 'Edit Link' %}</h4> | |
| 9 | 9 | </div> |
| 10 | 10 | <div class="modal-body"> |
| 11 | 11 | <!-- Card --> |
| 12 | + <form class="form-horizontal" method="post" id="form-update-link" enctype="multipart/form-data"> | |
| 13 | + {% csrf_token %} | |
| 14 | + {% for field in form %} | |
| 15 | + <div class="form-group is-empty"> | |
| 16 | + <div class="col-md-12"> | |
| 17 | + {% if field.field.required %} | |
| 18 | + <label for="{{ field.auto_id }}" class="control-label">{{ field.label }}<span>*</span></label> | |
| 19 | + {% else %} | |
| 20 | + <label for="{{ field.auto_id }}" class=" control-label">{{ field.label }}</label> | |
| 21 | + {% endif %} | |
| 22 | + {% render_field field class='form-control input-sm' %} | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + {% if field.errors %} | |
| 26 | + <div class="alert alert-danger alert-dismissible clearfix" role="alert"> | |
| 27 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 28 | + <span aria-hidden="true">×</span> | |
| 29 | + </button> | |
| 30 | + <ul> | |
| 31 | + {% for error in field.errors %} | |
| 32 | + <li>{{ error }}</li> | |
| 33 | + {% endfor %} | |
| 34 | + </ul> | |
| 35 | + </div> | |
| 36 | + {% endif %} | |
| 37 | + {% endfor %} | |
| 12 | 38 | <div class="form-group"> |
| 13 | - <label class="control-label" for="inputDefault">{% trans 'Name' %}</label> | |
| 14 | - <input value="Python" type="text" class="form-control" id="inputDefault"> | |
| 39 | + <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Cancel" %}</button> | |
| 40 | + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button> | |
| 15 | 41 | </div> |
| 16 | - <div class="form-group"> | |
| 17 | - <label class="control-label" for="inputDefault">{% trans 'URL' %}</label> | |
| 18 | - <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault"> | |
| 19 | - </div> | |
| 20 | - <div class="form-group is-empty"> | |
| 21 | - <label class="control-label" for="inputDefault">{% trans 'Descrição' %}</label> | |
| 22 | - <textarea class="form-control" rows="3"></textarea> | |
| 23 | - </div> | |
| 24 | - <div class="form-group"> | |
| 25 | - <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">{% trans 'Cancel' %}</a> | |
| 26 | - <a href="javascript:void(0)" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a> | |
| 27 | - </div> | |
| 28 | 42 | <!-- .end Card --> |
| 29 | 43 | </div> |
| 30 | 44 | </div> |
| 31 | 45 | </div> |
| 32 | 46 | </div> |
| 33 | 47 | <!-- EndModal --> |
| 48 | +{% block script_link %} | |
| 49 | + | |
| 50 | + {# // <script src="{% static 'js/links.js' %}"></script> #} | |
| 51 | + <script type="text/javascript"> | |
| 52 | + $("#form-update-link").submit(function(event) { | |
| 53 | + var data = new FormData($('#form-update-link').get(0)); | |
| 54 | + $.ajax({ | |
| 55 | + url: "{% url 'course:links:update_link' link.slug %}", | |
| 56 | + type: $("#form-update-link").attr('method'), | |
| 57 | + data: data, | |
| 58 | + cache: false, | |
| 59 | + processData: false, | |
| 60 | + contentType: false, | |
| 61 | + success: function(data) { | |
| 62 | + $('#linksModalEdit').modal('hide'); | |
| 63 | + $('#link_edit_{{ link.slug }}').replaceWith(data); | |
| 64 | + $('#link_{{ link.slug }}').replaceWith(data); | |
| 65 | + alertify.alert("Sucessfully Updated!") | |
| 66 | + }, | |
| 67 | + error: function(data){ | |
| 68 | + $('.erro-update').html(data.responseText); | |
| 69 | + $('.modal-backdrop').remove(); | |
| 70 | + $('#linksModalEdit').modal(); | |
| 71 | + alertify.alert('Invalid link, insert a valid one!'); | |
| 72 | + } | |
| 73 | + }); | |
| 74 | + event.preventDefault(); | |
| 75 | + }); | |
| 76 | + </script> | |
| 77 | +{% endblock script_link %} | ... | ... |
links/templates/links/view_link.html
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | <div class="modal-body"> |
| 11 | 11 | <!-- Card --> |
| 12 | 12 | <article class="card animated fadeInLeft"> |
| 13 | - <img class="card-img-top img-responsive" src="https://www.python.org/static/opengraph-icon-200x200.png" align="left"> | |
| 13 | + <img class="card-img-top img-responsive" src="{{ link.image.url}}" width="200" height="200" align="left"> | |
| 14 | 14 | <div class="card-block"> |
| 15 | 15 | <b class="card-title">{{link.name}}</b><p></p> |
| 16 | 16 | <p class="card-text"> </p><p>{{link.link_description}}</p> | ... | ... |
links/tests.py
| ... | ... | @@ -154,7 +154,9 @@ class LinkTestCase(TestCase): |
| 154 | 154 | url = reverse('course:links:update_link',kwargs={'slug': self.link.slug}) |
| 155 | 155 | print("slug",self.link.slug) |
| 156 | 156 | data = { |
| 157 | + "name" : 'testinglink', | |
| 157 | 158 | "link_description":'new description', |
| 159 | + "link_url" : 'teste.com', | |
| 158 | 160 | } |
| 159 | 161 | self.assertEqual(Link.objects.all()[0].link_description, "testdescription") # old description |
| 160 | 162 | response = self.client.post(url, data) | ... | ... |
links/urls.py
| ... | ... | @@ -3,8 +3,8 @@ from . import views |
| 3 | 3 | |
| 4 | 4 | urlpatterns = [ |
| 5 | 5 | url(r'^create_link/(?P<slug>[\w_-]+)/$', views.CreateLink.as_view(), name='create_link'), |
| 6 | - url(r'^deletelink/(?P<linkname>[\w_-]+)/$', views.deleteLink,name = 'delete_link'), | |
| 7 | - url(r'^updatelink/(?P<slug>[\w_-]+)/$', views.UpdateLink.as_view(),name = 'update_link'), | |
| 8 | - url(r'^render-link/(?P<id>[0-9]+)/$', views.render_link, name='render_link'), | |
| 6 | + url(r'^delete_link/(?P<slug>[\w_-]+)/$', views.DeleteLink.as_view(),name = 'delete_link'), | |
| 7 | + url(r'^update_link/(?P<slug>[\w_-]+)/$', views.UpdateLink.as_view(),name = 'update_link'), | |
| 8 | + url(r'^render-link/(?P<slug>[\w_-]+)/$', views.render_link, name='render_link'), | |
| 9 | 9 | url(r'^view_link/(?P<slug>[\w_-]+)/$',views.ViewLink.as_view(),name = 'view_link') |
| 10 | 10 | ] | ... | ... |
links/views.py
| ... | ... | @@ -6,12 +6,16 @@ from django.utils.translation import ugettext_lazy as _ |
| 6 | 6 | from django.shortcuts import get_object_or_404,redirect |
| 7 | 7 | from django.contrib.auth.mixins import LoginRequiredMixin |
| 8 | 8 | from rolepermissions.mixins import HasRoleMixin |
| 9 | +from core.mixins import NotificationMixin | |
| 10 | +from django.urls import reverse | |
| 11 | +from django.core.files.base import ContentFile | |
| 12 | +from rolepermissions.verifications import has_role | |
| 9 | 13 | |
| 14 | +from .image_crawler import * | |
| 10 | 15 | from courses.models import Topic |
| 11 | 16 | from .models import Link |
| 12 | 17 | from .forms import * |
| 13 | -from core.mixins import NotificationMixin | |
| 14 | -from django.urls import reverse | |
| 18 | + | |
| 15 | 19 | |
| 16 | 20 | # Create your views here. |
| 17 | 21 | class CreateLink(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.CreateView): |
| ... | ... | @@ -20,19 +24,36 @@ class CreateLink(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.Cr |
| 20 | 24 | form_class = CreateLinkForm |
| 21 | 25 | success_url = reverse_lazy('course:manage') |
| 22 | 26 | context_object_name = 'form' |
| 27 | + def form_invalid(self,form): | |
| 28 | + context = super(CreateLink, self).form_invalid(form) | |
| 29 | + context.status_code = 400 | |
| 30 | + | |
| 31 | + return context | |
| 23 | 32 | |
| 24 | 33 | def form_valid(self, form): |
| 25 | 34 | self.object = form.save(commit = False) |
| 26 | 35 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
| 27 | 36 | self.object.topic = topic |
| 28 | - messages.success(self.request, _('Link created successfully!')) | |
| 29 | - | |
| 30 | 37 | self.object.save() |
| 38 | + self.link = Link.objects.get(slug = self.object.slug) | |
| 39 | + self.formato,self.baixado = get_images(self.link.link_url,self.link.slug) | |
| 40 | + self.caminho = 'links/static/images/%s'%(self.link.slug)+'%s'%(self.formato) | |
| 41 | + | |
| 31 | 42 | super(CreateLink, self).createNotification(message="created a Link at "+ self.object.topic.name, actor=self.request.user, |
| 32 | - resource_name=self.object.name, resource_link= reverse('course:view_topic', args=[self.object.topic.slug]), | |
| 43 | + resource_name=self.object.name, resource_link= reverse('course:view_topic', args=[self.object.topic.slug]), | |
| 33 | 44 | users=self.object.topic.subject.students.all()) |
| 34 | - | |
| 45 | + self.setImage() | |
| 35 | 46 | return self.get_success_url() |
| 47 | + def setImage(self): | |
| 48 | + if self.baixado: | |
| 49 | + with open(self.caminho,'rb') as f: | |
| 50 | + data = f.read() | |
| 51 | + nome = '%s'%(self.link.slug)+"%s"%(self.formato) | |
| 52 | + self.link.image.save(nome,ContentFile(data)) | |
| 53 | + else: | |
| 54 | + with open('links/static/images/default.jpg','rb') as f: | |
| 55 | + data = f.read() | |
| 56 | + self.link.image.save('default.jpg',ContentFile(data)) | |
| 36 | 57 | def get_context_data(self,**kwargs): |
| 37 | 58 | context = {} |
| 38 | 59 | context['links'] = Link.objects.all() |
| ... | ... | @@ -41,20 +62,37 @@ class CreateLink(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.Cr |
| 41 | 62 | context["topic"] = topic |
| 42 | 63 | return context |
| 43 | 64 | def get_success_url(self): |
| 44 | - self.success_url = redirect('course:links:render_link', id = self.object.id) | |
| 65 | + self.success_url = redirect('course:links:render_link', slug = self.object.slug) | |
| 45 | 66 | return self.success_url |
| 46 | -def deleteLink(request,linkname): | |
| 47 | - link = get_object_or_404(Link,name = linkname) | |
| 48 | - link.delete() | |
| 49 | - template_name = 'links/delete_link.html' | |
| 50 | - messages.success(request,_("Link deleted Successfully!")) | |
| 51 | - | |
| 52 | - return redirect('course:manage') | |
| 53 | 67 | |
| 54 | -def render_link(request, id): | |
| 68 | +class DeleteLink(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): | |
| 69 | + allowed_roles = ['professor', 'system_admin'] | |
| 70 | + login_url = reverse_lazy("core:home") | |
| 71 | + redirect_field_name = 'next' | |
| 72 | + model = Link | |
| 73 | + template_name = 'links/delete_link.html' | |
| 74 | + | |
| 75 | + def dispatch(self, *args, **kwargs): | |
| 76 | + link = get_object_or_404(Link, slug = self.kwargs.get('slug')) | |
| 77 | + if(not (link.topic.owner == self.request.user) and not(has_role(self.request.user, 'system_admin')) ): | |
| 78 | + return self.handle_no_permission() | |
| 79 | + return super(DeleteLink, self).dispatch(*args, **kwargs) | |
| 80 | + | |
| 81 | + def get_context_data(self, **kwargs): | |
| 82 | + context = super(DeleteLink, self).get_context_data(**kwargs) | |
| 83 | + context['course'] = self.object.topic.subject.course | |
| 84 | + context['subject'] = self.object.topic.subject | |
| 85 | + context['link'] = self.object | |
| 86 | + context["topic"] = self.object.topic | |
| 87 | + return context | |
| 88 | + | |
| 89 | + def get_success_url(self): | |
| 90 | + return reverse_lazy('course:view_topic', kwargs={'slug' : self.object.topic.slug}) | |
| 91 | + | |
| 92 | +def render_link(request, slug): | |
| 55 | 93 | template_name = 'links/render_link.html' |
| 56 | 94 | context = { |
| 57 | - 'link': get_object_or_404(Link, id = id) | |
| 95 | + 'link': get_object_or_404(Link, slug = slug) | |
| 58 | 96 | } |
| 59 | 97 | return render(request, template_name, context) |
| 60 | 98 | |
| ... | ... | @@ -64,18 +102,41 @@ class UpdateLink(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
| 64 | 102 | template_name = 'links/update_link.html' |
| 65 | 103 | form_class = UpdateLinkForm |
| 66 | 104 | success_url = reverse_lazy('course:links:render_link') |
| 67 | - def form_valid(self, form): | |
| 68 | - form.save() | |
| 69 | - messages.success(self.request, _('Link updated successfully!')) | |
| 70 | 105 | |
| 71 | - return super(UpdateLink, self).form_valid(form) | |
| 106 | + def form_invalid(self,form): | |
| 107 | + context = super(UpdateLink, self).form_invalid(form) | |
| 108 | + context.status_code = 400 | |
| 72 | 109 | |
| 110 | + return context | |
| 111 | + def form_valid(self, form): | |
| 112 | + formulario = form | |
| 113 | + if formulario.has_changed(): | |
| 114 | + if 'link_url' in formulario.changed_data: | |
| 115 | + self.object = form.save() | |
| 116 | + self.link = Link.objects.get(slug = self.object.slug) | |
| 117 | + self.formato,self.baixado = get_images(self.link.link_url,self.link.slug) | |
| 118 | + self.caminho = 'links/static/images/%s'%(self.link.slug)+'%s'%(self.formato) | |
| 119 | + self.setImage() | |
| 120 | + else: | |
| 121 | + form.save() | |
| 122 | + else: | |
| 123 | + form.save() | |
| 124 | + return super(UpdateLink, self).form_valid(form) | |
| 125 | + def setImage(self): | |
| 126 | + if self.baixado: | |
| 127 | + with open(self.caminho,'rb') as f: | |
| 128 | + data = f.read() | |
| 129 | + nome = '%s'%(self.link.slug)+"%s"%(self.formato) | |
| 130 | + self.object.image.save(nome,ContentFile(data)) | |
| 131 | + else: | |
| 132 | + with open('links/static/images/default.jpg','rb') as f: | |
| 133 | + data = f.read() | |
| 134 | + self.object.image.save('default.jpg',ContentFile(data)) | |
| 73 | 135 | def get_object(self, queryset=None): |
| 74 | 136 | self.object = get_object_or_404(Link, slug = self.kwargs.get('slug')) |
| 75 | - print(self.object.link_description) | |
| 76 | 137 | return self.object |
| 77 | 138 | def get_success_url(self): |
| 78 | - self.success_url = redirect('course:links:render_link', id = self.object.id) | |
| 139 | + self.success_url = reverse_lazy('course:links:render_link', args = (self.object.slug, )) | |
| 79 | 140 | return self.success_url |
| 80 | 141 | class ViewLink(LoginRequiredMixin,HasRoleMixin,generic.DetailView): |
| 81 | 142 | allowed_roles = ['professor', 'system_admin'] |
| ... | ... | @@ -88,7 +149,7 @@ class ViewLink(LoginRequiredMixin,HasRoleMixin,generic.DetailView): |
| 88 | 149 | context['link'] = link |
| 89 | 150 | return context |
| 90 | 151 | def get_success_url(self): |
| 91 | - self.success_url = redirect('course:links:render_link', id = self.object.id) | |
| 152 | + self.success_url = redirect('course:links:render_link', slug = self.object.slug) | |
| 92 | 153 | return self.success_url |
| 93 | 154 | def get_queryset(self): |
| 94 | 155 | self.queryset = Link.objects.filter(slug = self.kwargs.get('slug')) | ... | ... |
poll/locale/pt_BR/LC_MESSAGES/django.po
| ... | ... | @@ -24,108 +24,108 @@ msgstr "" |
| 24 | 24 | |
| 25 | 25 | #: poll/models.py:11 poll/models.py:32 |
| 26 | 26 | msgid "Poll" |
| 27 | -msgstr "" | |
| 27 | +msgstr "Enquete" | |
| 28 | 28 | |
| 29 | 29 | #: poll/models.py:12 |
| 30 | 30 | msgid "Polls" |
| 31 | -msgstr "" | |
| 31 | +msgstr "Enquetes" | |
| 32 | 32 | |
| 33 | 33 | #: poll/models.py:18 poll/models.py:24 poll/templates/poll/answer.html:11 |
| 34 | 34 | #: poll/templates/poll/answer_student.html:27 |
| 35 | 35 | #: poll/templates/poll/create.html:68 poll/templates/poll/create.html:85 |
| 36 | 36 | #: poll/templates/poll/view.html:33 |
| 37 | 37 | msgid "Answer" |
| 38 | -msgstr "" | |
| 38 | +msgstr "Reposta" | |
| 39 | 39 | |
| 40 | 40 | #: poll/models.py:19 |
| 41 | 41 | msgid "Order" |
| 42 | -msgstr "" | |
| 42 | +msgstr "Ordem" | |
| 43 | 43 | |
| 44 | 44 | #: poll/models.py:20 poll/models.py:25 |
| 45 | 45 | msgid "Answers" |
| 46 | -msgstr "" | |
| 46 | +msgstr "Repostas" | |
| 47 | 47 | |
| 48 | 48 | #: poll/models.py:31 |
| 49 | 49 | msgid "Answered" |
| 50 | -msgstr "" | |
| 50 | +msgstr "Respondido" | |
| 51 | 51 | |
| 52 | 52 | #: poll/models.py:33 |
| 53 | 53 | msgid "Answers Students" |
| 54 | -msgstr "" | |
| 54 | +msgstr "Respostas dos estudantes" | |
| 55 | 55 | |
| 56 | 56 | #: poll/models.py:34 |
| 57 | 57 | msgid "Student" |
| 58 | -msgstr "" | |
| 58 | +msgstr "Estudante" | |
| 59 | 59 | |
| 60 | 60 | #: poll/models.py:35 |
| 61 | 61 | msgid "Answered Date" |
| 62 | -msgstr "" | |
| 62 | +msgstr "Data de resposta" | |
| 63 | 63 | |
| 64 | 64 | #: poll/models.py:38 |
| 65 | 65 | msgid "Answer Stundent" |
| 66 | -msgstr "" | |
| 66 | +msgstr "Resposta do estudante" | |
| 67 | 67 | |
| 68 | 68 | #: poll/models.py:39 |
| 69 | 69 | msgid "Answers Student" |
| 70 | -msgstr "" | |
| 70 | +msgstr "Respostas dos estudantes" | |
| 71 | 71 | |
| 72 | 72 | #: poll/templates/poll/answer.html:12 poll/templates/poll/create.html:69 |
| 73 | 73 | #: poll/templates/poll/create.html:86 |
| 74 | 74 | msgid "Possible answer for the question" |
| 75 | -msgstr "" | |
| 75 | +msgstr "Possível resposta para a questão" | |
| 76 | 76 | |
| 77 | 77 | #: poll/templates/poll/create.html:22 |
| 78 | 78 | msgid "Create a Poll" |
| 79 | -msgstr "" | |
| 79 | +msgstr "Criar enquete" | |
| 80 | 80 | |
| 81 | 81 | #: poll/templates/poll/create.html:38 |
| 82 | 82 | msgid "Question?" |
| 83 | -msgstr "" | |
| 83 | +msgstr "Pergunta?" | |
| 84 | 84 | |
| 85 | 85 | #: poll/templates/poll/create.html:39 |
| 86 | 86 | msgid "A Question to be answered" |
| 87 | -msgstr "" | |
| 87 | +msgstr "A questão a ser respondida" | |
| 88 | 88 | |
| 89 | 89 | #: poll/templates/poll/create.html:154 |
| 90 | 90 | msgid "Close" |
| 91 | -msgstr "" | |
| 91 | +msgstr "Fechar" | |
| 92 | 92 | |
| 93 | 93 | #: poll/templates/poll/create.html:157 |
| 94 | 94 | msgid "Create" |
| 95 | -msgstr "" | |
| 95 | +msgstr "Criar" | |
| 96 | 96 | |
| 97 | 97 | #: poll/templates/poll/remove.html:7 |
| 98 | 98 | msgid "Delete Poll" |
| 99 | -msgstr "" | |
| 99 | +msgstr "Deletar enquete" | |
| 100 | 100 | |
| 101 | 101 | #: poll/templates/poll/remove.html:15 |
| 102 | 102 | msgid "Are you sure you want to delete the subject" |
| 103 | -msgstr "" | |
| 103 | +msgstr "Tem certeza que deseja deletar este assunto" | |
| 104 | 104 | |
| 105 | 105 | #: poll/templates/poll/remove.html:19 |
| 106 | 106 | msgid "Delete" |
| 107 | -msgstr "" | |
| 107 | +msgstr "Deletar" | |
| 108 | 108 | |
| 109 | 109 | #: poll/templates/poll/update.html:7 |
| 110 | 110 | msgid "Update a Poll" |
| 111 | -msgstr "" | |
| 111 | +msgstr "Atualizar enquete" | |
| 112 | 112 | |
| 113 | 113 | #: poll/templates/poll/update.html:12 |
| 114 | 114 | msgid "Update" |
| 115 | -msgstr "" | |
| 115 | +msgstr "Atualizar" | |
| 116 | 116 | |
| 117 | 117 | #: poll/templates/poll/view.html:17 |
| 118 | 118 | msgid "Limit date:" |
| 119 | -msgstr "" | |
| 119 | +msgstr "Data limite:" | |
| 120 | 120 | |
| 121 | 121 | #: poll/templates/poll/view.html:20 |
| 122 | 122 | msgid "Status:" |
| 123 | -msgstr "" | |
| 123 | +msgstr "Status:" | |
| 124 | 124 | |
| 125 | 125 | #: poll/templates/poll/view.html:22 |
| 126 | 126 | msgid "Poll answered" |
| 127 | -msgstr "" | |
| 127 | +msgstr "Enquete respondida" | |
| 128 | 128 | |
| 129 | 129 | #: poll/templates/poll/view.html:24 |
| 130 | 130 | msgid "Poll don't yet answered" |
| 131 | -msgstr "" | |
| 131 | +msgstr "A enquete não foi respondida ainda" | ... | ... |
users/forms.py
| ... | ... | @@ -63,7 +63,6 @@ class UpdateUserForm(forms.ModelForm): |
| 63 | 63 | def clean_birth_date(self): |
| 64 | 64 | birth_date = self.cleaned_data['birth_date'] |
| 65 | 65 | if birth_date >= date.today(): |
| 66 | - print('===============' + date.today() + '================') | |
| 67 | 66 | raise forms.ValidationError(_('Please enter a valid date')) |
| 68 | 67 | return birth_date |
| 69 | 68 | |
| ... | ... | @@ -73,10 +72,18 @@ class UpdateUserForm(forms.ModelForm): |
| 73 | 72 | 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'titration', |
| 74 | 73 | 'year_titration', 'institution', 'curriculum', 'is_staff', 'is_active'] |
| 75 | 74 | |
| 76 | -class UpdateProfileForm(UpdateUserForm): | |
| 75 | +class UpdateProfileFormAdmin(UpdateUserForm): | |
| 77 | 76 | |
| 78 | 77 | class Meta: |
| 79 | 78 | model = User |
| 80 | 79 | fields = ['username', 'name', 'email', 'birth_date', 'city', |
| 81 | 80 | 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'titration', |
| 82 | 81 | 'year_titration', 'institution', 'curriculum', 'is_staff', 'is_active'] |
| 82 | + | |
| 83 | +class UpdateProfileForm(UpdateUserForm): | |
| 84 | + | |
| 85 | + class Meta: | |
| 86 | + model = User | |
| 87 | + fields = ['username', 'name', 'email', 'birth_date', 'city', | |
| 88 | + 'state', 'gender', 'cpf', 'phone', 'image', 'titration', | |
| 89 | + 'year_titration', 'institution', 'curriculum'] | ... | ... |
users/templates/list_users.html
| 1 | 1 | {% extends 'home.html' %} |
| 2 | 2 | |
| 3 | -{% load i18n pagination django_bootstrap_breadcrumbs static %} | |
| 3 | +{% load i18n pagination django_bootstrap_breadcrumbs permission_tags static %} | |
| 4 | 4 | |
| 5 | 5 | {% block breadcrumbs %} |
| 6 | 6 | |
| ... | ... | @@ -9,20 +9,23 @@ |
| 9 | 9 | |
| 10 | 10 | {% endblock %} |
| 11 | 11 | |
| 12 | -{% block sidebar %} | |
| 13 | - <div class="panel panel-primary navigation"> | |
| 14 | - <div class="panel-heading"> | |
| 15 | - <h5>{% trans 'Menu' %}</h5> | |
| 16 | - </div> | |
| 17 | - <div class="panel-body"> | |
| 18 | - <ul class="nav nav-pills nav-stacked"> | |
| 19 | - <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> | |
| 20 | - <li><a href="{% url 'users:create' %}">{% trans 'Add user' %}</a></li> | |
| 21 | - <li><a href="javascript:void(0)">{% trans 'Send email' %}</a></li> | |
| 22 | - </ul> | |
| 12 | +{% if user|has_role:'system_admin' %} | |
| 13 | + {% block sidebar %} | |
| 14 | + <div class="panel panel-primary navigation"> | |
| 15 | + <div class="panel-heading"> | |
| 16 | + <h5>{% trans 'Menu' %}</h5> | |
| 17 | + </div> | |
| 18 | + <div class="panel-body"> | |
| 19 | + <ul class="nav nav-pills nav-stacked"> | |
| 20 | + <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> | |
| 21 | + <li><a href="{% url 'users:create' %}">{% trans 'Add user' %}</a></li> | |
| 22 | + <li><a href="javascript:void(0)">{% trans 'Send email' %}</a></li> | |
| 23 | + </ul> | |
| 24 | + </div> | |
| 23 | 25 | </div> |
| 24 | - </div> | |
| 25 | -{% endblock %} | |
| 26 | + {% endblock %} | |
| 27 | +{% endif %} | |
| 28 | + | |
| 26 | 29 | |
| 27 | 30 | {% block content %} |
| 28 | 31 | {% if messages %} |
| ... | ... | @@ -54,7 +57,7 @@ |
| 54 | 57 | <div class="panel-body"> |
| 55 | 58 | <div class="col-md-4"> |
| 56 | 59 | {% if acc.image %} |
| 57 | - <div style="background-image: url('{{ acc.image.url }}'); background-size: 100%" alt="photoUser" class="img-circle img-responsive img-list-user"></div> | |
| 60 | + <div style="background-image: url('{{ acc.image.url }}'); background-size: 100% 100%; background-repeat: no-repeat;" alt="photoUser" class="img-circle img-responsive img-list-user"></div> | |
| 58 | 61 | {% else %} |
| 59 | 62 | {% if acc.gender == 'M' %} |
| 60 | 63 | <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user"> | ... | ... |
users/templates/users/edit_profile.html
| 1 | -{% extends 'list_users.html' %} | |
| 1 | +{% extends 'users/profile.html' %} | |
| 2 | 2 | |
| 3 | 3 | {% load static i18n permission_tags %} |
| 4 | 4 | {% load widget_tweaks %} |
| ... | ... | @@ -6,9 +6,13 @@ |
| 6 | 6 | {% load django_bootstrap_breadcrumbs %} |
| 7 | 7 | |
| 8 | 8 | {% block breadcrumbs %} |
| 9 | - | |
| 10 | - {{ block.super }} | |
| 11 | - {% breadcrumb 'Update User' 'users:update' %} | |
| 9 | + {% if user|has_role:'system_admin' %} | |
| 10 | + {{ block.super }} | |
| 11 | + {% breadcrumb 'Update User' 'users:update' %} | |
| 12 | + {% else %} | |
| 13 | + {{ block.super }} | |
| 14 | + {% breadcrumb 'Update Profile' 'users:update' %} | |
| 15 | + {% endif %} | |
| 12 | 16 | |
| 13 | 17 | {% endblock %} |
| 14 | 18 | |
| ... | ... | @@ -25,7 +29,7 @@ |
| 25 | 29 | {% endfor %} |
| 26 | 30 | {% endif %} |
| 27 | 31 | |
| 28 | - <div class="card"> | |
| 32 | + <div class="card mg-b-5m"> | |
| 29 | 33 | <div class="card-content"> |
| 30 | 34 | <div class="card-body"> |
| 31 | 35 | <form method="post" action="" enctype="multipart/form-data"> |
| ... | ... | @@ -53,6 +57,9 @@ |
| 53 | 57 | |
| 54 | 58 | {% elif field.auto_id == 'id_phone' %} |
| 55 | 59 | {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} |
| 60 | + | |
| 61 | + {% elif field.auto_id == 'id_year_titration' %} | |
| 62 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | |
| 56 | 63 | |
| 57 | 64 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} |
| 58 | 65 | {% if user|has_role:'system_admin' %} | ... | ... |
users/templates/users/profile.html
| ... | ... | @@ -44,7 +44,15 @@ |
| 44 | 44 | <div class="well well-lg"> |
| 45 | 45 | <div class="row"> |
| 46 | 46 | <div class="col-md-4"> |
| 47 | - <img src="{{ user.image_url }}" class="img-responsive center-block img-circle" alt="foto perfil" style="max-height:174px"> | |
| 47 | + {% if user.image %} | |
| 48 | + <div style="background-image: url('{{ user.image.url }}'); background-size: 100% 100%; background-repeat: no-repeat; margin-left: 8em;" alt="photoUser" class="img-circle img-responsive img-list-user"></div> | |
| 49 | + {% else %} | |
| 50 | + {% if usser.gender == 'M' %} | |
| 51 | + <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;"> | |
| 52 | + {% else %} | |
| 53 | + <img src="{% static 'img/female_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;"> | |
| 54 | + {% endif %} | |
| 55 | + {% endif %} | |
| 48 | 56 | </div> |
| 49 | 57 | <div class="col-md-8"> |
| 50 | 58 | <table class="table table-hover table-edited"> |
| ... | ... | @@ -123,22 +131,21 @@ |
| 123 | 131 | </tr> |
| 124 | 132 | <tr> |
| 125 | 133 | <td>{% trans "Institution" %}:</td> |
| 126 | - {% if user.institution %} | |
| 127 | - <td>{{user.institution}}</td> | |
| 128 | - {% else %} | |
| 129 | - <td>{% trans "Didn't inform institution" %}</td> | |
| 130 | - {% endif %} | |
| 131 | - | |
| 132 | - | |
| 134 | + {% if user.institution %} | |
| 135 | + <td>{{user.institution}}</td> | |
| 136 | + {% else %} | |
| 137 | + <td>{% trans "Didn't inform institution" %}</td> | |
| 138 | + {% endif %} | |
| 133 | 139 | </tr> |
| 134 | 140 | <tr> |
| 135 | 141 | <td>{% trans "Curriculum" %}:</td> |
| 136 | 142 | {% if user.curriculum %} |
| 137 | - <td>{{user.curriculum}}</td> | |
| 143 | + <td> | |
| 144 | + <a href="{{user.curriculum.url }}" target="_blank">link</a> | |
| 145 | + </td> | |
| 138 | 146 | {% else %} |
| 139 | 147 | <td>{% trans "Didn't upload any curriculum" %}</td> |
| 140 | 148 | {% endif %} |
| 141 | - | |
| 142 | 149 | </tr> |
| 143 | 150 | </tbody> |
| 144 | 151 | </table> | ... | ... |
users/templates/users/update.html
| ... | ... | @@ -6,10 +6,10 @@ |
| 6 | 6 | {% load django_bootstrap_breadcrumbs %} |
| 7 | 7 | |
| 8 | 8 | {% block breadcrumbs %} |
| 9 | - | |
| 10 | - {{ block.super }} | |
| 11 | - {% breadcrumb 'Update User' 'users:update' %} | |
| 12 | - | |
| 9 | + | |
| 10 | + {{ block.super }} | |
| 11 | + {% breadcrumb 'Update User' 'users:update' %} | |
| 12 | + | |
| 13 | 13 | {% endblock %} |
| 14 | 14 | |
| 15 | 15 | |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | {% endfor %} |
| 26 | 26 | {% endif %} |
| 27 | 27 | |
| 28 | - <div class="card"> | |
| 28 | + <div class="card mg-b-5m"> | |
| 29 | 29 | <div class="card-content"> |
| 30 | 30 | <div class="card-body"> |
| 31 | 31 | <form method="post" action="" enctype="multipart/form-data"> | ... | ... |
users/views.py
| ... | ... | @@ -7,8 +7,9 @@ from django.contrib.auth.mixins import LoginRequiredMixin |
| 7 | 7 | from django.core.urlresolvers import reverse_lazy |
| 8 | 8 | from django.utils.translation import ugettext_lazy as _ |
| 9 | 9 | from rolepermissions.shortcuts import assign_role |
| 10 | +from rolepermissions.verifications import has_role | |
| 10 | 11 | from .models import User |
| 11 | -from .forms import UserForm, UpdateProfileForm, UpdateUserForm | |
| 12 | +from .forms import UserForm, UpdateProfileForm, UpdateUserForm, UpdateProfileFormAdmin | |
| 12 | 13 | |
| 13 | 14 | # ================ ADMIN ======================= |
| 14 | 15 | class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): |
| ... | ... | @@ -110,8 +111,6 @@ class Remove_account(generic.TemplateView): |
| 110 | 111 | |
| 111 | 112 | |
| 112 | 113 | class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): |
| 113 | - | |
| 114 | - allowed_roles = ['student'] | |
| 115 | 114 | login_url = reverse_lazy("core:home") |
| 116 | 115 | template_name = 'users/edit_profile.html' |
| 117 | 116 | form_class = UpdateProfileForm |
| ... | ... | @@ -121,6 +120,14 @@ class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): |
| 121 | 120 | user = get_object_or_404(User, username = self.request.user.username) |
| 122 | 121 | return user |
| 123 | 122 | |
| 123 | + def get_context_data(self, **kwargs): | |
| 124 | + context = super(UpdateProfile, self).get_context_data(**kwargs) | |
| 125 | + if has_role(self.request.user, 'system_admin'): | |
| 126 | + context['form'] = UpdateProfileFormAdmin(instance = self.object) | |
| 127 | + else: | |
| 128 | + context['form'] = UpdateProfileForm(instance = self.object) | |
| 129 | + return context | |
| 130 | + | |
| 124 | 131 | def form_valid(self, form): |
| 125 | 132 | form.save() |
| 126 | 133 | messages.success(self.request, _('Profile edited successfully!')) | ... | ... |