0001-mails-add-subject-field-11289.patch
welco/contrib/alfortville/templates/alfortville/dg-table.html | ||
---|---|---|
18 | 18 |
<table class="main"> |
19 | 19 |
<thead> |
20 | 20 |
<th>{% trans 'Scan Date' %}</th> |
21 |
<th>{% trans 'Post Date' %}</th> |
|
22 |
<th>{% trans 'Subject' %}</th> |
|
21 | 23 |
<th>{% trans 'User' %}</th> |
22 | 24 |
<th>{% trans 'Category' %}</th> |
23 | 25 |
<th>{% trans 'Related Forms' %}</th> |
... | ... | |
27 | 29 |
{% for object in mails %} |
28 | 30 |
<tr data-mail-id="{{object.id}}"> |
29 | 31 |
<td class="r">{{object.creation_timestamp|date:"d F Y"|lower}}</td> |
32 |
<td class="r">{{object.post_date|date:"d F Y"|lower}}</td> |
|
33 |
<td class="r">{{object.subject|default:'-'}}</td> |
|
30 | 34 |
<td class="r">{{object.contact_name }}</td> |
31 | 35 |
<td class="r">{{object.categories|join:", " }}</td> |
32 | 36 |
<td class="r">{% for association in object.associations.all %}{{association.formdef_name}}{% if not forloop.last %}, {% endif %}{% endfor %}</td> |
welco/contrib/alfortville/templates/alfortville/mail-table-waiting.html | ||
---|---|---|
14 | 14 |
<thead> |
15 | 15 |
<th>{% trans 'Scan Date' %}</th> |
16 | 16 |
<th>{% trans 'Post Date' %}</th> |
17 |
<th>{% trans 'Subject' %}</th> |
|
17 | 18 |
<th>{% trans 'Related Forms' %}</th> |
18 | 19 |
<th>{% trans 'Status' %}</th> |
19 | 20 |
</thead> |
... | ... | |
22 | 23 |
<tr> |
23 | 24 |
<td>{{object.creation_timestamp|date:"d F Y"|lower}}</td> |
24 | 25 |
<td>{{object.post_date|default:'-'}}</td> |
26 |
<td>{{object.subject|default:'-'}}</td> |
|
25 | 27 |
<td>{% for association in object.associations.all %}{{association.formdef_name}}{% if not forloop.last %}, {% endif %}{% endfor %}</td> |
26 | 28 |
<td>{% if object.status == 'done-qualif' %}En attente de validation DGS |
27 | 29 |
{% elif object.status == 'done-dgs' %}En attente de validation DGA |
welco/sources/mail/forms.py | ||
---|---|---|
18 | 18 |
from django.utils.translation import ugettext_lazy as _ |
19 | 19 | |
20 | 20 |
class MailQualificationForm(forms.Form): |
21 |
subject = forms.CharField(label='', required=False, |
|
22 |
widget=forms.TextInput(attrs={'placeholder': _('Subject')})) |
|
21 | 23 |
post_date = forms.DateTimeField(label=_('Post Date (*)'), required=False) |
22 | 24 |
registered_mail_number = forms.CharField(label=_('Registered Mail Number'), required=False) |
welco/sources/mail/migrations/0010_mail_subject.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
from __future__ import unicode_literals |
|
3 | ||
4 |
from django.db import migrations, models |
|
5 | ||
6 | ||
7 |
class Migration(migrations.Migration): |
|
8 | ||
9 |
dependencies = [ |
|
10 |
('mail', '0009_mail_scanner_category'), |
|
11 |
] |
|
12 | ||
13 |
operations = [ |
|
14 |
migrations.AddField( |
|
15 |
model_name='mail', |
|
16 |
name='subject', |
|
17 |
field=models.CharField(max_length=200, null=True, verbose_name='Subject'), |
|
18 |
), |
|
19 |
] |
welco/sources/mail/models.py | ||
---|---|---|
38 | 38 |
post_date = models.DateField(_('Post Date'), null=True) |
39 | 39 |
registered_mail_number = models.CharField(_('Registered Mail Number'), |
40 | 40 |
null=True, max_length=50) |
41 |
subject = models.CharField(_('Subject'), null=True, max_length=200) |
|
41 | 42 |
note = models.TextField(_('Note'), null=True) |
42 | 43 | |
43 | 44 |
scanner_category = models.CharField(max_length=100, blank=True, null=True) |
... | ... | |
59 | 60 |
def get_qualification_form(self): |
60 | 61 |
return self.get_qualification_form_class()({ |
61 | 62 |
'post_date': self.post_date, |
62 |
'registered_mail_number': self.registered_mail_number}) |
|
63 |
'registered_mail_number': self.registered_mail_number, |
|
64 |
'subject': self.subject}) |
|
63 | 65 | |
64 | 66 |
@classmethod |
65 | 67 |
def get_qualification_form_submit_url(cls): |
... | ... | |
110 | 112 |
'channel': 'mail', |
111 | 113 |
'post_date': self.post_date and self.post_date.strftime('%Y-%m-%d'), |
112 | 114 |
'registered_mail_number': self.registered_mail_number, |
115 |
'subject': self.subject, |
|
113 | 116 |
} |
114 | 117 | |
115 | 118 |
welco/sources/mail/templates/welco/mail_home.html | ||
---|---|---|
11 | 11 |
data-pdf-href="{{ mail.content.url }}" |
12 | 12 |
data-post-date="{{ mail.post_date|date:"d/m/Y" }}" |
13 | 13 |
data-registered-mail-number="{% firstof mail.registered_mail_number %}" |
14 |
data-subject="{% firstof mail.subject %}" |
|
14 | 15 |
>{{ mail.creation_timestamp|date:"d/m/Y" }} |
15 | 16 |
{{mail.contact_name}} |
16 | 17 |
{% for association in mail.associations.all %} |
welco/sources/mail/templates/welco/mail_summary.html | ||
---|---|---|
7 | 7 |
<p class="registered-mail-number">{% trans "Registered Mail Number:" %} {{object.registered_mail_number}}</p> |
8 | 8 |
{% endif %} |
9 | 9 | |
10 |
{% if object.subject %} |
|
11 |
<p class="subject">{% trans "Subject:" %} {{object.subject}}</p> |
|
12 |
{% endif %} |
|
13 | ||
10 | 14 |
<p class="thumbnail"> |
11 | 15 |
<a href="{{ site_base }}{{ object.content.url }}" target="_blank"> |
12 | 16 |
<img src="{{ site_base }}{{ object.content.url }}.png" alt=""/> |
welco/sources/mail/views.py | ||
---|---|---|
88 | 88 |
if form.is_valid(): |
89 | 89 |
mail.post_date = form.cleaned_data['post_date'] |
90 | 90 |
mail.registered_mail_number = form.cleaned_data['registered_mail_number'] |
91 |
mail.subject = form.cleaned_data['subject'] |
|
91 | 92 |
mail.save() |
92 | 93 |
return HttpResponseRedirect(reverse('qualif-zone') + |
93 | 94 |
'?source_type=%s&source_pk=%s' % (request.POST['source_type'], |
welco/static/css/style.css | ||
---|---|---|
474 | 474 |
padding: 0.5ex 0.5ex; |
475 | 475 |
} |
476 | 476 | |
477 |
#source-mainarea input#id_subject { |
|
478 |
width: 40em; |
|
479 |
} |
|
480 | ||
477 | 481 |
#source-mainarea button { |
478 | 482 |
position: relative; |
479 | 483 |
top: -2px; |
welco/static/js/welco.js | ||
---|---|---|
79 | 79 |
$(this).addClass('active'); |
80 | 80 |
$('#id_post_date').val($(this).data('post-date')); |
81 | 81 |
$('#id_registered_mail_number').val($(this).data('registered-mail-number')); |
82 |
$('#id_subject').val($(this).data('subject')); |
|
82 | 83 |
var source_pk = $('div.source .active[data-source-pk]').data('source-pk'); |
83 | 84 |
$('#postit > div.content').data('url', $('#postit > div.content').data('base-url') + '?mail=' + source_pk); |
84 | 85 |
$('#postit').trigger('welco:load-mail-note'); |
... | ... | |
212 | 213 |
$('.document').delegate('button.save', 'click', function() { |
213 | 214 |
var post_date = $('#id_post_date').val(); |
214 | 215 |
var registered_mail_number = $('#id_registered_mail_number').val(); |
216 |
var subject = $('#id_subject').val(); |
|
215 | 217 |
var source_type = $('div.source div[data-source-type]').data('source-type'); |
216 | 218 |
var source_pk = $('div.source .active[data-source-pk]').data('source-pk'); |
217 | 219 |
$.ajax({url: $(this).data('action-url'), |
218 | 220 |
data: {post_date: post_date, |
219 | 221 |
registered_mail_number: registered_mail_number, |
222 |
subject: subject, |
|
220 | 223 |
source_type: source_type, |
221 | 224 |
source_pk: source_pk}, |
222 | 225 |
method: 'POST', |
... | ... | |
224 | 227 |
success: function(data) { |
225 | 228 |
$('div.source .active').data('post-date', post_date); |
226 | 229 |
$('div.source .active').data('registered-mail-number', registered_mail_number); |
230 |
$('div.source .active').data('subject', subject); |
|
227 | 231 |
$('#source-mainarea form').effect('highlight'); |
228 | 232 |
if ($('#id_post_date').length && !$('#id_post_date').val()) { |
229 | 233 |
$('div.qualif button.done').attr('disabled', 'disabled'); |
230 |
- |