Fixed text modules.
This commit is contained in:
parent
9742f5f0b2
commit
3c751d68f2
1 changed files with 6 additions and 5 deletions
|
@ -20,24 +20,25 @@ class App.WidgetTextModule extends App.Controller
|
||||||
|
|
||||||
reload: (data) =>
|
reload: (data) =>
|
||||||
return if !data
|
return if !data
|
||||||
|
@data = data
|
||||||
@update()
|
@update()
|
||||||
|
|
||||||
update: =>
|
update: =>
|
||||||
allRaw = App.TextModule.all()
|
allRaw = App.TextModule.all()
|
||||||
all = []
|
all = []
|
||||||
ui = @data || @
|
data = @data || @
|
||||||
for item in allRaw
|
for item in allRaw
|
||||||
if item.active is true
|
if item.active is true
|
||||||
attributes = item.attributes()
|
attributes = item.attributes()
|
||||||
attributes.content = attributes.content.replace( /<%=\s{0,2}(.+?)\s{0,2}%>/g, ( index, key ) ->
|
attributes.content = attributes.content.replace( /<%=\s{0,2}(.+?)\s{0,2}%>/g, ( index, key ) ->
|
||||||
key = key.replace( /@/g, 'ui.data.' )
|
key = key.replace( /@/g, 'data.' )
|
||||||
varString = "#{key}" + ''
|
varString = "#{key}" + ''
|
||||||
# console.log( "tag replacement env: ", ui.data)
|
#console.log( "tag replacement env: ", data)
|
||||||
try
|
try
|
||||||
# console.log( "tag replacement: " + key, varString )
|
#console.log( "tag replacement: " + key, varString )
|
||||||
key = eval (varString)
|
key = eval (varString)
|
||||||
catch error
|
catch error
|
||||||
# console.log( "tag replacement error: " + error )
|
#console.log( "tag replacement error: " + error )
|
||||||
key = ''
|
key = ''
|
||||||
return key
|
return key
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue