Init version of i18n support.
This commit is contained in:
parent
df1493fb81
commit
e86204db76
11 changed files with 72 additions and 52 deletions
|
@ -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 + ' - ' + name )
|
||||
$('html head title').html( Config.product_name + ' - ' + T(name) )
|
||||
|
||||
# add @notify methode to create notification
|
||||
notify: (data) ->
|
||||
|
|
|
@ -96,7 +96,7 @@ class Index extends App.Controller
|
|||
Spine.trigger 'notify:removeall'
|
||||
Spine.trigger 'notify', {
|
||||
type: 'success',
|
||||
msg: 'Login successfully! Have a nice day!',
|
||||
msg: T('Login successfully! Have a nice day!'),
|
||||
}
|
||||
|
||||
# redirect to #
|
||||
|
@ -115,12 +115,11 @@ class Index extends App.Controller
|
|||
Spine.trigger 'notify:removeall'
|
||||
Spine.trigger 'notify', {
|
||||
type: 'error',
|
||||
msg: 'Wrong Username and Password combination.',
|
||||
msg: T('Wrong Username and Password combination.'),
|
||||
}
|
||||
|
||||
# rerender login page
|
||||
@render(
|
||||
msg: 'Wrong Username and Password combination.',
|
||||
username: @username
|
||||
)
|
||||
|
||||
|
|
|
@ -22,9 +22,4 @@ class Index extends Spine.Controller
|
|||
# redirect to login
|
||||
@navigate 'login'
|
||||
|
||||
Config.Routes['logout'] = Index
|
||||
|
||||
#class App.Logout extends App.Router
|
||||
# routes:
|
||||
# 'logout': Index
|
||||
#Config.Controller.push App.Logout
|
||||
Config.Routes['logout'] = Index
|
|
@ -176,7 +176,8 @@ class App.Navigation extends App.Controller
|
|||
Config.NavBar['TicketOverview' + item.url] = {
|
||||
prio: item.prio,
|
||||
parent: '#ticket/view',
|
||||
name: T(item.name) + ' (' + item.count + ')',
|
||||
name: item.name,
|
||||
count: item.count,
|
||||
target: '#ticket/view/' + item.url,
|
||||
role: ['Agent'],
|
||||
}
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<p>Sign in with</p>
|
||||
<p><%= T('Sign in with') %></p>
|
||||
<form id="login" class="form-search">
|
||||
<input name="username" type="text" class="input span3" placeholder="Username or email" value="<%= @item.username %>" autocapitalize="off"/>
|
||||
<input name="password" type="password" class="input span3" placeholder="Password"/>
|
||||
<button class="btn btn-primary" type="submit">Sign in</button>
|
||||
<input name="username" type="text" class="input span3" placeholder="<%= T('Username or email') %>" value="<%= @item.username %>" autocapitalize="off"/>
|
||||
<input name="password" type="password" class="input span3" placeholder="<%= T('Password') %>"/>
|
||||
<button class="btn btn-primary" type="submit"><%= T('Sign in') %></button>
|
||||
<div>
|
||||
<span class="small"><input name="remember_me" value="1" type="checkbox"/> Remember me</span>
|
||||
<span class="small"><input name="remember_me" value="1" type="checkbox"/> <%= T('Remember me') %></span>
|
||||
<span class="small">·</span>
|
||||
<a href="#reset_password" class="small">Forgot password?</a>
|
||||
<a href="#reset_password" class="small"><%= T('Forgot password?') %></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -24,16 +24,16 @@
|
|||
<% if !_.isEmpty(@auth_providers): %>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<p>--- or ---</p>
|
||||
<p>--- <%= T('or') %> ---</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<p>Sign in using</p>
|
||||
<p><%= T('Sign in using') %></p>
|
||||
<ul>
|
||||
<% for auth_provider in @auth_providers: %>
|
||||
<li><a href="<%= auth_provider.url %>"><%= auth_provider.name %></a></li>
|
||||
<li><a href="<%= auth_provider.url %>"><%= T(auth_provider.name) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -42,14 +42,14 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<p>--- or ---</p>
|
||||
<p>--- <%= T('or') %> ---</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<p>New to <%= Config.product_name %>, join today!</p>
|
||||
<p><a href="#signup" class="btn">Sign up</a>
|
||||
<p><%= T('New to') %> <%= Config.product_name %>, <%= T('join today!') %></p>
|
||||
<p><a href="#signup" class="btn"><%= T('Sign up') %></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<% if item.navheader: %>
|
||||
<li class="nav-header"><%= T(item.navheader) %></li>
|
||||
<% end %>
|
||||
<li><a href="<%= item.target %>"><%= T(item.name) %></a></li>
|
||||
<li><a href="<%= item.target %>"><%= T(item.name) %><% if item['count'] isnt undefined: %> <span class="count">(<%= item['count'] %>)</span><% end %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<% if item.navheader: %>
|
||||
<li class="nav-header"><%= T(item.navheader) %></li>
|
||||
<% end %>
|
||||
<li><a href="<%= item.target %>"><%= T(item.name) %></a></li>
|
||||
<li><a href="<%= item.target %>"><%= T(item.name) %><% if item['count'] isnt undefined: %> <span class="count">(<%= item['count'] %>)</span><% end %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<div class="hero-unit">
|
||||
<h1>Join <%= Config.product_name %><small></small></h1>
|
||||
<h1><%= T('Join') %> <%= Config.product_name %><small></small></h1>
|
||||
|
||||
<div class="container">
|
||||
<form class="form-horizontal">
|
||||
<p>
|
||||
<%- @form %>
|
||||
</p>
|
||||
<a href="#/" class="btn cancel">Cancel</a>
|
||||
<button class="btn btn-primary submit">Create my account</button>
|
||||
<a href="#/" class="btn cancel"><%= T('Cancel') %></a>
|
||||
<button class="btn btn-primary submit"><%= T('Create my account') %></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -41,7 +41,7 @@
|
|||
<% else: %>
|
||||
<span title="<%= T(item['title']) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
|
||||
<% end %>
|
||||
<%= T(item['name']) %>
|
||||
<%= T(item['name']) %> <% if item['count'] isnt undefined: %><span class="count">(<%= item['count'] %>)</span><% end %>
|
||||
<% if item['url']: %>
|
||||
</a>
|
||||
<% else: %>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<% else: %>
|
||||
<span title="<%= T(item['title']) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
|
||||
<% end %>
|
||||
<%= T(item['name']) %>
|
||||
<%= T(item['name']) %> <% if item['count'] isnt undefined: %><span class="count">(<%= item['count'] %>)</span><% end %>
|
||||
<% if item['url']: %>
|
||||
</a>
|
||||
<% else: %>
|
||||
|
|
|
@ -42,6 +42,7 @@ var Trans = {
|
|||
'Zip': 'PLZ',
|
||||
'City': 'Stadt',
|
||||
'Note': 'Notiz',
|
||||
'note': 'Notiz',
|
||||
'New User': 'Neuer Benutzer',
|
||||
'new': 'neu',
|
||||
'closed': 'geschlossen',
|
||||
|
@ -67,6 +68,19 @@ var Trans = {
|
|||
'To': 'An',
|
||||
'Customer': 'Kunde',
|
||||
'Linked Accounts': 'Verknüpfte Accounts',
|
||||
'Sign in with': 'Anmelden mit',
|
||||
'Username or email': 'Benutzer oder Email',
|
||||
'Remember me': 'An mich erinnern',
|
||||
'Forgot password?': 'Passwort vergessen?',
|
||||
'Sign in using': 'Anmelden über',
|
||||
'New to': 'Neu bei',
|
||||
'join today!': 'werde Teil!',
|
||||
'Sign up': 'Registrieren',
|
||||
'Sign in': 'Anmelden',
|
||||
'Create my account': 'Meinen Account erstellen',
|
||||
'Login successfully! Have a nice day!': 'Anmeldung erfolgreich!',
|
||||
'Wrong Username and Password combination.': 'Benutzername oder Password falsch.',
|
||||
|
||||
}
|
||||
var T = function(string) {
|
||||
if ( Trans[string] !== undefined ) {
|
||||
|
|
|
@ -168,32 +168,43 @@ class ApplicationController < ActionController::Base
|
|||
# do not show password
|
||||
user['password'] = ''
|
||||
|
||||
# show linked topics and items
|
||||
user['links'] = []
|
||||
|
||||
# TEMP: compat. reasons
|
||||
user['preferences'] = {} if user['preferences'] == nil
|
||||
|
||||
topic = {
|
||||
:title => 'Tickets',
|
||||
:items => [
|
||||
{
|
||||
:url => '',
|
||||
:name => 'open (' + user['preferences'][:tickets_open].to_s + ')',
|
||||
:title => 'Open Tickets',
|
||||
:class => 'user-tickets',
|
||||
:data => 'open'
|
||||
},
|
||||
{
|
||||
:url => '',
|
||||
:name => 'closed (' + user['preferences'][:tickets_closed].to_s + ')',
|
||||
:title => 'Closed Tickets',
|
||||
:class => 'user-tickets',
|
||||
:data => 'closed'
|
||||
}
|
||||
]
|
||||
}
|
||||
user['links'].push topic
|
||||
items = []
|
||||
if user['preferences'][:tickets_open].to_i > 0
|
||||
item = {
|
||||
:url => '',
|
||||
:name => 'open',
|
||||
:count => user['preferences'][:tickets_open] || 0,
|
||||
:title => 'Open Tickets',
|
||||
:class => 'user-tickets',
|
||||
:data => 'open'
|
||||
}
|
||||
items.push item
|
||||
end
|
||||
if user['preferences'][:tickets_closed].to_i > 0
|
||||
item = {
|
||||
:url => '',
|
||||
:name => 'closed',
|
||||
:count => user['preferences'][:tickets_closed] || 0,
|
||||
:title => 'Closed Tickets',
|
||||
:class => 'user-tickets',
|
||||
:data => 'closed'
|
||||
}
|
||||
items.push item
|
||||
end
|
||||
|
||||
# show linked topics and items
|
||||
if items.count > 0
|
||||
topic = {
|
||||
:title => 'Tickets',
|
||||
:items => items,
|
||||
}
|
||||
user['links'] = []
|
||||
user['links'].push topic
|
||||
end
|
||||
|
||||
return user
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue