fix message handling for mobile

This commit is contained in:
2012-10-30 14:14:27 +01:00
parent 28ec047f1d
commit b952a10f64
5 changed files with 106 additions and 20 deletions
@@ -14,7 +14,7 @@
//= require jquery_ujs
// require twitter/bootstrap
//= require twitter/bootstrap/bootstrap-transition
// require twitter/bootstrap/bootstrap-alert
//= require twitter/bootstrap/bootstrap-alert
//= require twitter/bootstrap/bootstrap-modal
//= require twitter/bootstrap/bootstrap-dropdown
//= require twitter/bootstrap/bootstrap-scrollspy
@@ -38,8 +38,9 @@ var path_mapping = {
history_list: '/user/history_list',
obtain_user_token: '/user/obtain_token'
}
var translations = {
var $translations = {
en: {
messages: <%= I18n.t('messages', locale: :en).to_json %>,
confirmations: {
},
list_needs_help: {
@@ -70,6 +71,7 @@ var translations = {
}
},
nl: {
messages: <%= I18n.t('messages', locale: :en).to_json %>,
confirmations: {
},
list_needs_help: {
@@ -117,7 +119,7 @@ String.prototype.capitalize = function() {
function t(path, vars){
vars || (vars = {});
var parts = path.split('.');
var accessor = 'translations["' + parts.join('"]["')+ '"]';
var accessor = '$translations.'+$locale+'["' + parts.join('"]["')+ '"]';
var result;
try{
result = eval(accessor);
@@ -133,4 +135,20 @@ $.ajaxSetup({
window.location = data_host + '/user/obtain_token.html';
}
}
})
});
function getUrlVars() {
if($url_vars) return $url_vars;
$url_vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
$url_vars[key] = value;
});
return $url_vars;
}
$(function(){
if(getUrlVars().message){
var container = $('.alert-success div');
container.text($translations[$locale]['messages'][getUrlVars().message] || ('Message ' + getUrlVars().message + ' not found'));
container.show();
}
});
+10 -11
View File
@@ -17,18 +17,19 @@ html lang="en"
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="/favicon.ico" rel="shortcut icon"
javascript:
var data_host = 'http://data.qwaiter.com';
//var data_host = 'http://data.qwaiter.com';
//var data_host = 'http://localhost:3000';
//var data_host = 'http://192.168.1.240:3000';
var data_host = 'http://192.168.1.74:3000';
var $locale = '#{I18n.locale}';
var $url_vars = null;
// Dummy holder when Qmobile object is not supplied by the mobile phone
var QMobile, Qwaiter, Quser;
QMobile || (QMobile = {
scanQr: function(){window.location = '/select_qrcode'},
activateRotation: function(){},
mobile: function(){return false},
authentication_string: function(){return this.authentication_string_storage},
authentication_object: function(){return this.authentication_object_storage},
authentication_string: function(){return this.authentication_string_storage || ''},
authentication_object: function(){return this.authentication_object_storage || '{}'},
setAuthToken: function(token){
this.authentication_string_storage = 'auth_token='+token;
this.authentication_object_storage = '{"auth_token": "'+token+'"}'
@@ -55,14 +56,12 @@ html lang="en"
.container
.content
- if flash[:alert].present?
.alert.alert-error
a.close data-dismiss="alert" &#215;
.alert.alert-error.hide
button.close type="button" data-dismiss="alert" &#215;
div= flash[:alert]
- if flash[:notice].present?
.alert.alert-success
a.close data-dismiss="alert" &#215;
div= flash[:notice]
.alert.alert-success.hide
button.close type="button" data-dismiss="alert" &#215;
div
.row
.span12
= yield
+69
View File
@@ -0,0 +1,69 @@
nl:
errors:
messages:
not_found: "bestaat niet"
already_confirmed: "was reeds bevestigd"
not_locked: "was niet vergrendeld"
not_saved: "niet uitgevoerd"
devise:
failure:
already_authenticated: 'U bent reeds ingelogd.'
unauthenticated: 'U moet inloggen voordat u verder kunt'
unconfirmed: 'U dient deze account te bevestigen voordat u verder kunt.'
locked: 'Uw account is geblokkeerd.'
invalid: 'Deze login gegevens zijn niet geldig'
invalid_token: 'Invalid authentication token.'
timeout: 'Uw sessie is verlopen. U moet opnieuw inloggen om verder te gaan.'
inactive: 'Your account was not activated yet.'
sessions:
title: Inloggen
button: Inloggen
signed_in: Succesvol ingelogd
signed_out: Succesvol uitgelogd
signed_in_as: Ingelogd als
forgot_your_password: Wachtwoord vergeten?
sign_out: Uitloggen
sign_in: Inloggen
remember_me: Ingelogd blijven?
passwords:
send_instructions: 'U ontvangt binnen enkele minuten een e-mail met instructies voor het resetten van uw wachtwoord'
updated: 'Uw wachtwoord is succesvol gewijzigd. U bent nu ingelogd.'
forgot_password: Wachtwoord vergeten?
send_instructions_button: Stuur mij reset instructies
confirmations:
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
confirmed: 'Your account was successfully confirmed. You are now signed in.'
did_not_receive_instructions_link: "Heeft u geen bevestigingsinstructies ontvangen?"
did_not_receive: Heeft u geen bevestigingsinstructies ontvangen?
registrations:
title: Aanmelden
button: Aanmelden
signed_up: 'Welcome! You have signed up successfully.'
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
updated: 'You updated your account successfully.'
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent your e-mail.'
updated: 'You updated your account successfully.'
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
sign_up: Acount aanvragen
unlocks:
did_not_receive_instructions_link: "Didn't receive unlock instructions?"
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account was successfully unlocked. You are now signed in.'
did_not_receive: Heeft u geen deblokkeerinstructies ontvangen?
send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
omniauth_callbacks:
sign_in_with: "Sign in with %{provider}"
success: 'Successfully authorized from %{kind} account.'
failure: 'Could not authorize you from %{kind} because "%{reason}".'
mailer:
confirmation_instructions:
subject: 'Bevestigingsinstructies'
reset_password_instructions:
subject: 'Wachtwoord reset instructies'
unlock_instructions:
subject: 'Ontsluitings instructies'
+2 -2
View File
@@ -13,14 +13,14 @@ en:
messages:
cannot_order_on_non_active_list: You cannot place an order on a closed list
order_is_placed: Your order has been received in good order
the_list_has_been_closed: The %{list} has been closed
the_list_has_been_closed: The list has been closed
illegal_history_list_attempt: The list you want to access is not yours
table_is_occupied: The table you want to sit on is already occupied
table_is_reserved: The table you want to sit on is reserved by someone else
table_is_closed: The table you want to sit on is not available for service
supplier_is_closed: The owner of this table is currently not handling orders
join_request_rejected: Your request to join the table has been rejected
table_is_from_other_supplier: You cannot move to another table when you have a %{list} open
table_is_from_other_supplier: You cannot move to another table when you have an open list
moved_to_another_table: You successfully moved to another table
cannot_identify_table: The application cannot determine the table number
action:
+2 -2
View File
@@ -12,14 +12,14 @@ nl:
messages:
cannot_order_on_non_active_list: Je kan niet bestellen op een gesloten lijst
order_is_placed: Je bestelling is in goede orde aangekomen
the_list_has_been_closed: De %{list} is afgesloten
the_list_has_been_closed: De lijst is afgesloten
illegal_history_list_attempt: Je probeert een lijst op te vragen die niet van jou is
table_is_occupied: De tafel waar je aan wil gaan zitten is reeds bezet
table_is_reserved: De tafel waar je aan wil gaan zitten is gereserveerd
table_is_closed: De tafel waar je aan wil gaan zitten is niet beschikbaar voor bediening
supplier_is_closed: De eigenaar van deze tafel is momenteel gesloten
join_request_rejected: Je verzoek om te mogen bestellen op een bestaande lijst is afgewezen
table_is_from_other_supplier: Je kan geen lijst openen bij een andere zaak zolang je huidige %{list} nog niet is afgesloten
table_is_from_other_supplier: Je kan geen lijst openen bij een andere zaak zolang je huidige lijst nog niet is afgesloten
moved_to_another_table: De tafel is gewijzigd
cannot_identify_table: De applicatie kan niet bepalen om welke tafel het gaat
action: