Streamline of placeholder format.
This commit is contained in:
parent
a526c47b8a
commit
5c50ec5972
4 changed files with 14 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
9
db/migrate/20160211000002_migrate_text_modules2.rb
Normal file
9
db/migrate/20160211000002_migrate_text_modules2.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class MigrateTextModules2 < ActiveRecord::Migration
|
||||
def up
|
||||
TextModule.all.each {|text_module|
|
||||
text_module.content.gsub!('<%=', '#{')
|
||||
text_module.content.gsub!('%>', '}')
|
||||
text_module.save
|
||||
}
|
||||
end
|
||||
end
|
|
@ -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,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue