Fixed title and translation issues.

This commit is contained in:
Martin Edenhofer 2015-05-27 22:19:02 +02:00
parent 495868dff8
commit c40945f7cd
22 changed files with 54 additions and 22 deletions

View file

@ -71,9 +71,12 @@ class App.Controller extends Spine.Controller
# release custom bindings after it got removed from dom # release custom bindings after it got removed from dom
# add @title methode to set title # add @title methode to set title
title: (name) -> title: (name, translate = false) ->
# $('html head title').html( @Config.get(product_name) + ' - ' + App.i18n.translateInline(name) ) # $('html head title').html( @Config.get(product_name) + ' - ' + App.i18n.translateInline(name) )
document.title = @Config.get('product_name') + ' - ' + App.i18n.translatePlain(name) title = name
if translate
title = App.i18n.translatePlain(name)
document.title = @Config.get('product_name') + ' - ' + title
copyToClipboard: (text) -> copyToClipboard: (text) ->
if window.clipboardData # IE if window.clipboardData # IE
@ -132,8 +135,8 @@ class App.Controller extends Spine.Controller
position = [ 15, 30, 15, 0, -15, -30, -15, 0 ] position = [ 15, 30, 15, 0, -15, -30, -15, 0 ]
position = position.concat( position.concat( position ) ) position = position.concat( position.concat( position ) )
element.css( 'position', 'relative' ) element.css( 'position', 'relative' )
shakeMe( element, position, 20 ) shakeMe( element, position, 20 )
isRole: (name) -> isRole: (name) ->
roles = @Session.get( 'roles' ) roles = @Session.get( 'roles' )

View file

@ -105,7 +105,7 @@ class App.ControllerGenericIndex extends App.Controller
super super
# set title # set title
@title @pageData.title @title @pageData.title, true
# set nav bar # set nav bar
@navupdate @pageData.navupdate @navupdate @pageData.navupdate

View file

@ -2,6 +2,8 @@ class App.ChannelChat extends App.ControllerTabs
constructor: -> constructor: ->
super super
@title 'Chat', true
@tabs = [ @tabs = [
{ {
name: 'Settings', name: 'Settings',
@ -10,4 +12,4 @@ class App.ChannelChat extends App.ControllerTabs
}, },
] ]
@render() @render()

View file

