Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

WCM-87 Add guid to fields in formTrackingAction editor #16

Closed
wants to merge 3 commits into from

2 participants

Chema Balsas Julio Camarero
This page is out of date. Refresh to see the latest.
2  content-targeting-api/src/com/liferay/contenttargeting/api/model/BaseTrackingAction.java
View
@@ -110,7 +110,7 @@ public String getTrackingActionKey() {
@Override
public boolean isInstantiable() {
- return false;
+ return true;
}
public void processTrackingAction(
13 content-targeting-web/docroot/js/content_targeting/ct_form_builder.js
View
@@ -169,6 +169,7 @@ AUI.add(
editor = field.attr('data-template'),
icon = field.attr('data-icon'),
key = field.attr('data-key'),
+ fieldData = /^([^_]*)(?:_(.*))?$/.exec(key),
name = field.one('.field-title').text(),
unique = field.attr('data-unique') === 'true';
@@ -177,6 +178,7 @@ AUI.add(
description: description,
editor: editor,
icon: icon,
+ id: fieldData[2] ? key : '',
key: key,
name: name
}
@@ -185,7 +187,7 @@ AUI.add(
fields.push(
{
iconClass: icon,
- id: /^([^_]*)(_.*)?$/.exec(key)[1],
+ id: fieldData[1],
label: A.Lang.sub(
labelTpl,
{
@@ -268,6 +270,11 @@ AUI.add(
acceptChildren: {
readOnly: true,
value: false
+ },
+
+ fieldId: {
+ validator: A.Lang.isString,
+ value: field.id
}
},
@@ -275,11 +282,13 @@ AUI.add(
getHTML: function() {
var instance = this;
+ var fieldId = instance.get('fieldId') || A.guid();
+
return A.Lang.sub(
ITEM_FIELD_TPL,
{
description: field.description,
- editor: field.editor,
+ editor: field.editor.replace(/\{ct_field_guid\}/g, fieldId),
icon: field.icon,
name: field.name
}
6 tracking-action-form/src/templates/ct_tracking_action.ftl
View
@@ -1,10 +1,10 @@
<#assign aui = PortletJspTagLibs["/META-INF/aui.tld"] />
-<@aui["input"] name="alias" type="text" value=alias />
+<@aui["input"] label="alias" name="{ct_field_guid}alias" type="text" value=alias />
-<@aui["input"] helpMessage="enter-the-id-of-the-form-to-be-tracked" label="form-id" name="elementId" type="text" value=elementId />
+<@aui["input"] helpMessage="enter-the-id-of-the-form-to-be-tracked" label="form-id" name="{ct_field_guid}elementId" type="text" value=elementId />
-<@aui["select"] label="tracking-action" name="eventType">
+<@aui["select"] label="tracking-action" name="{ct_field_guid}eventType">
<#list eventTypes as curEventType>
<@aui["option"] label="${curEventType}" selected=(eventType == curEventType) value=curEventType />
</#list>
Something went wrong with that request. Please try again.