SiteSetting, admin passtrough, CSS, hide on mobile

This commit is contained in:
Rafael dos Santos Silva 2016-08-04 01:58:19 -03:00
parent 804019647e
commit acc70cc3de
5 changed files with 17 additions and 2 deletions

View File

@ -7,6 +7,7 @@ export default ContainerView.extend({
@on('init') @on('init')
createButtons() { createButtons() {
const mobileView = this.site.mobileView; const mobileView = this.site.mobileView;
const { siteSettings } = this;
const topic = this.get('topic'); const topic = this.get('topic');
@ -32,7 +33,9 @@ export default ContainerView.extend({
this.attachViewClass('invite-reply-button'); this.attachViewClass('invite-reply-button');
} }
this.attachViewClass('print-button'); if (!mobileView && siteSettings.allow_print_page) {
this.attachViewClass('print-button');
}
if (topic.get('isPrivateMessage')) { if (topic.get('isPrivateMessage')) {
this.attachViewClass('archive-button'); this.attachViewClass('archive-button');

View File

@ -70,8 +70,9 @@ class TopicsController < ApplicationController
end end
if opts[:print] if opts[:print]
raise Discourse::InvalidAccess unless SiteSetting.allow_print_page
begin begin
RateLimiter.new(current_user, "print-topic-per-hour", 10, 1.hour).performed! RateLimiter.new(current_user, "print-topic-per-hour", 10, 1.hour).performed! unless current_user.admin?
rescue RateLimiter::LimitExceeded rescue RateLimiter::LimitExceeded
render_json_error(I18n.t("rate_limiter.slow_down")) render_json_error(I18n.t("rate_limiter.slow_down"))
end end

View File

@ -43,6 +43,11 @@
.topic-list > div { .topic-list > div {
margin-bottom: 15px; margin-bottom: 15px;
} }
body img.emoji {
width: 20px;
height: 20px;
vertical-align: middle;
}
</style> </style>
</head> </head>

View File

@ -1312,6 +1312,8 @@ en:
topic_page_title_includes_category: "Topic page title includes the category name." topic_page_title_includes_category: "Topic page title includes the category name."
allow_print_page: "Enable a special topic page for printing"
full_name_required: "Full name is a required field of a user's profile." full_name_required: "Full name is a required field of a user's profile."
enable_names: "Show the user's full name on their profile, user card, and emails. Disable to hide full name everywhere." enable_names: "Show the user's full name on their profile, user card, and emails. Disable to hide full name everywhere."
display_name_on_posts: "Show a user's full name on their posts in addition to their @username." display_name_on_posts: "Show a user's full name on their posts in addition to their @username."

View File

@ -1220,6 +1220,10 @@ uncategorized:
topic_page_title_includes_category: true topic_page_title_includes_category: true
allow_print_page:
default: true
client: true
user_preferences: user_preferences:
default_email_digest_frequency: default_email_digest_frequency:
enum: 'DigestEmailSiteSetting' enum: 'DigestEmailSiteSetting'