From 500a945f98532dd062b0443bbe35aa5f8ced4ae6 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Fri, 2 May 2014 20:52:59 +0200 Subject: [PATCH] HTML fragments in templates instead of hardcoded --- core/lib/Thelia/Coupon/Type/RemoveXAmount.php | 9 +++++++++ .../lib/Thelia/Coupon/Type/RemoveXPercent.php | 19 +++++++------------ .../type-fragments/remove-x-amount.html | 9 +++++++++ .../type-fragments/remove-x-percent.html | 8 ++++++++ 4 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 templates/backOffice/default/coupon/type-fragments/remove-x-amount.html create mode 100644 templates/backOffice/default/coupon/type-fragments/remove-x-percent.html diff --git a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php index 5ee212b27..c644706a2 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php +++ b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php @@ -65,4 +65,13 @@ class RemoveXAmount extends CouponAbstract return $toolTip; } + + public function drawBackOfficeInputs() + { + return $this->facade->getParser()->render('coupon/type-fragments/remove-x-amount.html', [ + 'label' => $this->getInputName(), + 'fieldName' => self::INPUT_AMOUNT_NAME, + 'value' => $this->amount + ]); + } } diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php index db0a011ea..83c625d9c 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php @@ -145,17 +145,12 @@ class RemoveXPercent extends CouponAbstract */ public function drawBackOfficeInputs() { - $labelPercentage = $this->getInputName(); - - $html = ' - -
- - -
- '; - - return $html; + return $this->facade->getParser()->render('coupon/type-fragments/remove-x-percent.html', [ + 'label' => $this->getInputName(), + 'typeKey' => self::INPUT_AMOUNT_NAME, + 'fieldId' => self::INPUT_PERCENTAGE_NAME, + 'fieldName' => self::INPUT_EXTENDED__NAME, + 'value' => $this->percentage + ]); } - } diff --git a/templates/backOffice/default/coupon/type-fragments/remove-x-amount.html b/templates/backOffice/default/coupon/type-fragments/remove-x-amount.html new file mode 100644 index 000000000..6159af73f --- /dev/null +++ b/templates/backOffice/default/coupon/type-fragments/remove-x-amount.html @@ -0,0 +1,9 @@ +
+ +
+ + {loop type="currency" name="get-symbol" default_only="true"} +
{$SYMBOL}
+ {/loop} +
+
diff --git a/templates/backOffice/default/coupon/type-fragments/remove-x-percent.html b/templates/backOffice/default/coupon/type-fragments/remove-x-percent.html new file mode 100644 index 000000000..7cd461a48 --- /dev/null +++ b/templates/backOffice/default/coupon/type-fragments/remove-x-percent.html @@ -0,0 +1,8 @@ + +
+ +
+ +
%
+
+