Commits

Diego Búrigo Zacarão committed 1d1243d

Fixed 'Save and exit' button on Lotte

Comments (0)

Files changed (3)

transifex/addons/lotte/media/css/webtrans.css

   text-align: right;
 }
 
+div.warning_notes {
+  color:#E3720F;
+}
+
 
 /* Lotte details styles */
 div.lotte_details_wrapper ul.details_right {

transifex/addons/lotte/media/js/tx.lotte2.js

 
     // Method for pushing one or more TranslationStrings of this StringSet
     this.push = function(ts, callback) {
-		var messages = false;
+        var messages = false;
         this_stringset = this;
         var to_update = [];
         if (ts) { /* Pushing one TranslationString instance */
                             }
                             // Deep copy of the array
                             ts.previous = jQuery.extend(true, {}, ts.translated_strings);
-                            
+
                             // Hide the error div if it is visible
                             if ( json_response_dict[ts.id]['message'] != null ) {
-								messages=true;
-								this_stringset.current_box.parents('td.trans').find('div.error_notes').text(json_response_dict[ts.id]['message']);
-								this_stringset.current_box.parents('td.trans').find('div.error_notes').show();
-							} else
-								this_stringset.current_box.parents('td.trans').find('div.error_notes').hide();
+                                messages=true;
+                                this_stringset.current_box.parents('td.trans').find('div.error_notes').text(json_response_dict[ts.id]['message']);
+                                this_stringset.current_box.parents('td.trans').find('div.error_notes').addClass('warning_notes');
+                                this_stringset.current_box.parents('td.trans').find('div.error_notes').show();
+                            } else
+                                this_stringset.current_box.parents('td.trans').find('div.error_notes').hide();
                         }else{ // Handle the error
                             this_stringset.current_box.parents('td.trans').find('div.error_notes').text(json_response_dict[ts.id]['message']);
                             this_stringset.current_box.parents('td.trans').find('div.error_notes').show();
                                     // Deep copy of the array
                                     this_stringset.strings[j].previous =  jQuery.extend(true, {}, this_stringset.strings[j].translated_strings);
 
-                                    // Hide the error div if it is visible
-                                    $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').hide();
+                                    if ( json_response_dict[this_stringset.strings[j].id]['message'] != null ) {
+                                        messages=true;
+                                        $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').text(json_response_dict[this_stringset.strings[j].id]['message']);
+                                        $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').addClass('warning_notes');
+                                        $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').show();
+                                    } else {
+                                        // Hide the error div if it is visible
+                                        $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').hide();
+                                    }
                                 }else{ // Handle the error
-									messages=true;
+                                    messages=true;
                                     $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').text(json_response_dict[this_stringset.strings[j].id]['message']);
                                     $('textarea#translation_'+j).parents('td.trans').find('div.error_notes').show();
                                 }
             });
         }
         if (typeof callback === 'function') {
-			if ( ! messages )
-				callback(lotteStatus.updated);
-			else
-				alert("There were a few warnings or errors. Check them out before exiting lotte.");
-		}
+            if ( ! messages )
+                callback(lotteStatus.updated);
+            else
+                alert("There were a few warnings or errors. Check them out before exiting lotte.");
+        }
     }
 
-
     /* Update the color classes for textareas and show/hide save buttons */
     this.updateColors_Buttons = function() {
         $('tr td textarea.default_translation', this.bound_table).each(function (i) {

transifex/addons/lotte/templates/translate.html

                 function(updated){
                     $.ajax({
                         url: "{{ url_exit_lotte }}",
-                        data: {updated:updated}, 
+                        data: JSON.stringify({updated:updated}),
                         dataType : "json",
                         type: "POST",
                         contentType: "application/json",
-                        success: function(xmlhttpreq, textStatus) {
+                        success: function(data, textStatus) {
                             if (textStatus=='success'){
-                                response = JSON.parse(xmlhttpreq.responseText);
-                                window.location = response['redirect'];
+                                window.location = data['redirect'];
                             }
                         }
                     });