Streamline of placeholder format.

This commit is contained in:
Martin Edenhofer 2016-02-11 01:24:24 +01:00
parent a526c47b8a
commit 5c50ec5972
4 changed files with 14 additions and 5 deletions

View file

@ -30,7 +30,7 @@ class App.WidgetTextModule extends App.Controller
for item in allRaw
if item.active is true
attributes = item.attributes()
attributes.content = attributes.content.replace( /<%=\s{0,2}(.+?)\s{0,2}%>/g, ( index, key ) ->
attributes.content = attributes.content.replace( /#\{{0,2}(.+?)\s{0,2}\}/g, ( index, key ) ->
key = key.replace( /@/g, 'data.' )
varString = "#{key}" + ''
#console.log( "tag replacement env: ", data)

View file

@ -21,9 +21,9 @@ Create Text Modules to **spend less time writing responses**. TextModules can in
Examples of snippets are:
* Hallo Frau <%= @ticket.customer.lastname %>,
* Hallo Herr <%= @ticket.customer.lastname %>,
* Hallo <%= @ticket.customer.firstname %>,
* Hallo Frau #{@ticket.customer.lastname},
* Hallo Herr #{@ticket.customer.lastname},
* Hallo #{@ticket.customer.firstname},
Of course you can also use multi line snippets.

View file

@ -0,0 +1,9 @@
class MigrateTextModules2 < ActiveRecord::Migration
def up
TextModule.all.each {|text_module|
text_module.content.gsub!('&lt;%=', '#{')
text_module.content.gsub!('%&gt;', '}')
text_module.save
}
end
end

View file

@ -101,7 +101,7 @@ class AgentTicketActionLevel0Test < TestCase
data: {
name: 'some name' + random,
keywords: random,
content: 'some content <%= @ticket.customer.lastname %>' + random,
content: 'some content #{@ticket.customer.lastname}' + random,
},
)