Skip to content
Snippets Groups Projects
Commit 0efcac49 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Dedicated submit text for the last step in the wizard, done step is TODO

parent a3a432e8
No related branches found
No related tags found
1 merge request!1Wizard form
Pipeline #9306 passed
...@@ -122,9 +122,15 @@ window.onload = function() { ...@@ -122,9 +122,15 @@ window.onload = function() {
<input type="hidden" name="ippi_wizard-current_step" <input type="hidden" name="ippi_wizard-current_step"
value="{{ wizard.steps.current }}" value="{{ wizard.steps.current }}"
id="id_ippi_wizard-current_step"/> id="id_ippi_wizard-current_step"/>
<input class="submit_button" type="submit" <button class="submit_button" type="submit">
value="{%block submit_button_text%}{% trans 'Next step' %}{%endblock%}" {%block submit_button_text%}
/> {% if wizard.steps.step1 == wizard.steps.count %}
{% trans 'Save in Database' %}
{%else%}
{% trans 'Next step' %}
{%endif%}
{%endblock%}
</button>
</div> </div>
</form> </form>
<div class="empty_form" style="display:none">{% block emptyform %}{% endblock emptyform%}</div> <div class="empty_form" style="display:none">{% block emptyform %}{% endblock emptyform%}</div>
......
...@@ -30,6 +30,10 @@ def bootstrap(object): ...@@ -30,6 +30,10 @@ def bootstrap(object):
wrapping_classes = "form-check" wrapping_classes = "form-check"
label_classes = "form-check-label" label_classes = "form-check-label"
css_classes.add("form-check-input") css_classes.add("form-check-input")
# elif isinstance(field.field.widget, widgets.RadioSelect):
# wrapping_classes = "form-check"
# label_classes = "form-check-label"
# css_classes.add("form-check-input")
else: else:
wrapping_classes = "input_field form-group" wrapping_classes = "input_field form-group"
label_classes = "form-control-placeholder" label_classes = "form-control-placeholder"
......
...@@ -69,6 +69,7 @@ TEMPLATES = {"IdForm": "IdForm.html", ...@@ -69,6 +69,7 @@ TEMPLATES = {"IdForm": "IdForm.html",
class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView): class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
# @formatter:off
context = super(IppiWizard, self).get_context_data(**kwargs) context = super(IppiWizard, self).get_context_data(**kwargs)
if self.steps.current == 'BibliographyForm': if self.steps.current == 'BibliographyForm':
context['id_source'] = self.storage.get_step_data('IdForm').get('IdForm-id_source') context['id_source'] = self.storage.get_step_data('IdForm').get('IdForm-id_source')
...@@ -82,6 +83,7 @@ class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView): ...@@ -82,6 +83,7 @@ class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView):
context['complex_choice'] = self.storage.get_step_data('ProteinDomainComplexTypeForm').get('ProteinDomainComplexTypeForm-complexChoice') context['complex_choice'] = self.storage.get_step_data('ProteinDomainComplexTypeForm').get('ProteinDomainComplexTypeForm-complexChoice')
context['complex_type'] = self.storage.get_step_data('ProteinDomainComplexTypeForm').get('ProteinDomainComplexTypeForm-complexType') context['complex_type'] = self.storage.get_step_data('ProteinDomainComplexTypeForm').get('ProteinDomainComplexTypeForm-complexType')
context['pdb_id'] = self.storage.get_step_data('PDBForm').get('PDBForm-pdb_id') context['pdb_id'] = self.storage.get_step_data('PDBForm').get('PDBForm-pdb_id')
# @formatter:on
return context return context
def get_form_kwargs(self, step=None): def get_form_kwargs(self, step=None):
...@@ -145,7 +147,8 @@ class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView): ...@@ -145,7 +147,8 @@ class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView):
def get_template_names(self): def get_template_names(self):
return [TEMPLATES[self.steps.current]] return [TEMPLATES[self.steps.current]]
def done(self, form_list, **kwargs): def done(self, form_list, form_dict=None, **kwargs):
super().done(form_list=form_list, **kwargs)
return render(self.request, 'done.html', { return render(self.request, 'done.html', {
'form_data': [form.cleaned_data for form in form_list], 'form_data': [form.cleaned_data for form in form_list],
}) })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment