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-15 17:03:24 +02:00

24 lines
520 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");
}
}
});