diff --git a/app/assets/javascripts/discourse/controllers/upload_selector_controller.js b/app/assets/javascripts/discourse/controllers/upload_selector_controller.js index c9da0d601a..c24a625139 100644 --- a/app/assets/javascripts/discourse/controllers/upload_selector_controller.js +++ b/app/assets/javascripts/discourse/controllers/upload_selector_controller.js @@ -10,10 +10,14 @@ Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.ModalFunctionality, { remote: Em.computed.not("local"), local: false, + showMore: false, init: function() { this._super(); - this.set("local", this.get("allowLocal")); + this.setProperties({ + local: this.get("allowLocal"), + showMore: false + }); }, allowLocal: function() { @@ -21,8 +25,9 @@ Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.Modal }.property(), actions: { - useLocal: function() { this.set("local", true); }, - useRemote: function() { this.set("local", false); } + useLocal: function() { this.setProperties({ local: true, showMore: false}); }, + useRemote: function() { this.set("local", false); }, + toggleShowMore: function() { this.toggleProperty("showMore"); } } }); diff --git a/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars b/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars index 91ea5227e8..df8e01d87d 100644 --- a/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars @@ -16,11 +16,19 @@ {{#if remote}}
-
+
{{unbound view.tip}}
{{/if}} + {{#if showMore}} +
+
+
+ {{i18n upload_selector.image_link}} +
+
+ {{/if}}

{{unbound view.hint}}

@@ -34,4 +42,5 @@ {{i18n upload}} {{i18n cancel}} + {{#if remote}}{{i18n show_more}}{{/if}}
diff --git a/app/assets/javascripts/discourse/views/modal/upload_selector_view.js b/app/assets/javascripts/discourse/views/modal/upload_selector_view.js index 7d16998230..52e2b8fe66 100644 --- a/app/assets/javascripts/discourse/views/modal/upload_selector_view.js +++ b/app/assets/javascripts/discourse/views/modal/upload_selector_view.js @@ -47,7 +47,14 @@ Discourse.UploadSelectorView = Discourse.ModalBodyView.extend({ if (this.get("controller.local")) { $('#reply-control').fileupload('add', { fileInput: $('#filename-input') }); } else { - this.get('controller.composerView').addMarkdown($('#fileurl-input').val()); + var imageUrl = $('#fileurl-input').val(); + var imageLink = $('#link-input').val(); + var composerView = this.get('controller.composerView'); + if (this.get("controller.showMore") && imageLink.length > 3) { + composerView.addMarkdown("\n \n"); + } else { + composerView.addMarkdown(imageUrl); + } this.get('controller').send('closeModal'); } } diff --git a/app/assets/stylesheets/desktop/upload.scss b/app/assets/stylesheets/desktop/upload.scss index 68b328e964..ab6391c3ea 100644 --- a/app/assets/stylesheets/desktop/upload.scss +++ b/app/assets/stylesheets/desktop/upload.scss @@ -6,7 +6,7 @@ position: relative; left: -5px; bottom: -5px; - text-shadow: + text-shadow: -1px -1px 0 $btn-primary-background-color, 1px 1px 0 $btn-primary-background-color, 1px -1px 0 $btn-primary-background-color, @@ -19,7 +19,7 @@ padding-left: 10px; } .radios { - margin: 0 0 25px 0; + height: 60px; .inputs { float: right; width: 75%; @@ -40,4 +40,7 @@ } } } + .radios:last-child { + height: 20px; + } } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 94e8a724cf..2f3731d00c 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -611,6 +611,7 @@ en: hint: "(you can also drag & drop into the editor to upload them)" hint_for_chrome: "(you can also drag and drop or paste images into the editor to upload them)" uploading: "Uploading" + image_link: "enter the link you want your image to point to" search: title: "search for topics, posts, users, or categories"