Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builder imporvement: removed terms & privacy settings, added new terms & privacy preset field #1845

Merged
merged 6 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 88 additions & 6 deletions assets/js/admin-multi-directory-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,12 @@ __webpack_require__.r(__webpack_exports__);
},
preview: {
required: false
},
editor: {
required: false
},
editorID: {
required: false
}
}
});
Expand Down Expand Up @@ -14209,6 +14215,11 @@ var axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js").de
var field_list = [];
for (var _field in fields) {
var _value = this.maybeJSON([fields[_field].value]);
if (fields[_field].editor) {
var privacyFieldID = fields[_field].editorID;
var editorInstance = tinymce.get(privacyFieldID);
_value = editorInstance.getContent();
}
form_data.append(_field, _value);
field_list.push(_field);
}
Expand Down Expand Up @@ -15309,6 +15320,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
var type_class = field && field.type ? "cptm-field-wraper-type-" + field.type : "cptm-field-wraper";
var key_class = "cptm-field-wraper-key-" + field_key;
return _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, type_class, true), key_class, true);
},
fieldWrapperID: function fieldWrapperID(field) {
var type_id = "";
if (field && field.editor !== undefined) {
type_id = field.editor === "wp_editor" ? "cptm-field_wp_editor" : "";
}
return type_id;
}
}
});
Expand Down Expand Up @@ -25435,8 +25453,65 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _mixins_form_fields_textarea_field__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../../../mixins/form-fields/textarea-field */ "./assets/src/js/admin/vue/mixins/form-fields/textarea-field.js");

/* harmony default export */ __webpack_exports__["default"] = ({
name: 'textarea-field-theme-default',
mixins: [_mixins_form_fields_textarea_field__WEBPACK_IMPORTED_MODULE_0__["default"]]
name: "textarea-field-theme-default",
mixins: [_mixins_form_fields_textarea_field__WEBPACK_IMPORTED_MODULE_0__["default"]],
props: {
editor: {
required: false,
default: ""
},
editorID: {
required: false,
default: ""
},
fieldId: {
required: false,
default: ""
},
value: {
required: false,
default: ""
}
},
data: function data() {
return {
local_value: this.value
};
},
watch: {
value: function value(newValue) {
if (newValue !== this.local_value) {
this.local_value = newValue;
}
},
local_value: function local_value(newValue) {
this.$emit("input", newValue);
}
},
mounted: function mounted() {
var _this = this;
var editorID = this.editorID;
var value = this.local_value;
tinymce.init({
selector: "#".concat(editorID),
plugins: "link",
toolbar: "undo redo | formatselect | bold italic | link",
menubar: false,
branding: false,
init_instance_callback: function init_instance_callback(editor) {
editor.setContent(value);
editor.on("Change KeyUp", function () {
_this.local_value = editor.getContent();
});
}
});
this.editorInstance = tinymce.get(editorID);
},
beforeDestroy: function beforeDestroy() {
if (this.editorInstance) {
this.editorInstance.destroy();
}
}
});

