Skip to content

Commit bb6b729

Browse files
committed
Installing Soczed LessCSS
1 parent 993b3a1 commit bb6b729

File tree

31 files changed

+5322
-1
lines changed

31 files changed

+5322
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the Open Software License (OSL 3.0)
6+
* that is bundled with this package in the file LICENSE.txt.
7+
* It is also available through the world-wide-web at this URL:
8+
* http://opensource.org/licenses/osl-3.0.php
9+
*
10+
* @category Soczed
11+
* @package Soczed_Less
12+
* @copyright Copyright (c) 2012 Soczed <[email protected]> (Benoît Leulliette <[email protected]>)
13+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
14+
*/
15+
16+
class Soczed_Less_Block_Adminhtml_File
17+
extends Mage_Adminhtml_Block_Widget_Grid_Container
18+
{
19+
public function __construct()
20+
{
21+
$this->_controller = 'adminhtml_file';
22+
$this->_blockGroup = 'less';
23+
$this->_headerText = $this->__('Manage Less Files');
24+
parent::__construct();
25+
$this->_removeButton('add');
26+
}
27+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the Open Software License (OSL 3.0)
6+
* that is bundled with this package in the file LICENSE.txt.
7+
* It is also available through the world-wide-web at this URL:
8+
* http://opensource.org/licenses/osl-3.0.php
9+
*
10+
* @category Soczed
11+
* @package Soczed_Less
12+
* @copyright Copyright (c) 2012 Soczed <[email protected]> (Benoît Leulliette <[email protected]>)
13+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
14+
*/
15+
16+
class Soczed_Less_Block_Adminhtml_File_Edit
17+
extends Mage_Adminhtml_Block_Widget
18+
{
19+
public function __construct()
20+
{
21+
parent::__construct();
22+
$this->setTemplate('soczed/less/file/edit.phtml');
23+
$this->setId('less_file_edit');
24+
}
25+
26+
public function getLessFile()
27+
{
28+
return Mage::registry('current_less_file');
29+
}
30+
31+
public function getLessFileId()
32+
{
33+
return $this->getLessFile()->getId();
34+
}
35+
36+
protected function _prepareLayout()
37+
{
38+
$file = $this->getLessFile();
39+
40+
$this->setChild('back_button',
41+
$this->getLayout()->createBlock('adminhtml/widget_button')
42+
->setData(array(
43+
'label' => $this->__('Back'),
44+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
45+
'class' => 'back',
46+
))
47+
);
48+
$this->setChild('save_button',
49+
$this->getLayout()->createBlock('adminhtml/widget_button')
50+
->setData(array(
51+
'label' => $this->__('Save'),
52+
'onclick' => 'lessFileForm.submit()',
53+
'class' => 'save',
54+
))
55+
);
56+
$this->setChild('save_and_edit_button',
57+
$this->getLayout()->createBlock('adminhtml/widget_button')
58+
->setData(array(
59+
'label' => $this->__('Save and Continue Edit'),
60+
'onclick' => 'saveAndContinueEdit(\''.$this->getSaveAndContinueUrl().'\')',
61+
'class' => 'save',
62+
))
63+
);
64+
$this->setChild('delete_button',
65+
$this->getLayout()->createBlock('adminhtml/widget_button')
66+
->setData(array(
67+
'label' => $this->__('Delete'),
68+
'onclick' => 'confirmSetLocation(\''.$this->__('Are you sure?').'\', \''.$this->getDeleteUrl().'\')',
69+
'class' => 'delete',
70+
))
71+
);
72+
73+
return parent::_prepareLayout();
74+
}
75+
76+
protected function _beforeToHtml()
77+
{
78+
if ($tabsBlock = $this->getChild('less_file_tabs')) {
79+
$tabsBlock->setActiveTab($this->getSelectedTabId());
80+
}
81+
return parent::_beforeToHtml();
82+
}
83+
84+
public function getBackButtonHtml()
85+
{
86+
return $this->getChildHtml('back_button');
87+
}
88+
89+
public function getCancelButtonHtml()
90+
{
91+
return $this->getChildHtml('reset_button');
92+
}
93+
94+
public function getSaveButtonHtml()
95+
{
96+
return $this->getChildHtml('save_button');
97+
}
98+
99+
public function getSaveAndEditButtonHtml()
100+
{
101+
return $this->getChildHtml('save_and_edit_button');
102+
}
103+
104+
public function getDeleteButtonHtml()
105+
{
106+
return $this->getChildHtml('delete_button');
107+
}
108+
109+
public function getSaveUrl()
110+
{
111+
return $this->getUrl('*/*/save', array('_current' => true, 'back' => null));
112+
}
113+
114+
public function getSaveAndContinueUrl()
115+
{
116+
return $this->getUrl('*/*/save', array(
117+
'_current' => true,
118+
'back' => 'edit',
119+
'tab' => '{{tab_id}}',
120+
'active_tab' => null,
121+
));
122+
}
123+
124+
public function getDeleteUrl()
125+
{
126+
return $this->getUrl('*/*/delete', array('_current' => true));
127+
}
128+
129+
public function getHeader()
130+
{
131+
return $this->htmlEscape($this->getLessFile()->getPath());
132+
}
133+
134+
public function getSelectedTabId()
135+
{
136+
return addslashes(htmlspecialchars($this->getRequest()->getParam('tab')));
137+
}
138+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the Open Software License (OSL 3.0)
6+
* that is bundled with this package in the file LICENSE.txt.
7+
* It is also available through the world-wide-web at this URL:
8+
* http://opensource.org/licenses/osl-3.0.php
9+
*
10+
* @category Soczed
11+
* @package Soczed_Less
12+
* @copyright Copyright (c) 2012 Soczed <[email protected]> (Benoît Leulliette <[email protected]>)
13+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
14+
*/
15+
16+
class Soczed_Less_Block_Adminhtml_File_Edit_Tab_General
17+
extends Mage_Adminhtml_Block_Widget_Form
18+
{
19+
protected function _prepareForm()
20+
{
21+
$file = Mage::registry('current_less_file');
22+
$form = new Varien_Data_Form();
23+
$fieldset = $form->addFieldset('general', array('legend' => $this->__('General')));
24+
25+
$yesNo = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
26+
27+
$fieldset->addField('force_rebuild', 'select', array(
28+
'name' => 'force_rebuild',
29+
'label' => $this->__('Force Rebuild'),
30+
'class' => 'required-entry',
31+
'values' => $yesNo,
32+
'value' => (bool)$file->getForceRebuild(),
33+
));
34+
$fieldset->addField('use_global_variables', 'select', array(
35+
'name' => 'use_global_variables',
36+
'label' => $this->__('Use Global Variables'),
37+
'class' => 'required-entry',
38+
'values' => $yesNo,
39+
'value' => (bool)$file->getUseGlobalVariables(),
40+
));
41+
$fieldset->addField('force_global_variables', 'select', array(
42+
'name' => 'force_global_variables',
43+
'label' => $this->__('Force Global Variables'),
44+
'class' => 'required-entry',
45+
'values' => $yesNo,
46+
'value' => (bool)$file->getForceGlobalVariables(),
47+
));
48+
$fieldset->addField('variables', 'text', array(
49+
'name' => 'variables',
50+
'label' => $this->__('Custom Variables List'),
51+
'class' => 'required-entry',
52+
'value' => $file->getCustomVariables(),
53+
));
54+
$form->getElement('variables')->setRenderer(
55+
$this->getLayout()->createBlock('less/adminhtml_widget_form_element_variables')
56+
);
57+
58+
$this->setForm($form);
59+
return $this;
60+
}
61+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the Open Software License (OSL 3.0)
6+
* that is bundled with this package in the file LICENSE.txt.
7+
* It is also available through the world-wide-web at this URL:
8+
* http://opensource.org/licenses/osl-3.0.php
9+
*
10+
* @category Soczed
11+
* @package Soczed_Less
12+
* @copyright Copyright (c) 2012 Soczed <[email protected]> (Benoît Leulliette <[email protected]>)
13+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
14+
*/
15+
16+
class Soczed_Less_Block_Adminhtml_File_Edit_Tabs
17+
extends Mage_Adminhtml_Block_Widget_Tabs
18+
{
19+
public function __construct()
20+
{
21+
parent::__construct();
22+
$this->setId('less_file_info_tabs');
23+
$this->setDestElementId('less_file_edit_form');
24+
$this->setTitle($this->__('Less File'));
25+
}
26+
27+
public function getLessFile()
28+
{
29+
return Mage::registry('current_less_file');
30+
}
31+
32+
protected function _prepareLayout()
33+
{
34+
$file = $this->getLessFile();
35+
36+
$this->addTab('general', array(
37+
'label' => $this->__('General'),
38+
'content' => $this->getLayout()->createBlock('less/adminhtml_file_edit_tab_general')->toHtml(),
39+
'active' => true,
40+
));
41+
42+
return parent::_prepareLayout();
43+
}
44+
}

0 commit comments

Comments
 (0)