diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index c79250a56..48c19cd44 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -2,7 +2,7 @@ class App.Controller extends Spine.Controller # add @title methode to set title title: (name) -> - $('html head title').html( Config.product_name + ' - ' + T(name) ) + $('html head title').html( Config.product_name + ' - ' + Ti(name) ) # add @notify methode to create notification notify: (data) -> @@ -166,7 +166,7 @@ class App.Controller extends Spine.Controller name_new = name if attribute.translate - name_new = T(name) + name_new = Ti(name) attribute.options.push { name: name_new, value: item.id, @@ -399,10 +399,6 @@ class App.Controller extends Spine.Controller if row.callback object[row.name]['name'] = row.callback(object[row.name]['name']) - # check if translation is needed - if row.translate - object[row.name]['name'] = T( object[row.name]['name'] ) - # @log 'table', 'header', header, 'overview', data_types, 'objects', objects table = App.view('generic/table')( header: header, diff --git a/app/assets/javascripts/app/controllers/channel.js.coffee b/app/assets/javascripts/app/controllers/channel.js.coffee index fc8bcd41f..5d9281fec 100644 --- a/app/assets/javascripts/app/controllers/channel.js.coffee +++ b/app/assets/javascripts/app/controllers/channel.js.coffee @@ -13,6 +13,7 @@ class Index extends App.ControllerLevel2 ] page: { title: 'Channels', + head: 'Channels', sub_title: 'Management' nav: '#channels', } diff --git a/app/assets/javascripts/app/controllers/settings.js.coffee b/app/assets/javascripts/app/controllers/settings.js.coffee index a5c502855..cf30f7bef 100644 --- a/app/assets/javascripts/app/controllers/settings.js.coffee +++ b/app/assets/javascripts/app/controllers/settings.js.coffee @@ -19,6 +19,7 @@ class Index extends App.ControllerLevel2 ] @page = { title: 'System', + head: 'System', sub_title: 'Settings' nav: '#settings/system', } @@ -32,6 +33,7 @@ class Index extends App.ControllerLevel2 ] @page = { title: 'Security', + head: 'Security', sub_title: 'Settings' nav: '#settings/security', } @@ -45,6 +47,7 @@ class Index extends App.ControllerLevel2 ] @page = { title: 'Ticket', + head: 'Ticket', sub_title: 'Settings' nav: '#settings/ticket', } diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index e1f0292a9..c917ef218 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -148,7 +148,8 @@ class App.i18n extends App.Ajax constructor: -> @set('de') - window.T = @translate + window.T = @translate_content + window.Ti = @translate_inline set: (locale) => @map = {} @@ -162,21 +163,47 @@ class App.i18n extends App.Ajax console.log 'error', error, statusText, xhr.statusCode ) + translate_inline: (string, args...) => + @translate(string, args...) + + translate_content: (string, args...) => + translated = @translate(string, args...) +# replace = '' + translated + '' + replace = '' + translated + '' +# if !@_translated +# replace += 'XX' + replace += '' + translate: (string, args...) => + # return '' on undefined + return '' if string is undefined + # return translation if @map[string] isnt undefined + @_translated = true translated = @map[string] else + @_translated = false translated = string # search %s for arg in args translated = translated.replace(/%s/, arg) + # escape + translated = @escape(translated) + # return translated string return translated + escape: (string) -> + string = ('' + string) + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/\x22/g, '"') + class App.Run extends Spine.Controller constructor: -> super @@ -204,6 +231,26 @@ class App.Run extends Spine.Controller window.Session['UISeletion'] = @getSelected() + '' ) +# $('.translation [contenteditable]') + $('.translation') + .live 'focus', -> + $this = $(this) + $this.data 'before', $this.html() + console.log('11111before', $this.html()) + return $this + .live 'blur keyup paste', -> +# .live 'blur', -> + $this = $(this) + if $this.data('before') isnt $this.html() + $this.data 'before', $this.html() + $this.trigger('change') + console.log('111changed', $this.html(), $this.attr('data-text') ) + a = $this.html() + a = ('' + a) + .replace(/<.+?>/g, '') + $this.html(a) + return $this + # @ws = new WebSocket("ws://localhost:3001/"); # Set event handlers. diff --git a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco index c2a1a4dee..493154ba5 100644 --- a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco @@ -1,5 +1,5 @@
@@ -16,6 +16,6 @@
-   +  
diff --git a/app/assets/javascripts/app/views/agent_ticket_zoom.jst.eco b/app/assets/javascripts/app/views/agent_ticket_zoom.jst.eco index 2910dcd77..d8639a804 100644 --- a/app/assets/javascripts/app/views/agent_ticket_zoom.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_zoom.jst.eco @@ -7,9 +7,9 @@
<%= @ticket.group.name %> - - <%= T(@ticket.ticket_state.name) %> - - <%= T(@ticket.ticket_priority.name) %> - - <%= @ticket.humanTime %> + <%- T(@ticket.ticket_state.name) %> - + <%- T(@ticket.ticket_priority.name) %> - + <%- @ticket.humanTime %>
@@ -26,24 +26,24 @@
<% if article.from: %>
- <%= article.from %> + <%= article.from %> <% if article.actions: %> <% for action in article.actions: %> - <%= action.name %> <% end %> <% end %> - - <%= article.humanTime %> ago + - <%- article.humanTime %> <%- T('ago') %>
<% end %> <% if article.to: %> -
<%= article.to %>
+
<%= article.to %>
<% end %> <% if article.cc: %> -
<%= article.cc %>
+
<%= article.cc %>
<% end %> <% if article.subject: %> -
<%= article.subject %>
+
<%= article.subject %>
<% end %> <% if article.attachments: %>
@@ -71,7 +71,7 @@
  - +
