From 4ec9b5d43d400f3108313a59f08685b75270db90 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 13 May 2013 00:51:05 -0700 Subject: [PATCH] Focus add subreddit box after multireddit creation. --- r2/r2/public/static/js/multi.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/r2/r2/public/static/js/multi.js b/r2/r2/public/static/js/multi.js index 1840606f2..d8a84176d 100644 --- a/r2/r2/public/static/js/multi.js +++ b/r2/r2/public/static/js/multi.js @@ -8,12 +8,16 @@ r.multi = { var detailsEl = $('.multi-details') if (detailsEl.length) { - var multi = this.multis.touch(detailsEl.data('path')) - new r.multi.MultiDetails({ - model: multi, - el: detailsEl - }) + var multi = this.multis.touch(detailsEl.data('path')), + detailsView = new r.multi.MultiDetails({ + model: multi, + el: detailsEl + }) multi.fetch() + + if (location.hash == '#created') { + detailsView.focusAdd() + } } var subscribeBubbleGroup = {} @@ -304,6 +308,10 @@ r.multi.MultiDetails = Backbone.View.extend({ window.location = '/' } }) + }, + + focusAdd: function() { + this.$('.add-sr .sr-name').focus() } }) @@ -408,7 +416,7 @@ r.multi.ListingChooser = Backbone.View.extend({ r.multi.mine.create({name: name}, { wait: true, success: function(multi) { - window.location = multi.get('path') + window.location = multi.get('path') + '#created' }, error: _.bind(function(multi, xhr) { var resp = JSON.parse(xhr.responseText)