Ticket #5328: 0001-Fixed-so-that-HTML-is-displayed-instead-of-a-popup.patch

File 0001-Fixed-so-that-HTML-is-displayed-instead-of-a-popup.patch, 2.2 KB (added by molgrum, 9 years ago)
  • mediagoblin/static/js/file_size.js

    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 b var file;  
    2020var uploaded;
    2121var upload_limit;
    2222var max_file_size;
    23 
    24 // FIXME: Very hackish, please fix if you can. This is because the extra HTML won't appear.
    25 var popup;
     23var bAttachment;
    2624
    2725function check_file_size() {
    2826    var file_size = file.files[0].size / (1024.0 * 1024);
    2927
    3028    if (file_size >= max_file_size) {
    31         if (popup)
     29        if (bAttachment)
    3230        {
    33             alert("Sorry, the file size is too big.")
     31            $('#attachment_file').after('<p id="file_size_error" class="form_field_error">Sorry, the file size is too big.</p>');
    3432            document.getElementById('max_size_reached').value = true;
    3533        }
    3634        else if (document.getElementById('upload_limit_error')) {
    function check_file_size() {  
    4341
    4442    if (upload_limit) {
    4543        if ( uploaded + file_size >= upload_limit) {
    46             if (popup)
     44            if (bAttachment)
    4745            {
    48                 alert("Sorry, uploading this file will put you over your upload limit.");
     46                $('#attachment_file').after('<p id="upload_limit_error" class="form_field_error">Sorry, uploading this file will put you over your upload limit.</p>');
    4947                document.getElementById('max_size_reached').value = true;
    5048            }
    5149            else if (document.getElementById('upload_limit_error')) {
    function check_file_size() {  
    6058}
    6159
    6260$(document).ready(function(){
    63     popup = false;
     61    bAttachment = false;
    6462    file = document.getElementById('file');
    6563    if (file == null)
    6664    {
    67         popup = true;
     65        bAttachment = true;
    6866        file = document.getElementById('attachment_file');
    6967    }
    7068    uploaded = parseInt(document.getElementById('uploaded').value);