HTML fragments in templates instead of hardcoded

This commit is contained in:
Franck Allimant
2014-05-02 20:52:59 +02:00
parent fe93bfacec
commit 500a945f98
4 changed files with 33 additions and 12 deletions

View File

@@ -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
]);
}
}

View File

@@ -145,17 +145,12 @@ class RemoveXPercent extends CouponAbstract
*/
public function drawBackOfficeInputs()
{
$labelPercentage = $this->getInputName();
$html = '
<input type="hidden" name="thelia_coupon_creation[' . self::INPUT_AMOUNT_NAME . ']" value="0"/>
<div class="form-group input-' . self::INPUT_PERCENTAGE_NAME . '">
<label for="' . self::INPUT_PERCENTAGE_NAME . '" class="control-label">' . $labelPercentage . '</label>
<input id="' . self::INPUT_PERCENTAGE_NAME . '" class="form-control" name="' . self::INPUT_EXTENDED__NAME . '[' . self::INPUT_PERCENTAGE_NAME . ']' . '" type="text" value="' . $this->percentage . '"/>
</div>
';
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
]);
}
}

View File

@@ -0,0 +1,9 @@
<div class="form-group input-{$fieldName}">
<label for="{$fieldName}" class="control-label">{$label}</label>
<div class="input-group">
<input id="{$fieldName}" type="money" class="form-control" name="thelia_coupon_creation[{$fieldName}]" value="{$value}" placeholder="14.50">
{loop type="currency" name="get-symbol" default_only="true"}
<div class="input-group-addon">{$SYMBOL}</div>
{/loop}
</div>
</div>

View File

@@ -0,0 +1,8 @@
<input type="hidden" name="thelia_coupon_creation[{$typeKey}]" value="0"/>
<div class="form-group input-{$fieldId}">
<label for="{$fieldId}" class="control-label">{$label}</label>
<div class="input-group">
<input id="{$fieldId}" class="form-control" name="[$fieldName][{$fieldId}]" type="text" value="{$value}"/>
<div class="input-group-addon">%</div>
</div>
</div>