Files
grecia/app/assets/javascripts/valuation_spending_proposal_form.js.coffee
Javi Martín b27855c1cf Use double quotes in CoffeeScript files
As we do in the rest of the application.

Note we cannot add a rule enforcing double quotes because CoffeeScript
Lint does not have such rule.
2019-03-06 11:41:21 +01:00

33 lines
1.3 KiB
CoffeeScript

App.ValuationSpendingProposalForm =
showFeasibleFields: ->
$("#valuation_spending_proposal_edit_form #not_feasible_fields").hide("down")
$("#valuation_spending_proposal_edit_form #feasible_fields").show()
showNotFeasibleFields: ->
$("#valuation_spending_proposal_edit_form #feasible_fields").hide("down")
$("#valuation_spending_proposal_edit_form #not_feasible_fields").show()
showAllFields: ->
$("#valuation_spending_proposal_edit_form #feasible_fields").show("down")
$("#valuation_spending_proposal_edit_form #not_feasible_fields").show("down")
showFeasibilityFields: ->
feasible = $("#valuation_spending_proposal_edit_form input[type=radio][name='spending_proposal[feasible]']:checked").val()
if feasible == "true"
App.ValuationSpendingProposalForm.showFeasibleFields()
else if feasible == "false"
App.ValuationSpendingProposalForm.showNotFeasibleFields()
showFeasibilityFieldsOnChange: ->
$("#valuation_spending_proposal_edit_form input[type=radio][name='spending_proposal[feasible]']").change ->
App.ValuationSpendingProposalForm.showAllFields()
App.ValuationSpendingProposalForm.showFeasibilityFields()
initialize: ->
App.ValuationSpendingProposalForm.showFeasibilityFields()
App.ValuationSpendingProposalForm.showFeasibilityFieldsOnChange()
false