From 29af9f63a1792f48fa86d855423438ec46777794 Mon Sep 17 00:00:00 2001 From: Henry Doupe Date: Fri, 22 Dec 2017 11:23:07 -0500 Subject: [PATCH] First attempt at adding output year param in frontend --- static/js/taxbrain.js | 11 +++++++++++ staticfiles/js/taxbrain.js | 11 +++++++++++ templates/taxbrain/input_form.html | 28 ++++++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/static/js/taxbrain.js b/static/js/taxbrain.js index 585ddc56..a78e943c 100644 --- a/static/js/taxbrain.js +++ b/static/js/taxbrain.js @@ -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"); +}); diff --git a/staticfiles/js/taxbrain.js b/staticfiles/js/taxbrain.js index 585ddc56..a78e943c 100644 --- a/staticfiles/js/taxbrain.js +++ b/staticfiles/js/taxbrain.js @@ -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"); +}); diff --git a/templates/taxbrain/input_form.html b/templates/taxbrain/input_form.html index 85b0f56a..6ece0d9b 100644 --- a/templates/taxbrain/input_form.html +++ b/templates/taxbrain/input_form.html @@ -132,13 +132,20 @@

Tax-Calculator Code Build

- +
{% if is_edit_page %} Reset Parameters @@ -255,4 +262,21 @@
+ {% endblock %}