Skip to content

Commit 215c077

Browse files
committed
Update as of 9/27/2012
* Refactoring Magento 2 to use jQuery instead of Prototype: * Implemented simple lazy-loading functionality * Converted decorator mechanism to jQuery * Moved Installation process to jQuery * Moved Home, Category and Simple Product View pages to jQuery * Moved all frontend libraries from `pub/js` directory to `pub/lib` * Improved Javascript unit tests to be consistent with other test frameworks in Magento * Added Javascript code analysis tests to the static tests suite * Added jQuery file uploader for admin backend, cleaned out old deprecated uploaders * Implemented fixture of 100k orders for the performance tests * Fixes * Admin menu elements order differs for a cached page and non-cached one * Typos in System > Configuration > General Tab * Wrong elements positions on "View Order" page * Impossible to configure checkout on store scope * Warning message in `system.log` when using GD2 image adapter * "Preview" link is absent for managing CMS Pages in single store mode * "Promotions" tab is missing on Configuration page * Wrong format of performance tests config
1 parent da072ba commit 215c077

File tree

1,345 files changed

+104772
-94780
lines changed

Some content is hidden

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

1,345 files changed

+104772
-94780
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ atlassian*
3434
dev/api-tests/config.php
3535
dev/api-tests/integration/tmp/*
3636
dev/api-tests/integration/framework/local-mysql.xml
37+

CHANGELOG.markdown

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
Update as of 9/27/2012
2+
======================
3+
* Refactoring Magento 2 to use jQuery instead of Prototype:
4+
* Implemented simple lazy-loading functionality
5+
* Converted decorator mechanism to jQuery
6+
* Moved Installation process to jQuery
7+
* Moved Home, Category and Simple Product View pages to jQuery
8+
* Moved all frontend libraries from `pub/js` directory to `pub/lib`
9+
* Improved Javascript unit tests to be consistent with other test frameworks in Magento
10+
* Added Javascript code analysis tests to the static tests suite
11+
* Added jQuery file uploader for admin backend, cleaned out old deprecated uploaders
12+
* Implemented fixture of 100k orders for the performance tests
13+
* Fixes
14+
* Admin menu elements order differs for a cached page and non-cached one
15+
* Typos in System > Configuration > General Tab
16+
* Wrong elements positions on "View Order" page
17+
* Impossible to configure checkout on store scope
18+
* Warning message in `system.log` when using GD2 image adapter
19+
* "Preview" link is absent for managing CMS Pages in single store mode
20+
* "Promotions" tab is missing on Configuration page
21+
* Wrong format of performance tests config
22+
123
Update as of 9/13/2012
224
======================
325
* Implemented the option to enable the single store mode in the system configuration, which simplifies the back-end GUI:

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery extends Varien_Da
3838
public function getElementHtml()
3939
{
4040
$html = $this->getContentHtml();
41-
//$html.= $this->getAfterElementHtml();
4241
return $html;
4342
}
4443

@@ -54,8 +53,9 @@ public function getContentHtml()
5453
$content = Mage::getSingleton('Mage_Core_Model_Layout')
5554
->createBlock('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content');
5655

57-
$content->setId($this->getHtmlId() . '_content')
58-
->setElement($this);
56+
$content->setId($this->getHtmlId() . '_content')->setElement($this);
57+
$galleryJs = $content->getJsObjectName();
58+
$content->getUploader()->getConfig()->setMegiaGallery($galleryJs);
5959
return $content->toHtml();
6060
}
6161

app/code/core/Mage/Adminhtml/Block/Media/Editor.php

-151
This file was deleted.

app/code/core/Mage/Adminhtml/Block/Media/Uploader.php

+9-54
Original file line numberDiff line numberDiff line change
@@ -60,65 +60,20 @@ public function __construct()
6060
));
6161
}
6262

63+
/**
64+
* Prepares layout and set element renderer
65+
*
66+
* @return Mage_Adminhtml_Block_Media_Uploader
67+
*/
6368
protected function _prepareLayout()
6469
{
65-
$this->setChild(
66-
'browse_button',
67-
$this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
68-
->addData(array(
69-
'id' => $this->_getButtonId('browse'),
70-
'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Browse Files...'),
71-
'type' => 'button',
72-
'onclick' => $this->getJsObjectName() . '.browse()'
73-
))
74-
);
75-
76-
$this->setChild(
77-
'upload_button',
78-
$this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
79-
->addData(array(
80-
'id' => $this->_getButtonId('upload'),
81-
'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Upload Files'),
82-
'type' => 'button',
83-
'onclick' => $this->getJsObjectName() . '.upload()'
84-
))
85-
);
86-
87-
$this->setChild(
88-
'delete_button',
89-
$this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
90-
->addData(array(
91-
'id' => '{{id}}-delete',
92-
'class' => 'delete',
93-
'type' => 'button',
94-
'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Remove'),
95-
'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
96-
))
97-
);
98-
70+
$head = $this->getLayout()->getBlock('head');
71+
if ($head) {
72+
$head->addCss('Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css');
73+
}
9974
return parent::_prepareLayout();
10075
}
10176

