Skip to content

Commit

Permalink
MAGE-478 : Fix calculator styling in FE and admin
Browse files Browse the repository at this point in the history
  • Loading branch information
BoulangerV committed Mar 25, 2020
1 parent 50e19c1 commit fabe018
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 230 deletions.
33 changes: 33 additions & 0 deletions app/code/community/Payone/Core/Block/PaymentAdditionalStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,37 @@ public function getActiveShortcuts()
}
return $activeMethods;
}

/**
* @return string
*/
public function getRatepayExternalStyleUrl()
{
$ratepayMethods = array(
Payone_Core_Model_System_Config_PaymentMethodCode::RATEPAYINVOICING,
Payone_Core_Model_System_Config_PaymentMethodCode::RATEPAY,
Payone_Core_Model_System_Config_PaymentMethodCode::RATEPAYDIRECTDEBIT,
);

/** @var \Mage_Checkout_Model_Session $session */
$session = Mage::getSingleton('checkout/session');

/** @var \Mage_Payment_Helper_Data $paymentHelper */
$paymentHelper = Mage::helper('payment');

foreach ($ratepayMethods as $methodCode) {
$paymentMethod = $paymentHelper->getMethodInstance($methodCode);
try {
/** @var \Payone_Core_Model_Config_Payment_Method $paymentConfig */
$paymentConfig = $paymentMethod->getConfigForQuote($session->getQuote());
if (!empty($paymentConfig)) {
return 'https://www.ratepay.com/ratenrechner/resources/ratepay-bootstrap.min.css';
}
} catch (\Payone_Core_Exception_PaymentMethodConfigNotFound $e) {
continue;
}
}

return '';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,40 +270,44 @@ $initialDebitType = $isAllowedDirectDebit ? Payone_Api_Enum_RatepayDebitType::DI
</div>
<div class="row">
<div class="col-md-4">
<div class="ratepay-panel panel panel-default">
<div class="ratepay-panel-heading panel-heading text-center" id="firstInput">
<div class="panel panel-default">
<div class="panel-heading text-center" id="firstInput">
<h2><?php echo $this->__('lang_choose_runtime'); ?></h2>
<?php echo $this->__('lang_payment_text_runtime'); ?> <b><?php echo $this->__('lang_runtime_duration_unit'); ?></b>
</div>
<div class="ratepay-panel-body panel-body">
<div class="input-group input-group-justified" role="group" aria-label="...">
<div class="input-group input-group-sm" role="group">
<input class="ratepay-runtime-btn btn btn-default <?php echo $code ?>-btn-runtime" data-bind="3" value="3" readonly="readonly"/>

<input class="ratepay-runtime-btn btn btn-default <?php echo $code ?>-btn-runtime" data-bind="6" value="6" readonly="readonly"/>

<input class="ratepay-runtime-btn btn btn-default <?php echo $code ?>-btn-runtime" data-bind="12" value="12" readonly="readonly"/>

<input class="ratepay-runtime-btn btn btn-default <?php echo $code ?>-btn-runtime" data-bind="24" value="24" readonly="readonly"/>

<input class="ratepay-runtime-btn btn btn-default <?php echo $code ?>-btn-runtime" data-bind="36" value="36" readonly="readonly"/>
<div class="panel-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<div class="btn-group btn-group-sm" role="group">
<input class="btn btn-default <?php echo $code ?>-btn-runtime" data-bind="3" value="3" readonly="readonly"/>
</div>
<div class="btn-group btn-group-sm" role="group">
<input class="btn btn-default <?php echo $code ?>-btn-runtime" data-bind="6" value="6" readonly="readonly"/>
</div>
<div class="btn-group btn-group-sm" role="group">
<input class="btn btn-default <?php echo $code ?>-btn-runtime" data-bind="12" value="12" readonly="readonly"/>
</div>
<div class="btn-group btn-group-sm" role="group">
<input class="btn btn-default <?php echo $code ?>-btn-runtime" data-bind="24" value="24" readonly="readonly"/>
</div>
<div class="btn-group btn-group-sm" role="group">
<input class="btn btn-default <?php echo $code ?>-btn-runtime" data-bind="36" value="36" readonly="readonly"/>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ratepay-panel panel panel-default">
<div class="ratepay-panel-heading panel-heading text-center" id="secondInput">
<div class="panel panel-default">
<div class="panel-heading text-center" id="secondInput">
<h2><?php echo $this->__('lang_insert_wishrate'); ?></h2>
<?php echo $this->__('lang_payment_text_wishrate'); ?>
</div>
<div class="ratepay-panel-body panel-body">
<div class="panel-body">
<div class="input-group input-group-sm">
<span class="input-group-addon">€</span>
<input type="text" id="<?php echo $code ?>-rate" class="ratepay-rate-form-input form-control" aria-label="Amount" data-com.agilebits.onepassword.user-edited="yes">
<input type="text" id="<?php echo $code ?>-rate" class="form-control" aria-label="Amount" data-com.agilebits.onepassword.user-edited="yes">
<span class="input-group-btn">
<input id="<?php echo $code ?>-btn-rate" class="ratepay-rate-btn btn btn-default <?php echo $code ?>-btn-rate" value="<?php echo $this->__('lang_calculate_rate'); ?>" readonly="readonly"/>
<input id="<?php echo $code ?>-btn-rate" class="btn btn-default <?php echo $code ?>-btn-rate" value="<?php echo $this->__('lang_calculate_rate'); ?>" readonly="readonly"/>
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
foreach ($this->getActiveShortcuts() as $url) {
echo '<link rel="stylesheet" href="' . $url . '" />' . PHP_EOL;
}

$ratepayExternalStyleUrl = $this->getRatepayExternalStyleUrl();
if (!empty($ratepayExternalStyleUrl)) {
echo '<link rel="stylesheet" href="' . $ratepayExternalStyleUrl . '" />' . PHP_EOL;
}
?>
69 changes: 68 additions & 1 deletion skin/adminhtml/default/default/payone/core/ratepay.css
Original file line number Diff line number Diff line change
Expand Up @@ -747,4 +747,71 @@ table#ratepay-InstallmentTerms {
float:left;
outline: solid 2px white;
outline-offset: -3px;
}
}

/** MAGE-478 : reported from ratepay bootstrap */
.text-center {
text-align:center
}
.text-right {
text-align:right
}
.text-uppercase {
text-transform:uppercase
}
.small,
small {
font-size:85%
}
.table {
width:100%;
max-width:100%;
margin-bottom:20px
}
.table-striped>tbody>tr:nth-of-type(odd) {
background-color:#f9f9f9
}
.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
padding:8px;
line-height:1.42857143;
vertical-align:top;
border-top:1px solid #ddd
}
.table>thead>tr>th {
vertical-align:bottom;
border-bottom:2px solid #ddd
}
.table>tbody>tr.warning>td,
.table>tbody>tr.warning>th,
.table>tbody>tr>td.warning,
.table>tbody>tr>th.warning,
.table>tfoot>tr.warning>td,
.table>tfoot>tr.warning>th,
.table>tfoot>tr>td.warning,
.table>tfoot>tr>th.warning,
.table>thead>tr.warning>td,
.table>thead>tr.warning>th,
.table>thead>tr>td.warning,
.table>thead>tr>th.warning {
background-color:#fcf8e3
}
.table>caption+thead>tr:first-child>td,
.table>caption+thead>tr:first-child>th,
.table>colgroup+thead>tr:first-child>td,
.table>colgroup+thead>tr:first-child>th,
.table>thead:first-child>tr:first-child>td,
.table>thead:first-child>tr:first-child>th {
border-top:0
}
.table>tbody+tbody {
border-top:2px solid #ddd
}
.table .table {
background-color:#fff
}
/** MAGE-478 : reported from ratepay bootstrap */
Loading

0 comments on commit fabe018

Please sign in to comment.