@ -2,6 +2,8 @@ class App.ChannelEmail extends App.ControllerTabs
constructor: -> constructor: ->
super super
@title 'Email', true
@tabs = [ @tabs = [
{ {
name: 'Inbound', name: 'Inbound',

View file

@ -2,12 +2,13 @@ class App.ChannelFacebook extends App.Controller
constructor: -> constructor: ->
super super
@title 'Facebook'
# render page # render page
@render() @render()
render: -> render: ->
@html App.view('channel/facebook')( @html App.view('channel/facebook')(
head: 'some header' head: 'some header'
) )

View file

@ -2,6 +2,8 @@ class App.ChannelTwitter extends App.Controller
constructor: -> constructor: ->
super super
@title 'Twitter'
# render page # render page
@render() @render()

View file

@ -2,6 +2,8 @@ class App.ChannelWeb extends App.ControllerTabs
constructor: -> constructor: ->
super super
@title 'Web', true
@tabs = [ @tabs = [
{ {
name: 'Settings', name: 'Settings',

View file

@ -12,7 +12,7 @@ App.Config.set( 'User', {
role: [ 'Agent', 'Customer' ] role: [ 'Agent', 'Customer' ]
}, 'NavBarRight' ) }, 'NavBarRight' )
App.Config.set( 'Admin', { prio: 9000, parent: '', name: 'Admin', target: '#manage', role: ['Admin'] }, 'NavBarRight' ) App.Config.set( 'Admin', { prio: 9000, parent: '', name: 'Admin', translate: true, target: '#manage', role: ['Admin'] }, 'NavBarRight' )
App.Config.set( 'New', { prio: 20000, parent: '', name: 'New', target: '#new', class: 'add' }, 'NavBarRight' ) App.Config.set( 'New', { prio: 20000, parent: '', name: 'New', translate: true, target: '#new', class: 'add' }, 'NavBarRight' )
App.Config.set( 'Misc', { prio: 90000, parent: '', name: 'Tools', target: '#tools', child: true, class: 'tools' }, 'NavBar' ) App.Config.set( 'Misc', { prio: 90000, parent: '', name: 'Tools', translate: true, target: '#tools', child: true, class: 'tools' }, 'NavBar' )

View file

@ -602,4 +602,4 @@ App.Config.set( 'ticket/create/:ticket_id/:article_id', Router, 'Routes' )
App.Config.set( 'ticket/create/id/:id/:ticket_id/:article_id', Router, 'Routes' ) App.Config.set( 'ticket/create/id/:id/:ticket_id/:article_id', Router, 'Routes' )
# set new actions # set new actions
App.Config.set( 'TicketCreate', { prio: 8003, parent: '#new', name: 'New Ticket', target: '#ticket/create', role: ['Agent'], divider: true }, 'NavBarRight' ) App.Config.set( 'TicketCreate', { prio: 8003, parent: '#new', name: 'New Ticket', translate: true, target: '#ticket/create', role: ['Agent'], divider: true }, 'NavBarRight' )

View file

@ -213,4 +213,4 @@ class Index extends App.ControllerContent
) )
App.Config.set( 'customer_ticket_new', Index, 'Routes' ) App.Config.set( 'customer_ticket_new', Index, 'Routes' )
App.Config.set( 'CustomerTicketNew', { prio: 8003, parent: '#new', name: 'New Ticket', target: '#customer_ticket_new', role: ['Customer'], divider: true }, 'NavBarRight' ) App.Config.set( 'CustomerTicketNew', { prio: 8003, parent: '#new', name: 'New Ticket', translate: true, target: '#customer_ticket_new', role: ['Customer'], divider: true }, 'NavBarRight' )

View file

@ -928,4 +928,4 @@ class highlightRef extends App.ControllerContent
App.Config.set( 'layout_ref/highlight', highlightRef, 'Routes' ) App.Config.set( 'layout_ref/highlight', highlightRef, 'Routes' )
App.Config.set( 'LayoutRef', { prio: 1700, parent: '#current_user', name: 'Layout Reference', target: '#layout_ref', role: [ 'Admin' ] }, 'NavBarRight' ) App.Config.set( 'LayoutRef', { prio: 1700, parent: '#current_user', name: 'Layout Reference', translate: true, target: '#layout_ref', role: [ 'Admin' ] }, 'NavBarRight' )

View file

@ -18,4 +18,4 @@ class Index extends App.ControllerContent
@delay redirect, 150 @delay redirect, 150
App.Config.set( 'logout', Index, 'Routes' ) App.Config.set( 'logout', Index, 'Routes' )
App.Config.set( 'Logout', { prio: 1800, parent: '#current_user', name: 'Sign out', target: '#logout', divider: true, iconClass: 'signout', role: [ 'Agent', 'Customer' ] }, 'NavBarRight' ) App.Config.set( 'Logout', { prio: 1800, parent: '#current_user', name: 'Sign out', translate: true, target: '#logout', divider: true, iconClass: 'signout', role: [ 'Agent', 'Customer' ] }, 'NavBarRight' )

View file

@ -4,8 +4,12 @@ class Index extends App.ControllerContent
constructor: -> constructor: ->
super super
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
@title 'Maintenance', true
@render() @render()
render: -> render: ->

View file

@ -5,6 +5,8 @@ class Index extends App.ControllerTabs
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
@title 'Objects', true
# get data # get data
@ajax( @ajax(
id: 'object_manager_attributes_list' id: 'object_manager_attributes_list'

View file

@ -8,8 +8,8 @@ class Index extends App.ControllerContent
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
# set title @title 'Packages', true
@title 'Packages'
@load() @load()
load: -> load: ->

View file

@ -5,9 +5,12 @@ class Index extends App.ControllerContent
constructor: -> constructor: ->
super super
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
@title 'Sessions', true
@load() @load()
@interval( @interval(
=> =>

View file

@ -4,6 +4,8 @@ class System extends App.ControllerTabs
return if !@authenticate() return if !@authenticate()
@title 'System', true
@tabs = [ @tabs = [
{ name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'System::Base' } }, { name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'System::Base' } },
# { name: 'Language', 'target': 'language', controller: App.SettingsSystem, params: { area: 'System::Language' } }, # { name: 'Language', 'target': 'language', controller: App.SettingsSystem, params: { area: 'System::Language' } },
@ -22,6 +24,8 @@ class Security extends App.ControllerTabs
return if !@authenticate() return if !@authenticate()
@title 'Security', true
@tabs = [ @tabs = [
{ name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Security::Base' } }, { name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Security::Base' } },
# { name: 'Authentication', 'target': 'auth', controller: App.SettingsArea, params: { area: 'Security::Authentication' } }, # { name: 'Authentication', 'target': 'auth', controller: App.SettingsArea, params: { area: 'Security::Authentication' } },
@ -38,6 +42,8 @@ class Import extends App.ControllerTabs
return if !@authenticate() return if !@authenticate()
@title 'Import', true
# import # import
@tabs = [ @tabs = [
{ name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Import::Base' } }, { name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Import::Base' } },
@ -52,6 +58,8 @@ class Ticket extends App.ControllerTabs
return if !@authenticate() return if !@authenticate()
@title 'Ticket', true
# ticket # ticket
@tabs = [ @tabs = [
{ name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Ticket::Base' } }, { name: 'Base', 'target': 'base', controller: App.SettingsArea, params: { area: 'Ticket::Base' } },

View file

@ -775,7 +775,7 @@ class Navbar extends App.Controller
for item in @cache for item in @cache
if item.link is @view if item.link is @view
meta.title = item.name meta.title = item.name
@title meta.title @title meta.title, true
render: => render: =>
#console.log('RENDER NAV') #console.log('RENDER NAV')

View file

@ -5,7 +5,7 @@ class Index extends App.ControllerContent
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
@title 'Translations' @title 'Translations', true
@render() @render()

View file

@ -10,6 +10,9 @@ class Index extends App.Controller
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
# set title
@title 'Users', true
@render() @render()
render: -> render: ->

View file

@ -9,4 +9,4 @@
</ul> </ul>
<% end %> <% end %>
</p> </p>
<a href="" data-type="add" class="glyphicon glyphicon-plus" title="<%- @Ti('add') %>"></a> <a href="" data-type="add" class="glyphicon glyphicon-plus" title="<%- @Ti('Add') %>"></a>

View file

@ -1,7 +1,7 @@
<% for item in @items: %> <% for item in @items: %>
<% if item.child: %> <% if item.child: %>
<li class="<% if item.class: %><%- item.class %><% end %> dropup <% if @open_tab[item.target] : %>open<% end %>"> <li class="<% if item.class: %><%- item.class %><% end %> dropup <% if @open_tab[item.target] : %>open<% end %>">
<a class="list-button dropdown-toggle" data-toggle="dropdown" href="<%= item.target %>" title="<%- @Ti( item.name ) %>"> <a class="list-button dropdown-toggle" data-toggle="dropdown" href="<%= item.target %>" title="<% if item.translate: %><%- @Ti( item.name ) %><% else: %><%= item.name %><% end %>">
<span class="dropdown-nose"></span> <span class="dropdown-nose"></span>
<% if item.class is 'user': %> <% if item.class is 'user': %>
<span class="js-avatar"></span> <span class="js-avatar"></span>
@ -19,7 +19,7 @@
<% end %> <% end %>
<li class="<% if @active_tab[item.target] : %>active<% end %>"> <li class="<% if @active_tab[item.target] : %>active<% end %>">
<a href="<%= item.target %>" class="horizontal center"> <a href="<%= item.target %>" class="horizontal center">
<span class="flex u-textTruncate"><%- @T( item.name ) %></span> <span class="flex u-textTruncate"><% if item.translate: %><%- @T( item.name ) %><% else: %><%= item.name %><% end %></span>
<% if item['count'] isnt undefined: %><span class="badge count"><%= item['count'] %></span><% end %> <% if item['count'] isnt undefined: %><span class="badge count"><%= item['count'] %></span><% end %>
<% if item.iconClass: %><svg class="icon-<%= item.iconClass %>"><use xlink:href="#icon-<%= item.iconClass %>" /></svg><% end %> <% if item.iconClass: %><svg class="icon-<%= item.iconClass %>"><use xlink:href="#icon-<%= item.iconClass %>" /></svg><% end %>
</a> </a>