Changed post upload to select first, not last row

This commit is contained in:
Marcin Kurczewski
2014-10-18 14:39:00 +02:00
parent c6d5a130e4
commit 428a1ae18c
2 changed files with 11 additions and 5 deletions

View File

@ -107,12 +107,18 @@ App.Presenters.PostUploadPresenter = function(
}
}
$input.val('');
addPostFromUrl(url);
var post = addPostFromUrl(url);
selectPostTableRow(post);
}
function fileHandlerChanged(files) {
for (var i = 0; i < files.length; i ++) {
addPostFromFile(files[i]);
if (files.length > 0) {
var posts = [];
for (var i = 0; i < files.length; i ++) {
var post = addPostFromFile(files[i]);
posts.push(post);
}
selectPostTableRow(_.first(posts));
}
}
@ -251,6 +257,7 @@ App.Presenters.PostUploadPresenter = function(
});
postAdded(post);
return post;
}
function addPostFromUrl(url) {
@ -266,6 +273,7 @@ App.Presenters.PostUploadPresenter = function(
post.thumbnail = url;
postThumbnailLoaded(post);
}
return post;
}
function createPostTableRow(post) {
@ -286,7 +294,6 @@ App.Presenters.PostUploadPresenter = function(
postChanged(post);
selectPostTableRow(post);
showOrHidePostsTable();
}