mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Jump to post on iOS was broken - replace with prompt
This commit is contained in:
parent
2a4006fe0c
commit
424bb143db
@ -168,26 +168,8 @@ export default Ember.Component.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
_jumpTo(postIndex) {
|
||||||
toggleExpansion(opts) {
|
postIndex = parseInt(postIndex, 10);
|
||||||
this.toggleProperty('expanded');
|
|
||||||
if (this.get('expanded')) {
|
|
||||||
this.set('userWantsToJump', false);
|
|
||||||
this.set('toPostIndex', this.get('progressPosition'));
|
|
||||||
if(opts && opts.highlight){
|
|
||||||
// TODO: somehow move to view?
|
|
||||||
Em.run.next(function(){
|
|
||||||
$('.jump-form input').select().focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!this.site.mobileView && !this.capabilities.isIOS) {
|
|
||||||
Ember.run.schedule('afterRender', () => this.$('input').focus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
jumpPost() {
|
|
||||||
let postIndex = parseInt(this.get('toPostIndex'), 10);
|
|
||||||
|
|
||||||
// Validate the post index first
|
// Validate the post index first
|
||||||
if (isNaN(postIndex) || postIndex < 1) {
|
if (isNaN(postIndex) || postIndex < 1) {
|
||||||
@ -201,6 +183,31 @@ export default Ember.Component.extend({
|
|||||||
this.sendAction('jumpToIndex', postIndex);
|
this.sendAction('jumpToIndex', postIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
toggleExpansion(opts) {
|
||||||
|
this.toggleProperty('expanded');
|
||||||
|
if (this.get('expanded')) {
|
||||||
|
this.set('userWantsToJump', false);
|
||||||
|
this.set('toPostIndex', this.get('progressPosition'));
|
||||||
|
if (opts && opts.highlight) {
|
||||||
|
Ember.run.next(() => $('.jump-form input').select().focus());
|
||||||
|
}
|
||||||
|
if (!this.site.mobileView && !this.capabilities.isIOS) {
|
||||||
|
Ember.run.schedule('afterRender', () => this.$('input').focus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
jumpPrompt() {
|
||||||
|
const postIndex = prompt(I18n.t('topic.progress.jump_prompt_long'));
|
||||||
|
if (postIndex === null) { return; }
|
||||||
|
this._jumpTo(postIndex);
|
||||||
|
},
|
||||||
|
|
||||||
|
jumpPost() {
|
||||||
|
this._jumpTo(this.get('toPostIndex'));
|
||||||
|
},
|
||||||
|
|
||||||
jumpTop() {
|
jumpTop() {
|
||||||
this._beforeJump();
|
this._beforeJump();
|
||||||
this.sendAction('jumpTop');
|
this.sendAction('jumpTop');
|
||||||
|
@ -6,10 +6,15 @@
|
|||||||
class="full no-text"
|
class="full no-text"
|
||||||
icon="caret-up"
|
icon="caret-up"
|
||||||
label="topic.progress.go_top"}}
|
label="topic.progress.go_top"}}
|
||||||
|
{{#unless capabilities.isIOS}}
|
||||||
<div class='jump-form'>
|
<div class='jump-form'>
|
||||||
{{input value=toPostIndex}}
|
{{input value=toPostIndex}}
|
||||||
{{d-button action="jumpPost" label="topic.progress.go"}}
|
{{d-button action="jumpPost" label="topic.progress.go"}}
|
||||||
</div>
|
</div>
|
||||||
|
{{else}}
|
||||||
|
{{d-button action="jumpPrompt" class="full jump-prompt" label="topic.progress.jump_prompt"}}
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
{{d-button action="jumpBottom"
|
{{d-button action="jumpBottom"
|
||||||
disabled=jumpBottomDisabled
|
disabled=jumpBottomDisabled
|
||||||
class="full no-text jump-bottom"
|
class="full no-text jump-bottom"
|
||||||
|
@ -133,6 +133,10 @@
|
|||||||
width: 55px;
|
width: 55px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
button.btn.jump-prompt {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
button.btn.jump-bottom {
|
button.btn.jump-bottom {
|
||||||
margin: 5px 0 0 0;
|
margin: 5px 0 0 0;
|
||||||
}
|
}
|
||||||
|
@ -1349,6 +1349,8 @@ en:
|
|||||||
go_bottom: "bottom"
|
go_bottom: "bottom"
|
||||||
go: "go"
|
go: "go"
|
||||||
jump_bottom: "jump to last post"
|
jump_bottom: "jump to last post"
|
||||||
|
jump_prompt: "jump to post"
|
||||||
|
jump_prompt_long: "What post would you like to jump to?"
|
||||||
jump_bottom_with_number: "jump to post %{post_number}"
|
jump_bottom_with_number: "jump to post %{post_number}"
|
||||||
total: total posts
|
total: total posts
|
||||||
current: current post
|
current: current post
|
||||||
|
Loading…
Reference in New Issue
Block a user