/***/ }),
Expand Down Expand Up @@ -26138,7 +26213,10 @@ var render = function render() {
}, _vm._l(_vm.sectionFields(section), function (field, field_key) {
return _c("div", {
key: field_key,
class: _vm.fieldWrapperClass(field, _vm.fields[field])
class: _vm.fieldWrapperClass(field, _vm.fields[field]),
attrs: {
id: _vm.fieldWrapperID(_vm.fields[field])
}
}, [_vm.fields[field] ? _c(_vm.getFormFieldName(_vm.fields[field].type), _vm._b({
key: field_key,
ref: field,
Expand Down Expand Up @@ -28030,7 +28108,7 @@ var render = function render() {
}, "form-builder-widget-group-header-component", _vm.$props, false)), _vm._v(" "), _c("slide-up-down", {
attrs: {
active: _vm.widgetsExpandState,
duration: 1000
duration: 800
}
}, [_c("div", {
staticClass: "cptm-form-builder-group-fields"
Expand Down Expand Up @@ -34668,7 +34746,12 @@ var render = function render() {
domProps: {
innerHTML: _vm._s(_vm.description)
}
}) : _vm._e(), _vm._v(" "), _c("textarea", {
}) : _vm._e(), _vm._v(" "), _vm.editor ? _c("div", {
staticClass: "cptm-form-control",
attrs: {
id: _vm.editorID
}
}) : _c("textarea", {
directives: [{
name: "model",
rawName: "v-model",
Expand All @@ -34678,7 +34761,6 @@ var render = function render() {
staticClass: "cptm-form-control",
attrs: {
name: "",
id: "",
cols: _vm.cols,
rows: _vm.rows,
placeholder: _vm.placeholder
Expand Down
89 changes: 83 additions & 6 deletions assets/js/admin-settings-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,12 @@ __webpack_require__.r(__webpack_exports__);
},
preview: {
required: false
},
editor: {
required: false
},
editorID: {
required: false
}
}
});
Expand Down Expand Up @@ -15294,6 +15300,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
var type_class = field && field.type ? "cptm-field-wraper-type-" + field.type : "cptm-field-wraper";
var key_class = "cptm-field-wraper-key-" + field_key;
return _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, type_class, true), key_class, true);
},
fieldWrapperID: function fieldWrapperID(field) {
var type_id = "";
if (field && field.editor !== undefined) {
type_id = field.editor === "wp_editor" ? "cptm-field_wp_editor" : "";
}
return type_id;
}
}
});
Expand Down Expand Up @@ -25420,8 +25433,65 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _mixins_form_fields_textarea_field__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../../../mixins/form-fields/textarea-field */ "./assets/src/js/admin/vue/mixins/form-fields/textarea-field.js");

/* harmony default export */ __webpack_exports__["default"] = ({
name: 'textarea-field-theme-default',
mixins: [_mixins_form_fields_textarea_field__WEBPACK_IMPORTED_MODULE_0__["default"]]
name: "textarea-field-theme-default",
mixins: [_mixins_form_fields_textarea_field__WEBPACK_IMPORTED_MODULE_0__["default"]],
props: {
editor: {
required: false,
default: ""
},
editorID: {
required: false,
default: ""
},
fieldId: {
required: false,
default: ""
},
value: {
required: false,
default: ""
}
},
data: function data() {
return {
local_value: this.value
};
},
watch: {
value: function value(newValue) {
if (newValue !== this.local_value) {
this.local_value = newValue;
}
},
local_value: function local_value(newValue) {
this.$emit("input", newValue);
}
},
mounted: function mounted() {
var _this = this;
var editorID = this.editorID;
var value = this.local_value;
tinymce.init({
selector: "#".concat(editorID),
plugins: "link",
toolbar: "undo redo | formatselect | bold italic | link",
menubar: false,
branding: false,
init_instance_callback: function init_instance_callback(editor) {
editor.setContent(value);
editor.on("Change KeyUp", function () {
_this.local_value = editor.getContent();
});
}
});
this.editorInstance = tinymce.get(editorID);
},
beforeDestroy: function beforeDestroy() {
if (this.editorInstance) {
this.editorInstance.destroy();
}
}
});

/***/ }),
Expand Down Expand Up @@ -26196,7 +26266,10 @@ var render = function render() {
}, _vm._l(_vm.sectionFields(section), function (field, field_key) {
return _c("div", {
key: field_key,
class: _vm.fieldWrapperClass(field, _vm.fields[field])
class: _vm.fieldWrapperClass(field, _vm.fields[field]),
attrs: {
id: _vm.fieldWrapperID(_vm.fields[field])
}
}, [_vm.fields[field] ? _c(_vm.getFormFieldName(_vm.fields[field].type), _vm._b({
key: field_key,
ref: field,
Expand Down Expand Up @@ -28088,7 +28161,7 @@ var render = function render() {
}, "form-builder-widget-group-header-component", _vm.$props, false)), _vm._v(" "), _c("slide-up-down", {
attrs: {
active: _vm.widgetsExpandState,
duration: 1000
duration: 800
}
}, [_c("div", {
staticClass: "cptm-form-builder-group-fields"
Expand Down Expand Up @@ -34726,7 +34799,12 @@ var render = function render() {
domProps: {
innerHTML: _vm._s(_vm.description)
}
}) : _vm._e(), _vm._v(" "), _c("textarea", {
}) : _vm._e(), _vm._v(" "), _vm.editor ? _c("div", {
staticClass: "cptm-form-control",
attrs: {
id: _vm.editorID
}
}) : _c("textarea", {
directives: [{
name: "model",
rawName: "v-model",
Expand All @@ -34736,7 +34814,6 @@ var render = function render() {
staticClass: "cptm-form-control",
attrs: {
name: "",
id: "",
cols: _vm.cols,
rows: _vm.rows,
placeholder: _vm.placeholder
Expand Down
6 changes: 6 additions & 0 deletions assets/src/js/admin/vue/apps/cpt-manager/CPT_Manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ export default {
for (let field in fields) {
let value = this.maybeJSON([fields[field].value]);

if (fields[field].editor) {
let privacyFieldID = fields[field].editorID;
let editorInstance = tinymce.get(privacyFieldID);
value = editorInstance.getContent();
}

form_data.append(field, value);
field_list.push(field);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,11 @@ export default {
preview: {
required: false,
},
editor: {
required: false,
},
editorID: {
required: false,
},
},
}
20 changes: 10 additions & 10 deletions assets/src/js/admin/vue/mixins/form-fields/text-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ export default {

input_type() {
const supported_types = {
'text-field': 'text',
'number-field': 'number',
'password-field': 'password',
'text-field': 'text',
'number-field': 'number',
'password-field': 'password',
'date-field': 'date',
'hidden-field': 'hidden',
'text': 'text',
'number': 'number',
'password': 'password',
'hidden-field': 'hidden',
'text': 'text',
'number': 'number',
'password': 'password',
'date': 'date',
'hidden': 'hidden',
'hidden': 'hidden',
};

if ( typeof supported_types[ this.type ] !== 'undefined' ) {
return supported_types[ this.type ];
}

return 'text';
},

Expand All @@ -49,7 +49,7 @@ export default {
if ( this.input_style && this.input_style.class_names ) {
class_names[ this.input_style.class_names ] = true;
}

return class_names;
}
},
Expand Down
12 changes: 6 additions & 6 deletions assets/src/js/admin/vue/mixins/form-fields/textarea-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ export default {
prop: 'value',
event: 'input'
},

computed: {
input_type() {
const supported_types = {
'text-field': 'text',
'number-field': 'number',
'password-field': 'password',
'text-field': 'text',
'number-field': 'number',
'password-field': 'password',
'date-field': 'date',
'hidden-field': 'hidden',
'hidden-field': 'hidden',
};

if ( typeof supported_types[ this.type ] !== 'undefined' ) {
return supported_types[ this.type ];
}

return 'text';
},

Expand Down
Loading