diff --git a/welco/settings.py b/welco/settings.py index cb356ae..fdd35b5 100644 --- a/welco/settings.py +++ b/welco/settings.py @@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/1.7/ref/settings/ import os from django.conf import global_settings +from django.utils.translation import ugettext_lazy as _ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -172,6 +173,12 @@ VALIDATION_STEPS = { 'mail': ['done-qualif', 'done-dgs', 'done-dga'], } +VALIDATION_STEP_LABELS = { + 'done-qualif': _('Send to DGS'), + 'done-dgs': _('Send to DGA'), + 'done-dga': _('Send to service'), +} + # mapping of channel to group/role *names* CHANNEL_ROLES = { 'mail': [], diff --git a/welco/static/css/style.css b/welco/static/css/style.css index 90f7462..70c1b76 100644 --- a/welco/static/css/style.css +++ b/welco/static/css/style.css @@ -163,12 +163,16 @@ div#content .cell.qualif form button.add { right: 1ex; } -div#content .cell.qualif form button.done { +div#content .cell.qualif form .done { position: absolute; right: 1ex; bottom: 1ex; } +div#content .cell.qualif form .done button { + position: static; +} + div#content .cell.qualif .select2-container, div#content .cell.qualif select { width: 98%; diff --git a/welco/templates/welco/qualification.html b/welco/templates/welco/qualification.html index 44262a0..4032e3f 100644 --- a/welco/templates/welco/qualification.html +++ b/welco/templates/welco/qualification.html @@ -33,7 +33,15 @@ {% endif %} {% if associations|length %} - +
+ {% if validation_steps %} + {% for validation_step in validation_steps %} + + {% endfor %} + {% else %} + + {% endif %} +
{% endif %} {% endif %} diff --git a/welco/views.py b/welco/views.py index c91d4a6..ccf035c 100644 --- a/welco/views.py +++ b/welco/views.py @@ -86,6 +86,9 @@ class Qualification(TemplateView): context['associations'] = Association.objects.filter( source_type=ContentType.objects.get(id=self.request.GET['source_type']), source_pk=self.request.GET['source_pk']).order_by('id') + validation_steps = settings.VALIDATION_STEPS.get(source_type.model.lower()) or [] + context['validation_steps'] = [ + {'id': x, 'label': settings.VALIDATION_STEP_LABELS[x]} for x in validation_steps] return context def post(self, request, *args, **kwargs): @@ -159,11 +162,14 @@ def qualification_done(request): id=request.POST['source_type']).model_class() source_object = source_class.objects.get(id=request.POST['source_pk']) validation_steps = settings.VALIDATION_STEPS.get(source_class.__name__.lower()) - if source_object.status: - source_object.status = validation_steps[ - validation_steps.index(source_object.status)+1] + if request.GET.get('step'): + source_object.status = validation_steps[validation_steps.index(request.GET.get('step'))] else: - source_object.status = validation_steps[0] + if source_object.status: + source_object.status = validation_steps[ + validation_steps.index(source_object.status)+1] + else: + source_object.status = validation_steps[0] if source_object.status == validation_steps[-1]: for association in Association.objects.filter( source_type=request.POST['source_type'],