Skip to content

Commit 905009f

Browse files
committed
Add RTL LTR switch support using LESS variables.
1 parent bb6b729 commit 905009f

File tree

111 files changed

+712
-13599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+712
-13599
lines changed

app/code/community/Bubble/AdminTheme/Helper/Data.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,13 @@
22

33
class Bubble_AdminTheme_Helper_Data extends Mage_Core_Helper_Abstract
44
{
5+
var $_rtl_locale_codes = array('he_IL', 'ar', 'ur', 'ur_PK', );
6+
7+
public function isRtlLocale() {
8+
9+
$_store_locale_code = Mage::app()->getLocale()->getLocaleCode();
10+
11+
return in_array($_store_locale_code, $this->_rtl_locale_codes);
12+
13+
}
514
}

app/code/community/Bubble/AdminTheme/Model/Adminhtml/Observer.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,44 @@ public function setTheme()
99
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
1010
Mage::getDesign()->setTheme($type, $theme);
1111
}
12+
13+
14+
$headBlock = Mage::getLayout()->getBlock('head');
15+
16+
$headBlock->addCss('app.css');
17+
18+
}
19+
20+
public function setLessVariables(Varien_Event_Observer $observer) {
21+
22+
$response = $observer->getEvent()->getResponse();
23+
24+
if (Mage::helper('bubble_admintheme')->isRtlLocale()) {
25+
$response->setLessVariables($this->_getRtlLessVariables());
26+
}
27+
28+
else {
29+
$response->setLessVariables($this->_getLtrLessVariables());
30+
}
31+
32+
return $this;
33+
}
34+
35+
private function _getRtlLessVariables() {
36+
return array(
37+
'bi-app-left' => 'right',
38+
'bi-app-right' => 'left',
39+
'bi-app-direction' => 'rtl',
40+
'bi-app-invert-direction' => 'ltr'
41+
);
42+
}
43+
44+
private function _getLtrLessVariables() {
45+
return array(
46+
'bi-app-left' => 'left',
47+
'bi-app-right' => 'right',
48+
'bi-app-direction' => 'ltr',
49+
'bi-app-invert-direction' => 'rtl'
50+
);
1251
}
1352
}

app/code/community/Bubble/AdminTheme/etc/config.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
</bubble_admintheme_admin_predispatch>
3131
</observers>
3232
</adminhtml_controller_action_predispatch_start>
33+
<soczed_less_additional_variables>
34+
<observers>
35+
<bubble_admintheme_less_additional_variables>
36+
<class>Bubble_AdminTheme_Model_Adminhtml_Observer</class>
37+
<method>setLessVariables</method>
38+
</bubble_admintheme_less_additional_variables>
39+
</observers>
40+
</soczed_less_additional_variables>
3341
</events>
3442
</global>
3543
<admin>

app/code/community/Magemaven/Lesscss/Helper/Data.php

Lines changed: 0 additions & 75 deletions
This file was deleted.

app/code/community/Magemaven/Lesscss/Model/Design/Package.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

app/code/community/Magemaven/Lesscss/etc/config.xml

Lines changed: 0 additions & 38 deletions
This file was deleted.

app/code/community/Soczed/Less/Block/Adminhtml/File.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)