Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an output year parameter #789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions static/js/taxbrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,14 @@ $('#current-year-modal').on('hide.bs.modal', function (e) {
$('#start-year-select option').removeAttr("selected");
$('#start-year-select option[value="' + currentYear + '"]').attr("selected", "selected");
});

var outputYear = $('#output-year-select').val();
$('#output-year-select').change(function(e) {
$('#output-year-link').attr('href', '/taxbrain/?output_start_year=' + $(this).val());
$('#output-year-modal').modal('show');
});

$('#output-year-modal').on('hide.bs.modal', function (e) {
$('#output-year-select option').removeAttr("selected");
$('#output-year-select option[value="' + outputYear + '"]').attr("selected", "selected");
});
11 changes: 11 additions & 0 deletions staticfiles/js/taxbrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,14 @@ $('#current-year-modal').on('hide.bs.modal', function (e) {
$('#start-year-select option').removeAttr("selected");
$('#start-year-select option[value="' + currentYear + '"]').attr("selected", "selected");
});

var outputYear = $('#output-year-select').val();
$('#output-year-select').change(function(e) {
$('#output-year-link').attr('href', '/taxbrain/?output_start_year=' + $(this).val());
$('#output-year-modal').modal('show');
});

$('#output-year-modal').on('hide.bs.modal', function (e) {
$('#output-year-select option').removeAttr("selected");
$('#output-year-select option[value="' + outputYear + '"]').attr("selected", "selected");
});
28 changes: 26 additions & 2 deletions templates/taxbrain/input_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,20 @@ <h2>Tax-Calculator Code Build</h2>
<div class="row">
<div class="col-xs-3">
<div class="inputs-sidebar" data-spy="affix" data-offset-top="435" data-offset-bottom="245">
<label class="">Start Year:
<label class="">Parameter Start Year:
<select id="start-year-select" class="form-control pull-right">
{% for year in start_years %}
<option value="{{year}}" {% if year == start_year %} selected {% endif %}>{{year}}</option>
{% endfor %}
</select>
</label>
</label>
<label class="">Output Start Year:
<select id="output-year-select" class="form-control pull-right">
{% for year in start_years %}
<option value="{{year}}" {% if year == start_year %} selected {% endif %}>{{year}}</option>
{% endfor %}
</select>
</label>
<div class="reset-button">
{% if is_edit_page %}
<a href="/taxbrain" class="btn btn-tertiary btn-block" style="background-color:#96000b">Reset Parameters</a>
Expand Down Expand Up @@ -255,4 +262,21 @@ <h4 class="modal-title" id="myModalLabel">Change Start Year</h4>
</div>
</div>
</div>
<div class="modal fade" id="output-year-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Change Output Start Year</h4>
</div>
<div class="modal-body">
Warning: This will clear your current inputs.
</div>
<div class="modal-footer">
<a type="button" class="btn btn-default" data-dismiss="modal">Nevermind.</a>
<a type="button" class="btn btn-primary" id="output-year-link">OK, go for it.</a>
</div>
</div>
</div>
</div>
{% endblock %}