Skip to content

Commit 7779c7f

Browse files
author
Eugene Tupikov
committed
fixed markup #2
1 parent e7e966a commit 7779c7f

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

examples/views/multiple-input.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<h3>Multiple columns</h3>
4848
<?php
49-
echo $form->field($model, 'schedule')->widget(MultipleInput::className(), [
49+
echo $form->field($model, 'schedule')->label(false)->widget(MultipleInput::className(), [
5050
'id' => 'examplemodel-schedule',
5151
'max' => 4,
5252
'allowEmptyList' => true,
@@ -58,6 +58,7 @@
5858
}
5959
return $options;
6060
},
61+
'cloneButton' => true,
6162
'columns' => [
6263
[
6364
'name' => 'user_id',

src/assets/src/css/multiple-input.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ table.multiple-input-list tr > th {
5959
padding-left: 5px;
6060
}
6161

62+
.multiple-input-list.list-renderer .list-cell__button:last-child {
63+
padding-right: 15px;
64+
}
65+
6266
.multiple-input-list.list-renderer tbody .list-cell__button .btn{
6367
margin-top: 25px;
6468
}

src/assets/src/js/jquery.multipleInput.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
// fetch default attribute options from active from attribute
152152
if (typeof attribute === 'object') {
153153
$.each(attribute, function (key, value) {
154-
if (['id', 'input', 'container'].indexOf(key) == -1) {
154+
if (['id', 'input', 'container'].indexOf(key) === -1) {
155155
defaultAttributeOptions[key] = value;
156156
}
157157
});
@@ -199,7 +199,7 @@
199199

200200
remove: function (index) {
201201
var row = null;
202-
if (index != undefined) {
202+
if (index !== undefined) {
203203
row = $(this).find('.js-input-remove:eq(' + index + ')');
204204
} else {
205205
row = $(this).find('.js-input-remove').last();
@@ -239,7 +239,7 @@
239239
template = settings.template,
240240
inputList = $wrapper.children('.multiple-input-list').first();
241241

242-
if (settings.max != null && getCurrentIndex($wrapper) >= settings.max) {
242+
if (settings.max !== null && getCurrentIndex($wrapper) >= settings.max) {
243243
return;
244244
}
245245

@@ -287,10 +287,10 @@
287287
if (values) {
288288
var val = values[index];
289289

290-
if (tag == 'INPUT' || tag == 'TEXTAREA') {
290+
if (tag === 'INPUT' || tag === 'TEXTAREA') {
291291
obj.val(val);
292-
} else if (tag == 'SELECT') {
293-
if (val && val.indexOf('option') != -1) {
292+
} else if (tag === 'SELECT') {
293+
if (val && val.indexOf('option') !== -1) {
294294
obj.append(val);
295295
} else {
296296
var option = obj.find('option[value="' + val + '"]');
@@ -362,7 +362,7 @@
362362

363363

364364
// do not add attribute which are not the part of widget
365-
if (wrapper.length == 0) {
365+
if (wrapper.length === 0) {
366366
return;
367367
}
368368

src/assets/src/js/jquery.multipleInput.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderers/ListRenderer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public function renderHeader()
5757

5858
$content = [];
5959
$content[] = Html::tag('td', '&nbsp;');
60+
61+
if ($this->cloneButton) {
62+
$content[] = Html::tag('td', '&nbsp;');
63+
}
64+
6065
$content[] = Html::tag('td', $button, [
6166
'class' => 'list-cell__button',
6267
]);

src/renderers/TableRenderer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ public function renderHeader()
5858
$cells[] = $this->renderHeaderCell($column);
5959
}
6060

61-
62-
6361
if ($this->max === null || ($this->max >= 1 && $this->max !== $this->min)) {
6462
$button = $this->isAddButtonPositionHeader() ? $this->renderAddButton() : '';
6563

0 commit comments

Comments
 (0)