Form toggling! Fuck yeah

This commit is contained in:
Will Marshall
2014-02-14 11:31:27 +11:00
parent 25916caeb4
commit 4704e927e3
2 changed files with 9 additions and 5 deletions

View File

@@ -1,2 +1,5 @@
angular.module("Checkout").controller "CheckoutCtrl", ($scope, $rootScope) ->
$scope.require_ship_method = false
$scope.require_ship_address = false
$scope.shipping_method = -1
$scope.shippingMethodChanged = ->
$scope.require_ship_address = $("#order_shipping_method_" + $scope.shipping_method).attr("data-require-ship-address")

View File

@@ -1,5 +1,5 @@
%checkout{"ng-app" => "Checkout", "ng-controller" => "CheckoutCtrl"}
= form_for @order, url: "test", html: { class: "custom" } do |f|
= form_for @order, url: "test" do |f|
.large-8.columns
%fieldset#details
%legend Customer Details
@@ -50,13 +50,14 @@
.row
.large-12.columns
%label
= f.radio_button :shipping_method, ship_method.id,
= f.radio_button :shipping_method, ship_method.id,
"ng-model" => "shipping_method",
"ng-change" => "shippingMethodChanged()",
"data-require-ship-address" => ship_method.require_ship_address
%span.custom.radio
= ship_method.name
= fields_for @order.ship_address do |sa|
#ship_address{"ng-show" => "require_ship_method"}
#ship_address{"ng-show" => "require_ship_address"}
.row
.large-12.columns
= sa.label :address1