102-
protected function _getButtonId($buttonName)
103-
{
104-
return $this->getHtmlId() . '-' . $buttonName;
105-
}
106-
107-
public function getBrowseButtonHtml()
108-
{
109-
return $this->getChildHtml('browse_button');
110-
}
111-
112-
public function getUploadButtonHtml()
113-
{
114-
return $this->getChildHtml('upload_button');
115-
}
116-
117-
public function getDeleteButtonHtml()
118-
{
119-
return $this->getChildHtml('delete_button');
120-
}
121-
12277
/**
12378
* Retrive uploader js object name
12479
*

app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml

+27
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
5151
<action method="addJs"><file>jquery/jquery-ui-1.8.18.custom.min.js</file></action>
5252
<action method="addCss"><file>Mage_Adminhtml::css/ui-lightness/jquery-ui-1.8.21.custom.css</file></action>
53+
54+
<action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
55+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
56+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
57+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
58+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
59+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
60+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
5361
</reference>
5462
<reference name="content">
5563
<block type="Mage_Adminhtml_Block_Catalog_Product_Edit" name="product_edit"></block>
@@ -72,6 +80,14 @@
7280
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
7381
<action method="addJs"><file>jquery/jquery-ui-1.8.18.custom.min.js</file></action>
7482
<action method="addCss"><file>Mage_Adminhtml::css/ui-lightness/jquery-ui-1.8.21.custom.css</file></action>
83+
84+
<action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
85+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
86+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
87+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
88+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
89+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
90+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
7591
</reference>
7692
<reference name="content">
7793
<block type="Mage_Adminhtml_Block_Catalog_Product_Edit" name="product_edit"></block>
@@ -288,6 +304,17 @@ Layout handle for configurable products
288304

289305
<adminhtml_catalog_category_edit>
290306
<update handle="editor"/>
307+
<reference name="head">
308+
<action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
309+
310+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
311+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
312+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
313+
314+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
315+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
316+
<action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
317+
</reference>
291318
<reference name="left">
292319
<block name="category.tree" type="Mage_Adminhtml_Block_Catalog_Category_Tree" template="catalog/category/tree.phtml" />
293320
</reference>

app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product.js

+12-24
Original file line numberDiff line numberDiff line change
@@ -91,30 +91,18 @@ Product.Gallery.prototype = {
9191
this.getElement('add_images_button').hide();
9292
this.getElement('uploader').show();
9393
},
94-
handleUploadComplete : function(files) {
95-
files.each( function(item) {
96-
if (!item.response.isJSON()) {
97-
try {
98-
console.log(item.response);
99-
} catch (e2) {
100-
alert(item.response);
101-
}
102-
return;
103-
}
104-
var response = item.response.evalJSON();
105-
if (response.error) {
106-
return;
107-
}
108-
var newImage = {};
109-
newImage.url = response.url;
110-
newImage.file = response.file;
111-
newImage.label = '';
112-
newImage.position = this.getNextPosition();
113-
newImage.disabled = 0;
114-
newImage.removed = 0;
115-
this.images.push(newImage);
116-
this.uploader.removeFile(item.id);
117-
}.bind(this));
94+
handleUploadComplete : function(file) {
95+
if (file.error) {
96+
return;
97+
}
98+
var newImage = {};
99+
newImage.url = file.url;
100+
newImage.file = file.file;
101+
newImage.label = '';
102+
newImage.position = this.getNextPosition();
103+
newImage.disabled = 0;
104+
newImage.removed = 0;
105+
this.images.push(newImage);
118106
this.container.setHasChanges();
119107
this.updateImages();
120108
},

app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product/helper/gallery.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,6 @@ $_block = $this;
120120
<input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save_image" name="<?php echo $_block->getElement()->getName() ?>[values]" value="<?php echo $_block->escapeHtml($_block->getImagesValuesJson()) ?>" />
121121
<script type="text/javascript">
122122
//<![CDATA[
123-
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()):?>null<?php else:?><?php echo $_block->getUploader()->getJsObjectName() ?><?php endif;?>, <?php echo $_block->getImageTypesJson() ?>);
123+
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', null, <?php echo $_block->getImageTypesJson() ?>);
124124
//]]>
125125
</script>

0 commit comments

Comments
 (0)