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; float: left;
} }
.tab-content { #upload-step1 {
margin-bottom: 1em; display: table;
width: 100%;
} }
.tab-content.url {
display: none;
}
#file-handler-wrapper { #file-handler-wrapper {
display: table; display: table;
width: 100%; width: 100%;
@ -33,10 +30,23 @@
border-color: firebrick; border-color: firebrick;
} }
#url-handler textarea { #url-handler {
width: 100%; margin-top: 0.5em;
height: 10em; position: relative;
margin-bottom: 0.5em; }
#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 { .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) $('#url-handler-wrapper button').click(function(e)
{ {
var urls = []; var url = $('#url-handler-wrapper input').val();
$.each($('#url-handler-wrapper textarea').val().split(/\s+/), function(i, url) url = url.replace(/^\s+|\s+$/, '');
{ if (url == '')
url = url.replace(/^\s+|\s+$/, ''); return;
if (url == '') $('#url-handler-wrapper input').val('');
return; handleURLs([url]);
urls.push(url);
});
$('#url-handler-wrapper textarea').val('');
handleURLs(urls);
}); });

View file

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