Browse Source

DIV-573

pull/160/head
Justin Johnson 8 years ago
parent
commit
57b1a1b85b
16 changed files with 50 additions and 25 deletions
  1. +3
    -3
      edivorce/apps/core/static/css/main.css.map
  2. +1
    -1
      edivorce/apps/core/static/js/ajax.js
  3. +6
    -2
      edivorce/apps/core/static/js/functions.js
  4. +2
    -1
      edivorce/apps/core/static/js/main.js
  5. +1
    -0
      edivorce/apps/core/static/js/vendor/moment.min.js
  6. +1
    -0
      edivorce/apps/core/templates/base.html
  7. +3
    -3
      edivorce/apps/core/templates/partials/reconciliation_period.html
  8. +1
    -1
      edivorce/apps/core/templates/prequalification/step_03.html
  9. +2
    -2
      edivorce/apps/core/templates/question/02_claimant.html
  10. +2
    -2
      edivorce/apps/core/templates/question/03_respondent.html
  11. +2
    -2
      edivorce/apps/core/templates/question/04_marriage.html
  12. +1
    -1
      edivorce/apps/core/templates/question/06_children_your_children.html
  13. +1
    -1
      edivorce/apps/core/templates/question/10_other_questions.html
  14. +3
    -3
      edivorce/apps/core/templates/styleguide/guide.html
  15. +20
    -3
      edivorce/apps/core/templatetags/input_field.py
  16. +1
    -0
      edivorce/settings/base.py

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


+ 1
- 1
edivorce/apps/core/static/js/ajax.js View File

@ -12,7 +12,7 @@ var ajaxOnChange = function () {
if (skipAjax !== undefined && skipAjax === "true") {
return;
}
var question = el.prop('name');
var value = getValue(el, question);
var isValid = true;


+ 6
- 2
edivorce/apps/core/static/js/functions.js View File

@ -271,6 +271,9 @@ var validateEmail = function(el){
}
};
var $DateFormat = 'M d, yyyy';
var MomentFormat = 'MMM D, YYYY';
// check if value in date field is in DD/MM/YYYY format
// and check if it is valid date and it is today or earlier
var validateDate = function(el){
@ -284,9 +287,10 @@ var validateDate = function(el){
return true;
}
var date = new Date(el.val());
var isFuture = el.is('.date-picker-future');
if (isValidDate(el.val(), isFuture)) {
el.val(formatDate(stringToDate(el.val())));
el.val(moment(stringToDate(el.val())).format('MMM D, YYYY'));
return true;
}
@ -375,4 +379,4 @@ var checkDateOverlap = function(dates, newFromDate, newToDate){
});
return isOverlap;
};
};

+ 2
- 1
edivorce/apps/core/static/js/main.js View File

