Skip to content
Extraits de code Groupes Projets
Valider 315fdabd rédigé par MrZYX's avatar MrZYX
Parcourir les fichiers

let the user upload an image without touching the textarea, improved check in...

let the user upload an image without touching the textarea, improved check in Photo#process to not yield no method on nil error in some cases
parent c4bc24d4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -101,7 +101,7 @@ class Photo < Post
end
def process
return false if unprocessed_image.path.include?('.gif') || self.processed?
return false if self.processed? || unprocessed_image.path.include?('.gif')
processed_image.store!(unprocessed_image) #Ultra naive
save!
end
......
......@@ -272,9 +272,10 @@ var Publisher = {
determineSubmitAvailability: function(){
var onlyWhitespaces = (Publisher.input().val().trim() == '');
var isSubmitDisabled = Publisher.submit().attr('disabled');
if (onlyWhitespaces && !isSubmitDisabled) {
var isPhotoAttached = ($("#photodropzone").children().length > 0)
if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) {
Publisher.submit().attr('disabled', true);
} else if (!onlyWhitespaces && isSubmitDisabled) {
} else if ((!onlyWhitespaces || isPhotoAttached) && isSubmitDisabled) {
Publisher.submit().removeAttr('disabled');
}
},
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter