Browse Source

DIV-758: Hiding children related information/menus if there are no children of the marriage

pull/160/head
Benard Ebinu 7 years ago
parent
commit
58ead2d340
6 changed files with 42 additions and 14 deletions
  1. +4
    -3
      edivorce/apps/core/templates/overview.html
  2. +4
    -2
      edivorce/apps/core/templates/partials/progress.html
  3. +4
    -3
      edivorce/apps/core/templates/question/13_review.html
  4. +21
    -5
      edivorce/apps/core/templatetags/step_order.py
  5. +8
    -1
      edivorce/apps/core/utils/derived.py
  6. +1
    -0
      edivorce/apps/core/views/main.py

+ 4
- 3
edivorce/apps/core/templates/overview.html View File

@ -47,18 +47,19 @@
{% if step_status.your_separation == 'Started' %}<span class="progress-status"><i class="fa fa-adjust" aria-hidden="true"></i> Started</span>
{% elif step_status.your_separation == 'Complete' %}<span class="progress-status"><i class="fa fa-check" aria-hidden="true"></i> Completed</span> {% endif %}
</a>
{% if children_of_marriage == 'YES' or derived.has_children_of_marriage %}
<a href="{% url 'question_steps' 'children' 'your_children'%}" class="progress-question {% if step_status.your_children == 'Complete' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-users" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step 6</small><br />Your children</span>
<span class="progress-content"><small>Step {% step_order step="children" %}</small><br />Your children</span>
{% if step_status.your_children == 'Started' %}<span class="progress-status"><i class="fa fa-adjust" aria-hidden="true"></i> Started</span>
{% elif step_status.your_children == 'Complete' %}<span class="progress-status"><i class="fa fa-check" aria-hidden="true"></i> Completed</span> {% endif %}
</a>
{% endif %}
{% if 'Spousal support' in which_orders.0.value|load_json %}
<a href="{% url 'question_steps' 'support' %}" class="progress-question {% if step_status.spousal_support == 'Complete' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-life-ring" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step 7</small><br />Spousal support</span>
<span class="progress-content"><small>Step {% step_order step="support" %}</small><br />Spousal support</span>
{% if step_status.spousal_support == 'Started' %}<span class="progress-status"><i class="fa fa-adjust" aria-hidden="true"></i> Started</span>
{% elif step_status.spousal_support == 'Complete' %}<span class="progress-status"><i class="fa fa-check" aria-hidden="true"></i> Completed</span> {% endif %}
</a>


+ 4
- 2
edivorce/apps/core/templates/partials/progress.html View File

@ -40,10 +40,11 @@
{% elif step_status.your_separation == 'Complete' %}<span class="progress-status"><i class="fa fa-check" aria-hidden="true"></i></span> {% endif %}
</a>
{% if children_of_marriage == 'YES' or derived.has_children_of_marriage %}
<div class="progress-question collapse-trigger {% if step_status.your_children == 'Complete' %} complete {% endif %} {% if active_page == 'children' %} active {% endif %}"
data-toggle="collapse" aria-expanded="false" data-target="#children_nav" aria-controls="children_nav">
<span class="progress-icon"><i class="fa fa-users" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step 6</small><br />Your children</span>
<span class="progress-content"><small>Step {% step_order step="children" %}</small><br />Your children</span>
{% if step_status.your_children == 'Started' %}<span class="progress-status"><i class="fa fa-adjust" aria-hidden="true"></i></span>
{% elif step_status.your_children == 'Complete' %}<span class="progress-status"><i class="fa fa-check" aria-hidden="true"></i></span> {% endif %}
</div>
@ -75,11 +76,12 @@
</a>
</li>
</ul>
{% endif %}
{% if 'Spousal support' in want_which_orders|load_json or 'Spousal support' in which_orders.0.value|load_json %}
<a href="{% url 'question_steps' 'support' %}" class="progress-question {% if step_status.spousal_support == 'Complete' %} complete {% endif %} {% if active_page == 'support' %} active {% endif %}">
<span class="progress-icon"><i class="fa fa-life-ring" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step 7</small><br />Spousal support</span>
<span class="progress-content"><small>Step {% step_order step="support" %}</small><br />Spousal support</span>
{% if step_status.spousal_support == 'Started' %}<span class="progress-status"><i class="fa fa-adjust" aria-hidden="true"></i></span>
{% elif step_status.spousal_support == 'Complete' %}<span class="progress-status"><i class="fa fa-check" aria-hidden="true"></i></span> {% endif %}
</a>


+ 4
- 3
edivorce/apps/core/templates/question/13_review.html View File

@ -107,10 +107,11 @@
</div>
</div>
{% if derived.has_children_of_marriage %}
<div class="question-well step-review">
<div class="collapse-trigger" data-toggle="collapse" aria-expanded="true" data-target="#review_step_6" aria-controls="collapse_changed_name">
<div>
Step 6: Your children
Step {% step_order step="children" %}: Your children
</div>
</div>
<p class="review-buttons"><a class="btn btn-success" href="{% url 'question_steps' 'children' 'your_children' %}">Edit</a> </p>
@ -121,13 +122,13 @@
</div>
</div>
</div>
{% endif %}
{% if 'Spousal support' in which_orders.0.value|load_json %}
<div class="question-well step-review">
<div class="collapse-trigger" data-toggle="collapse" aria-expanded="true" data-target="#review_step_7" aria-controls="collapse_changed_name">
<div>
Step 7: Spousal support
Step {% step_order step="support" %}: Spousal support
</div>
</div>
<p class="review-buttons"><a class="btn btn-success" href="{% url 'question_steps' 'support' %}">Edit</a> </p>


+ 21
- 5
edivorce/apps/core/templatetags/step_order.py View File

@ -11,19 +11,24 @@ register = template.Library()
def _get_next_step(context, step, sub_step, direction):
want_which_orders = json.loads(context.get('want_which_orders', '[]'))
sub_step_name = _get_next_sub_step(step, sub_step, want_which_orders, direction=direction)
children_of_marriage = context.get('children_of_marriage', None)
sub_step_name = _get_next_sub_step(step, sub_step, want_which_orders,
children_of_marriage=children_of_marriage,
direction=direction)
if sub_step_name is not None:
return sub_step_name
current_step_base_order = template_step_order[step]
next_item = _adjust_for_orders(current_step_base_order, want_which_orders, direction=direction)
next_item = _adjust_for_orders(current_step_base_order, want_which_orders,
children_of_marriage=children_of_marriage,
direction=direction)
# The next page or previous page could land on a sub step page so need to do lookup to find
# out where may fall.
return get_step_or_sub_step_name(next_item, direction=direction)
def _get_next_sub_step(step, sub_step, want_which_orders, direction):
def _get_next_sub_step(step, sub_step, want_which_orders, children_of_marriage, direction):
current_step_base_order = template_step_order[step]
if template_sub_step_order.get(step, None) is not None:
current_sub_step_base_order = template_sub_step_order[step].get(sub_step, None)
@ -36,18 +41,23 @@ def _get_next_sub_step(step, sub_step, want_which_orders, direction):
if next_sub_step is not None:
return reverse('question_steps', kwargs={'step': step, 'sub_step': next_sub_step})
next_item = _adjust_for_orders(current_step_base_order, want_which_orders, direction=direction)
next_item = _adjust_for_orders(current_step_base_order, want_which_orders,
children_of_marriage=children_of_marriage,
direction=direction)
return reverse('question_steps', kwargs={'step': get_step_name(template_step_order, next_item)})
return None
def _adjust_for_orders(next_item, want_which_orders, direction):
def _adjust_for_orders(next_item, want_which_orders, children_of_marriage=None, direction=None):
addend = 1
if direction != 'next':
addend = -1
next_item += addend
if next_item == 6 and 'YES' != children_of_marriage:
next_item += addend
if next_item == 7 and 'Spousal support' not in want_which_orders:
next_item += addend
@ -66,6 +76,12 @@ def step_order(context, step):
base_order = template_step_order[step]
order = base_order
if base_order > 5 and (
context.get('children_of_marriage', None) != 'YES' and
context.get('derived', dict()).get('has_children_of_marriage', None) is False
):
order -= 1
if base_order > 6 and 'Spousal support' not in want_which_orders:
order -= 1


+ 8
- 1
edivorce/apps/core/utils/derived.py View File

@ -18,6 +18,7 @@ import json
DERIVED_DATA = [
'orders_wanted',
'children',
'has_children_of_marriage',
'wants_divorce_order',
'wants_spousal_support',
'wants_property_division',
@ -86,6 +87,12 @@ def children(responses, derived):
return json.loads(responses.get('claimant_children', '[]'))
def has_children_of_marriage(responses, derived):
""" Returns whether or not the their are children of marriage for claim"""
return responses.get('children_of_marriage', '') == 'YES'
def wants_divorce_order(responses, derived):
""" Return whether or not the user wants an order for divorce """
@ -167,7 +174,7 @@ def show_fact_sheet_d(responses, derived):
support = json.loads(responses.get('children_financial_support', '[]'))
return (len(support) > 0 and
'NO' not in support and responses.get('children_of_marriage', '') == 'YES')
'NO' not in support and has_children_of_marriage(responses, derived))
def show_fact_sheet_e(responses, derived):


+ 1
- 0
edivorce/apps/core/views/main.py View File

@ -150,6 +150,7 @@ def overview(request):
# Add step status dictionary
responses_dict_by_step['step_status'] = get_step_status(responses_dict_by_step)
responses_dict_by_step['active_page'] = 'overview'
responses_dict_by_step['derived'] = get_derived_data(get_responses_from_db(request.user))
response = render(request, 'overview.html', context=responses_dict_by_step)


Loading…
Cancel
Save