diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-02-15 23:58:56 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-02-23 22:34:42 +0100 |
commit | adb6749310ff75f684f730c6e3144194046536a9 (patch) | |
tree | 49408542d9f2bce13e36b04b85bc91b9478e553d | |
parent | ea7467a584ad344e13f0cc595f58a1bb22e1649c (diff) |
Rearrange upload form
This allows the textarea to be wider without vanishing behind the file
upload form.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | application/views/file/upload_form.php | 28 | ||||
-rw-r--r-- | data/js/script.js | 15 |
2 files changed, 29 insertions, 14 deletions
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php index f0c1ab933..c2ee18e2f 100644 --- a/application/views/file/upload_form.php +++ b/application/views/file/upload_form.php @@ -1,31 +1,31 @@ <?php if (isset($username) && $username) { ?> <div class="well"> <div class="row-fluid"> - <div class="span6"> - <div style="border-right:1px solid #ddd;padding-right:25px;"> + <div class="span12 text-upload-form"> <?php echo form_open_multipart('file/do_paste'); ?> <h2>Text paste</h2> - <textarea name="content" style="width:98%; height:300px;"></textarea> + <textarea name="content" class="text-upload span12" style="height: 300px;"></textarea> <button type="submit" class="btn btn-primary">Paste it!</button> </form> - </div> </div> + </div> + <div class="row-fluid"> <div class="span6"> <?php echo form_open_multipart('file/do_upload'); ?> <h2>File upload</h2> <input class="file-upload" type="file" name="file[]" multiple="multiple"><br> <button type="submit" id="upload_button" class="btn btn-primary">Upload it!</button> </form> - <div class="alert alert-block alert-info"> - <h4 class="alert-heading">Notice!</h4> - <p> - Uploads/pastes are deleted after <?php echo $upload_max_age; ?> days - <?php if($small_upload_size > 0) { - echo "unless they are smaller than ".format_bytes($small_upload_size); - } ?>. Maximum upload size is <?php echo format_bytes($max_upload_size); ?>. - You can upload a maximum of <?php echo ini_get("max_file_uploads"); ?> files at once. - </p> - </div> + </div> + <div class="span6 alert alert-block alert-info"> + <h4 class="alert-heading">Notice!</h4> + <p> + Uploads/pastes are deleted after <?php echo $upload_max_age; ?> days + <?php if($small_upload_size > 0) { + echo "unless they are smaller than ".format_bytes($small_upload_size); + } ?>. Maximum upload size is <?php echo format_bytes($max_upload_size); ?>. + You can upload a maximum of <?php echo ini_get("max_file_uploads"); ?> files at once. + </p> </div> </div> </div> diff --git a/data/js/script.js b/data/js/script.js index cb9afa66c..ffa036280 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -94,6 +94,21 @@ function fixedEncodeURIComponent (str) { $('.file-upload').bind('change', checkFileUpload); } + $('.text-upload').css('height', '100px'); + $('.text-upload').bind('blur', function() { + $('.text-upload').animate({height: "100px"}, 300); + }); + $('.text-upload').bind('focus', function() { + $('.text-upload').animate({height: "300px"}, 300); + }); + + // work around to submit the form if the click causes the + // textarea to shrink and you can't relase the mouse fast enough + // so mouseup will be outside the button area and not trigger + // submission properly + $('.text-upload-form :submit').bind('mousedown', function() { + $(this).click(); + }); }); })(jQuery); |