Skip to content

Commit

Permalink
Merge pull request #262 from magento-vanilla/PR
Browse files Browse the repository at this point in the history
[Vanilla] Sprints 16-17
  • Loading branch information
Vilchynskyi, Dmytro(dvilchynskyi) committed Apr 30, 2015
2 parents 28f4987 + 199391f commit 1efdc59
Show file tree
Hide file tree
Showing 477 changed files with 18,363 additions and 14,684 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
?>
<div
data-mage-init='{"toolbarEntry": {}}'
class="notifications-wrapper"
class="notifications-wrapper admin__action-dropdown-wrap"
data-notification-count="<?php echo $notificationCount; ?>">
<?php if ($notificationCount > 0) : ?>
<a
href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>"
class="notifications-action"
class="notifications-action admin__action-dropdown"
data-mage-init='{"dropdown":{}}'
title="<?php echo __('Notifications'); ?>"
data-toggle="dropdown">
Expand All @@ -28,7 +28,7 @@
</span>
</a>
<ul
class="notifications-list"
class="admin__action-dropdown-menu"
data-mark-as-read-url="<?php echo $block->getUrl('adminhtml/notification/ajaxMarkAsRead'); ?>">
<?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?>
<?php /** @var $notification \Magento\AdminNotification\Model\Inbox*/ ?>
Expand Down Expand Up @@ -76,7 +76,7 @@
</ul>
<?php else : ?>
<a
class="notifications-action"
class="notifications-action admin__action-dropdown"
href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>"
title="<?php echo __('Notifications'); ?>">
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define([

// Mark notification as read via AJAX call
var markNotificationAsRead = function (notificationId) {
var requestUrl = $('.notifications-wrapper .notifications-list').attr('data-mark-as-read-url');
var requestUrl = $('.notifications-wrapper .admin__action-dropdown-menu').attr('data-mark-as-read-url');
$.ajax({
url: requestUrl,
type: 'POST',
Expand All @@ -33,7 +33,7 @@ define([

if (notificationCount == 0) {
// Change appearance of the bubble and its behavior when the last notification is removed
$('.notifications-wrapper .notifications-list').remove();
$('.notifications-wrapper .admin__action-dropdown-menu').remove();
var notificationIcon = $('.notifications-wrapper .notifications-icon');
notificationIcon.removeAttr('data-toggle');
notificationIcon.off('click.dropdown');
Expand All @@ -45,7 +45,7 @@ define([
}
$('.notifications-entry-last .notifications-counter').text(notificationCount);
// Modify caption of the 'See All' link
var actionElement = $('.notifications-wrapper .notifications-list .last .action-more');
var actionElement = $('.notifications-wrapper .admin__action-dropdown-menu .last .action-more');
actionElement.text(actionElement.text().replace(/\d+/, notificationCount));
}
},
Expand All @@ -65,7 +65,7 @@ define([
};

// Show notification description when corresponding item is clicked
$('.notifications-wrapper .notifications-list .notifications-entry').on('click.showNotification', function (event) {
$('.notifications-wrapper .admin__action-dropdown-menu .notifications-entry').on('click.showNotification', function (event) {
// hide notification dropdown
$('.notifications-wrapper .notifications-icon').trigger('click.dropdown');

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ protected function _addSubMenu($menuItem, $level, $limit, $id = null)
if ($level == 0 && $limit) {
$colStops = $this->_columnBrake($menuItem->getChildren(), $limit);
$output .= '<strong class="submenu-title">' . $this->_getAnchorLabel($menuItem) . '</strong>';
$output .= '<a href="#" class="submenu-close _close" data-role="close-submenu"></a>';
$output .= '<a href="#" class="action-close _close" data-role="close-submenu"></a>';
}

$output .= $this->renderNavigation($menuItem->getChildren(), $level + 1, $limit, $colStops);
Expand Down
12 changes: 12 additions & 0 deletions app/code/Magento/Backend/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ protected function _preparePage()
*/
protected function _prepareGrid()
{
$this->_eventManager->dispatch(
'backend_block_widget_grid_prepare_grid_before',
['grid' => $this, 'collection' => $this->getCollection()]
);
if ($this->getChildBlock('grid.massaction') && $this->getChildBlock('grid.massaction')->isAvailable()) {
$this->getChildBlock('grid.massaction')->prepareMassactionColumn();
}
Expand Down Expand Up @@ -433,6 +437,10 @@ protected function _prepareFilterButtons()
'Magento\Backend\Block\Widget\Button'
)->setData(
['label' => __('Reset Filter'), 'onclick' => $this->getJsObjectName() . '.resetFilter()', 'class' => 'action-reset']
)->setDataAttribute(
[
'action' => 'grid-filter-reset'
]
)
);
$this->setChild(
Expand All @@ -445,6 +453,10 @@ protected function _prepareFilterButtons()
'onclick' => $this->getJsObjectName() . '.doFilter()',
'class' => 'task',
]
)->setDataAttribute(
[
'action' => 'grid-filter-apply'
]
)
);
}
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Backend/Block/Widget/Grid/Extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ protected function _prepareLayout()
'onclick' => $this->getJsObjectName() . '.resetFilter()',
'class' => 'action-reset'
]
)->setDataAttribute(
[
'action' => 'grid-filter-reset'
]
)
);
$this->setChild(
Expand All @@ -218,6 +222,10 @@ protected function _prepareLayout()
'onclick' => $this->getJsObjectName() . '.doFilter()',
'class' => 'task',
]
)->setDataAttribute(
[
'action' => 'grid-filter-apply'
]
)
);
return parent::_prepareLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,41 @@
// @codingStandardsIgnoreFile

?>

<form method="post" action="" id="login-form" data-mage-init='{"form": {}, "validation": {}}' autocomplete="off">
<fieldset class="admin__fieldset">
<legend class="admin__legend"><span><?php echo __('Welcome, please sign in') ?></span></legend><br/>
<input name="form_key" type="hidden" value="<?php echo $block->getFormKey() ?>" />
<div class="admin__field _required field-username">
<label for="username" class="admin__field-label"><span><?php echo __('Username') ?></span></label>
<div class="admin__field-control">
<input type="text" id="username" name="login[username]" autofocus value="" data-validate="{required:true}" class="admin__control-text" placeholder="<?php echo __('user name') ?>" />
<input
id="username"
class="admin__control-text"
type="text"
name="login[username]"
autofocus
value=""
data-validate="{required:true}"
placeholder="<?php echo __('user name') ?>"/>
</div>
</div>
<div class="admin__field _required field-password">
<label for="login" class="admin__field-label"><span><?php echo __('Password') ?></span></label>
<div class="admin__field-control">
<!-- This is a dummy hidden field to trick firefox from auto filling the password -->
<input type="text" class="admin__control-dummy" name="dummy" id="dummy" />
<input type="password" id="login" name="login[password]" data-validate="{required:true}" class="admin__control-text" value="" placeholder="<?php echo __('password') ?>" />
<input
id="dummy"
class="admin__control-dummy"
type="text"
name="dummy"/>
<input
id="login"
class="admin__control-text"
type="password"
name="login[password]"
data-validate="{required:true}"
value="" placeholder="<?php echo __('password') ?>" />
</div>
</div>
<?php echo $block->getChildHtml('form.additional.info'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
</a>
<?php break; ?>
<?php case 'user': ?>
<div class="admin-user">
<div class="admin-user admin__action-dropdown-wrap">
<a
href="<?php echo $block->getUrl('adminhtml/system_account/index') ?>"
class="admin-user-account"
class="admin__action-dropdown"
title="<?php echo $block->escapeHtml(__('My Account')) ?>"
data-mage-init='{"dropdown":{}}'
data-toggle="dropdown">
<span class="admin-user-account-text-wrapper">
<span class="admin__action-dropdown-text">
<span class="admin-user-account-text"><?php echo $block->escapeHtml($block->getUser()->getUsername()); ?></span>
</span>
</a>
<ul class="admin-user-menu">
<ul class="admin__action-dropdown-menu">
<?php if ($block->getAuthorization()->isAllowed('Magento_Backend::myaccount')): ?>
<li>
<a
Expand Down
23 changes: 19 additions & 4 deletions app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
<?php /* @var $block \Magento\Captcha\Block\Captcha\DefaultCaptcha */ ?>
<?php $captcha = $block->getCaptchaModel() ?>
<div class="admin__field _required">
<label for="captcha" class="admin__field-label"><span><?php echo __('Please enter the letters from the image') ?></span></label>
<label for="captcha" class="admin__field-label">
<span><?php echo __('Please enter the letters from the image') ?></span>
</label>
<div class="admin__field-control">
<input type="text" name="<?php echo \Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE ?>[<?php echo $block->getFormId()?>]" id="captcha" data-validate="{required:true}" class="admin__control-text"/>
<input
id="captcha"
class="admin__control-text"
type="text"
name="<?php echo \Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE ?>[<?php echo $block->getFormId()?>]"
data-validate="{required:true}"/>
<?php if ($captcha->isCaseSensitive()) :?>
<div class="admin__field-note">
<span><?php echo __('<strong>Attention</strong>: Captcha is case sensitive.') ?></span>
Expand All @@ -22,8 +29,16 @@
</div>
</div>
<div class="admin__field field-captcha">
<img id="captcha-reload" class="captcha-reload" src="<?php echo $block->getViewFileUrl('Magento_Captcha::reload.png') ?>" alt="<?php echo __('Reload captcha') ?>"/>
<img id="<?php echo $block->getFormId() ?>" width="<?php echo $block->getImgWidth() ?>" height="<?php echo $block->getImgHeight() ?>" src="<?php echo $captcha->getImgSrc() ?>" />
<img
id="captcha-reload"
class="captcha-reload"
src="<?php echo $block->getViewFileUrl('Magento_Captcha::reload.png') ?>"
alt="<?php echo __('Reload captcha') ?>"/>
<img
id="<?php echo $block->getFormId() ?>"
width="<?php echo $block->getImgWidth() ?>"
height="<?php echo $block->getImgHeight() ?>"
src="<?php echo $captcha->getImgSrc() ?>" />
</div>
<script>
require(["prototype", "mage/captcha"], function(){
Expand Down
58 changes: 34 additions & 24 deletions app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,72 @@
* See COPYING.txt for license details.
*/
require([
"jquery",
"prototype"
], function(jQuery){
'jquery'
], function ($) {
'use strict';

window.Product = {};

function byId(id) {
return document.getElementById(id);
}

function toogleFieldEditMode(toogleIdentifier, fieldContainer) {
if ($(toogleIdentifier).checked) {
if (byId(toogleIdentifier).checked) {
enableFieldEditMode(fieldContainer);
} else {
disableFieldEditMode(fieldContainer);
}
}

function disableFieldEditMode(fieldContainer) {
$(fieldContainer).disabled = true;
if ($(fieldContainer + '_hidden')) {
$(fieldContainer + '_hidden').disabled = true;
byId(fieldContainer).disabled = true;

if (byId(fieldContainer + '_hidden')) {
byId(fieldContainer + '_hidden').disabled = true;
}
}

function enableFieldEditMode(fieldContainer) {
$(fieldContainer).disabled = false;
if ($(fieldContainer + '_hidden')) {
$(fieldContainer + '_hidden').disabled = false;
byId(fieldContainer).disabled = false;

if (byId(fieldContainer + '_hidden')) {
byId(fieldContainer + '_hidden').disabled = false;
}
}

function onCompleteDisableInited() {
jQuery.each(jQuery('[data-disable]'), function () {
var item = jQuery(this).data('disable');
$.each($('[data-disable]'), function () {
var item = $(this).data('disable');
disableFieldEditMode(item);
});
}

function onUrlkeyChanged(urlKey) {
urlKey = $(urlKey);
var hidden = urlKey.next('input[type=hidden]');
var chbx = urlKey.next('input[type=checkbox]');
urlKey = byId(urlKey);
var hidden = $(urlKey).next('input[type=hidden]')[0];
var chbx = $(urlKey).next('input[type=checkbox]')[0];
var oldValue = chbx.value;
chbx.disabled = (oldValue == urlKey.value);

chbx.disabled = (oldValue === urlKey.value);
hidden.disabled = chbx.disabled;
}

function onCustomUseParentChanged(element) {
var useParent = (element.value == 1) ? true : false;
element.up(2).select('input', 'select', 'textarea').each(function (el) {
if (element.id != el.id) {
var useParent = (element.value === 1) ? true : false,
parent = $(element).parent().parent();

parent.find('input, select, textarea').each(function (i, el) {
if (element.id !== el.id) {
el.disabled = useParent;
}
});
element.up(2).select('img').each(function (el) {

parent.find('img').each(function (i, el) {
if (useParent) {
el.hide();
$(el).hide();
} else {
el.show();
$(el).show();
}
});
}
Expand All @@ -67,5 +77,5 @@ require([
window.onUrlkeyChanged = onUrlkeyChanged;
window.toogleFieldEditMode = toogleFieldEditMode;

Event.observe(window, 'load', onCompleteDisableInited);
});
$(window).load(onCompleteDisableInited);
});
17 changes: 8 additions & 9 deletions app/code/Magento/Cms/Controller/Adminhtml/AbstractMassDelete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
Expand All @@ -21,7 +20,7 @@ class AbstractMassDelete extends \Magento\Backend\App\Action
/**
* Redirect url
*/
const REDIRECT_URL = '*/*/index';
const REDIRECT_URL = '*/*/';

/**
* Resource collection
Expand All @@ -45,17 +44,17 @@ class AbstractMassDelete extends \Magento\Backend\App\Action
*/
public function execute()
{
$data = $this->getRequest()->getParam('massaction', '[]');
$data = json_decode($data, true);
$selected = $this->getRequest()->getParam('selected');
$excluded = $this->getRequest()->getParam('excluded');

if (isset($data['all_selected']) && $data['all_selected'] === true) {
if (!empty($data['excluded'])) {
$this->excludedDelete($data['excluded']);
if (isset($excluded)) {
if (!empty($excluded)) {
$this->excludedDelete($excluded);
} else {
$this->deleteAll();
}
} elseif (!empty($data['selected'])) {
$this->selectedDelete($data['selected']);
} elseif (!empty($selected)) {
$this->selectedDelete($selected);
} else {
$this->messageManager->addError(__('Please select item(s).'));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
Expand Down
Loading

0 comments on commit 1efdc59

Please sign in to comment.