diff --git a/src/cli/cms/data/regex.js b/src/cli/cms/data/regex.js
index 41a3a97..2fef43a 100755
--- a/src/cli/cms/data/regex.js
+++ b/src/cli/cms/data/regex.js
@@ -11,6 +11,10 @@ export let abeAsAttributePattern = /( [A-Za-z0-9\-\_]+=["|']{1})([^=]*?)({{abe.*
export let eachBlockPattern = /(\{\{#each (\r|\t|\n|.)*?\/each\}\})/g
// This pattern finds all {{#each ...}}...{{/each}} blocks
export let blockPattern = /(\{\{#each.*\}\}[\s\S]*?\{\{\/each\}\})/g
+// This pattern finds all non editable data types
+export let nonEditableDataReg = /({{abe.*(type=[\'|\"]data')?.*editable=[\'|\"]false.*(type=[\'|\"]data')?.*}})/g
+// This pattern finds all data types
+export let dataTypeReg = /({{abe.*type=[\'|\"]data.*}})/g
/**
* escape a regex
diff --git a/src/cli/cms/data/source.js b/src/cli/cms/data/source.js
index d9d4f81..f8eae8f 100644
--- a/src/cli/cms/data/source.js
+++ b/src/cli/cms/data/source.js
@@ -227,7 +227,11 @@ export function getDataList(tplPath, text, jsonPage, onlyDynamicSelect = false)
}
export function removeDataList(text) {
- var listReg = /({{abe.*type=[\'|\"]data.*}})/g
- return text.replace(listReg, '')
-}
\ No newline at end of file
+ return text.replace(cmsData.regex.dataTypeReg, '')
+}
+
+export function removeNonEditableDataList(text) {
+
+ return text.replace(cmsData.regex.nonEditableDataReg, '')
+}
diff --git a/src/server/controllers/editor.js b/src/server/controllers/editor.js
index 5507005..e1e7278 100755
--- a/src/server/controllers/editor.js
+++ b/src/server/controllers/editor.js
@@ -250,7 +250,6 @@ export function editor(text, json, documentLink, precontrib = false) {
let p = new Promise((resolve) => {
var util = new cmsEditor.form()
var arrayBlock = []
-
cmsData.source.getDataList(path.dirname(documentLink), text, json)
.then(() => {
addSource(text, json, util)
@@ -260,6 +259,7 @@ export function editor(text, json, documentLink, precontrib = false) {
text = cmsTemplates.template.setAbePrecontribDefaultValueIfDoesntExist(text)
}
+ text = cmsData.source.removeNonEditableDataList(text)
matchAttrAbe(text, json, util, arrayBlock)
arrayBlock = []
each(text, json, util, arrayBlock)
diff --git a/tests/demo/templates/data.html b/tests/demo/templates/data.html
new file mode 100644
index 0000000..f358c5d
--- /dev/null
+++ b/tests/demo/templates/data.html
@@ -0,0 +1,14 @@
+
+{{abe type='data' key='stores' source='reference/category.json' editable='false'}}
+
+
+
+
+
+
+ test
+
+
+ content
+
+
diff --git a/tests/functional/1-index.js b/tests/functional/1-index.js
index 3063132..df8e984 100644
--- a/tests/functional/1-index.js
+++ b/tests/functional/1-index.js
@@ -27,7 +27,7 @@ describe('Abe', function() {
.waitForElementVisible('//body')
.assert.title('Abe')
.click('//*[@id="level-1"]/option[2]')
- .click('//*[@id="selectTemplate"]/option[9]')
+ .click('//*[@id="selectTemplate"]/option[10]')
.waitForElementVisible("//div[@data-precontrib-templates='single']//input[@id='name']", 1000)
.setValue("//div[@data-precontrib-templates='single']//input[@id='name']", 'ftest')
.click("//button[@type='submit']")
diff --git a/tests/functional/3-abe-data.js b/tests/functional/3-abe-data.js
new file mode 100644
index 0000000..259684c
--- /dev/null
+++ b/tests/functional/3-abe-data.js
@@ -0,0 +1,60 @@
+describe('Abe', function() {
+
+ describe('data', function() {
+
+ before(function(client, done) {
+ done();
+ });
+
+ after(function(client, done) {
+ client.end(function() {
+ done();
+ });
+ });
+
+ afterEach(function(client, done) {
+ done();
+ });
+
+ beforeEach(function(client, done) {
+ done();
+ });
+
+ it('Create a autocomplete template post', function(client) {
+ client
+ .useXpath()
+ .url('http://localhost:3003/abe/editor')
+ .click('//*[@id="selectTemplate"]/option[3]')
+ .waitForElementVisible("//div[@data-precontrib-templates='data']//input[@id='name']", 1000)
+ .setValue("//div[@data-precontrib-templates='data']//input[@id='name']", 'data')
+ .click("//button[@type='submit']")
+ .pause(1000)
+ .waitForElementVisible('//*[@id="abeForm"]', 2000)
+ .assert.urlEquals("http://localhost:3003/abe/editor/data.html", "Clicked URL Matches with URL of the New Window");
+ });
+
+ it('Abe type data reference json', function(client) {
+ client
+ .useXpath()
+ .url('http://localhost:3003/abe/editor/data.html')
+ .waitForElementVisible('//body')
+ .pause(1000)
+ .expect.element("//form[@id='abeForm']//li[@class='active']/a").text.to.contain('slug');
+ });
+
+
+ it('The autocomplete article is deleted in the manager', function(client) {
+ client
+ .useXpath()
+ .url('http://localhost:3003/abe/editor')
+ .waitForElementVisible('//body')
+ .pause(1000)
+ .click("//table[@id='navigation-list']/tbody/tr[1]/td[7]/div/a")
+ .pause(1000)
+ .acceptAlert()
+ .url('http://localhost:3003/abe/editor')
+ .pause(2000)
+ .expect.element("//table[@id='navigation-list']/tbody/tr[1]/td[2]/a").text.to.not.contain('/articles/ftest.html');
+ });
+ });
+});
\ No newline at end of file