From ae3bddc36eee0e1eb68c8a28b24a6f2ba280963a Mon Sep 17 00:00:00 2001
From: Andreas Nilsson <nilsson.andreas.85@gmail.com>
Date: Thu, 2 Jul 2015 18:48:06 +0200
Subject: [PATCH] Fixed so that HTML is displayed instead of a popup.

---
 mediagoblin/static/js/file_size.js | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/mediagoblin/static/js/file_size.js b/mediagoblin/static/js/file_size.js
index 9ba366b..477d0cc 100644
--- a/mediagoblin/static/js/file_size.js
+++ b/mediagoblin/static/js/file_size.js
@@ -20,17 +20,15 @@ var file;
 var uploaded;
 var upload_limit;
 var max_file_size;
-
-// FIXME: Very hackish, please fix if you can. This is because the extra HTML won't appear.
-var popup;
+var bAttachment;
 
 function check_file_size() {
     var file_size = file.files[0].size / (1024.0 * 1024);
 
     if (file_size >= max_file_size) {
-        if (popup)
+        if (bAttachment)
         {
-            alert("Sorry, the file size is too big.")
+            $('#attachment_file').after('<p id="file_size_error" class="form_field_error">Sorry, the file size is too big.</p>');
             document.getElementById('max_size_reached').value = true;
         }
         else if (document.getElementById('upload_limit_error')) {
@@ -43,9 +41,9 @@ function check_file_size() {
 
     if (upload_limit) {
         if ( uploaded + file_size >= upload_limit) {
-            if (popup)
+            if (bAttachment)
             {
-                alert("Sorry, uploading this file will put you over your upload limit.");
+                $('#attachment_file').after('<p id="upload_limit_error" class="form_field_error">Sorry, uploading this file will put you over your upload limit.</p>');
                 document.getElementById('max_size_reached').value = true;
             }
             else if (document.getElementById('upload_limit_error')) {
@@ -60,11 +58,11 @@ function check_file_size() {
 }
 
 $(document).ready(function(){
-    popup = false;
+    bAttachment = false;
     file = document.getElementById('file');
     if (file == null)
     {
-        popup = true;
+        bAttachment = true;
         file = document.getElementById('attachment_file');
     }
     uploaded = parseInt(document.getElementById('uploaded').value);
-- 
2.1.4

