Skip to content

Commit

Permalink
fix: precontrib handlebars variable inside string & id level folder
Browse files Browse the repository at this point in the history
  • Loading branch information
wonknu committed Nov 15, 2016
1 parent 5bf7e41 commit 87159f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/cms/editor/handlebars/recursiveFolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function recursiveFolder(obj, index = 1, dataShow = '', links = n
var parent = obj[0] ? obj[0].path.split('/')[0] : ''
var res = `<div class="form-group level-${index} ${classHidden}" data-parent="${parent}" data-shown="${dataShow}">
<label for="${id}" class="control-label">Level ${index}</label>
<select data-precontrib="true" data-slug="true" data-slug-type="path" data-show-hide-sub-folder="true" id="${id}" class="form-control">
<select data-precontrib="true" data-slug="true" data-slug-type="path" data-show-hide-sub-folder="true" id="${id}" data-id="${id}" class="form-control">
<option data-level-hide="${index+1}"></option>`

var sub = ''
Expand Down
8 changes: 8 additions & 0 deletions src/server/public/scripts/modules/EditorAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ export default class EditorAutocomplete {
}
var dataVal = target.getAttribute('data-value').replace(/&quote;/g, '\'')

if(dataVal.indexOf('{{') > -1){
var match
while (match = /\{\{(.*?)\}\}/.exec(dataVal)) {
var selector = document.querySelector('[data-id="' + match[1] + '"]')
if(selector != null) dataVal = dataVal.replace('{{' + match[1] + '}}', selector.value);
}
}

if (dataVal.indexOf('http') === 0) {
this._ajax(
{
Expand Down

0 comments on commit 87159f2

Please sign in to comment.