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