mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -06:00
UX: Add tooltip why file upload is disabled (#19471)
Follow up to commit 0cc6e678bb
.
This commit is contained in:
parent
8126c1613a
commit
1f6e9bd5a9
@ -8,11 +8,19 @@ import lightbox from "discourse/lib/lightbox";
|
||||
import { next } from "@ember/runloop";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { authorizesOneOrMoreExtensions } from "discourse/lib/uploads";
|
||||
import I18n from "I18n";
|
||||
|
||||
export default Component.extend(UppyUploadMixin, {
|
||||
classNames: ["image-uploader"],
|
||||
disabled: or("notAllowed", "uploading", "processing"),
|
||||
|
||||
@discourseComputed("disabled", "notAllowed")
|
||||
disabledReason(disabled, notAllowed) {
|
||||
if (disabled && notAllowed) {
|
||||
return I18n.t("post.errors.no_uploads_authorized");
|
||||
}
|
||||
},
|
||||
|
||||
@discourseComputed(
|
||||
"currentUser.staff",
|
||||
"siteSettings.{authorized_extensions,authorized_extensions_for_staff}"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="placeholder-overlay" style={{this.placeholderStyle}}></div>
|
||||
{{/if}}
|
||||
<div class="image-upload-controls">
|
||||
<label class="btn btn-default pad-left no-text {{if this.disabled "disabled"}}">
|
||||
<label class="btn btn-default pad-left no-text {{if this.disabled "disabled"}}" title={{this.disabledReason}}>
|
||||
{{d-icon "far-image"}}
|
||||
<PickFilesButton @fileInputDisabled={{this.disabled}} @fileInputClass="hidden-upload-field" @acceptedFormatsOverride="image/*" />
|
||||
</label>
|
||||
|
Loading…
Reference in New Issue
Block a user