Skip to content

Commit c652b40

Browse files
author
Natalia Momotenko
committed
Merge remote-tracking branch 'origin/MAGETWO-35182' into UI
2 parents b38d9f6 + 14f32ba commit c652b40

File tree

10 files changed

+415
-109
lines changed

10 files changed

+415
-109
lines changed

app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require([
2626
var uploaderTemplate = '<div class="no-display" id="[[idName]]-template">' +
2727
'<div id="<%- data.id %>" class="file-row file-row-narrow">' +
2828
'<span class="file-info">' +
29-
'<span class="file-info-name"><%- data.name %></span>' +
29+
'<span class="file-info-name"><%= data.name %></span>' +
3030
' ' +
3131
'<span class="file-info-size">(<%- data.size %>)</span>' +
3232
'</span>' +
@@ -41,7 +41,7 @@ var uploaderTemplate = '<div class="no-display" id="[[idName]]-template">' +
4141
'</div>';
4242

4343
var fileListTemplate = '<span class="file-info">' +
44-
'<span class="file-info-name"><%- data.name %></span>' +
44+
'<span class="file-info-name"><%= data.name %></span>' +
4545
' ' +
4646
'<span class="file-info-size">(<%- data.size %>)</span>' +
4747
'</span>';

app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml

Lines changed: 66 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -15,58 +15,61 @@
1515
?>
1616
<?php $_product = $block->getProduct()?>
1717
<?php $block->getConfigJson() ?>
18-
<div class="form-inline">
19-
<div class="field">
20-
<label class="label" for="name"><span><?php echo __('Title')?></span></label>
21-
<div class="control">
22-
<input type="text" class="input-text" id="downloadable_links_title" name="product[links_title]" value="<?php echo $block->getLinksTitle() ?>" <?php echo($_product->getStoreId() && $block->getUsedDefault()) ? 'disabled="disabled"' : '' ?>>
23-
<?php if ($_product->getStoreId()): ?>
24-
<input id="link_title_default" type="checkbox" name="use_default[]" value="links_title" onclick="toggleValueElements(this, this.parentNode.parentNode)" <?php echo $block->getUsedDefault() ? 'checked="checked"' : '' ?> />
25-
<label class="normal" for="link_title_default"><?php echo __('Use Default Value'); ?></label>
26-
<?php endif; ?>
27-
</div>
28-
<div class="field-service">
29-
<?php echo !$block->isSingleStoreMode() ? __('[STORE VIEW]') : ''; ?>
18+
<div class="admin__scope">
19+
<fieldset class="admin__fieldset downloadable-form">
20+
21+
<div class="admin__field" <?php echo !$block->isSingleStoreMode() ? ' data-config-scope="' . __('[STORE VIEW]') . '"' : ''; ?>>
22+
<label class="admin__field-label" for="downloadable_links_title"><span><?php echo __('Title')?></span></label>
23+
<div class="admin__field-control">
24+
<input type="text" class="admin__control-text" id="downloadable_links_title" name="product[links_title]" value="<?php echo $block->getLinksTitle() ?>" <?php echo($_product->getStoreId() && $block->getUsedDefault()) ? 'disabled="disabled"' : '' ?>>
25+
<?php if ($_product->getStoreId()): ?>
26+
<div class="admin__field admin__field-option">
27+
<input id="link_title_default" class="admin__control-checkbox" type="checkbox" name="use_default[]" value="links_title" onclick="toggleValueElements(this, this.parentNode.parentNode)" <?php echo $block->getUsedDefault() ? 'checked="checked"' : '' ?> />
28+
<label class="admin__field-label" for="link_title_default"><span><?php echo __('Use Default Value'); ?></span></label>
29+
</div>
30+
<?php endif; ?>
31+
</div>
3032
</div>
31-
</div>
3233

33-
<div class="field">
34-
<label class="label" for="name"><span><?php echo __('Links can be purchased separately')?></span></label>
35-
<div class="control">
36-
<?php echo $block->getPurchasedSeparatelySelect()?>
34+
<div class="admin__field" <?php echo !$block->isSingleStoreMode() ? ' data-config-scope="' . __('[GLOBAL]') . '"' : ''; ?>>
35+
<label class="admin__field-label" for="downloadable_link_purchase_type"><span><?php echo __('Links can be purchased separately')?></span></label>
36+
<div class="admin__field-control">
37+
<?php echo $block->getPurchasedSeparatelySelect()?>
38+
</div>
3739
</div>
38-
<div class="field-service">
39-
<?php echo !$block->isSingleStoreMode() ? __('[GLOBAL]') : ''; ?>
40+
<div class="admin__field admin__field-wide">
41+
<div class="admin__field-control">
42+
<div class="admin__control-table-wrapper">
43+
<table cellspacing="0" class="admin__control-table">
44+
<thead>
45+
<tr>
46+
<th class="col-title _required"><span><?php echo __('Title') ?></span></th>
47+
<?php if ($block->getCanReadPrice() !== false) : ?>
48+
<th class="col-price"><span><?php echo __('Price') ?></span></th>
49+
<?php endif; ?>
50+
<th class="col-limit"><span><?php echo __('Max. Downloads') ?></span></th>
51+
<th class="col-option"><span><?php echo __('Shareable') ?></span></th>
52+
<th class="col-sample"><span><?php echo __('Sample') ?></span></th>
53+
<th class="col-file"><span><?php echo __('File') ?></span></th>
54+
<th class="col-sort"><span><?php echo __('Sort Order') ?></span></th>
55+
<th class="col-actions">&nbsp;</th>
56+
</tr>
57+
</thead>
58+
<tfoot>
59+
<tr>
60+
<td colspan="8"><?php echo $block->getAddButtonHtml() ?></td>
61+
</tr>
62+
</tfoot>
63+
<tbody id="link_items_body">
64+
</tbody>
65+
</table>
66+
</div>
67+
<div class="admin__field-note">
68+
<span><?php echo __('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.')?></span>
69+
</div>
70+
</div>
4071
</div>
41-
</div>
42-
43-
<table cellspacing="0" class="data-table">
44-
<thead>
45-
<tr>
46-
<th><?php echo __('Title')?> <span class="required">*</span></th>
47-
<?php if ($block->getCanReadPrice() !== false) : ?>
48-
<th><?php echo __('Price')?></th>
49-
<?php endif; ?>
50-
<th><?php echo __('Max. Downloads')?></th>
51-
<th><?php echo __('Shareable')?></th>
52-
<th><?php echo __('Sample')?></th>
53-
<th><?php echo __('File')?></th>
54-
<th><?php echo __('Sort Order')?></th>
55-
<th class="col-delete">&nbsp;</th>
56-
</tr>
57-
</thead>
58-
<tfoot>
59-
<tr>
60-
<td colspan="8" class="col-actions-add"><?php echo $block->getAddButtonHtml()?></td>
61-
</tr>
62-
</tfoot>
63-
<tbody id="link_items_body">
64-
</tbody>
65-
</table>
66-
67-
<div><small><?php echo __('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.')?></small></div>
68-
69-
72+
</fieldset>
7073
</div>
7174
<script>
7275
require([
@@ -79,15 +82,15 @@ require([
7982
], function(jQuery, registry, mageTemplate){
8083
registry.get('downloadable', function (Downloadable) {
8184
var linkTemplate = '<tr>'+
82-
'<td>'+
85+
'<td class="col-title">'+
8386
'<input type="hidden" class="__delete__" name="downloadable[link][<%- data.id %>][is_delete]" value="" />'+
8487
'<input type="hidden" name="downloadable[link][<%- data.id %>][link_id]" value="<%- data.link_id %>" />'+
85-
'<input type="text" class="required-entry input-text" name="downloadable[link][<%- data.id %>][title]" value="<%- data.title %>" />'+
88+
'<input type="text" class="required-entry input-text admin__control-text" name="downloadable[link][<%- data.id %>][title]" value="<%- data.title %>" />'+
8689
'<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_<%- data.id %>_title" name="downloadable[link][<%- data.id %>][use_default_title]" value="1" /><label class="normal" for="downloadable_link_<%- data.id %>_title">Use Default Value</label>' : '' ?>'+
8790
'</td>'+
8891
<?php if ($block->getCanReadPrice() !== false) : ?>
89-
'<td class="input-price">'+
90-
'<input type="text" id="downloadable_link_<%- data.id %>_price_value" class="input-text validate-number link-prices<?php if ($block->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][<%- data.id %>][price]" value="<%- data.price %>"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' +
92+
'<td class="input-price col-price">'+
93+
'<input type="text" id="downloadable_link_<%- data.id %>_price_value" class="input-text admin__control-text validate-number link-prices<?php if ($block->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][<%- data.id %>][price]" value="<%- data.price %>"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' +
9194
'<label>[<?php echo $block->getBaseCurrencyCode($_product->getStoreId()) ?>]</label>' +
9295
<?php if ($_product->getStoreId() && $block->getIsPriceWebsiteScope()) : ?>
9396
'<br /><input type="checkbox" id="downloadable_link_<%- data.id %>_price" name="downloadable[link][<%- data.id %>][use_default_price]" value="1"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_<%- data.id %>_price">Use Default Value</label>' +
@@ -99,16 +102,16 @@ require([
99102
'<input type="hidden" id="downloadable_link_<%- data.id %>_price" name="downloadable[link][<%- data.id %>][use_default_price]" value="1" />' +
100103
<?php endif; ?>
101104
<?php endif; ?>
102-
'<td><input type="text" id="downloadable_link_<%- data.id %>_downloads" name="downloadable[link][<%- data.id %>][number_of_downloads]" class="input-text downloads" value="<%- data.number_of_downloads %>" />'+
105+
'<td class="col-limit"><input type="text" id="downloadable_link_<%- data.id %>_downloads" name="downloadable[link][<%- data.id %>][number_of_downloads]" class="input-text admin__control-text downloads" value="<%- data.number_of_downloads %>" />'+
103106
'<p><input type="checkbox" class="checkbox" id="downloadable_link_<%- data.id %>_is_unlimited" name="downloadable[link][<%- data.id %>][is_unlimited]" value="1" <%- data.is_unlimited %> /> <label for="downloadable_link_<%- data.id %>_is_unlimited">Unlimited</label></p></td>'+
104-
'<td>'+
107+
'<td class="col-share">'+
105108
'<select id="downloadable_link _<%- data.id %>_shareable" name="downloadable[link][<%- data.id %>][is_shareable]">'+
106109
'<option value="1">Yes</option>'+
107110
'<option value="0">No</option>'+
108111
'<option value="2" selected="selected">Use config</option>'+
109112
'</select>'+
110113
'</td>'+
111-
'<td>'+
114+
'<td class="col-file">'+
112115
'<div class="files">'+
113116
'<div class="row">'+
114117
'<label for="downloadable_link_<%- data.id %>_sample_file_type"><input type="radio" class="radio" id="downloadable_link_<%- data.id %>_sample_file_type" name="downloadable[link][<%- data.id %>][sample][type]" value="file"<%- data.sample_file_checked %> /> File:</label>'+
@@ -127,14 +130,14 @@ require([
127130
'</div>'+
128131
'</div>'+
129132
'<div class="row">'+
130-
'<label for="downloadable_link_<%- data.id %>_sample_url_type"><input type="radio" class="radio" id="downloadable_link_<%- data.id %>_sample_url_type" name="downloadable[link][<%- data.id %>][sample][type]" value="url"<%- data.sample_url_checked %> /> URL:</label><input type="text" class="input-text validate-downloadable-url validate-url" name="downloadable[link][<%- data.id %>][sample][url]" value="<%- data.sample_url %>" />'+
133+
'<label for="downloadable_link_<%- data.id %>_sample_url_type"><input type="radio" class="radio" id="downloadable_link_<%- data.id %>_sample_url_type" name="downloadable[link][<%- data.id %>][sample][type]" value="url"<%- data.sample_url_checked %> /> URL:</label><input type="text" class="input-text admin__control-text validate-downloadable-url validate-url" name="downloadable[link][<%- data.id %>][sample][url]" value="<%- data.sample_url %>" />'+
131134
'</div>'+
132135
'<div>'+
133136
'<span id="downloadable_link_<%- data.id %>_sample_container"></span>'+
134137
'</div>'+
135138
'</div>'+
136139
'</td>'+
137-
'<td>'+
140+
'<td class="col-file">'+
138141
'<div class="files">'+
139142
'<div class="row">'+
140143
'<label for="downloadable_link_<%- data.id %>_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%- data.id %>_file_type" name="downloadable[link][<%- data.id %>][type]" value="file"<%- data.file_checked %> /> File:</label>'+
@@ -153,16 +156,16 @@ require([
153156
'</div>'+
154157
'</div>'+
155158
'<div class="row">'+
156-
'<label for="downloadable_link_<%- data.id %>_url_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%- data.id %>_url_type" name="downloadable[link][<%- data.id %>][type]" value="url"<%- data.url_checked %> /> URL:</label><input type="text" class="validate-downloadable-url validate-url input-text" name="downloadable[link][<%- data.id %>][link_url]" value="<%- data.link_url %>" />'+
159+
'<label for="downloadable_link_<%- data.id %>_url_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%- data.id %>_url_type" name="downloadable[link][<%- data.id %>][type]" value="url"<%- data.url_checked %> /> URL:</label><input type="text" class="validate-downloadable-url validate-url input-text admin__control-text" name="downloadable[link][<%- data.id %>][link_url]" value="<%- data.link_url %>" />'+
157160
'</div>'+
158161
'<div>'+
159162
'<span id="downloadable_link_<%- data.id %>_link_container"></span>'+
160163
'</div>'+
161164
'</div>'+
162165
'</td>'+
163-
'<td><input type="text" name="downloadable[link][<%- data.id %>][sort_order]" value="<%- data.sort_order %>" class="input-text sort" /></td>'+
164-
'<td class="col-delete">'+
165-
'<button id="downloadable_link_<%- data.id %>_delete_button" type="button" class="action- scalable delete delete-link-item"><span><span><span><?php echo __('Delete'); ?></span></span></span></button>'+
166+
'<td class="col-sort"><input type="text" name="downloadable[link][<%- data.id %>][sort_order]" value="<%- data.sort_order %>" class="input-text admin__control-text sort" /></td>'+
167+
'<td class="col-action">'+
168+
'<button id="downloadable_link_<%- data.id %>_delete_button" type="button" class="action-remove"><span><?php echo __('Delete'); ?></span></button>'+
166169
'</td>'+
167170
'</tr>';
168171

@@ -309,7 +312,7 @@ require([
309312
}
310313
},
311314
bindRemoveButtons : function(){
312-
var buttons = $$('tbody#link_items_body .delete-link-item');
315+
var buttons = $$('tbody#link_items_body .action-remove');
313316
for(var i=0;i<buttons.length;i++){
314317
if(!$(buttons[i]).binded && !$(buttons[i]).hasClassName('disabled')){
315318
$(buttons[i]).binded = true;
@@ -351,7 +354,7 @@ require([
351354
if ($(id + ' .progressbar-container').length) {
352355
$(id + ' .progressbar-container').parent().remove();
353356
}
354-
357+
355358
fileSize = typeof file.size == "undefined" ?
356359
$.mage.__('We could not detect a size.') :
357360
byteConvert(file.size);

0 commit comments

Comments
 (0)