Removes UI for print, adds CTRL+P shortcut
This commit is contained in:
parent
0229df4c73
commit
03ec480c65
|
@ -687,6 +687,12 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
this.send('togglePinnedForUser');
|
||||
},
|
||||
|
||||
print() {
|
||||
if (this.siteSettings.max_prints_per_hour_per_user > 0) {
|
||||
window.open(this.get('model.printUrl'), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=600,height=315');
|
||||
}
|
||||
},
|
||||
|
||||
canMergeTopic: function() {
|
||||
if (!this.get('model.details.can_move_posts')) return false;
|
||||
return this.get('selectedPostsCount') > 0;
|
||||
|
|
|
@ -13,6 +13,8 @@ const bindings = {
|
|||
'c': {handler: 'createTopic'},
|
||||
'ctrl+f': {handler: 'showPageSearch', anonymous: true},
|
||||
'command+f': {handler: 'showPageSearch', anonymous: true},
|
||||
'ctrl+p': {handler: 'printTopic', anonymous: true},
|
||||
'command+p': {handler: 'printTopic', anonymous: true},
|
||||
'd': {postAction: 'deletePost'},
|
||||
'e': {postAction: 'editPost'},
|
||||
'end': {handler: 'goToLastPost', anonymous: true},
|
||||
|
@ -151,6 +153,15 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
printTopic(event) {
|
||||
Ember.run(() => {
|
||||
if ($('.container.posts').length) {
|
||||
event.preventDefault(); // We need to stop printing the current page in Firefox
|
||||
this.container.lookup('controller:topic').print();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
createTopic() {
|
||||
this.container.lookup('controller:composer').open({action: Composer.CREATE_TOPIC, draftKey: Composer.CREATE_TOPIC});
|
||||
},
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<li>{{{i18n 'keyboard_shortcuts_help.actions.mark_regular'}}}</li>
|
||||
<li>{{{i18n 'keyboard_shortcuts_help.actions.mark_tracking'}}}</li>
|
||||
<li>{{{i18n 'keyboard_shortcuts_help.actions.mark_watching'}}}</li>
|
||||
<li>{{{i18n 'keyboard_shortcuts_help.actions.print'}}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import ButtonView from 'discourse/views/button';
|
||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
||||
|
||||
export default ButtonView.extend({
|
||||
classNames: ['print'],
|
||||
textKey: 'topic.print.title',
|
||||
helpKey: 'topic.print.help',
|
||||
|
||||
renderIcon(buffer) {
|
||||
buffer.push(iconHTML("print"));
|
||||
},
|
||||
|
||||
click() {
|
||||
window.open(this.get('controller.model.printUrl'), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=600,height=315');
|
||||
}
|
||||
});
|
|
@ -32,10 +32,6 @@ export default ContainerView.extend({
|
|||
this.attachViewClass('invite-reply-button');
|
||||
}
|
||||
|
||||
if (!mobileView && this.siteSettings.max_prints_per_hour_per_user > 0) {
|
||||
this.attachViewClass('print-button');
|
||||
}
|
||||
|
||||
if (topic.get('isPrivateMessage')) {
|
||||
this.attachViewClass('archive-button');
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
|
||||
.keyboard-shortcuts-modal .modal-body {
|
||||
max-height: 520px;
|
||||
max-height: 560px;
|
||||
}
|
||||
|
||||
#keyboard-shortcuts-help {
|
||||
|
|
|
@ -80,7 +80,9 @@
|
|||
<% if @topic_view.print %>
|
||||
<% content_for :after_body do %>
|
||||
<script>
|
||||
window.print();
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
window.print();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -2122,6 +2122,7 @@ en:
|
|||
mark_regular: '<b>m</b>, <b>r</b> Regular (default) topic'
|
||||
mark_tracking: '<b>m</b>, <b>t</b> Track topic'
|
||||
mark_watching: '<b>m</b>, <b>w</b> Watch topic'
|
||||
print: '<b>ctrl</b>+<b>p</b> Print topic'
|
||||
|
||||
badges:
|
||||
earned_n_times:
|
||||
|
|
Loading…
Reference in New Issue