mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Remove 'show more' from upload modals (#8470)
This commit is contained in:
parent
276fb7f46f
commit
192ada0067
@ -1,10 +1,7 @@
|
||||
import { equal } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import {
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import {
|
||||
allowsAttachments,
|
||||
authorizedExtensions,
|
||||
@ -20,9 +17,7 @@ function uploadTranslate(key, user) {
|
||||
}
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
showMore: false,
|
||||
imageUrl: null,
|
||||
imageLink: null,
|
||||
local: equal("selection", "local"),
|
||||
remote: equal("selection", "remote"),
|
||||
selection: "local",
|
||||
@ -49,13 +44,6 @@ export default Controller.extend(ModalFunctionality, {
|
||||
});
|
||||
},
|
||||
|
||||
@observes("selection")
|
||||
_selectionChanged() {
|
||||
if (this.local) {
|
||||
this.set("showMore", false);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
upload() {
|
||||
if (this.local) {
|
||||
@ -64,22 +52,15 @@ export default Controller.extend(ModalFunctionality, {
|
||||
});
|
||||
} else {
|
||||
const imageUrl = this.imageUrl || "";
|
||||
const imageLink = this.imageLink || "";
|
||||
const toolbarEvent = this.toolbarEvent;
|
||||
|
||||
if (this.showMore && imageLink.length > 3) {
|
||||
toolbarEvent.addText(`[](${imageLink})`);
|
||||
} else if (imageUrl.match(/\.(jpg|jpeg|png|gif)$/)) {
|
||||
if (imageUrl.match(/\.(jpg|jpeg|png|gif)$/)) {
|
||||
toolbarEvent.addText(``);
|
||||
} else {
|
||||
toolbarEvent.addText(imageUrl);
|
||||
}
|
||||
}
|
||||
this.send("closeModal");
|
||||
},
|
||||
|
||||
toggleShowMore() {
|
||||
this.toggleProperty("showMore");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -145,8 +145,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
|
||||
showUploadSelector(toolbarEvent) {
|
||||
showModal("uploadSelector").setProperties({
|
||||
toolbarEvent,
|
||||
imageUrl: null,
|
||||
imageLink: null
|
||||
imageUrl: null
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -19,14 +19,6 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if showMore}}
|
||||
<div class="radios">
|
||||
<div class="inputs">
|
||||
{{input value=imageLink placeholder="http://example.com"}}
|
||||
<span class="description">{{i18n 'upload_selector.image_link'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="radios">
|
||||
<div class="inputs">
|
||||
<p class="hint">
|
||||
@ -43,5 +35,4 @@
|
||||
<div class="modal-footer">
|
||||
{{d-button action=(action "upload") class='btn-primary' icon=uploadIcon label='upload'}}
|
||||
{{d-modal-cancel close=(route-action "closeModal")}}
|
||||
{{#if remote}}<a {{action "toggleShowMore"}} class="pull-right">{{i18n 'show_more'}}</a>{{/if}}
|
||||
</div>
|
||||
|
@ -1836,7 +1836,6 @@ en:
|
||||
hint_for_supported_browsers: "you can also drag and drop or paste images into the editor"
|
||||
uploading: "Uploading"
|
||||
select_file: "Select File"
|
||||
image_link: "link your image will point to"
|
||||
default_image_alt_text: image
|
||||
|
||||
search:
|
||||
|
Loading…
Reference in New Issue
Block a user