Skip to content

Commit 68f5ee4

Browse files
committed
support for enable/disable inline editing through map functions
1 parent 864ab84 commit 68f5ee4

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lib/functions.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,19 @@ const f = {
146146
* Note: using this method will escape all special characters in the output of the property
147147
* @param {string} $ - the element
148148
* @param {string} name - the name of the field
149+
* @param {string} inlineName - the name of the field for repeatable inline editables or false to disable inline edit
150+
* @param {string} inlineChildName - the name of the variable for inline repeatables
149151
*/
150152
mapField($, name, inlineName, inlineChildName) {
151153
$.html(`{{${name}}}`)
152-
if(!inlineName) {
154+
if(inlineName === undefined) {
153155
$.attr('data-per-inline', name)
154156
} else {
155-
$.attr('v-bind:data-per-inline', '`'+inlineName+'.${i}.'+inlineChildName+'`')
157+
if(inlineName === false) {
158+
// no need to do anything, we do not want this field to be inline editable
159+
} else {
160+
$.attr('v-bind:data-per-inline', '`'+inlineName+'.${i}.'+inlineChildName+'`')
161+
}
156162
}
157163
},
158164

@@ -161,13 +167,19 @@ const f = {
161167
* In the vuejs implementation this maps to an attribute v-html="model.<name>"
162168
* @param {string} $ - the element
163169
* @param {string} name - the name of the field
170+
* @param {string} inlineName - the name of the field for repeatable inline editables or false to disable inline edit
171+
* @param {string} inlineChildName - the name of the variable for inline repeatables
164172
*/
165173
mapRichField($, name, inlineName, inlineChildName) {
166174
$.attr('v-html', name)
167-
if(!inlineName) {
175+
if(inlineName === undefined) {
168176
$.attr('v-bind:data-per-inline', '`'+name+'`')
169177
} else {
170-
$.attr('v-bind:data-per-inline', '`'+inlineName+'.${i}.'+inlineChildName+'`')
178+
if(inlineName === false) {
179+
// no need to do anything, we do not want this field to be inline editable
180+
} else {
181+
$.attr('v-bind:data-per-inline', '`'+inlineName+'.${i}.'+inlineChildName+'`')
182+
}
171183
}
172184
$.html(``)
173185
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "percli",
3-
"version": "0.1.39-alpha",
3+
"version": "0.1.40-alpha",
44
"description": "peregrine-cms cli tool",
55
"main": "/bin/percli",
66
"keywords": [

0 commit comments

Comments
 (0)