Commit da0c6bf248ff2d00056b5c4e93554f5a9e5affef
Exists in
master
and in
2 other branches
Merge branch 'refactoring' of https://github.com/amadeusproject/amadeuslms into refactoring
Showing
45 changed files
with
714 additions
and
167 deletions
Show diff stats
amadeus/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:12-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" |
... | ... | @@ -26,95 +26,95 @@ msgstr "" |
26 | 26 | msgid "English" |
27 | 27 | msgstr "" |
28 | 28 | |
29 | -#: amadeus/templates/base.html:93 | |
29 | +#: amadeus/templates/base.html:96 | |
30 | 30 | msgid "Search for subjects and resources" |
31 | 31 | msgstr "Buscar por assuntos ou recursos" |
32 | 32 | |
33 | -#: amadeus/templates/base.html:106 amadeus/templates/base.html:111 | |
33 | +#: amadeus/templates/base.html:109 amadeus/templates/base.html:114 | |
34 | 34 | msgid "Language Selector" |
35 | 35 | msgstr "" |
36 | 36 | |
37 | -#: amadeus/templates/base.html:152 | |
37 | +#: amadeus/templates/base.html:155 | |
38 | 38 | msgid "Profile" |
39 | 39 | msgstr "Perfil" |
40 | 40 | |
41 | -#: amadeus/templates/base.html:153 | |
41 | +#: amadeus/templates/base.html:156 | |
42 | 42 | msgid "Edit Profile" |
43 | 43 | msgstr "Editar Perfil" |
44 | 44 | |
45 | -#: amadeus/templates/base.html:154 | |
45 | +#: amadeus/templates/base.html:157 | |
46 | 46 | msgid "Change Password" |
47 | 47 | msgstr "Alterar Senha" |
48 | 48 | |
49 | -#: amadeus/templates/base.html:155 | |
49 | +#: amadeus/templates/base.html:158 | |
50 | 50 | msgid "Delete Account" |
51 | 51 | msgstr "Remover Conta" |
52 | 52 | |
53 | -#: amadeus/templates/base.html:156 | |
53 | +#: amadeus/templates/base.html:159 | |
54 | 54 | msgid "Logout" |
55 | 55 | msgstr "Sair" |
56 | 56 | |
57 | -#: amadeus/templates/base.html:161 | |
57 | +#: amadeus/templates/base.html:164 | |
58 | 58 | msgid "settings" |
59 | 59 | msgstr "configurações" |
60 | 60 | |
61 | -#: amadeus/templates/base.html:164 | |
61 | +#: amadeus/templates/base.html:167 | |
62 | 62 | msgid "Settings" |
63 | 63 | msgstr "Configurações" |
64 | 64 | |
65 | -#: amadeus/templates/base.html:167 | |
65 | +#: amadeus/templates/base.html:170 | |
66 | 66 | msgid "Manage Users" |
67 | 67 | msgstr "Gerenciar Usuários" |
68 | 68 | |
69 | -#: amadeus/templates/base.html:168 | |
69 | +#: amadeus/templates/base.html:171 | |
70 | 70 | msgid "Manage Categories" |
71 | 71 | msgstr "Gerenciar Categorias" |
72 | 72 | |
73 | -#: amadeus/templates/base.html:169 | |
73 | +#: amadeus/templates/base.html:172 | |
74 | 74 | msgid "Manage News" |
75 | 75 | msgstr "Gerenciar Notícias" |
76 | 76 | |
77 | -#: amadeus/templates/base.html:176 | |
77 | +#: amadeus/templates/base.html:179 | |
78 | 78 | msgid "System" |
79 | 79 | msgstr "Sistema" |
80 | 80 | |
81 | -#: amadeus/templates/base.html:183 | |
81 | +#: amadeus/templates/base.html:186 | |
82 | 82 | msgid "Mail Sender" |
83 | 83 | msgstr "Remetente de Email" |
84 | 84 | |
85 | -#: amadeus/templates/base.html:184 | |
85 | +#: amadeus/templates/base.html:187 | |
86 | 86 | msgid "Security" |
87 | 87 | msgstr "Segurança" |
88 | 88 | |
89 | -#: amadeus/templates/base.html:185 | |
89 | +#: amadeus/templates/base.html:188 | |
90 | 90 | msgid "Theme" |
91 | 91 | msgstr "Temas" |
92 | 92 | |
93 | -#: amadeus/templates/base.html:186 | |
93 | +#: amadeus/templates/base.html:189 | |
94 | 94 | #, fuzzy |
95 | 95 | #| msgid "Web Conference Settings" |
96 | 96 | msgid "Web Conference" |
97 | 97 | msgstr "Web conferência" |
98 | 98 | |
99 | -#: amadeus/templates/base.html:206 amadeus/templates/base.html:261 | |
99 | +#: amadeus/templates/base.html:209 amadeus/templates/base.html:264 | |
100 | 100 | msgid "Subjects" |
101 | 101 | msgstr "Assuntos" |
102 | 102 | |
103 | -#: amadeus/templates/base.html:211 amadeus/templates/base.html:266 | |
103 | +#: amadeus/templates/base.html:214 amadeus/templates/base.html:269 | |
104 | 104 | msgid "Mural" |
105 | 105 | msgstr "" |
106 | 106 | |
107 | -#: amadeus/templates/base.html:217 amadeus/templates/base.html:272 | |
107 | +#: amadeus/templates/base.html:220 amadeus/templates/base.html:275 | |
108 | 108 | msgid "Messages" |
109 | 109 | msgstr "Mensagens" |
110 | 110 | |
111 | -#: amadeus/templates/base.html:223 amadeus/templates/base.html:278 | |
111 | +#: amadeus/templates/base.html:226 amadeus/templates/base.html:281 | |
112 | 112 | #, fuzzy |
113 | 113 | #| msgid "Pendencias" |
114 | 114 | msgid "Pendencies" |
115 | 115 | msgstr "Pendências" |
116 | 116 | |
117 | -#: amadeus/templates/base.html:231 amadeus/templates/base.html:286 | |
117 | +#: amadeus/templates/base.html:234 amadeus/templates/base.html:289 | |
118 | 118 | msgid "Analytics" |
119 | 119 | msgstr "Analytics" |
120 | 120 | ... | ... |
amadeus/settings.py
... | ... | @@ -209,8 +209,8 @@ CRON_CLASSES = [ |
209 | 209 | ] |
210 | 210 | |
211 | 211 | CRONJOBS = [ |
212 | - ('1 */12 * * *', 'notifications.cron.notification_cron'), | |
213 | - ('1 */12 * * *', 'goals.cron.setgoals_cron') | |
212 | + ('0 0 * * *', 'notifications.cron.notification_cron'), | |
213 | + ('0 0 * * *', 'goals.cron.setgoals_cron') | |
214 | 214 | ] |
215 | 215 | |
216 | 216 | CHANNEL_LAYERS = { | ... | ... |
... | ... | @@ -0,0 +1,66 @@ |
1 | +$(function () { | |
2 | + | |
3 | + /* Script para abrir o modal com a imagem selecionada */ | |
4 | + $("#id_image").change(function () { | |
5 | + if (this.files && this.files[0]) { | |
6 | + var reader = new FileReader(); | |
7 | + reader.onload = function (e) { | |
8 | + $("#image").attr("src", e.target.result); | |
9 | + $("#modalCrop").modal("show"); | |
10 | + } | |
11 | + reader.readAsDataURL(this.files[0]); | |
12 | + } | |
13 | + }); | |
14 | + | |
15 | + /* Scripts da caixa de corte da imagem */ | |
16 | + var $image = $("#image"); | |
17 | + var cropBoxData; | |
18 | + var canvasData; | |
19 | + $("#modalCrop").on("shown.bs.modal", function () { | |
20 | + $image.cropper({ | |
21 | + viewMode: 1, | |
22 | + aspectRatio: 1/1, | |
23 | + minCropBoxWidth: 700, | |
24 | + minCropBoxHeight: 200, | |
25 | + ready: function () { | |
26 | + $image.cropper("setCanvasData", canvasData); | |
27 | + $image.cropper("setCropBoxData", cropBoxData); | |
28 | + } | |
29 | + }); | |
30 | + }).on("hidden.bs.modal", function () { | |
31 | + cropBoxData = $image.cropper("getCropBoxData"); | |
32 | + canvasData = $image.cropper("getCanvasData"); | |
33 | + $image.cropper("destroy"); | |
34 | + }); | |
35 | + | |
36 | + $(".js-zoom-in").click(function () { | |
37 | + $image.cropper("zoom", 0.1); | |
38 | + }); | |
39 | + | |
40 | + $(".js-zoom-out").click(function () { | |
41 | + $image.cropper("zoom", -0.1); | |
42 | + }); | |
43 | + | |
44 | + /* Script para pegar os valores das dimensões e depois fechar o modal */ | |
45 | + $(".js-crop-and-upload").click(function () { | |
46 | + var cropData = $image.cropper("getData"); | |
47 | + $("#id_x").val(cropData["x"]); | |
48 | + $("#id_y").val(cropData["y"]); | |
49 | + $("#id_height").val(cropData["height"]); | |
50 | + $("#id_width").val(cropData["width"]); | |
51 | + $("#modalCrop").modal('hide'); | |
52 | + }); | |
53 | + | |
54 | + /* Script para remover o arquivo enviado caso o usuário clique em cancelar*/ | |
55 | + $("#id_image").on('change', function(){ | |
56 | + console.log(this.value); | |
57 | + }); | |
58 | + | |
59 | + $('#crop_cancel').on('click', function(e){ | |
60 | + var input = $("#id_image"); | |
61 | + var holder = $("#pic_holder"); | |
62 | + input.replaceWith(input.val('').clone(true)); | |
63 | + holder.replaceWith(holder.val('').clone(true)); | |
64 | + }); | |
65 | + | |
66 | +}); | ... | ... |
amadeus/templates/base.html
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | |
33 | 33 | <script src="{% static 'js/cropper.min.js' %}"></script> <!-- Js for cropper--> |
34 | 34 | <script src="{% static 'js/crop.js' %}"></script> <!-- Js for cropper--> |
35 | + <script src="{% static 'js/crop_news.js' %}"></script> | |
35 | 36 | <link href="{% static 'css/cropper.min.css' %}" rel="stylesheet"> <!-- CSS for cropper--> |
36 | 37 | |
37 | 38 | <script type="text/javascript" src="{% static 'js/printThis.js' %}"></script> <!-- Print this plugin js--> | ... | ... |
categories/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
chat/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:12-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" | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10.4 on 2017-04-13 23:34 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('chat', '0003_auto_20170407_2251'), | |
12 | + ('chat', '0003_auto_20170407_2154'), | |
13 | + ] | |
14 | + | |
15 | + operations = [ | |
16 | + ] | ... | ... |
file_link/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
goals/forms.py
... | ... | @@ -2,8 +2,9 @@ |
2 | 2 | from django import forms |
3 | 3 | from datetime import datetime |
4 | 4 | from django.conf import settings |
5 | +from django.utils.html import strip_tags | |
5 | 6 | from django.utils.translation import ugettext_lazy as _ |
6 | -from django.forms.models import inlineformset_factory | |
7 | +from django.forms.models import inlineformset_factory, BaseInlineFormSet | |
7 | 8 | |
8 | 9 | from subjects.models import Tag |
9 | 10 | |
... | ... | @@ -48,6 +49,9 @@ class GoalsForm(forms.ModelForm): |
48 | 49 | |
49 | 50 | limit_submission_date = cleaned_data.get('limit_submission_date', None) |
50 | 51 | |
52 | + presentation = cleaned_data.get('presentation', '') | |
53 | + cleaned_presentation = strip_tags(presentation) | |
54 | + | |
51 | 55 | if self.topic: |
52 | 56 | if self.instance.id: |
53 | 57 | exist = self.topic.resource_topic.filter(goals__isnull = False).exclude(id = self.instance.id).exists() |
... | ... | @@ -57,6 +61,9 @@ class GoalsForm(forms.ModelForm): |
57 | 61 | if exist: |
58 | 62 | self.add_error('name', _('There already is another resource with the goals specification for the Topic %s')%(str(self.topic))) |
59 | 63 | |
64 | + if cleaned_presentation == '': | |
65 | + self.add_error('presentation', _('This field is required.')) | |
66 | + | |
60 | 67 | if limit_submission_date: |
61 | 68 | if not limit_submission_date == ValueError: |
62 | 69 | if not self.instance.id and limit_submission_date.date() < datetime.today().date(): |
... | ... | @@ -67,6 +74,8 @@ class GoalsForm(forms.ModelForm): |
67 | 74 | |
68 | 75 | if limit_submission_date.date() > self.subject.end_date: |
69 | 76 | self.add_error('limit_submission_date', _('This input should be filled with a date equal or after the subject end date.')) |
77 | + else: | |
78 | + self.add_error('limit_submission_date', _('This field is required')) | |
70 | 79 | |
71 | 80 | return cleaned_data |
72 | 81 | |
... | ... | @@ -116,6 +125,18 @@ class GoalItemForm(forms.ModelForm): |
116 | 125 | |
117 | 126 | return cleaned_data |
118 | 127 | |
128 | +class GoalItemFormset(BaseInlineFormSet): | |
129 | + def __init__(self, *args, **kwargs): | |
130 | + super(GoalItemFormset, self).__init__(*args, **kwargs) | |
131 | + | |
132 | + self.forms[0].empty_permitted = False | |
133 | + | |
134 | + def clean(self): | |
135 | + description = self.forms[0].cleaned_data.get('description', None) | |
136 | + | |
137 | + if not description: | |
138 | + raise forms.ValidationError(_('It\'s necessary to enter at least one goal specification.')) | |
139 | + | |
119 | 140 | class MyGoalsForm(forms.ModelForm): |
120 | 141 | def __init__(self, *args, **kwargs): |
121 | 142 | super(MyGoalsForm, self).__init__(*args, **kwargs) |
... | ... | @@ -127,4 +148,4 @@ class MyGoalsForm(forms.ModelForm): |
127 | 148 | fields = ['value', 'item'] |
128 | 149 | |
129 | 150 | InlinePendenciesFormset = inlineformset_factory(Goals, Pendencies, form = PendenciesLimitedForm, extra = 1, max_num = 3, validate_max = True, can_delete = True) |
130 | -InlineGoalItemFormset = inlineformset_factory(Goals, GoalItem, form = GoalItemForm, extra = 1, can_delete = True) | |
131 | 151 | \ No newline at end of file |
152 | +InlineGoalItemFormset = inlineformset_factory(Goals, GoalItem, form = GoalItemForm, min_num = 1, validate_min = True, extra = 0, can_delete = True, formset = GoalItemFormset) | |
132 | 153 | \ No newline at end of file | ... | ... |
goals/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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,15 +18,15 @@ msgstr "" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
20 | 20 | |
21 | -#: goals/forms.py:33 | |
21 | +#: goals/forms.py:34 | |
22 | 22 | msgid "Tags" |
23 | 23 | msgstr "Tags" |
24 | 24 | |
25 | -#: goals/forms.py:39 | |
25 | +#: goals/forms.py:40 | |
26 | 26 | msgid "Name" |
27 | 27 | msgstr "Nome" |
28 | 28 | |
29 | -#: goals/forms.py:58 | |
29 | +#: goals/forms.py:62 | |
30 | 30 | #, python-format |
31 | 31 | msgid "" |
32 | 32 | "There already is another resource with the goals specification for the Topic " |
... | ... | @@ -34,12 +34,16 @@ msgid "" |
34 | 34 | msgstr "" |
35 | 35 | "Já existe um outro recurso com a especificação de metas para o tópico %s" |
36 | 36 | |
37 | -#: goals/forms.py:63 | |
37 | +#: goals/forms.py:65 goals/forms.py:124 | |
38 | +msgid "This field is required." | |
39 | +msgstr "Esse campo é obrigatório." | |
40 | + | |
41 | +#: goals/forms.py:70 | |
38 | 42 | msgid "This input should be filled with a date equal or after today's date." |
39 | 43 | msgstr "" |
40 | 44 | "Esse campo deve ser preenchido com uma data igual ou posterior à data atual." |
41 | 45 | |
42 | -#: goals/forms.py:66 | |
46 | +#: goals/forms.py:73 | |
43 | 47 | msgid "" |
44 | 48 | "This input should be filled with a date equal or after the subject begin " |
45 | 49 | "date." |
... | ... | @@ -47,17 +51,23 @@ msgstr "" |
47 | 51 | "Esse campo deve ser preenchido com uma data igual ou posterior à data de " |
48 | 52 | "início do assunto." |
49 | 53 | |
50 | -#: goals/forms.py:69 | |
54 | +#: goals/forms.py:76 | |
51 | 55 | msgid "" |
52 | 56 | "This input should be filled with a date equal or after the subject end date." |
53 | 57 | msgstr "" |
54 | 58 | "Esse campo deve ser preenchido com uma data igual ou posterior à data final " |
55 | 59 | "do assunto." |
56 | 60 | |
57 | -#: goals/forms.py:115 | |
58 | -msgid "This field is required." | |
61 | +#: goals/forms.py:78 | |
62 | +#, fuzzy | |
63 | +#| msgid "This field is required." | |
64 | +msgid "This field is required" | |
59 | 65 | msgstr "Esse campo é obrigatório." |
60 | 66 | |
67 | +#: goals/forms.py:138 | |
68 | +msgid "It's necessary to enter at least one goal specification." | |
69 | +msgstr "Você deve cadastrar ao menos uma especificação de meta." | |
70 | + | |
61 | 71 | #: goals/models.py:10 |
62 | 72 | msgid "Presentation" |
63 | 73 | msgstr "Apresentação" |
... | ... | @@ -134,46 +144,46 @@ msgstr "Data de atualização" |
134 | 144 | msgid "Goals Specification" |
135 | 145 | msgstr "Especificação de Metas" |
136 | 146 | |
137 | -#: goals/templates/goals/_form.html:101 | |
147 | +#: goals/templates/goals/_form.html:109 | |
138 | 148 | #: goals/templates/goals/_form_submit.html:22 |
139 | 149 | #: goals/templates/goals/view.html:74 |
140 | 150 | msgid "Minimum percentage desired" |
141 | 151 | msgstr "Porcentagem mínima desejada" |
142 | 152 | |
143 | -#: goals/templates/goals/_form.html:156 | |
153 | +#: goals/templates/goals/_form.html:164 | |
144 | 154 | msgid "Common resources settings" |
145 | 155 | msgstr "Configurações comuns a todos os recursos" |
146 | 156 | |
147 | -#: goals/templates/goals/_form.html:204 | |
157 | +#: goals/templates/goals/_form.html:212 | |
148 | 158 | msgid "Pendencies Notifications" |
149 | 159 | msgstr "Notificações de Pendências" |
150 | 160 | |
151 | -#: goals/templates/goals/_form.html:226 | |
161 | +#: goals/templates/goals/_form.html:240 | |
152 | 162 | msgid "Action not performed by the user" |
153 | 163 | msgstr "Ação não realizada pelo usuário" |
154 | 164 | |
155 | -#: goals/templates/goals/_form.html:252 | |
165 | +#: goals/templates/goals/_form.html:266 | |
156 | 166 | msgid "Wished period" |
157 | 167 | msgstr "Período desejado" |
158 | 168 | |
159 | -#: goals/templates/goals/_form.html:388 | |
169 | +#: goals/templates/goals/_form.html:402 | |
160 | 170 | #: goals/templates/goals/_form_submit.html:54 |
161 | 171 | msgid "Save" |
162 | 172 | msgstr "Salvar" |
163 | 173 | |
164 | -#: goals/templates/goals/_form.html:399 | |
174 | +#: goals/templates/goals/_form.html:413 | |
165 | 175 | msgid "Add new goal" |
166 | 176 | msgstr "Adicionar nova meta" |
167 | 177 | |
168 | -#: goals/templates/goals/_form.html:400 | |
178 | +#: goals/templates/goals/_form.html:414 | |
169 | 179 | msgid "Remove this goal" |
170 | 180 | msgstr "Remover essa meta" |
171 | 181 | |
172 | -#: goals/templates/goals/_form.html:420 | |
182 | +#: goals/templates/goals/_form.html:434 | |
173 | 183 | msgid "Add new notification" |
174 | 184 | msgstr "Adicionar nova notificação" |
175 | 185 | |
176 | -#: goals/templates/goals/_form.html:421 | |
186 | +#: goals/templates/goals/_form.html:435 | |
177 | 187 | msgid "Remove this" |
178 | 188 | msgstr "Remover essa notificação" |
179 | 189 | |
... | ... | @@ -344,35 +354,35 @@ msgstr "Suas metas para %s foram salvas com sucesso!" |
344 | 354 | msgid "Your goals for %s was update successfully!" |
345 | 355 | msgstr "Suas metas para %s foram atualizadas com sucesso!" |
346 | 356 | |
347 | -#: goals/views.py:636 goals/views.py:650 goals/views.py:671 goals/views.py:790 | |
348 | -#: goals/views.py:804 goals/views.py:814 | |
357 | +#: goals/views.py:636 goals/views.py:650 goals/views.py:675 goals/views.py:794 | |
358 | +#: goals/views.py:808 goals/views.py:818 | |
349 | 359 | msgid "Visualize" |
350 | 360 | msgstr "Visualizar" |
351 | 361 | |
352 | -#: goals/views.py:636 goals/views.py:650 goals/views.py:671 goals/views.py:790 | |
353 | -#: goals/views.py:804 goals/views.py:814 | |
362 | +#: goals/views.py:636 goals/views.py:650 goals/views.py:675 goals/views.py:794 | |
363 | +#: goals/views.py:808 goals/views.py:818 | |
354 | 364 | msgid "Submit" |
355 | 365 | msgstr "Submeter" |
356 | 366 | |
357 | -#: goals/views.py:734 | |
367 | +#: goals/views.py:738 | |
358 | 368 | msgid "Create Topic Goals" |
359 | 369 | msgstr "Adicionar Metas do Tópico" |
360 | 370 | |
361 | -#: goals/views.py:745 | |
371 | +#: goals/views.py:749 | |
362 | 372 | #, python-format |
363 | 373 | msgid "The Goals specification for the topic %s was realized successfully!" |
364 | 374 | msgstr "A Especificação de Metas para o tópico %s foi realizada com sucesso!" |
365 | 375 | |
366 | -#: goals/views.py:869 | |
376 | +#: goals/views.py:873 | |
367 | 377 | msgid "Update Topic Goals" |
368 | 378 | msgstr "Atualizar Metas do Tópico" |
369 | 379 | |
370 | -#: goals/views.py:880 | |
380 | +#: goals/views.py:884 | |
371 | 381 | #, python-format |
372 | 382 | msgid "The Goals specification for the topic %s was updated successfully!" |
373 | 383 | msgstr "A Especificação de Metas para o tópico %s foi atualizada com sucesso!" |
374 | 384 | |
375 | -#: goals/views.py:916 | |
385 | +#: goals/views.py:920 | |
376 | 386 | #, python-format |
377 | 387 | msgid "The Goals specification of the topic %s was removed successfully!" |
378 | 388 | msgstr "A Especificação de Metas para o tópico %s foi removida com sucesso!" | ... | ... |
goals/templates/goals/_form.html
... | ... | @@ -61,7 +61,15 @@ |
61 | 61 | </div> |
62 | 62 | <div id="goal_items" class="panel-collapse collapse"> |
63 | 63 | {{ goalitems_form.management_form }} |
64 | - {{ goalitems_form.non_form_errors }} | |
64 | + | |
65 | + {% if goalitems_form.non_form_errors %} | |
66 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
67 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
68 | + <span aria-hidden="true">×</span> | |
69 | + </button> | |
70 | + {{ goalitems_form.non_form_errors }} | |
71 | + </div> | |
72 | + {% endif %} | |
65 | 73 | |
66 | 74 | {% for item in goalitems_form %} |
67 | 75 | <div class="goalitems"> |
... | ... | @@ -209,12 +217,18 @@ |
209 | 217 | </div> |
210 | 218 | <div id="notifications" class="panel-collapse collapse"> |
211 | 219 | {{ pendencies_form.management_form }} |
212 | - {{ pendencies_form.non_form_errors }} | |
220 | + {% if pendencies_form.non_form_errors %} | |
221 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
222 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
223 | + <span aria-hidden="true">×</span> | |
224 | + </button> | |
225 | + {{ pendencies_form.non_form_errors }} | |
226 | + </div> | |
227 | + {% endif %} | |
213 | 228 | |
214 | 229 | {% for notify in pendencies_form %} |
215 | 230 | <div class="notifies"> |
216 | 231 | <div style="text-align:left"> |
217 | - {{ notify.errors }} | |
218 | 232 | {% render_field notify.id %} |
219 | 233 | {% render_field notify.resource %} |
220 | 234 | {% render_field notify.subject class='pend_subj' %} | ... | ... |
goals/views.py
... | ... | @@ -667,7 +667,11 @@ class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
667 | 667 | return initial |
668 | 668 | |
669 | 669 | def form_invalid(self, form, pendencies_form, goalitems_form): |
670 | + slug = self.kwargs.get('slug', '') | |
671 | + topic = get_object_or_404(Topic, slug = slug) | |
672 | + | |
670 | 673 | for p_form in pendencies_form.forms: |
674 | + print(p_form.initial['subject']) | |
671 | 675 | p_form.fields['action'].choices = [("", "-------"),("view", _("Visualize")), ("submit", _("Submit"))] |
672 | 676 | |
673 | 677 | return self.render_to_response(self.get_context_data(form = form, pendencies_form = pendencies_form, goalitems_form = goalitems_form)) | ... | ... |
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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
log/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
mailsender/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:12-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" | ... | ... |
mural/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
news/forms.py
... | ... | @@ -3,10 +3,50 @@ from django.utils.translation import ugettext_lazy as _ |
3 | 3 | |
4 | 4 | from .models import News |
5 | 5 | from resubmit.widgets import ResubmitFileWidget |
6 | - | |
6 | +from os.path import join | |
7 | +from PIL import Image | |
8 | +import os | |
9 | +from amadeus import settings | |
7 | 10 | |
8 | 11 | class NewsForm(forms.ModelForm): |
9 | 12 | MAX_UPLOAD_SIZE = 5*1024*1024 |
13 | + | |
14 | + #Cropping image | |
15 | + x = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
16 | + y = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
17 | + width = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
18 | + height = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
19 | + | |
20 | + def save(self, commit=True): | |
21 | + super(NewsForm, self).save(commit=False) | |
22 | + self.deletepath = "" | |
23 | + | |
24 | + x = self.cleaned_data.get('x') | |
25 | + y = self.cleaned_data.get('y') | |
26 | + w = self.cleaned_data.get('width') | |
27 | + h = self.cleaned_data.get('height') | |
28 | + | |
29 | + if self.instance.image : | |
30 | + image = Image.open(self.instance.image) | |
31 | + if not x is None: | |
32 | + cropped_image = image.crop((x, y, w+x, h+y)) | |
33 | + resized_image = cropped_image.resize((700, 200), Image.ANTIALIAS) | |
34 | + | |
35 | + folder_path = join(settings.MEDIA_ROOT, 'news') | |
36 | + #check if the folder already exists | |
37 | + if not os.path.isdir(folder_path): | |
38 | + os.makedirs(folder_path) | |
39 | + | |
40 | + if ("news" not in self.instance.image.path): | |
41 | + self.deletepath = self.instance.image.path | |
42 | + | |
43 | + resized_image.save(self.instance.image.path) | |
44 | + | |
45 | + self.instance.save() | |
46 | + if (self.deletepath): | |
47 | + os.remove(self.deletepath) | |
48 | + return self.instance | |
49 | + | |
10 | 50 | class Meta: |
11 | 51 | model = News |
12 | 52 | fields = ['title','image','content'] | ... | ... |
news/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-17 12:04-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,104 +18,131 @@ msgstr "" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
20 | 20 | |
21 | -#: news/forms.py:22 | |
21 | +#: .\forms.py:62 | |
22 | 22 | msgid "This field is required" |
23 | 23 | msgstr "Este campo é obrigatório." |
24 | 24 | |
25 | -#: news/forms.py:33 | |
25 | +#: .\forms.py:73 | |
26 | 26 | msgid "The image is too large. It should have less than 5MB." |
27 | 27 | msgstr "A imagem é muito grande. Ela deve ter menos que 5MB." |
28 | 28 | |
29 | -#: news/forms.py:36 | |
29 | +#: .\forms.py:76 | |
30 | 30 | msgid "This field is required." |
31 | 31 | msgstr "Este campo é obrigatório." |
32 | 32 | |
33 | -#: news/models.py:15 | |
33 | +#: .\models.py:15 | |
34 | 34 | msgid "File not supported." |
35 | 35 | msgstr "Arquivo não suportado" |
36 | 36 | |
37 | -#: news/models.py:18 | |
37 | +#: .\models.py:18 | |
38 | 38 | msgid "Title" |
39 | 39 | msgstr "Título" |
40 | 40 | |
41 | -#: news/models.py:19 | |
41 | +#: .\models.py:19 | |
42 | 42 | msgid "Slug" |
43 | 43 | msgstr "" |
44 | 44 | |
45 | -#: news/models.py:20 | |
45 | +#: .\models.py:20 | |
46 | 46 | msgid "News Image" |
47 | 47 | msgstr "Imagem de apresentação da notícia" |
48 | 48 | |
49 | -#: news/models.py:21 | |
49 | +#: .\models.py:21 | |
50 | 50 | msgid "News Content" |
51 | 51 | msgstr "Conteúdo da notícia" |
52 | 52 | |
53 | -#: news/models.py:22 | |
53 | +#: .\models.py:22 | |
54 | 54 | msgid "Create Date" |
55 | 55 | msgstr "Data de criação" |
56 | 56 | |
57 | -#: news/models.py:23 | |
57 | +#: .\models.py:23 | |
58 | 58 | msgid "Creator" |
59 | 59 | msgstr "Autor" |
60 | 60 | |
61 | -#: news/models.py:25 news/models.py:26 | |
61 | +#: .\models.py:25 .\models.py:26 | |
62 | 62 | msgid "News" |
63 | 63 | msgstr "Notícia" |
64 | 64 | |
65 | -#: news/templates/news/_form.html:12 | |
65 | +#: .\templates\news\_form.html:12 | |
66 | 66 | msgid "Choose your photo..." |
67 | 67 | msgstr "Escolha a foto" |
68 | 68 | |
69 | -#: news/templates/news/_form.html:59 | |
69 | +#: .\templates\news\_form.html:60 | |
70 | 70 | msgid "Save" |
71 | 71 | msgstr "Salvar" |
72 | 72 | |
73 | -#: news/templates/news/_form.html:62 | |
73 | +#: .\templates\news\_form.html:63 | |
74 | 74 | msgid "Cancel" |
75 | 75 | msgstr "Cancelar" |
76 | 76 | |
77 | -#: news/templates/news/create.html:7 | |
77 | +#: .\templates\news\create.html:7 | |
78 | 78 | msgid "Register News" |
79 | 79 | msgstr "Cadastrar notícia" |
80 | 80 | |
81 | -#: news/templates/news/list.html:7 news/views.py:47 | |
81 | +#: .\templates\news\delete.html:12 | |
82 | +msgid "Are you sure you want to delete the news" | |
83 | +msgstr "Você tem certeza que deseja apagar a notícia" | |
84 | + | |
85 | +#: .\templates\news\delete.html:12 | |
86 | +msgid "All its data will be lost and can't be recovered" | |
87 | +msgstr "Todos seus dados serão perdidos e não podem ser recuperados" | |
88 | + | |
89 | +#: .\templates\news\delete.html:18 | |
90 | +msgid "Close" | |
91 | +msgstr "Cancelar" | |
92 | + | |
93 | +#: .\templates\news\delete.html:19 .\templates\news\list.html:60 | |
94 | +#: .\templates\news\search.html:60 | |
95 | +msgid "Delete" | |
96 | +msgstr "Apagar" | |
97 | + | |
98 | +#: .\templates\news\list.html:7 .\views.py:47 | |
82 | 99 | msgid "Manage News" |
83 | 100 | msgstr "Gerenciar notícias" |
84 | 101 | |
85 | -#: news/templates/news/list.html:34 | |
86 | -msgid "Search..." | |
87 | -msgstr "" | |
102 | +#: .\templates\news\list.html:34 .\templates\news\search.html:34 | |
103 | +msgid "Search by title, author or date" | |
104 | +msgstr "Pesquisar por título, autor ou data" | |
88 | 105 | |
89 | -#: news/templates/news/list.html:45 news/views.py:74 | |
106 | +#: .\templates\news\list.html:45 .\templates\news\search.html:45 .\views.py:74 | |
90 | 107 | msgid "Create News" |
91 | 108 | msgstr "Criar notícia" |
92 | 109 | |
93 | -#: news/templates/news/list.html:59 | |
110 | +#: .\templates\news\list.html:59 .\templates\news\search.html:59 | |
94 | 111 | msgid "Edit" |
95 | -msgstr "" | |
112 | +msgstr "Editar" | |
96 | 113 | |
97 | -#: news/templates/news/list.html:60 | |
98 | -msgid "Delete" | |
99 | -msgstr "" | |
100 | - | |
101 | -#: news/templates/news/list.html:71 | |
114 | +#: .\templates\news\list.html:71 .\templates\news\search.html:71 | |
102 | 115 | msgid "No news found" |
103 | -msgstr "" | |
116 | +msgstr "Nenhuma notícia encontrada" | |
104 | 117 | |
105 | -#: news/templates/news/update.html:7 news/views.py:92 | |
106 | -#, fuzzy | |
107 | -#| msgid "Create News" | |
118 | +#: .\templates\news\search.html:7 .\views.py:142 | |
119 | +msgid "Search News" | |
120 | +msgstr "Pesquisar Notícia" | |
121 | + | |
122 | +#: .\templates\news\update.html:7 .\views.py:92 | |
108 | 123 | msgid "Update News" |
109 | -msgstr "Criar notícia" | |
124 | +msgstr "Atualizar Notícia" | |
110 | 125 | |
111 | -#: news/views.py:22 | |
126 | +#: .\templates\news\view.html:32 | |
127 | +msgid "Print News" | |
128 | +msgstr "Imprimir Notícia" | |
129 | + | |
130 | +#: .\views.py:22 | |
112 | 131 | msgid "Visualize News" |
113 | -msgstr "" | |
132 | +msgstr "Visualizar Notícia" | |
114 | 133 | |
115 | -#: news/views.py:68 news/views.py:86 | |
134 | +#: .\views.py:68 .\views.py:86 | |
116 | 135 | msgid "News successfully created!" |
117 | 136 | msgstr "Notícia criada com sucesso" |
118 | 137 | |
138 | +#: .\views.py:159 | |
139 | +msgid "News \"%s\" removed successfully!" | |
140 | +msgstr "Notícia \"%s\" removida com sucesso" | |
141 | + | |
142 | +#: .\views.py:166 | |
143 | +msgid "Delete News" | |
144 | +msgstr "Apagar Notícia" | |
145 | + | |
119 | 146 | #~ msgid "Create news" |
120 | 147 | #~ msgstr "Criar notícia" |
121 | 148 | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10.4 on 2017-04-13 23:34 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations, models | |
6 | +import news.models | |
7 | + | |
8 | + | |
9 | +class Migration(migrations.Migration): | |
10 | + | |
11 | + dependencies = [ | |
12 | + ('news', '0001_initial'), | |
13 | + ] | |
14 | + | |
15 | + operations = [ | |
16 | + migrations.AlterField( | |
17 | + model_name='news', | |
18 | + name='image', | |
19 | + field=models.ImageField(blank=True, upload_to='news/', validators=[news.models.validate_img_extension], verbose_name='News Image'), | |
20 | + ), | |
21 | + migrations.AlterField( | |
22 | + model_name='news', | |
23 | + name='title', | |
24 | + field=models.CharField(max_length=200, unique=True, verbose_name='Title'), | |
25 | + ), | |
26 | + ] | ... | ... |
news/templates/news/_form.html
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <label for="{{ field.auto_id }}">{{ field.label }} <span>*</span></label> |
10 | 10 | {% render_field field class='form-control' %} |
11 | 11 | <div class="input-group"> |
12 | - <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your photo...' %}"> | |
12 | + <input type="text" readonly="" class="form-control" id="pic_holder" placeholder="{% trans 'Choose your photo...' %}"> | |
13 | 13 | <span class="input-group-btn input-group-sm"> |
14 | 14 | <button type="button" class="btn btn-fab btn-fab-mini"> |
15 | 15 | <i class="material-icons">image</i> |
... | ... | @@ -27,11 +27,12 @@ |
27 | 27 | {% endif %} |
28 | 28 | {% render_field field class='form-control text_wysiwyg' %} |
29 | 29 | {% else %} |
30 | - {% if field.field.required %} | |
31 | - <label for="{{ field.auto_id }}">{{ field.label }} <span>*</span></label> | |
32 | - {% else %} | |
33 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
34 | 30 | |
31 | + {% if field.auto_id == 'id_title' %} | |
32 | + {% if field.field.required %} | |
33 | + <label for="{{ field.auto_id }}">{{ field.label }} <span>*</span></label> | |
34 | + {% else %} | |
35 | + {% endif %} | |
35 | 36 | {% endif %} |
36 | 37 | {% render_field field class='form-control' %} |
37 | 38 | |
... | ... | @@ -65,3 +66,4 @@ |
65 | 66 | </div> |
66 | 67 | |
67 | 68 | </form> |
69 | +{% include 'users/modal_crop.html' %} | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +{% load static i18n permission_tags %} | |
2 | + | |
3 | +<!-- Modal (remember to change the ids!!!) --> | |
4 | +<div class="modal fade" id="news" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
5 | + <div class="modal-dialog" role="document"> | |
6 | + <div class="modal-content"> | |
7 | + <!-- Modal Body --> | |
8 | + <div class="modal-body"> | |
9 | + <!-- Put ONLY your content here!!! --> | |
10 | + <form id="delete_form" action="{% url 'news:delete' new.slug %}" method="post"> | |
11 | + {% csrf_token %} | |
12 | + <p>{% trans 'Are you sure you want to delete the news' %} "{{new.title}}"? {% trans "All its data will be lost and can't be recovered" %}</p> | |
13 | + </form> | |
14 | + </div> | |
15 | + <!-- Modal Footer --> | |
16 | + <div id="delete-category-footer"class="modal-footer"> | |
17 | + <!-- Don't remove that!!! --> | |
18 | + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button> | |
19 | + <button type="submit" id="button" form="delete_form" class="btn btn-success btn-raised erase-button">{% trans "Delete" %}</button> | |
20 | + </div> | |
21 | + </div> | |
22 | + </div> | |
23 | +</div> | ... | ... |
news/templates/news/list.html
... | ... | @@ -28,10 +28,10 @@ |
28 | 28 | |
29 | 29 | <div class="row"> |
30 | 30 | <div class="col-md-9"> |
31 | - <form action="{% url 'users:search' %}" method="GET" class="form-horizontal"> | |
31 | + <form action="{% url 'news:search' %}" method="GET" class="form-horizontal"> | |
32 | 32 | <div class="form-group"> |
33 | 33 | <div class="col-md-11 col-sm-11 col-xs-11"> |
34 | - <input type="text" class="form-control" name="search" placeholder="{% trans 'Search...' %}" /> | |
34 | + <input type="text" class="form-control" name="search" placeholder="{% trans 'Search by title, author or date' %}" /> | |
35 | 35 | </div> |
36 | 36 | <div class="col-md-1 col-sm-1 col-xs-1"> |
37 | 37 | <button type="submit" class="btn btn-fab btn-fab-mini"> |
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | <div class="col-md-6"> |
58 | 58 | <div align="right"> |
59 | 59 | <a href="{% url 'news:update' new.slug %}" class="btn btn-success btn-raised btn-sm"><i class="fa fa-edit"></i> {% trans 'Edit' %}</a> |
60 | - <a href="" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a> | |
60 | + <a href="javascript:delete_news.get('{% url 'news:delete' new.slug %}','#news','#modal_remove')" class="btn btn-default btn-raised btn-sm" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a> | |
61 | 61 | </div> |
62 | 62 | </div> |
63 | 63 | </div> |
... | ... | @@ -75,5 +75,21 @@ |
75 | 75 | <div id="modal_remove"> |
76 | 76 | |
77 | 77 | </div> |
78 | +<script type="text/javascript"> | |
79 | +var delete_news = { | |
80 | + get: function (url, id_modal, id_div_modal){ | |
81 | + $.get(url, function(data){ | |
82 | + if($(id_modal).length){ | |
83 | + $(id_div_modal).empty(); | |
84 | + $(id_div_modal).append(data); | |
85 | + } else { | |
86 | + $(id_div_modal).append(data); | |
87 | + } | |
88 | + $(id_modal).modal('show'); | |
89 | + }); | |
90 | + } | |
91 | +}; | |
92 | + | |
93 | +</script> | |
78 | 94 | |
79 | 95 | {% endblock %} | ... | ... |
... | ... | @@ -0,0 +1,79 @@ |
1 | +{% extends 'news/list.html' %} | |
2 | + | |
3 | +{% load static i18n django_bootstrap_breadcrumbs permission_tags pagination %} | |
4 | + | |
5 | +{% block breadcrumbs %} | |
6 | + {{ block.super }} | |
7 | + {% trans 'Search News' as search_news %} | |
8 | + {% breadcrumb search_news 'news:search' %} | |
9 | +{% endblock %} | |
10 | + | |
11 | +{% block render_breadcrumbs %} | |
12 | + {% render_breadcrumbs %} | |
13 | +{% endblock %} | |
14 | + | |
15 | +{% block content %} | |
16 | + | |
17 | +{% if messages %} | |
18 | + {% for message in messages %} | |
19 | + <script type="text/javascript"> | |
20 | + {% if message.tags == "danger" %} | |
21 | + alertify.error('{{message}}'); | |
22 | + {% else %} | |
23 | + alertify.success('{{message}}'); | |
24 | + {% endif %} | |
25 | + </script> | |
26 | + {% endfor %} | |
27 | +{% endif %} | |
28 | + | |
29 | +<div class="row"> | |
30 | + <div class="col-md-9"> | |
31 | + <form action="{% url 'news:search' %}" method="GET" class="form-horizontal"> | |
32 | + <div class="form-group"> | |
33 | + <div class="col-md-11 col-sm-11 col-xs-11"> | |
34 | + <input type="text" class="form-control" name="search" placeholder="{% trans 'Search by title, author or date' %}" /> | |
35 | + </div> | |
36 | + <div class="col-md-1 col-sm-1 col-xs-1"> | |
37 | + <button type="submit" class="btn btn-fab btn-fab-mini"> | |
38 | + <i class="fa fa-search"></i> | |
39 | + </button> | |
40 | + </div> | |
41 | + </div> | |
42 | + </form> | |
43 | + </div> | |
44 | + <div class="col-md-3"> | |
45 | + <a href="{% url 'news:create' %}" class="pull-right btn btn-success btn-raised btn-md"><i class="fa fa-plus"></i> {% trans 'Create News' %}</a> | |
46 | + </div> | |
47 | +</div> | |
48 | + | |
49 | +{% if news %} | |
50 | + {% for new in news %} | |
51 | + <div class="row-fluid panel panel-default"> | |
52 | + <div class="panel-body"> | |
53 | + <div class="col-md-6"> | |
54 | + <a href="{% url 'news:view' new.slug %}"><h3> <b>{{ new }}</b> </h3></a> | |
55 | + <p>{{ new.creator}}, em {{ new.create_date }}</p> | |
56 | + </div> | |
57 | + <div class="col-md-6"> | |
58 | + <div align="right"> | |
59 | + <a href="{% url 'news:update' new.slug %}" class="btn btn-success btn-raised btn-sm"><i class="fa fa-edit"></i> {% trans 'Edit' %}</a> | |
60 | + <a href="" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a> | |
61 | + </div> | |
62 | + </div> | |
63 | + </div> | |
64 | + | |
65 | + </div> | |
66 | + {% endfor %} | |
67 | + {% pagination request paginator page_obj %} | |
68 | +{% else %} | |
69 | + <div class="row"> | |
70 | + <div class="col-md-12 col-sm-12 col-xs-12"> | |
71 | + <p>{% trans 'No news found' %}</p> | |
72 | + </div> | |
73 | + </div> | |
74 | +{% endif %} | |
75 | +<div id="modal_remove"> | |
76 | + | |
77 | +</div> | |
78 | + | |
79 | +{% endblock %} | ... | ... |
news/urls.py
... | ... | @@ -6,5 +6,7 @@ urlpatterns = [ |
6 | 6 | url(r'^view/(?P<slug>[\w_-]+)/$', views.VisualizeNews.as_view(), name = 'view'), |
7 | 7 | url(r'^create/$', views.CreateNewsView.as_view(), name='create'), |
8 | 8 | url(r'^update/(?P<slug>[\w_-]+)/$', views.UpdateNewsView.as_view(), name = 'update'), |
9 | + url(r'^search/$', views.SearchNewsView.as_view(), name = 'search'), | |
10 | + url(r'^delete/(?P<slug>[\w_-]+)/$', views.DeleteNewsView.as_view(), name='delete'), | |
9 | 11 | |
10 | 12 | ] | ... | ... |
news/views.py
1 | -from django.shortcuts import render | |
1 | +from django.shortcuts import get_object_or_404, redirect, render | |
2 | 2 | from django.views import generic |
3 | 3 | from django.contrib.auth.mixins import LoginRequiredMixin |
4 | 4 | from log.models import Log |
... | ... | @@ -6,12 +6,17 @@ from log.mixins import LogMixin |
6 | 6 | from django.core.urlresolvers import reverse, reverse_lazy |
7 | 7 | from django.contrib import messages |
8 | 8 | from django.utils.translation import ugettext_lazy as _ |
9 | - | |
9 | +from django.db.models import Q, Count | |
10 | 10 | |
11 | 11 | from .models import News |
12 | 12 | from .forms import NewsForm |
13 | 13 | |
14 | 14 | class VisualizeNews(LoginRequiredMixin,LogMixin,generic.ListView): |
15 | + log_action = "view_new" | |
16 | + log_resource = "news" | |
17 | + log_component = "news" | |
18 | + log_context = {} | |
19 | + | |
15 | 20 | login_url = reverse_lazy("users:login") |
16 | 21 | redirect_field_name = 'next' |
17 | 22 | template_name = 'news/view.html' |
... | ... | @@ -27,9 +32,20 @@ class VisualizeNews(LoginRequiredMixin,LogMixin,generic.ListView): |
27 | 32 | slug = self.kwargs.get('slug', '') |
28 | 33 | new = News.objects.get(slug=slug) |
29 | 34 | |
35 | + self.log_context['new_title'] = new.title | |
36 | + self.log_context['new_slug'] = new.slug | |
37 | + | |
38 | + super(VisualizeNews, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | |
39 | + | |
30 | 40 | return new |
31 | 41 | |
32 | 42 | class ListNewsView(LoginRequiredMixin,LogMixin,generic.ListView): |
43 | + log_action = "view_list_of_news" | |
44 | + log_resource = "news" | |
45 | + log_component = "news" | |
46 | + log_context = {} | |
47 | + | |
48 | + | |
33 | 49 | login_url = reverse_lazy("users:login") |
34 | 50 | redirect_field_name = 'next' |
35 | 51 | |
... | ... | @@ -46,10 +62,17 @@ class ListNewsView(LoginRequiredMixin,LogMixin,generic.ListView): |
46 | 62 | context = super(ListNewsView, self).get_context_data(**kwargs) |
47 | 63 | context['title'] = _('Manage News') |
48 | 64 | |
65 | + super(ListNewsView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | |
66 | + | |
49 | 67 | return context |
50 | 68 | |
51 | 69 | |
52 | 70 | class CreateNewsView(LoginRequiredMixin,LogMixin,generic.edit.CreateView): |
71 | + log_action = "create" | |
72 | + log_resource = "news" | |
73 | + log_component = "news" | |
74 | + log_context = {} | |
75 | + | |
53 | 76 | login_url = reverse_lazy("users:login") |
54 | 77 | redirect_field_name = 'next' |
55 | 78 | template_name = 'news/create.html' |
... | ... | @@ -62,6 +85,13 @@ class CreateNewsView(LoginRequiredMixin,LogMixin,generic.edit.CreateView): |
62 | 85 | |
63 | 86 | self.object.save() |
64 | 87 | |
88 | + self.log_context['new_creator_user'] = self.object.creator.get_short_name() | |
89 | + self.log_context['new_title'] = self.object.title | |
90 | + self.log_context['new_slug'] = self.object.slug | |
91 | + | |
92 | + super(CreateNewsView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | |
93 | + | |
94 | + | |
65 | 95 | return super(CreateNewsView, self).form_valid(form) |
66 | 96 | |
67 | 97 | def get_success_url(self): |
... | ... | @@ -76,28 +106,118 @@ class CreateNewsView(LoginRequiredMixin,LogMixin,generic.edit.CreateView): |
76 | 106 | return context |
77 | 107 | |
78 | 108 | class UpdateNewsView(LoginRequiredMixin,LogMixin,generic.UpdateView): |
79 | - login_url = reverse_lazy("users:login") | |
80 | - redirect_field_name = 'next' | |
81 | - template_name = 'news/update.html' | |
82 | - form_class = NewsForm | |
83 | - model = News | |
109 | + log_action = "update" | |
110 | + log_resource = "news" | |
111 | + log_component = "news" | |
112 | + log_context = {} | |
84 | 113 | |
85 | - def get_success_url(self): | |
86 | - messages.success(self.request, _('News successfully created!')) | |
114 | + login_url = reverse_lazy("users:login") | |
115 | + redirect_field_name = 'next' | |
116 | + template_name = 'news/update.html' | |
117 | + form_class = NewsForm | |
118 | + model = News | |
87 | 119 | |
88 | - return reverse_lazy('news:view', kwargs = {'slug': self.object.slug} ) | |
120 | + def get_success_url(self): | |
121 | + messages.success(self.request, _('News successfully created!')) | |
89 | 122 | |
90 | - def get_context_data (self, **kwargs): | |
91 | - context = super(UpdateNewsView, self).get_context_data(**kwargs) | |
92 | - context['title'] = _("Update News") | |
123 | + return reverse_lazy('news:view', kwargs = {'slug': self.object.slug} ) | |
93 | 124 | |
94 | - return context | |
125 | + def get_context_data (self, **kwargs): | |
126 | + context = super(UpdateNewsView, self).get_context_data(**kwargs) | |
127 | + context['title'] = _("Update News") | |
95 | 128 | |
96 | - def form_valid(self, form): | |
97 | - self.object = form.save(commit = False) | |
98 | - creator = self.request.user | |
99 | - self.object.creator = creator | |
129 | + return context | |
100 | 130 | |
101 | - self.object.save() | |
131 | + def form_valid(self, form): | |
132 | + self.object = form.save(commit = False) | |
133 | + creator = self.request.user | |
134 | + self.object.creator = creator | |
102 | 135 | |
103 | - return super(UpdateNewsView, self).form_valid(form) | |
136 | + self.object.save() | |
137 | + | |
138 | + self.log_context['new_update_user'] = self.object.creator.get_short_name() | |
139 | + self.log_context['new_title'] = self.object.title | |
140 | + self.log_context['new_slug'] = self.object.slug | |
141 | + | |
142 | + super(UpdateNewsView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | |
143 | + | |
144 | + | |
145 | + return super(UpdateNewsView, self).form_valid(form) | |
146 | + | |
147 | +class SearchNewsView(LoginRequiredMixin, LogMixin, generic.ListView): | |
148 | + login_url = reverse_lazy("users:login") | |
149 | + redirect_field_name = 'next' | |
150 | + | |
151 | + template_name = 'news/search.html' | |
152 | + context_object_name = 'news' | |
153 | + paginate_by = 10 | |
154 | + | |
155 | + def dispatch(self, request, *args, **kwargs): | |
156 | + search = self.request.GET.get('search', '') | |
157 | + | |
158 | + if search == '': | |
159 | + return redirect(reverse_lazy('news:manage_news')) | |
160 | + | |
161 | + return super(SearchNewsView, self).dispatch(request, *args, **kwargs) | |
162 | + | |
163 | + def get_queryset(self): | |
164 | + inteiro = False | |
165 | + | |
166 | + search = self.request.GET.get('search', '') | |
167 | + print(type(search)) | |
168 | + try: | |
169 | + search = int(search) | |
170 | + inteiro = True | |
171 | + except Exception as e: | |
172 | + inteiro = False | |
173 | + | |
174 | + if inteiro: | |
175 | + news = News.objects.filter(Q(title__icontains = search) | Q(creator__username__icontains = search) | Q(create_date__icontains = search) | Q(create_date__year = search) | Q(create_date__month = search) | Q(create_date__day = search) ).distinct().order_by('create_date') | |
176 | + else: | |
177 | + news = News.objects.filter(Q(title__icontains = search) | Q(creator__username__icontains = search) | Q(create_date__icontains = search) ).distinct().order_by('create_date') | |
178 | + | |
179 | + | |
180 | + return news | |
181 | + | |
182 | + def get_context_data (self, **kwargs): | |
183 | + context = super(SearchNewsView, self).get_context_data(**kwargs) | |
184 | + context['title'] = _('Search News') | |
185 | + context['search'] = self.request.GET.get('search') | |
186 | + | |
187 | + return context | |
188 | + | |
189 | +class DeleteNewsView(LoginRequiredMixin,LogMixin,generic.DeleteView): | |
190 | + log_component = 'news' | |
191 | + log_action = 'delete' | |
192 | + log_resource = 'news' | |
193 | + log_context = {} | |
194 | + | |
195 | + login_url = reverse_lazy("users:login") | |
196 | + redirect_field_name = 'next' | |
197 | + | |
198 | + model = News | |
199 | + template_name = 'news/delete.html' | |
200 | + | |
201 | + def delete(self, request, *args, **kwargs): | |
202 | + news = get_object_or_404(News, slug = self.kwargs.get('slug')) | |
203 | + return super(DeleteNewsView, self).delete(self, request, *args, **kwargs) | |
204 | + | |
205 | + def get_success_url(self): | |
206 | + messages.success(self.request, _('News "%s" removed successfully!')%(self.object.title)) | |
207 | + success_url = reverse_lazy('news:manage_news') | |
208 | + | |
209 | + return success_url | |
210 | + | |
211 | + def get_context_data(self, **kwargs): | |
212 | + context = super(DeleteNewsView, self).get_context_data(**kwargs) | |
213 | + context['title'] = _('Delete News') | |
214 | + news = get_object_or_404(News, slug = self.kwargs.get('slug')) | |
215 | + context['new'] = news | |
216 | + | |
217 | + self.log_context['new_creator'] = news.creator.get_short_name() | |
218 | + self.log_context['new_title'] = news.title | |
219 | + self.log_context['new_slug'] = news.slug | |
220 | + | |
221 | + super(DeleteNewsView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | |
222 | + | |
223 | + return context | ... | ... |
notifications/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:12-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" |
... | ... | @@ -97,17 +97,22 @@ msgstr "Notificação" |
97 | 97 | |
98 | 98 | #: notifications/templates/notifications/_ajax_history.html:48 |
99 | 99 | #: notifications/templates/notifications/_history.html:47 |
100 | +msgid "Aware" | |
101 | +msgstr "Ciente" | |
102 | + | |
103 | +#: notifications/templates/notifications/_ajax_history.html:53 | |
104 | +#: notifications/templates/notifications/_history.html:52 | |
100 | 105 | msgid "Observation" |
101 | 106 | msgstr "Observação" |
102 | 107 | |
103 | -#: notifications/templates/notifications/_ajax_history.html:59 | |
104 | -#: notifications/templates/notifications/_history.html:58 | |
108 | +#: notifications/templates/notifications/_ajax_history.html:64 | |
109 | +#: notifications/templates/notifications/_history.html:63 | |
105 | 110 | #: notifications/templates/notifications/_view.html:28 |
106 | 111 | msgid "Not Informed" |
107 | 112 | msgstr "Não Informado" |
108 | 113 | |
109 | -#: notifications/templates/notifications/_ajax_history.html:66 | |
110 | -#: notifications/templates/notifications/_history.html:65 | |
114 | +#: notifications/templates/notifications/_ajax_history.html:72 | |
115 | +#: notifications/templates/notifications/_history.html:71 | |
111 | 116 | msgid "No results found" |
112 | 117 | msgstr "Nenhum resultado encontrado" |
113 | 118 | |
... | ... | @@ -162,7 +167,9 @@ msgstr "Cancelar" |
162 | 167 | #: notifications/templates/notifications/index.html:19 |
163 | 168 | #: notifications/templates/notifications/subject.html:13 |
164 | 169 | msgid "This pendencies list is updated every 24 hours. Last update was in:" |
165 | -msgstr "Esta lista de pendências é atualizada a cada 24 horas. A última atualização ocorreu em:" | |
170 | +msgstr "" | |
171 | +"Esta lista de pendências é atualizada a cada 24 horas. A última atualização " | |
172 | +"ocorreu em:" | |
166 | 173 | |
167 | 174 | #: notifications/templates/notifications/index.html:19 |
168 | 175 | #: notifications/templates/notifications/subject.html:13 |
... | ... | @@ -209,13 +216,21 @@ msgstr "Essa tarefa está atrasada" |
209 | 216 | msgid "You miss this task" |
210 | 217 | msgstr "Você perdeu essa tarefa" |
211 | 218 | |
212 | -#: notifications/templatetags/notification_filters.py:120 | |
213 | -#: notifications/templatetags/notification_filters.py:124 | |
219 | +#: notifications/templatetags/notification_filters.py:40 | |
220 | +msgid "Yes" | |
221 | +msgstr "Sim" | |
222 | + | |
223 | +#: notifications/templatetags/notification_filters.py:42 | |
224 | +msgid "No" | |
225 | +msgstr "Não" | |
226 | + | |
227 | +#: notifications/templatetags/notification_filters.py:129 | |
228 | +#: notifications/templatetags/notification_filters.py:133 | |
214 | 229 | #, python-format |
215 | 230 | msgid "Goal defined to task realization: %s" |
216 | 231 | msgstr "Meta definida para realização da tarefa: %s" |
217 | 232 | |
218 | -#: notifications/templatetags/notification_filters.py:126 | |
233 | +#: notifications/templatetags/notification_filters.py:135 | |
219 | 234 | #, python-format |
220 | 235 | msgid "New goal defined to task realization: %s" |
221 | 236 | msgstr "Nova meta definida para realização da tarefa: %s" | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10.4 on 2017-04-13 23: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 | + ('notifications', '0002_auto_20170130_1828'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.AddField( | |
16 | + model_name='notification', | |
17 | + name='aware', | |
18 | + field=models.BooleanField(default=False, verbose_name='Aware'), | |
19 | + ), | |
20 | + ] | ... | ... |
notifications/migrations/0004_remove_notification_aware.py
0 → 100644
... | ... | @@ -0,0 +1,19 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10.4 on 2017-04-13 23:40 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('notifications', '0003_notification_aware'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.RemoveField( | |
16 | + model_name='notification', | |
17 | + name='aware', | |
18 | + ), | |
19 | + ] | ... | ... |
notifications/templates/notifications/_ajax_history.html
... | ... | @@ -44,6 +44,11 @@ |
44 | 44 | </a> |
45 | 45 | </th> |
46 | 46 | <th> |
47 | + <a href="javascript: orderBy({{ subject_id }}, '{{ request|order_ajax:'aware' }}')"> | |
48 | + {% trans 'Aware' %} <i class="fa fa-fw {{ request|order_icon_class:'aware' }} pull-right"></i> | |
49 | + </a> | |
50 | + </th> | |
51 | + <th> | |
47 | 52 | <a href="javascript: orderBy({{ subject_id }}, '{{ request|order_ajax:'obs' }}'')"> |
48 | 53 | {% trans 'Observation' %} <i class="fa fa-fw {{ request|order_icon_class:'obs' }} pull-right"></i> |
49 | 54 | </a> |
... | ... | @@ -58,12 +63,13 @@ |
58 | 63 | <td>{{ notification.task.get_action_display }}</td> |
59 | 64 | <td>{{ notification.task.end_date|date:"SHORT_DATE_FORMAT"|default:_('Not Informed') }}</td> |
60 | 65 | <td>{{ notification.level|warning_msg }}</td> |
66 | + <td>{{ notification.viewed|viewed_msg }}</td> | |
61 | 67 | <td>{{ notification|observation }}</td> |
62 | 68 | </tr> |
63 | 69 | {% endfor %} |
64 | 70 | {% else %} |
65 | 71 | <tr> |
66 | - <td colspan="6" class="text-center">{% trans 'No results found' %}</td> | |
72 | + <td colspan="7" class="text-center">{% trans 'No results found' %}</td> | |
67 | 73 | </tr> |
68 | 74 | {% endif %} |
69 | 75 | </tbody> | ... | ... |
notifications/templates/notifications/_history.html
... | ... | @@ -43,6 +43,11 @@ |
43 | 43 | </a> |
44 | 44 | </th> |
45 | 45 | <th> |
46 | + <a href="{{ request|order_href:'aware' }}"> | |
47 | + {% trans 'Aware' %} <i class="fa fa-fw {{ request|order_icon_class:'aware' }} pull-right"></i> | |
48 | + </a> | |
49 | + </th> | |
50 | + <th> | |
46 | 51 | <a href="{{ request|order_href:'obs' }}"> |
47 | 52 | {% trans 'Observation' %} <i class="fa fa-fw {{ request|order_icon_class:'obs' }} pull-right"></i> |
48 | 53 | </a> |
... | ... | @@ -57,12 +62,13 @@ |
57 | 62 | <td>{{ notification.task.get_action_display }}</td> |
58 | 63 | <td>{{ notification.task.end_date|date:"SHORT_DATE_FORMAT"|default:_('Not Informed') }}</td> |
59 | 64 | <td>{{ notification.level|warning_msg }}</td> |
65 | + <td>{{ notification.viewed|viewed_msg }}</td> | |
60 | 66 | <td>{{ notification|observation }}</td> |
61 | 67 | </tr> |
62 | 68 | {% endfor %} |
63 | 69 | {% else %} |
64 | 70 | <tr> |
65 | - <td colspan="6" class="text-center">{% trans 'No results found' %}</td> | |
71 | + <td colspan="7" class="text-center">{% trans 'No results found' %}</td> | |
66 | 72 | </tr> |
67 | 73 | {% endif %} |
68 | 74 | </tbody> | ... | ... |
notifications/templatetags/notification_filters.py
... | ... | @@ -34,6 +34,15 @@ def warning_msg(level): |
34 | 34 | |
35 | 35 | return msg |
36 | 36 | |
37 | +@register.filter(name = 'viewed_msg') | |
38 | +def viewed_msg(aware): | |
39 | + if aware: | |
40 | + msg = _('Yes') | |
41 | + else: | |
42 | + msg = _('No') | |
43 | + | |
44 | + return msg | |
45 | + | |
37 | 46 | @register.filter(name = 'done_percent') |
38 | 47 | def done_percent(notification): |
39 | 48 | users = get_resource_users(notification.task.resource) |
... | ... | @@ -117,12 +126,12 @@ def observation(notification): |
117 | 126 | |
118 | 127 | if notification.level == 1: |
119 | 128 | if notification.meta: |
120 | - msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta, "SHORT_DATETIME_FORMAT")) | |
129 | + msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta.astimezone(timezone.get_current_timezone()), "SHORT_DATETIME_FORMAT")) | |
121 | 130 | elif notification.level == 2: |
122 | 131 | if notification.meta: |
123 | 132 | if notification.meta < timezone.now(): |
124 | - msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta, "SHORT_DATETIME_FORMAT")) | |
133 | + msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta.astimezone(timezone.get_current_timezone()), "SHORT_DATETIME_FORMAT")) | |
125 | 134 | else: |
126 | - msg = _('New goal defined to task realization: %s')%(formats.date_format(notification.meta, "SHORT_DATETIME_FORMAT")) | |
135 | + msg = _('New goal defined to task realization: %s')%(formats.date_format(notification.meta.astimezone(timezone.get_current_timezone()), "SHORT_DATETIME_FORMAT")) | |
127 | 136 | |
128 | 137 | return msg |
129 | 138 | \ No newline at end of file | ... | ... |
notifications/utils.py
... | ... | @@ -94,6 +94,11 @@ def get_order_by(order): |
94 | 94 | return ["-level"] |
95 | 95 | else: |
96 | 96 | return ["level"] |
97 | + elif "aware" in order: | |
98 | + if "-" in order: | |
99 | + return ["-viewed"] | |
100 | + else: | |
101 | + return ["viewed"] | |
97 | 102 | elif "obs" in order: |
98 | 103 | if "-" in order: |
99 | 104 | return ["-meta"] | ... | ... |
pdf_file/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:12-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" | ... | ... |
pendencies/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
reports/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
No preview for this file type
security/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
students_group/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
subjects/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
themes/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
topics/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:12-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" | ... | ... |
users/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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,7 +18,7 @@ msgstr "" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
20 | 20 | |
21 | -#: users/forms.py:28 users/forms.py:33 users/forms.py:276 | |
21 | +#: users/forms.py:28 users/forms.py:33 users/forms.py:279 | |
22 | 22 | msgid "You must insert an email address" |
23 | 23 | msgstr "Você deve inserir um endereço de email" |
24 | 24 | |
... | ... | @@ -30,45 +30,45 @@ msgstr "A imagem é muito grande. Ela deve conter menos de 2MB." |
30 | 30 | msgid "The confirmation password is incorrect." |
31 | 31 | msgstr "A confirmação de senha está incorreta." |
32 | 32 | |
33 | -#: users/forms.py:61 users/forms.py:173 users/templates/users/login.html:52 | |
33 | +#: users/forms.py:61 users/forms.py:175 users/templates/users/login.html:52 | |
34 | 34 | msgid "Password" |
35 | 35 | msgstr "Senha" |
36 | 36 | |
37 | -#: users/forms.py:62 users/forms.py:174 users/forms.py:233 users/forms.py:289 | |
37 | +#: users/forms.py:62 users/forms.py:176 users/forms.py:236 users/forms.py:292 | |
38 | 38 | msgid "Confirm Password" |
39 | 39 | msgstr "Confirmação de Senha" |
40 | 40 | |
41 | -#: users/forms.py:108 users/forms.py:267 users/templates/users/list.html:56 | |
41 | +#: users/forms.py:109 users/forms.py:270 users/templates/users/list.html:56 | |
42 | 42 | #: users/templates/users/login.html:47 users/templates/users/search.html:47 |
43 | 43 | msgid "Email" |
44 | 44 | msgstr "Email" |
45 | 45 | |
46 | -#: users/forms.py:109 users/models.py:27 users/templates/users/list.html:55 | |
46 | +#: users/forms.py:110 users/models.py:27 users/templates/users/list.html:55 | |
47 | 47 | #: users/templates/users/search.html:46 |
48 | 48 | msgid "Name" |
49 | 49 | msgstr "Nome" |
50 | 50 | |
51 | -#: users/forms.py:110 users/models.py:28 | |
51 | +#: users/forms.py:111 users/models.py:28 | |
52 | 52 | msgid "Last Name" |
53 | 53 | msgstr "Sobrenome" |
54 | 54 | |
55 | -#: users/forms.py:111 users/models.py:29 | |
55 | +#: users/forms.py:112 users/models.py:29 | |
56 | 56 | msgid "Social Name" |
57 | 57 | msgstr "Nome Social" |
58 | 58 | |
59 | -#: users/forms.py:232 users/forms.py:288 | |
59 | +#: users/forms.py:235 users/forms.py:291 | |
60 | 60 | msgid "New Password" |
61 | 61 | msgstr "Nova Senha" |
62 | 62 | |
63 | -#: users/forms.py:239 | |
63 | +#: users/forms.py:242 | |
64 | 64 | msgid "The value inputed does not match with your actual password." |
65 | 65 | msgstr "O valor inserido não corresponde à sua senha atual." |
66 | 66 | |
67 | -#: users/forms.py:260 | |
67 | +#: users/forms.py:263 | |
68 | 68 | msgid "Actual Password" |
69 | 69 | msgstr "Senha Atual" |
70 | 70 | |
71 | -#: users/forms.py:281 | |
71 | +#: users/forms.py:284 | |
72 | 72 | msgid "You must insert a valid email address" |
73 | 73 | msgstr "Você deve inserir um endereço de email válido" |
74 | 74 | ... | ... |
webconference/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
webpage/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: 2017-04-11 19:18-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |
youtube_video/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: 2017-04-11 19:17-0300\n" | |
11 | +"POT-Creation-Date: 2017-04-15 00:13-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" | ... | ... |