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
|
end
|
||||||
|
|
||||||
def render_outfit_errors
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -737,7 +737,7 @@ body.outfits-edit
|
||||||
#save-error, #outfit-not-found
|
#save-error, #outfit-not-found
|
||||||
+error
|
+error
|
||||||
|
|
||||||
#userbar-message
|
#userbar-session-message
|
||||||
+opacity(.5)
|
+opacity(.5)
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,13 @@
|
||||||
%a.outfit-delete-confirmation-no{:href => '#'}
|
%a.outfit-delete-confirmation-no{:href => '#'}
|
||||||
= t '.sidebar.outfits.outfit.delete_confirmation.cancel'
|
= t '.sidebar.outfits.outfit.delete_confirmation.cancel'
|
||||||
</li>
|
</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
|
- content_for :javascripts do
|
||||||
= include_javascript_libraries :jquery, :swfobject, :jquery_tmpl
|
= include_javascript_libraries :jquery, :swfobject, :jquery_tmpl
|
||||||
= include_javascripts :edit_outfit_package
|
= include_javascripts :edit_outfit_package
|
||||||
|
|
|
@ -558,6 +558,12 @@ en-meep:
|
||||||
query_html: "%{filter_key}:%{filter_value}"
|
query_html: "%{filter_key}:%{filter_value}"
|
||||||
description_html:
|
description_html:
|
||||||
meeps any item that occupies a %{default_value} zone
|
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:
|
new:
|
||||||
tagline: Meeps made meepy!
|
tagline: Meeps made meepy!
|
||||||
|
|
|
@ -559,6 +559,12 @@ en:
|
||||||
query_html: "%{filter_key}:%{filter_value}"
|
query_html: "%{filter_key}:%{filter_value}"
|
||||||
description_html:
|
description_html:
|
||||||
returns any item that occupies a %{default_value} zone
|
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:
|
index:
|
||||||
title: Your Outfits
|
title: Your Outfits
|
||||||
|
|
|
@ -902,13 +902,6 @@ View.Outfits = function (wardrobe) {
|
||||||
new_outfit_form_el.toggleClass('starred');
|
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) {
|
function saveErrorMessage(text) {
|
||||||
save_error_el.text(text).notify();
|
save_error_el.text(text).notify();
|
||||||
}
|
}
|
||||||
|
@ -940,21 +933,10 @@ View.Outfits = function (wardrobe) {
|
||||||
wardrobe.outfits.bind('updatePetState', clearSharedOutfit);
|
wardrobe.outfits.bind('updatePetState', clearSharedOutfit);
|
||||||
|
|
||||||
function saveFailure(outfit, response) {
|
function saveFailure(outfit, response) {
|
||||||
var errors = response.errors;
|
if(typeof response.full_error_messages !== 'undefined') {
|
||||||
if(typeof errors == 'undefined') {
|
saveErrorMessage(response.full_error_messages.join(', '));
|
||||||
saveErrorMessage("Whoops! The save failed, but the server didn't say why. Please try again.");
|
|
||||||
} else {
|
} else {
|
||||||
for(var key in SAVE_ERRORS) {
|
saveErrorMessage("Could not save outfit. Please try again.");
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
new_outfit_form_el.stopLoading();
|
new_outfit_form_el.stopLoading();
|
||||||
liForOutfit(outfit).stopLoading();
|
liForOutfit(outfit).stopLoading();
|
||||||
|
@ -1336,12 +1318,8 @@ View.Search = function (wardrobe) {
|
||||||
//wardrobe.pet_attributes.bind('update', prepBuildHelper('only', getSpecies));
|
//wardrobe.pet_attributes.bind('update', prepBuildHelper('only', getSpecies));
|
||||||
}
|
}
|
||||||
|
|
||||||
var userbar_sessions_link = $('#userbar a:last'),
|
var userbar_sessions_link = $('#userbar a:last');
|
||||||
userbar_message_verb = userbar_sessions_link.text() == 'Log out' ? 'logged out' : 'sent to the login page',
|
var userbar_message_el = $('#userbar-session-message').prependTo('#userbar');
|
||||||
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');
|
|
||||||
|
|
||||||
userbar_sessions_link.hover(function () {
|
userbar_sessions_link.hover(function () {
|
||||||
userbar_message_el.stop().fadeTo('normal', .5);
|
userbar_message_el.stop().fadeTo('normal', .5);
|
||||||
|
|
|
@ -3293,7 +3293,7 @@ body.outfits-edit #save-error, body.outfits-edit #outfit-not-found {
|
||||||
color: #8a1f11;
|
color: #8a1f11;
|
||||||
}
|
}
|
||||||
/* line 740, ../../../app/stylesheets/outfits/_edit.sass */
|
/* line 740, ../../../app/stylesheets/outfits/_edit.sass */
|
||||||
body.outfits-edit #userbar-message {
|
body.outfits-edit #userbar-session-message {
|
||||||
-moz-opacity: 0.5;
|
-moz-opacity: 0.5;
|
||||||
-webkit-opacity: 0.5;
|
-webkit-opacity: 0.5;
|
||||||
-o-opacity: 0.5;
|
-o-opacity: 0.5;
|
||||||
|
|
Loading…
Reference in a new issue