This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6
2018-06-13 22:01:35 -07:00

21 lines
498 B
JavaScript

import ModalFunctionality from 'discourse/mixins/modal-functionality';
export default Ember.Controller.extend(ModalFunctionality, {
model: null,
postNumber: null,
onShow: () => {
Ember.run.next(() => $('#post-jump').focus());
},
actions: {
jump() {
const max = this.get("topic.postStream.filteredPostsCount");
const where = Math.min(max, Math.max(1, parseInt(this.get("postNumber"))));
this.jumpToIndex(where);
this.send('closeModal');
}
}
});