Upload no longer uses tabs

This commit is contained in:
Marcin Kurczewski 2014-02-16 15:08:54 +01:00
parent 7a5d97e153
commit 4a69084a8b
3 changed files with 42 additions and 48 deletions

View file

@ -8,13 +8,10 @@
float: left;
}
.tab-content {
margin-bottom: 1em;
#upload-step1 {
display: table;
width: 100%;
}
.tab-content.url {
display: none;
}
#file-handler-wrapper {
display: table;
width: 100%;
@ -33,10 +30,23 @@
border-color: firebrick;
}
#url-handler textarea {
width: 100%;
height: 10em;
margin-bottom: 0.5em;
#url-handler {
margin-top: 0.5em;
position: relative;
}
#url-handler input {
padding: 0.5em;
}
#url-handler .input-wrapper {
margin-right: 7.5em;
}
#url-handler button {
font-size: initial;
padding: 0.5em;
position: absolute;
top: 0;
right: 0;
width: 7em;
}
.post .thumbnail {

View file

@ -42,18 +42,22 @@ $(function()
$('#url-handler-wrapper input').keydown(function(e)
{
if (e.which == 13)
{
$('#url-handler-wrapper button').trigger('click');
e.preventDefault();
}
});
$('#url-handler-wrapper button').click(function(e)
{
var urls = [];
$.each($('#url-handler-wrapper textarea').val().split(/\s+/), function(i, url)
{
url = url.replace(/^\s+|\s+$/, '');
if (url == '')
return;
urls.push(url);
});
$('#url-handler-wrapper textarea').val('');
handleURLs(urls);
var url = $('#url-handler-wrapper input').val();
url = url.replace(/^\s+|\s+$/, '');
if (url == '')
return;
$('#url-handler-wrapper input').val('');
handleURLs([url]);
});

View file

@ -18,38 +18,18 @@ LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
<div id="inner-content">
<div id="upload-step1">
<nav class="tabs">
<ul>
<li class="selected file">
<a href="#">
Upload from file
</a>
</li>
<li class="url">
<a href="#">
Upload from URL
</a>
</li>
</ul>
</nav>
<div class="tab-content file">
<div id="file-handler-wrapper">
<input type=file multiple style="display: none"/>
<div id="file-handler-wrapper">
<div id="file-handler">
Drop files here!<br>
Or just click on this box.
</div>
<div id="file-handler">
Drop files here!<br>
Or just click on this box.
</div>
</div>
<div class="tab-content url">
<div id="url-handler-wrapper">
<div id="url-handler">
<div class="input-wrapper"><textarea placeholder="Paste some URLs here, one per line." name="urls"></textarea></div>
</div>
<button class="submit" type="submit">Add</button>
<div id="url-handler-wrapper">
<div id="url-handler">
<div class="input-wrapper"><input placeholder="Alternatively, paste an URL here." name="url"/></div>
<button class="submit" type="submit">Add URL</button>
</div>
</div>