@@ -85,8 +85,8 @@

Actions

diff --git a/app/assets/javascripts/app/views/agent_user_create.jst.eco b/app/assets/javascripts/app/views/agent_user_create.jst.eco index e11afcc06..58be48ada 100644 --- a/app/assets/javascripts/app/views/agent_user_create.jst.eco +++ b/app/assets/javascripts/app/views/agent_user_create.jst.eco @@ -1,13 +1,13 @@
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/dashboard.jst.eco b/app/assets/javascripts/app/views/dashboard.jst.eco index 65e9809dd..807317576 100644 --- a/app/assets/javascripts/app/views/dashboard.jst.eco +++ b/app/assets/javascripts/app/views/dashboard.jst.eco @@ -1,5 +1,5 @@
diff --git a/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco b/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco index 6856f8662..9f99249ec 100644 --- a/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco @@ -1,10 +1,10 @@
-

<%= T(@head) %>

+

<%- T(@head) %>

<% for item in @items: %>
"<%= item.created_by.realname %>"
-
<%= T(item.history_type.name) %> <%= item.history_object.name %> (<%= item.ticket.title %>).
+
<%- T(item.history_type.name) %> <%= item.history_object.name %> (<%= item.ticket.title %>).
<% end %>
diff --git a/app/assets/javascripts/app/views/dashboard/recent_viewed.jst.eco b/app/assets/javascripts/app/views/dashboard/recent_viewed.jst.eco index 0babd94a9..972146179 100644 --- a/app/assets/javascripts/app/views/dashboard/recent_viewed.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/recent_viewed.jst.eco @@ -1,6 +1,6 @@
-

<%= T(@head) %>

+

<%- T(@head) %>

    <% for item in @items: %>
  • <%= item.history_object.name %> (<%= item.ticket.title %>)
  • diff --git a/app/assets/javascripts/app/views/dashboard/rss.jst.eco b/app/assets/javascripts/app/views/dashboard/rss.jst.eco index 6dc188274..429ee7d6c 100644 --- a/app/assets/javascripts/app/views/dashboard/rss.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/rss.jst.eco @@ -1,6 +1,6 @@
    -

    <%= T(@head) %>

    +

    <%- T(@head) %>

      <% for item in @items: %>
    • <%= item.title %>"
    • diff --git a/app/assets/javascripts/app/views/dashboard/ticket.jst.eco b/app/assets/javascripts/app/views/dashboard/ticket.jst.eco index 8b76bc4e9..62d9cda6c 100644 --- a/app/assets/javascripts/app/views/dashboard/ticket.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/ticket.jst.eco @@ -1,10 +1,10 @@
      -
      -

      <%= T(@overview.meta.name) %>

      +
      +

      <%- T(@overview.meta.name) %>

      -
      +