Skip to content

Commit 97170c6

Browse files
committed
Fix "undefined" refs
1 parent 9fde131 commit 97170c6

6 files changed

Lines changed: 27 additions & 36 deletions

File tree

packages/craftcms-vue/admintable/App.vue

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,19 @@
104104
</template>
105105
<template slot="title" slot-scope="props">
106106
<span
107-
v-if="props.rowData.status !== undefined"
107+
v-if="props.rowData.status"
108108
class="status"
109109
:class="{enabled: props.rowData.status}"
110110
></span>
111111
<a
112-
:class="{'cell-bold': props.rowData.status === undefined}"
112+
:class="{'cell-bold': !props.rowData.status}"
113113
v-if="props.rowData.url"
114114
:href="props.rowData.url"
115115
>{{ props.rowData.title }}</a
116116
>
117-
<span
118-
:class="{'cell-bold': props.rowData.status === undefined}"
119-
v-else
120-
>{{ props.rowData.title }}</span
121-
>
117+
<span :class="{'cell-bold': !props.rowData.status}" v-else>{{
118+
props.rowData.title
119+
}}</span>
122120
</template>
123121

124122
<template slot="handle" slot-scope="props">
@@ -134,7 +132,7 @@
134132
}}<template
135133
v-if="
136134
props.rowData.menu.showCount ||
137-
props.rowData.menu.showCount === undefined
135+
typeof props.rowData.menu.showCount === 'undefined'
138136
"
139137
>
140138
({{ props.rowData.menu.items.length }})</template
@@ -172,8 +170,7 @@
172170
@click="handleDetailRow(props.rowData.id)"
173171
v-if="
174172
props.rowData.detail.content &&
175-
(!props.rowData.detail.handle ||
176-
props.rowData.detail.handle == undefined) &&
173+
!props.rowData.detail.handle &&
177174
(Object.keys(props.rowData.detail.content).length ||
178175
props.rowData.detail.content.length)
179176
"
@@ -202,7 +199,7 @@
202199
v-on:finishloading="loading(false)"
203200
v-on:reload="remove(props.rowIndex, props.rowData.id)"
204201
v-if="
205-
props.rowData._showDelete == undefined ||
202+
typeof props.rowData._showDelete === 'undefined' ||
206203
props.rowData._showDelete == true
207204
"
208205
></admin-table-delete-button>
@@ -830,8 +827,8 @@
830827
831828
canReorder() {
832829
if (
833-
this.$refs.vuetable == undefined ||
834-
this.$refs.vuetable.tableData == undefined
830+
typeof this.$refs.vuetable === 'undefined' ||
831+
typeof this.$refs.vuetable.tableData === 'undefined'
835832
) {
836833
return false;
837834
}

packages/craftcms-vue/admintable/components/AdminTableActionButton.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
:class="{
4242
...(act.class ? act.class : {}),
4343
...{
44-
error: act.error !== undefined && act.error,
44+
error: act.error,
4545
disabled:
4646
act.allowMultiple !== undefined &&
4747
!act.allowMultiple &&
@@ -53,7 +53,7 @@
5353
:data-ajax="act.ajax"
5454
@click.prevent="
5555
!(
56-
act.allowMultiple !== undefined &&
56+
typeof act.allowMultiple !== 'undefined' &&
5757
!act.allowMultiple &&
5858
hasMultipleSelected
5959
)
@@ -136,7 +136,7 @@
136136
this.$emit('click', param, value, action, ajax);
137137
138138
// Is the action button the one to deal with the click?
139-
if (handleClick !== undefined && !handleClick) {
139+
if (typeof handleClick !== 'undefined' && !handleClick) {
140140
return;
141141
}
142142

packages/craftcms-vue/admintable/components/AdminTableDeleteButton.vue

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,23 @@
3535
3636
computed: {
3737
success() {
38-
var successMessage =
39-
this.successMessage !== undefined
40-
? Craft.t('site', this.successMessage, {name: this.name})
41-
: Craft.t('app', '“{name}” deleted.', {name: this.name});
38+
var successMessage = this.successMessage
39+
? Craft.t('site', this.successMessage, {name: this.name})
40+
: Craft.t('app', '“{name}” deleted.', {name: this.name});
4241
return Craft.escapeHtml(successMessage);
4342
},
4443
confirm() {
45-
var confirmationMessage =
46-
this.confirmationMessage !== undefined
47-
? Craft.t('site', this.confirmationMessage, {name: this.name})
48-
: Craft.t('app', 'Are you sure you want to delete “{name}”?', {
49-
name: this.name,
50-
});
44+
var confirmationMessage = this.confirmationMessage
45+
? Craft.t('site', this.confirmationMessage, {name: this.name})
46+
: Craft.t('app', 'Are you sure you want to delete “{name}”?', {
47+
name: this.name,
48+
});
5149
return Craft.escapeHtml(confirmationMessage);
5250
},
5351
failed() {
54-
var failMessage =
55-
this.failMessage !== undefined
56-
? Craft.t('site', this.failMessage, {name: this.name})
57-
: Craft.t('app', 'Couldn’t delete “{name}”.', {name: this.name});
52+
var failMessage = this.failMessage
53+
? Craft.t('site', this.failMessage, {name: this.name})
54+
: Craft.t('app', 'Couldn’t delete “{name}”.', {name: this.name});
5855
return Craft.escapeHtml(failMessage);
5956
},
6057
},

packages/craftcms-vue/admintable/components/AdminTableDetailRow.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<template>
22
<div>
33
<div
4-
v-if="
5-
rowData.detail.content &&
6-
(!rowData.detail.showAsList || rowData.detail.showAsList === undefined)
7-
"
4+
v-if="rowData.detail.content && !rowData.detail.showAsList"
85
v-html="rowData.detail.content"
96
></div>
107
<div v-if="rowData.detail.content && rowData.detail.showAsList">

src/web/assets/admintable/dist/js/app.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/web/assets/admintable/dist/js/app.js.map

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

0 commit comments

Comments
 (0)