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

1
TODO
View file

@ -2,7 +2,6 @@ This is transient file that lists functionalities to be implemented before
first major release. first major release.
- autocomplete: don't show items that are already used in tag list (unsure) - autocomplete: don't show items that are already used in tag list (unsure)
- posts/upload: when adding multiple files, select first one, not last one
- posts/upload: better hotkeys for going to next post - posts/upload: better hotkeys for going to next post
- posts/upload: get rid of suggested tags after selecting next post - posts/upload: get rid of suggested tags after selecting next post
- posts/upload: ability to paste many urls (unsure) - posts/upload: ability to paste many urls (unsure)

View file

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