mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Extract duplicated checkout accordion heading to partial
This commit is contained in:
@@ -20,4 +20,8 @@ Darkswarm.controller "PaymentCtrl", ($scope, $timeout) ->
|
||||
$scope.years = [moment().year()..(moment().year()+15)]
|
||||
$scope.secrets.card_month = "1"
|
||||
$scope.secrets.card_year = moment().year()
|
||||
|
||||
$scope.summary = ->
|
||||
[$scope.Checkout.paymentMethod().name]
|
||||
|
||||
$timeout $scope.onTimeout
|
||||
|
||||
@@ -3,5 +3,8 @@ Darkswarm.controller "ShippingCtrl", ($scope, $timeout, ShippingMethods) ->
|
||||
$scope.ShippingMethods = ShippingMethods
|
||||
$scope.name = "shipping"
|
||||
$scope.nextPanel = "payment"
|
||||
|
||||
$scope.summary = ->
|
||||
[$scope.Checkout.shippingMethod().name]
|
||||
|
||||
$timeout $scope.onTimeout
|
||||
|
||||
15
app/views/checkout/_accordion_heading.html.haml
Normal file
15
app/views/checkout/_accordion_heading.html.haml
Normal file
@@ -0,0 +1,15 @@
|
||||
%accordion-heading
|
||||
.row
|
||||
.small-8.medium-10.columns
|
||||
%em
|
||||
%small
|
||||
{{ summary() | printArray }}
|
||||
.small-4.medium-2.columns.text-right
|
||||
%span.accordion-up
|
||||
%em
|
||||
%small Hide
|
||||
%i.ofn-i_053-point-up
|
||||
%span.accordion-down
|
||||
%em
|
||||
%small Expand
|
||||
%i.ofn-i_052-point-down
|
||||
@@ -11,22 +11,8 @@
|
||||
|
||||
%accordion-group{"is-open" => "accordion.billing",
|
||||
"ng-class" => "{valid: billing.$valid, open: accordion.billing}"}
|
||||
%accordion-heading
|
||||
.row
|
||||
.small-8.medium-10.columns
|
||||
%em
|
||||
%small
|
||||
{{ summary() | printArray }}
|
||||
.small-4.medium-2.columns.text-right
|
||||
%span.accordion-up
|
||||
%em
|
||||
%small Hide
|
||||
%i.ofn-i_053-point-up
|
||||
%span.accordion-down
|
||||
%em
|
||||
%small Expand
|
||||
%i.ofn-i_052-point-down
|
||||
|
||||
= render 'checkout/accordion_heading'
|
||||
|
||||
= f.fields_for :bill_address, @order.bill_address do |ba|
|
||||
.row
|
||||
.small-12.columns
|
||||
|
||||
@@ -11,21 +11,7 @@
|
||||
|
||||
%accordion-group{"is-open" => "accordion.details",
|
||||
"ng-class" => "{valid: details.$valid, open: accordion.details}"}
|
||||
%accordion-heading
|
||||
.row
|
||||
.small-8.medium-10.columns
|
||||
%em
|
||||
%small
|
||||
{{ summary() | printArray }}
|
||||
.small-4.medium-2.columns.text-right
|
||||
%span.accordion-up
|
||||
%em
|
||||
%small Hide
|
||||
%i.ofn-i_053-point-up
|
||||
%span.accordion-down
|
||||
%em
|
||||
%small Expand
|
||||
%i.ofn-i_052-point-down
|
||||
= render 'checkout/accordion_heading'
|
||||
|
||||
.row
|
||||
.small-6.columns
|
||||
|
||||
@@ -11,22 +11,7 @@
|
||||
|
||||
%accordion-group{"is-open" => "accordion.payment",
|
||||
"ng-class" => "{valid: payment.$valid, open: accordion.payment}"}
|
||||
%accordion-heading
|
||||
.row
|
||||
.small-8.medium-10.columns
|
||||
%em
|
||||
%small
|
||||
{{ Checkout.paymentMethod().name }}
|
||||
%small
|
||||
.small-4.medium-2.columns.text-right
|
||||
%span.accordion-up
|
||||
%em
|
||||
%small Hide
|
||||
%i.ofn-i_053-point-up
|
||||
%span.accordion-down
|
||||
%em
|
||||
%small Expand
|
||||
%i.ofn-i_052-point-down
|
||||
= render 'checkout/accordion_heading'
|
||||
|
||||
-# TODO render this in Angular instead of server-side
|
||||
-# The problem being how to render the partials
|
||||
|
||||
@@ -11,21 +11,7 @@
|
||||
|
||||
%accordion-group{"is-open" => "accordion.shipping",
|
||||
"ng-class" => "{valid: shipping.$valid, open: accordion.shipping}"}
|
||||
%accordion-heading
|
||||
.row
|
||||
.small-8.medium-10.columns
|
||||
%em
|
||||
%small
|
||||
{{ Checkout.shippingMethod().name }}
|
||||
.small-4.medium-2.columns.text-right
|
||||
%span.accordion-up
|
||||
%em
|
||||
%small Hide
|
||||
%i.ofn-i_053-point-up
|
||||
%span.accordion-down
|
||||
%em
|
||||
%small Expand
|
||||
%i.ofn-i_052-point-down
|
||||
= render 'checkout/accordion_heading'
|
||||
|
||||
.small-12.columns.medium-6.columns.large-6.columns
|
||||
%label{"ng-repeat" => "method in ShippingMethods.shipping_methods"}
|
||||
|
||||
Reference in New Issue
Block a user