@ -684,7 +684,8 @@ var date_picker = function (selector, showOnFocus) {
endDate = "0d";
}
$(selector).datepicker({
format: "dd/mm/yyyy",
format: "M d, yyyy",
// format: "dd/mm/yyyy",
startDate: startDate,
endDate: endDate,
autoclose: true,


+ 1
- 0
edivorce/apps/core/static/js/vendor/moment.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
edivorce/apps/core/templates/base.html View File

@ -165,6 +165,7 @@
<script type="text/javascript" src="{% static 'js/vendor/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/vendor/bootstrap-datepicker.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/vendor/spin.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/vendor/moment.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/functions.js' %}"></script>
<script type="text/javascript" src="{% static 'js/ajax.js' %}"></script>
<script type="text/javascript" src="{% static 'js/main.js' %}"></script>


+ 3
- 3
edivorce/apps/core/templates/partials/reconciliation_period.html View File

@ -3,15 +3,15 @@
<div class="form-group">
<label>From:</label>
<span class="input-group date date-pickers-group">
{% input_field type="text" name="reconciliation_period" value=from multiple='true' class="date-pickers reconciliation-from-date form-control" placeholder="DD/MM/YYYY" tabindex="-1" %}
{% input_field type="text" name="reconciliation_period" value=from multiple='true' class="date-pickers reconciliation-from-date form-control" placeholder="MMM D, YYYY" tabindex="-1" %}
</span>
</div>
<div class="form-group">
<label>To: </label>
<span class="input-group date date-pickers-group">
{% input_field type="text" name="reconciliation_period" value=to multiple='true' class="date-pickers reconciliation-to-date form-control" placeholder="DD/MM/YYYY" tabindex="-1" %}
{% input_field type="text" name="reconciliation_period" value=to multiple='true' class="date-pickers reconciliation-to-date form-control" placeholder="MMM D, YYYY" tabindex="-1" %}
</span>
</div>
<input type="button" class="btn btn-danger btn-delete-period form-control" tabindex="-1" value="Delete" />
<div class="form-warning has-error"></div>
</div>
</div>

+ 1
- 1
edivorce/apps/core/templates/prequalification/step_03.html View File

@ -42,7 +42,7 @@
</h3>
<p>
<span class="input-group date date-picker-group">
{% input_field type="text" name="separation_date" class="date-picker form-control" id="separated_date" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="separation_date" class="date-picker form-control" id="separated_date" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>


+ 2
- 2
edivorce/apps/core/templates/question/02_claimant.html View File

@ -104,7 +104,7 @@
<h3>What is your date of birth?</h3>
<p>
<span class="input-group date date-picker-group">
{% input_field type="text" name="birthday_you" class="date-picker form-control" id="birth_date" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="birthday_you" class="date-picker form-control" id="birth_date" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>
@ -124,7 +124,7 @@
<div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="lived_in_bc_you" value="Since birth" %}Since birth</label></div>
<div class="radio"><label>{% input_field type="radio" class="radio-with-other radio_with_textbox" name="lived_in_bc_you" value="Moved to B.C. on" %}Moved to B.C. on
<span class="input-group date date-picker-group">
{% input_field type="text" name="moved_to_bc_date_you" id="moved_date" class="date-picker other-textbox input-inline form-control" tabindex="-1" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="moved_to_bc_date_you" id="moved_date" class="date-picker other-textbox input-inline form-control" tabindex="-1" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>


+ 2
- 2
edivorce/apps/core/templates/question/03_respondent.html View File

@ -120,7 +120,7 @@
<h3>What is your spouse's date of birth?</h3>
<p>
<span class="input-group date date-picker-group">
{% input_field type="text" name="birthday_spouse" class="date-picker form-control" id="birth_date" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="birthday_spouse" class="date-picker form-control" id="birth_date" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>
@ -140,7 +140,7 @@
<div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="lived_in_bc_spouse" value="Since birth" %}Since birth</label></div>
<div class="radio"><label>{% input_field type="radio" class="radio-with-other radio_with_textbox" name="lived_in_bc_spouse" value="Moved to B.C. on" %}Moved to B.C. on
<span class="input-group date date-picker-group">
{% input_field type="text" name="moved_to_bc_date_spouse" id="moved_date" class="date-picker other-textbox input-inline form-control" tabindex="-1" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="moved_to_bc_date_spouse" id="moved_date" class="date-picker other-textbox input-inline form-control" tabindex="-1" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>


+ 2
- 2
edivorce/apps/core/templates/question/04_marriage.html View File

@ -34,7 +34,7 @@
<h3>When were you married?</h3>
<p>
<span class="input-group date date-picker-group">
{% input_field type="text" name="when_were_you_married" class="date-picker form-control" id="marriage_date" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="when_were_you_married" class="date-picker form-control" id="marriage_date" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>
@ -47,7 +47,7 @@
<h3>When did you and {% if name_spouse %} {{ name_spouse }} {% else %} your spouse {% endif %} begin to live together in a marriage-like relationship?</h3>
<p>
<span class="input-group date date-picker-group">
{% input_field type="text" name="when_were_you_live_married_like" class="date-picker form-control" id="lived_start_date" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="when_were_you_live_married_like" class="date-picker form-control" id="lived_start_date" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>


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

@ -63,7 +63,7 @@
<h3>What is your child's date of birth?</h3>
<p>
<span class="input-group date date-picker-group">
{% input_field type="text" name="child_birth_date" class="date-picker form-control children-input-block" id="childs_birth_date" placeholder="DD/MM/YYYY" data_mirror="true" data_mirror_target="#child_birth_date_0" data_skip_ajax="true" %}
{% input_field type="text" name="child_birth_date" class="date-picker form-control children-input-block" id="childs_birth_date" placeholder="MMM D, YYYY" data_mirror="true" data_mirror_target="#child_birth_date_0" data_skip_ajax="true" %}
<span class="input-group-addon">
<i class="fa fa-calendar circle"></i>
</span>


+ 1
- 1
edivorce/apps/core/templates/question/10_other_questions.html View File

@ -86,7 +86,7 @@
<div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="divorce_take_effect_on" value="the 31st day after the date of this order" %}the 31st day after the date of this order</label></div>
<div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="divorce_take_effect_on" value="specific date" %}a specific date
<span class="input-group date date-picker-group" data-allow-future-date="true">
{% input_field type="text" name="divorce_take_effect_on_specific_date" id="effect_date" class="date-picker-future other-textbox input-inline form-control" tabindex="-1" placeholder="DD/MM/YYYY" %}
{% input_field type="text" name="divorce_take_effect_on_specific_date" id="effect_date" class="date-picker-future other-textbox input-inline form-control" tabindex="-1" placeholder="MMM D, YYYY" %}
<span class="input-group-addon" ><i class="fa fa-calendar circle"></i></span>
</span>
</label></div>


+ 3
- 3
edivorce/apps/core/templates/styleguide/guide.html View File

@ -13,7 +13,7 @@
<h3>When were you married?</h3>
<p>
<span class="input-group date date-picker-group">
<input type="text" class="date-picker form-control" placeholder="DD/MM/YYYY">
<input type="text" class="date-picker form-control" placeholder="MMM D, YYYY">
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>
@ -93,7 +93,7 @@
<h3>When were you married?</h3>
<p>
<span class="input-group date date-picker-group">
<input type="text" class="date-picker form-control" placeholder="DD/MM/YYYY">
<input type="text" class="date-picker form-control" placeholder="MMM D, YYYY">
<span class="input-group-addon" >
<i class="fa fa-calendar circle"></i>
</span>
@ -178,4 +178,4 @@
{% endblock %} {% block sidebarText %}
<p>Phasellus sit amet ex diam. Morbi ultricies justo ac nibh ullamcorper ultricies. Nam quis viverra metus. Sed tincidunt mi id varius volutpat. Maecenas venenatis in velit ac tincidunt. Donec vulputate quam a metus sodales, eu aliquet lectus iaculis. Nam
finibus enim sit amet ex fringilla rhoncus. Maecenas dictum nisi ac mauris faucibus pretium. Nulla varius massa in urna dignissim mattis. In eget cursus est. Nulla facilisi. Donec fringilla urna ac luctus suscipit.</p>
{% endblock %}
{% endblock %}

+ 20
- 3
edivorce/apps/core/templatetags/input_field.py View File

@ -1,6 +1,10 @@
from django import template
from datetime import datetime
import json
from django import template
from ..models import UserResponse
register = template.Library()
@ -62,8 +66,21 @@ def input_field(context, type, name='', value='', multiple='', **kwargs):
tag.append('</textarea>')
else:
# set initial value for textbox
if type == "text" and value == '' and multiple != 'true':
value = context.get(name, '')
if type == "text":
if value == '' and multiple != 'true':
value = context.get(name, '')
if 'date-picker' in kwargs.get('class', ''): # DIV-573
try:
date = datetime.strptime(value, '%d/%m/%Y')
value = f'{date:%b} {date.day}, {date:%Y}'
if context['request'].user.is_authenticated():
UserResponse.objects.filter(
bceid_user=context['request'].user, question=name
).update(value=value)
else:
context['request'].session[name] = value
except ValueError:
pass # conversion to current format not needed
elif type == "number":
value = context.get(name, '')
tag = ['<input type="%s" name="%s" value="%s"' % (type, name, value)]


+ 1
- 0
edivorce/settings/base.py View File

@ -140,4 +140,5 @@ def show_toolbar(request):
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': show_toolbar,
'SHOW_COLLAPSED': True,
}

Loading…
Cancel
Save