Browse Source

Streamline of placeholder format.

Martin Edenhofer 9 years ago
parent
commit
5c50ec5972

+ 1 - 1
app/assets/javascripts/app/controllers/widget/text_module.coffee

@@ -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)

+ 3 - 3
app/assets/javascripts/app/models/text_module.coffee

@@ -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 - 0
db/migrate/20160211000002_migrate_text_modules2.rb

@@ -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

+ 1 - 1
test/browser/agent_ticket_actions_level0_test.rb

@@ -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,
       },
     )