diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 6c16f28f..e20b8a70 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -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 diff --git a/app/stylesheets/outfits/_edit.sass b/app/stylesheets/outfits/_edit.sass index d201e7bd..152e9b7e 100644 --- a/app/stylesheets/outfits/_edit.sass +++ b/app/stylesheets/outfits/_edit.sass @@ -737,7 +737,7 @@ body.outfits-edit #save-error, #outfit-not-found +error - #userbar-message + #userbar-session-message +opacity(.5) display: none diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index a6506dd8..7a832842 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -151,6 +151,13 @@ %a.outfit-delete-confirmation-no{:href => '#'} = t '.sidebar.outfits.outfit.delete_confirmation.cancel' + +%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 diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index ea5c6b75..b1203972 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -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! diff --git a/config/locales/en.yml b/config/locales/en.yml index 3c836420..b3e69ca8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 7e9ac917..50d73c4f 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -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 = $('', { - 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); diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index b5ca060a..5e0906ae 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -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;