i18n for outfits/edit.js userbar message and outfit save errors
This commit is contained in:
parent
ec6c7b550d
commit
629e5c68a9
7 changed files with 29 additions and 30 deletions
|
@ -90,7 +90,9 @@ class OutfitsController < ApplicationController
|
|||
end
|
||||
|
||||
def render_outfit_errors
|
||||
render :json => {:errors => @outfit.errors}, :status => :bad_request
|
||||
render :json => {:errors => @outfit.errors,
|
||||
:full_error_messages => @outfit.errors.full_messages},
|
||||
:status => :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -737,7 +737,7 @@ body.outfits-edit
|
|||
#save-error, #outfit-not-found
|
||||
+error
|
||||
|
||||
#userbar-message
|
||||
#userbar-session-message
|
||||
+opacity(.5)
|
||||
display: none
|
||||
|
||||
|
|
|
@ -151,6 +151,13 @@
|
|||
%a.outfit-delete-confirmation-no{:href => '#'}
|
||||
= t '.sidebar.outfits.outfit.delete_confirmation.cancel'
|
||||
</li>
|
||||
|
||||
%span#userbar-session-message
|
||||
- if user_signed_in?
|
||||
= t '.userbar.session_message.signed_in'
|
||||
- else
|
||||
= t '.userbar.session_message.not_signed_in'
|
||||
|
||||
- content_for :javascripts do
|
||||
= include_javascript_libraries :jquery, :swfobject, :jquery_tmpl
|
||||
= include_javascripts :edit_outfit_package
|
||||
|
|
|
@ -558,6 +558,12 @@ en-meep:
|
|||
query_html: "%{filter_key}:%{filter_value}"
|
||||
description_html:
|
||||
meeps any item that occupies a %{default_value} zone
|
||||
userbar:
|
||||
session_message:
|
||||
signed_in:
|
||||
You will be meeped out, then brought back to this exact outfit.
|
||||
not_signed_in:
|
||||
You will be meeped in, then brought back to this exact outfit.
|
||||
|
||||
new:
|
||||
tagline: Meeps made meepy!
|
||||
|
|
|
@ -559,6 +559,12 @@ en:
|
|||
query_html: "%{filter_key}:%{filter_value}"
|
||||
description_html:
|
||||
returns any item that occupies a %{default_value} zone
|
||||
userbar:
|
||||
session_message:
|
||||
signed_in:
|
||||
You will be logged out, then brought back to this exact outfit.
|
||||
not_signed_in:
|
||||
You will be logged in, then brought back to this exact outfit.
|
||||
|
||||
index:
|
||||
title: Your Outfits
|
||||
|
|
|
@ -902,13 +902,6 @@ View.Outfits = function (wardrobe) {
|
|||
new_outfit_form_el.toggleClass('starred');
|
||||
});
|
||||
|
||||
var SAVE_ERRORS = {
|
||||
'item_outfit_relationships': "Item not found. How odd. Pull some items out of your closet and try again.",
|
||||
'pet_state': "Pet state not found. How odd. Try picking a new Gender/Emotion.",
|
||||
'name': true,
|
||||
'user': "You must be logged in to save outfits"
|
||||
};
|
||||
|
||||
function saveErrorMessage(text) {
|
||||
save_error_el.text(text).notify();
|
||||
}
|
||||
|
@ -940,21 +933,10 @@ View.Outfits = function (wardrobe) {
|
|||
wardrobe.outfits.bind('updatePetState', clearSharedOutfit);
|
||||
|
||||
function saveFailure(outfit, response) {
|
||||
var errors = response.errors;
|
||||
if(typeof errors == 'undefined') {
|
||||
saveErrorMessage("Whoops! The save failed, but the server didn't say why. Please try again.");
|
||||
if(typeof response.full_error_messages !== 'undefined') {
|
||||
saveErrorMessage(response.full_error_messages.join(', '));
|
||||
} else {
|
||||
for(var key in SAVE_ERRORS) {
|
||||
if(SAVE_ERRORS.hasOwnProperty(key) && typeof errors[key] != 'undefined') {
|
||||
var message = SAVE_ERRORS[key];
|
||||
if(message === true) {
|
||||
message = key.charAt(0).toUpperCase() + key.substr(1) + ' ' +
|
||||
errors[key];
|
||||
}
|
||||
saveErrorMessage(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
saveErrorMessage("Could not save outfit. Please try again.");
|
||||
}
|
||||
new_outfit_form_el.stopLoading();
|
||||
liForOutfit(outfit).stopLoading();
|
||||
|
@ -1336,12 +1318,8 @@ View.Search = function (wardrobe) {
|
|||
//wardrobe.pet_attributes.bind('update', prepBuildHelper('only', getSpecies));
|
||||
}
|
||||
|
||||
var userbar_sessions_link = $('#userbar a:last'),
|
||||
userbar_message_verb = userbar_sessions_link.text() == 'Log out' ? 'logged out' : 'sent to the login page',
|
||||
userbar_message_el = $('<span/>', {
|
||||
id: 'userbar-message',
|
||||
text: "You will be " + userbar_message_verb + ", then brought back to this exact outfit you've made."
|
||||
}).prependTo('#userbar');
|
||||
var userbar_sessions_link = $('#userbar a:last');
|
||||
var userbar_message_el = $('#userbar-session-message').prependTo('#userbar');
|
||||
|
||||
userbar_sessions_link.hover(function () {
|
||||
userbar_message_el.stop().fadeTo('normal', .5);
|
||||
|
|
|
@ -3293,7 +3293,7 @@ body.outfits-edit #save-error, body.outfits-edit #outfit-not-found {
|
|||
color: #8a1f11;
|
||||
}
|
||||
/* line 740, ../../../app/stylesheets/outfits/_edit.sass */
|
||||
body.outfits-edit #userbar-message {
|
||||
body.outfits-edit #userbar-session-message {
|
||||
-moz-opacity: 0.5;
|
||||
-webkit-opacity: 0.5;
|
||||
-o-opacity: 0.5;
|
||||
|
|
Loading…
Reference in a new issue