Browse Source

DIV-611: Navigation for children submenu is in place

pull/160/head
Benard Ebinu 8 years ago
parent
commit
8e27bd63b9
9 changed files with 131 additions and 56 deletions
  1. +1
    -1
      edivorce/apps/core/static/css/main.css
  2. +25
    -0
      edivorce/apps/core/static/css/main.scss
  3. +1
    -1
      edivorce/apps/core/templates/partials/fact_sheet_expense.html
  4. +1
    -1
      edivorce/apps/core/templates/partials/fact_sheet_income_others.html
  5. +13
    -9
      edivorce/apps/core/templates/question/06_children_income_expenses.html
  6. +4
    -4
      edivorce/apps/core/templates/question/06_children_what_for.html
  7. +4
    -3
      edivorce/apps/core/templates/question/06_children_your_children.html
  8. +61
    -34
      edivorce/apps/core/templatetags/step_order.py
  9. +21
    -3
      edivorce/apps/core/utils/template_step_order.py

+ 1
- 1
edivorce/apps/core/static/css/main.css
File diff suppressed because it is too large
View File


+ 25
- 0
edivorce/apps/core/static/css/main.scss View File

@ -163,6 +163,7 @@ input[type=number]::-webkit-outer-spin-button {
input, textarea {
height: 100%;
width: 100%;
display: table-cell;
border: none;
@ -176,6 +177,10 @@ input[type=number]::-webkit-outer-spin-button {
background: #f2f2f2;
}
}
input {
text-align: right;
}
}
.table-cell-active {
@ -223,6 +228,26 @@ div.dollar-prefix {
}
}
div.percent-prefix {
position: relative;
&:before {
content: '% ';
top: 0;
height: 100%;
padding-left: 5px;
position: absolute;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
}
.money {
text-align: right;
}
.container-wrapper {
padding: 40px 0;


+ 1
- 1
edivorce/apps/core/templates/partials/fact_sheet_expense.html View File

@ -4,7 +4,7 @@
</td>
<td class="fact-sheet-answer table-bordered">
<div class="dollar-prefix">
{% money_input_field name="expense_amount" value=expense_amount multiple='true' class="money fact-sheet-input expense-input-field" placeholder="00.00" data_save_row="true" data_save_select=".expense-input-field" data_skip_ajax="true" %}
{% money_input_field name="expense_amount" value=expense_amount multiple='true' class="money fact-sheet-input expense-input-field" placeholder="" data_save_row="true" data_save_select=".expense-input-field" data_skip_ajax="true" %}
</div>
</td>
{% if not exclude_delete_button %}


+ 1
- 1
edivorce/apps/core/templates/partials/fact_sheet_income_others.html View File

@ -4,7 +4,7 @@
</td>
<td class="fact-sheet-answer table-bordered">
<div class="dollar-prefix">
{% money_input_field name="income_others_amount" value=income_others_amount class="money fact-sheet-input income-others-input-field income-amount-input-field input-narrow" step="1" data_sum="true" data_sum_class="income-amount-input-field" data_sum_target_id="total_income_others" placeholder="00" data_save_row="true" data_save_select=".income-others-input-field" data_skip_ajax="true" %}
{% money_input_field name="income_others_amount" value=income_others_amount class="money fact-sheet-input income-others-input-field income-amount-input-field" step="1" data_sum="true" data_sum_class="income-amount-input-field" data_sum_target_id="total_income_others" placeholder="" data_save_row="true" data_save_select=".income-others-input-field" data_skip_ajax="true" %}
</div>
</td>


+ 13
- 9
edivorce/apps/core/templates/question/06_children_income_expenses.html View File

@ -81,7 +81,7 @@
</p>
<p>
Source:
<a href='http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-2.html#h-6' target='_blank'>Federal Child Support Guidelines</a>, Department of Justice
<a href='http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-2.html#h-6' target='_blank'>Federal Child Support Guidelines Step-by-Step Guide</a>, Department of Justice
</p>
">
annual gross income <i class="fa fa-question-circle" aria-hidden="true"></i>
@ -129,7 +129,7 @@
</ul>
<p>
Source:
{% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h12" link_text="Federal Child Support Guidelines" %}
{% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h12" link_text="Federal Child Support Guidelines Step-by-Step Guide" %}
, Department of Justice
</p>
</div>
@ -183,7 +183,7 @@
</td>
<td class="fact-sheet-answer">
<div class="dollar-prefix">
{% money_input_field name="child_support_amount_under_high_income" class="fact-sheet-input guideline-amount" data_sum="true" data_sum_class="guideline-amount" data_sum_target_id="total_amount" %}
{% money_input_field name="child_support_amount_under_high_income" class="fact-sheet-input guideline-amount money" data_sum="true" data_sum_class="guideline-amount" data_sum_target_id="total_amount" %}
</div>
</td>
</tr>
@ -194,7 +194,9 @@
?
</td>
<td class="fact-sheet-answer">
{% input_field type="number" name="percent_income_over_high_income_limit" class="fact-sheet-input" %}
<div class="percent-prefix">
{% input_field type="number" name="percent_income_over_high_income_limit" class="fact-sheet-input" %}
</div>
</td>
</tr>
<tr>
@ -327,7 +329,7 @@
</p>
<p>
Source:
<a href='http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-2.html#h-6' target='_blank'>Federal Child Support Guidelines</a>, Department of Justice
<a href='http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-2.html#h-6' target='_blank'>Federal Child Support Guidelines Step-by-Step Guide</a>, Department of Justice
</p>
">
annual gross income <i class="fa fa-question-circle" aria-hidden="true"></i>
@ -375,7 +377,7 @@
</ul>
<p>
Source:
{% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h12" link_text="Federal Child Support Guidelines" %}
{% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h12" link_text="Federal Child Support Guidelines Step-by-Step Guide" %}
, Department of Justice
</p>
</div>
@ -437,7 +439,9 @@
?
</td>
<td class="fact-sheet-answer">
{% input_field type="number" name="spouse_percent_income_over_high_income_limit" class="fact-sheet-input" %}
<div class="percent-prefix">
{% input_field type="number" name="spouse_percent_income_over_high_income_limit" class="fact-sheet-input" %}
</div>
</td>
</tr>
<tr>
@ -915,7 +919,7 @@
</div>
<div id="fact_sheet_a" class="question-well" hidden>
<h1>Fact Sheet A Special or Extraordinary Expenses More Information</h1>
<h1>Fact Sheet A Special or Extraordinary Expenses</h1>
<table class="table table-bordered">
<thead>
<tr>
@ -1124,7 +1128,7 @@
{% endblock %}
{% block formBack %}{% prev_step step='children' %}{% endblock %}
{% block formBack %}{% prev_step step='children' sub_step='income_expenses' %}{% endblock %}
{% block formNext %}{% next_step step='children' %}{% endblock %}
{% block sidebarText %}


+ 4
- 4
edivorce/apps/core/templates/question/06_children_what_for.html View File

@ -236,7 +236,7 @@
</div>
</div>
{% input_field type="textarea" name="order_respecting_arrangement" class="response-textarea form-control" maxlength="20000" rows="15"%}
{% input_field type="textarea" name="order_respecting_arrangement" class="response-textarea form-control" maxlength="20000" rows="7"%}
</div>
<div class="question-well">
@ -266,7 +266,7 @@
</a> by the Legal Services Society for more information.
</p>
{% input_field type="textarea" name="order_for_child_support" class="response-textarea form-control" maxlength="20000" rows="15"%}
{% input_field type="textarea" name="order_for_child_support" class="response-textarea form-control" maxlength="20000" rows="7"%}
</div>
<div class="question-well">
@ -316,8 +316,8 @@
{% endblock content %}
{% block formBack %}{% prev_step step='children' %}{% endblock %}
{% block formNext %}{% next_step step='children' %}{% endblock %}
{% block formBack %}{% prev_step step='children' sub_step='what_for' %}{% endblock %}
{% block formNext %}{% next_step step='children' sub_step='what_for' %}{% endblock %}
{% block sidebarText %}
<p><strong>What does the law mean by “best interests of the child”?</strong></p>


+ 4
- 3
edivorce/apps/core/templates/question/06_children_your_children.html View File

@ -54,7 +54,8 @@
<div class="question-well">
<h3>What is your child's name?</h3>
<div>{% input_field type="text" name="child_name" class="form-block intput-wide responsive-textbox children-input-block" placeholder="First, Middle, Last Name" data_mirror="true" data_mirror_target="#child_name_0" data_skip_ajax="true" %}</div>
<p>First, Middle, Last Name</p>
{% input_field type="text" name="child_name" class="form-block input-wide response-textbox children-input-block" placeholder="First, Middle, Last Name" data_mirror="true" data_mirror_target="#child_name_0" data_skip_ajax="true" %}
</div>
@ -283,8 +284,8 @@
</div>
{% endblock %}
{% block formBack %}{% prev_step step='children' %}{% endblock %}
{% block formNext %}{% next_step step='children' %}{% endblock %}
{% block formBack %}{% prev_step step='children' sub_step='your_children' %}{% endblock %}
{% block formNext %}{% next_step step='children' sub_step='your_children' %}{% endblock %}
{% block sidebarText %}
<p><strong>Sole Custody Example</strong></p>


+ 61
- 34
edivorce/apps/core/templatetags/step_order.py View File

@ -1,10 +1,65 @@
from django import template
import json
from ..utils.template_step_order import template_step_order, get_step_name
from django.core.urlresolvers import reverse
from ..utils.template_step_order import template_step_order, template_sub_step_order, get_step_name, \
get_step_or_sub_step_name
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)
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)
# 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):
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)
if current_sub_step_base_order is not None:
if direction == 'next':
next_item = current_sub_step_base_order + 1
else:
next_item = current_sub_step_base_order - 1
next_sub_step = get_step_name(template_sub_step_order[step], next_item)
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)
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):
addend = 1
if direction != 'next':
addend = -1
next_item += addend
if next_item == 7 and 'Spousal support' not in want_which_orders:
next_item += addend
if next_item == 8 and 'Division of property and debts' not in want_which_orders:
next_item += addend
if next_item == 9 and 'Other orders' not in want_which_orders:
next_item += addend
return next_item
@register.simple_tag(takes_context=True)
def step_order(context, step):
want_which_orders = __parse_json_which_orders_selected(context)
@ -24,41 +79,13 @@ def step_order(context, step):
@register.simple_tag(takes_context=True)
def next_step(context, step):
want_which_orders = json.loads(context.get('want_which_orders', '[]'))
current_step_base_order = template_step_order[step]
next_item = current_step_base_order + 1
if next_item == 6 and 'Spousal support' not in want_which_orders:
next_item += 1
if next_item == 7 and 'Division of property and debts' not in want_which_orders:
next_item += 1
if next_item == 8 and 'Other orders' not in want_which_orders:
next_item += 1
return get_step_name(next_item)
def next_step(context, step, sub_step=None):
return _get_next_step(context, step, sub_step, 'next')
@register.simple_tag(takes_context=True)
def prev_step(context, step):
want_which_orders = json.loads(context.get('want_which_orders', '[]'))
current_step_base_order = template_step_order[step]
prev = current_step_base_order - 1
if prev == 8 and 'Other orders' not in want_which_orders:
prev -= 1
if prev == 7 and 'Division of property and debts' not in want_which_orders:
prev -= 1
if prev == 6 and 'Spousal support' not in want_which_orders:
prev -= 1
return get_step_name(prev)
def prev_step(context, step, sub_step=None):
return _get_next_step(context, step, sub_step, 'previous')
def __parse_json_which_orders_selected(context):
@ -79,4 +106,4 @@ def __parse_json_which_orders_selected(context):
want_which_orders = json.loads('[]')
else:
want_which_orders = json.loads(want_which_orders)
return want_which_orders
return want_which_orders

+ 21
- 3
edivorce/apps/core/utils/template_step_order.py View File

@ -18,11 +18,29 @@ template_step_order = {
'review': 13
}
template_sub_step_order = {
'children': {
'your_children': 1,
'what_for': 2,
'income_expenses': 3
}
}
def get_step_name(step_order):
def get_step_name(step_order_mappings, step_order):
"""
Preforms a reverse lookup in the template_step_order dictionary
Preforms a reverse lookup in the template_step_order or template_sub_step_order dictionary
depending on which is passed as an argument.
"""
return next(k for k, v in template_step_order.items() if v == step_order)
return next((k for k, v in step_order_mappings.items() if v == step_order), None)
def get_step_or_sub_step_name(step_order, direction='next'):
next_step = next(k for k, v in template_step_order.items() if v == step_order)
if next_step in template_sub_step_order:
sub_step_order = 1
if direction != 'next':
sub_step_order = len(template_sub_step_order[next_step].keys())
next_sub_step = next(k for k, v in template_sub_step_order[next_step].items() if v == sub_step_order)
return '{}/{}/'.format(next_step, next_sub_step)
return next_step

Loading…
Cancel
Save