diff --git a/app/assets/javascripts/discourse/components/utilities.js b/app/assets/javascripts/discourse/components/utilities.js
index ccb3937ca8e..f4f70f5c830 100644
--- a/app/assets/javascripts/discourse/components/utilities.js
+++ b/app/assets/javascripts/discourse/components/utilities.js
@@ -257,6 +257,15 @@ Discourse.Utilities = {
isUploadForbidden: function(path) {
if (Discourse.User.current('trust_level') > 0) { return false; }
return Discourse.Utilities.isAnImage(path) ? Discourse.SiteSettings.newuser_max_images === 0 : Discourse.SiteSettings.newuser_max_attachments === 0;
+ },
+
+ /**
+ Determines whether we allow attachments or not
+
+ @method allowsAttachments
+ **/
+ allowsAttachments: function() {
+ return _.difference(Discourse.SiteSettings.authorized_extensions.split("|"), [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tif", ".tiff"]).length > 0;
}
};
diff --git a/app/assets/javascripts/discourse/controllers/upload_selector_controller.js b/app/assets/javascripts/discourse/controllers/upload_selector_controller.js
index 6300983dafa..b3462a9ea77 100644
--- a/app/assets/javascripts/discourse/controllers/upload_selector_controller.js
+++ b/app/assets/javascripts/discourse/controllers/upload_selector_controller.js
@@ -12,6 +12,20 @@ Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.Modal
remoteSelected: Em.computed.not('localSelected'),
selectLocal: function() { this.set('localSelected', true); },
- selectRemote: function() { this.set('localSelected', false); }
+ selectRemote: function() { this.set('localSelected', false); },
+
+ localTitle: function() { return Discourse.UploadSelectorController.translate("local_title") }.property(),
+ remoteTitle: function() { return Discourse.UploadSelectorController.translate("remote_title") }.property(),
+ localTip: function() { return Discourse.UploadSelectorController.translate("local_tip") }.property(),
+ remoteTip: function() { return Discourse.UploadSelectorController.translate("remote_tip") }.property(),
+ uploadTitle: function() { return Discourse.UploadSelectorController.translate("upload_title") }.property(),
+ addTitle: function() { return Discourse.UploadSelectorController.translate("add_title") }.property()
});
+
+Discourse.UploadSelectorController.reopenClass({
+ translate: function(key) {
+ if (Discourse.Utilities.allowsAttachments()) key += "_with_attachments";
+ return I18n.t("upload_selector." + key);
+ }
+});
diff --git a/app/assets/javascripts/discourse/templates/composer.js.handlebars b/app/assets/javascripts/discourse/templates/composer.js.handlebars
index 693c8bb21af..3213ed8c3b0 100644
--- a/app/assets/javascripts/discourse/templates/composer.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/composer.js.handlebars
@@ -77,7 +77,7 @@
{{#if view.isUploading}}
- {{i18n upload_selector.upload_file}} {{view.uploadProgress}}%
{{i18n cancel}}
+ {{i18n upload_selector.uploading}} {{view.uploadProgress}}%
{{i18n cancel}}
{{/if}}
{{/if}}
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 f1dfbbd0963..32abb16770d 100644
--- a/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars
@@ -1,8 +1,8 @@
@@ -11,26 +11,26 @@
{{else}}
{{/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 fdd3134274a..be8b17a6203 100644
--- a/app/assets/javascripts/discourse/views/modal/upload_selector_view.js
+++ b/app/assets/javascripts/discourse/views/modal/upload_selector_view.js
@@ -9,7 +9,8 @@
Discourse.UploadSelectorView = Discourse.ModalBodyView.extend({
templateName: 'modal/upload_selector',
classNames: ['upload-selector'],
- title: I18n.t('upload_selector.title'),
+
+ title: function() { return Discourse.UploadSelectorController.translate("title"); }.property(),
upload: function() {
$('#reply-control').fileupload('add', { fileInput: $('#filename-input') });
diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml
index 56baa65b862..cbea8ff8142 100644
--- a/config/locales/client.cs.yml
+++ b/config/locales/client.cs.yml
@@ -510,13 +510,13 @@ cs:
title: "Vložit obrázek"
from_my_computer: "Z mého zařízení"
from_the_web: "Z webu"
- add_image: "Přidat obrázek"
+ add_title: "Přidat obrázek"
remote_title: "obrázek ze vzdáleného úložistě"
remote_tip: "zadejte adresu obrázku ve formátu http://example.com/image.jpg"
local_title: "obrázek z lokálního úložiště"
local_tip: "klikněte sem pro výběr obrázku z vašeho zařízení"
- upload: "Nahrát"
- upload_file: "Nahrávám obrázek"
+ upload_title: "Nahrát"
+ uploading: "Nahrávám obrázek"
search:
title: "hledání témat, příspěvků, uživatelů a kategorií"
diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml
index 49f7f1e1ff4..6cc05652c57 100644
--- a/config/locales/client.da.yml
+++ b/config/locales/client.da.yml
@@ -350,11 +350,11 @@ da:
title: "Indsæt billede"
from_my_computer: "Fra min computer"
from_the_web: "Fra nettet"
- add_image: "Indsæt billede"
+ add_title: "Indsæt billede"
remote_tip: "skriv adressen på et billede i formen http://example.com/billede.jpg"
local_tip: "klik for at vælge et billede fra din computer."
- upload: "Upload"
- upload_file: "Uploader billede"
+ upload_title: "Upload"
+ uploading: "Uploader billede"
search:
title: "søg efter emner, indlæg, brugere eller kategorier"
diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml
index 4f56fcdcaea..ea831d32bf9 100644
--- a/config/locales/client.de.yml
+++ b/config/locales/client.de.yml
@@ -494,13 +494,13 @@ de:
title: "Bild einfügen"
from_my_computer: "von meinem Gerät"
from_the_web: "aus dem Web"
- add_image: "Bild hinzufügen"
+ add_title: "Bild hinzufügen"
remote_title: "Entferntes Bild"
remote_tip: "Gib die Adresse eines Bildes wie folgt ein: http://example.com/image.jpg"
local_title: "Lokales Bild"
local_tip: "Klicke hier, um ein Bild von deinem Gerät zu wählen."
- upload: "Hochladen"
- upload_file: "Bild wird hochgeladen"
+ upload_title: "Hochladen"
+ uploading: "Bild wird hochgeladen"
search:
title: "Such nach Themen, Beiträgen, Nutzern oder Kategorien"
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index e4bff86b433..2094705f488 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -484,16 +484,23 @@ en:
total_flagged: "total flagged posts"
upload_selector:
- title: "Upload file"
+ title: "Upload an image"
+ title_with_attachments: "Upload an image or a file"
from_my_computer: "From My Device"
from_the_web: "From The Web"
- add_image: "Add File"
- remote_title: "remote file"
- remote_tip: "enter address of a file in the form http://example.com/image.jpg"
- local_title: "local file"
- local_tip: "click to select a file from your device."
- upload: "Upload"
- upload_file: "Uploading"
+ add_title: "Add image"
+ add_title_with_attachments: "Add image or file"
+ remote_title: "remote image"
+ remote_title_with_attachments: "remote image or file"
+ remote_tip: "enter address of an image in the form http://example.com/image.jpg"
+ remote_tip_with_attachments: "enter address of an image or a file in the form http://example.com/file.ext"
+ local_title: "local image"
+ local_title_with_attachments: "local image or file"
+ local_tip: "click to select an image from your device."
+ local_tip_with_attachments: "click to select an image or a file from your device."
+ upload_title: "Upload image"
+ upload_title_with_attachments: "Upload image or file"
+ uploading: "Uploading"
search:
title: "search for topics, posts, users, or categories"
diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml
index 8b4b6e86ebc..bf0f4018741 100644
--- a/config/locales/client.es.yml
+++ b/config/locales/client.es.yml
@@ -426,11 +426,11 @@ es:
title: "Insertar Imagen"
from_my_computer: "Desde Mí Dispositivo"
from_the_web: "Desde La Web"
- add_image: "Agregar Imagen"
+ add_title: "Agregar Imagen"
remote_tip: "ingrese una dirección de una imagen en la siguiente forma http://ejemplo.com/imagen.jpg"
local_tip: "click para seleccionar la imagen desde su dispositivo."
- upload: "Subir"
- upload_file: "Subiendo imagen"
+ upload_title: "Subir"
+ uploading: "Subiendo imagen"
search:
title: "buscar por temas, publicaciones, usuarios o categorías"
diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml
index c9d31859b80..be33a22e58e 100644
--- a/config/locales/client.fr.yml
+++ b/config/locales/client.fr.yml
@@ -489,16 +489,23 @@ fr:
total_flagged: "Nombre total de messages signalés"
upload_selector:
- title: "Insérer un fichier"
- from_my_computer: "Local"
- from_the_web: "Depuis internet"
- add_image: "Ajouter un fichier"
- remote_title: "Fichier distant"
- remote_tip: "saisissez l'url du fichier"
- local_title: "Fichier local"
- local_tip: "Cliquez pour sélectionner un fichier depuis votre ordinateur."
- upload: "Envoyer"
- upload_file: "Fichier en cours d'envoi"
+ title: "Insérer une image"
+ title_with_attachments: "Insérer une image ou un fichier"
+ from_my_computer: "Depuis mon ordinateur"
+ from_the_web: "Depuis le Web"
+ add_title: "Ajouter l'image"
+ add_title_with_attachments: "Ajouter le fichier"
+ remote_title: "Image distante"
+ remote_title_with_attachments: "Fichier distant"
+ remote_tip: "saisissez l'url de l'image (par exemple : http://monsite.com/image.jpg)"
+ remote_tip_with_attachments: "saisissez l'url du fichier (par exemple : http://monsite.com/fichier.txt)"
+ local_title: "Image locale"
+ local_title_with_attachments: "Fichier local"
+ local_tip: "Cliquez pour sélectionner une image depuis votre ordinateur."
+ local_tip_with_attachments: "Cliquez pour sélectionner un fichier depuis votre ordinateur."
+ upload_title: "Envoyer l'image"
+ upload_title_with_attachments: "Envoyer le fichier"
+ uploading: "Fichier en cours d'envoi..."
search:
title: "Rechercher les discussions, messages, utilisateurs ou catégories"
diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml
index 7ddf6242be3..6d1c38133ce 100644
--- a/config/locales/client.id.yml
+++ b/config/locales/client.id.yml
@@ -314,11 +314,11 @@ id:
title: "Insert Image"
from_my_computer: "From My Device"
from_the_web: "From The Web"
- add_image: "Add Image"
+ add_title: "Add Image"
remote_tip: "enter address of an image in the form http://example.com/image.jpg"
local_tip: "click to select an image from your device."
- upload: "Upload"
- upload_file: "Uploading image"
+ upload_title: "Upload"
+ uploading: "Uploading image"
search:
title: "search for topics, posts, users, or categories"
diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml
index 9e2788d1e57..fc8a7ef8f5d 100644
--- a/config/locales/client.it.yml
+++ b/config/locales/client.it.yml
@@ -419,13 +419,13 @@ it:
title: "Inserisci Immagine"
from_my_computer: "Dal mio dispositivo"
from_the_web: "Dal Web"
- add_image: "Aggiungi Immagine"
+ add_title: "Aggiungi Immagine"
remote_title: "immagine remota"
remote_tip: "inserisci l'indirizzo dell'immagine (es. http://example.com/image.jpg)"
local_title: "immagine locale"
local_tip: "clicca per selezionare un'immagine dal tuo dispositivo."
- upload: "Upload"
- upload_file: "Carico l'immagine"
+ upload_title: "Upload"
+ uploading: "Carico l'immagine"
search:
title: "cerca topic, post, utenti o categorie"
diff --git a/config/locales/client.ko.yml b/config/locales/client.ko.yml
index 538245aaa65..12adf7f0f8f 100644
--- a/config/locales/client.ko.yml
+++ b/config/locales/client.ko.yml
@@ -384,13 +384,13 @@ ko:
title: "이미지 삽입"
from_my_computer: "나의 장치로 부터"
from_the_web: "웹으로부터"
- add_image: "이미지 추가"
+ add_title: "이미지 추가"
remote_title: "원격 이미지"
remote_tip: "양식에서 http://example.com/image.jpg 의 이미지 주소 입력"
local_title: "기본 이미지"
local_tip: "당신의 장치로부터 이미지를 선택하여 클릭해주세요"
- upload: "업로드"
- uploading_image: "이미지 업로드중 ..."
+ upload_title: "업로드"
+ uploading: "이미지 업로드중 ..."
search:
title: "주제, 게시물, 사용자, 카테고리를 검색합니다"
diff --git a/config/locales/client.nb_NO.yml b/config/locales/client.nb_NO.yml
index 152c4a6aa74..041bba36d38 100644
--- a/config/locales/client.nb_NO.yml
+++ b/config/locales/client.nb_NO.yml
@@ -430,13 +430,13 @@ nb_NO:
title: "Legg til Bilde"
from_my_computer: "Fra Min Enhet"
from_the_web: "Fra Nettet"
- add_image: "Legg til Bilde"
+ add_title: "Legg til Bilde"
remote_title: "eksternt bilde"
remote_tip: "skriv inn addressen til et bilde, f.eks. http://example.com/image.jpg"
local_title: "lokalt bilde"
local_tip: "klikk for å velge et bilde fra din enhet."
- upload: "Last opp"
- upload_file: "Laster opp bilde"
+ upload_title: "Last opp"
+ uploading: "Laster opp bilde"
search:
title: "søk etter emner, innlegg, brukere eller kategorier"
diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml
index fb3380f251d..113fc09dbef 100644
--- a/config/locales/client.nl.yml
+++ b/config/locales/client.nl.yml
@@ -490,13 +490,13 @@ nl:
title: Voeg afbeelding toe
from_my_computer: Vanaf mijn apparaat
from_the_web: Vanaf het web
- add_image: Voeg afbeelding toe
+ add_title: Voeg afbeelding toe
remote_title: externe afbeelding
remote_tip: "vul een internetadres in van een afbeelding in deze vorm: http://example.com/image.jpg"
local_title: lokale afbeelding
local_tip: "klik om een afbeelding vanaf je apparaat te selecteren."
- upload: Uploaden
- upload_file: Afbeelding uploaden
+ upload_title: Uploaden
+ uploading: Afbeelding uploaden
search:
title: "zoek naar topics, posts, leden of categoriëen"
diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml
index fceae06e5f5..728361f5f34 100644
--- a/config/locales/client.pseudo.yml
+++ b/config/locales/client.pseudo.yml
@@ -474,14 +474,14 @@ pseudo:
title: '[[ Íɳšéřť Íɱáǧé ]]'
from_my_computer: '[[ Ƒřóɱ Ϻý Ďéνíčé ]]'
from_the_web: '[[ Ƒřóɱ Ťĥé Ŵéƀ ]]'
- add_image: '[[ Áďď Íɱáǧé ]]'
+ add_title: '[[ Áďď Íɱáǧé ]]'
remote_title: '[[ řéɱóťé íɱáǧé ]]'
remote_tip: '[[ éɳťéř áďďřéšš óƒ áɳ íɱáǧé íɳ ťĥé ƒóřɱ ĥťťƿ://éхáɱƿłé.čóɱ/íɱáǧé.ʲƿǧ
]]'
local_title: '[[ łóčáł íɱáǧé ]]'
local_tip: '[[ čłíčǩ ťó šéłéčť áɳ íɱáǧé ƒřóɱ ýóůř ďéνíčé. ]]'
- upload: '[[ Ůƿłóáď ]]'
- upload_file: '[[ Ůƿłóáďíɳǧ íɱáǧé ]]'
+ upload_title: '[[ Ůƿłóáď ]]'
+ uploading: '[[ Ůƿłóáďíɳǧ íɱáǧé ]]'
search:
title: '[[ šéářčĥ ƒóř ťóƿíčš, ƿóšťš, ůšéřš, óř čáťéǧóříéš ]]'
placeholder: '[[ ťýƿé ýóůř šéářčĥ ťéřɱš ĥéřé ]]'
diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml
index 0c6ef73b424..95facfd68b7 100644
--- a/config/locales/client.pt.yml
+++ b/config/locales/client.pt.yml
@@ -304,11 +304,11 @@ pt:
upload_selector:
from_my_computer: "Do meu dispositivo"
from_the_web: "Da internet"
- add_image: "Adicionar Imagem"
+ add_title: "Adicionar Imagem"
remote_tip: "insere o endereço de uma imagem no formato http://example.com/image.jpg"
local_tip: "clica para selecionar uma imagem no teu dispositivo."
- upload: "Enviar"
- upload_file: "A enviar imagem"
+ upload_title: "Enviar"
+ uploading: "A enviar imagem"
search:
title: "procurar por tópicos, posts, utilizadores, ou categorias"
diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml
index 7c336bba7a7..2fd3c56e28f 100644
--- a/config/locales/client.pt_BR.yml
+++ b/config/locales/client.pt_BR.yml
@@ -432,13 +432,13 @@ pt_BR:
title: "Enviar arquivo"
from_my_computer: "Do Meu Dispositivo"
from_the_web: "Da Internet"
- add_image: "Adicionar Arquivo"
+ add_title: "Adicionar Arquivo"
remote_title: "arquivo remoto"
remote_tip: "digite o endereço de um arquivo na forma http://exemplo.com/imagem.jpg"
local_title: "arquivo local"
local_tip: "clique para selecionar um arquivo do seu dispositivo"
- upload: "Enviar"
- upload_file: "Enviando"
+ upload_title: "Enviar"
+ uploading: "Enviando"
search:
title: "procurar por tópicos, posts, usuários, ou categorias"
placeholder: "escreve aqui o seu termo de buscar"
diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml
index 6db79cd5331..1df75111cca 100644
--- a/config/locales/client.ru.yml
+++ b/config/locales/client.ru.yml
@@ -490,13 +490,13 @@ ru:
title: Загрузить файл
from_my_computer: С устройства
from_the_web: Из интернета
- add_image: Добавить файл
+ add_title: Добавить файл
remote_title: удаленный файл
remote_tip: введите адрес файла в формате http://example.com/image.jpg
local_title: локальный файл
local_tip: кликните для выбора файла на вашем устройстве.
- upload: Загрузить
- upload_file: Загрузка
+ upload_title: Загрузить
+ uploading: Загрузка
search:
title: поиск по темам, сообщениям, пользователям или категориям
placeholder: условия поиска...
diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml
index e76eb10f0da..689a7675d04 100644
--- a/config/locales/client.sv.yml
+++ b/config/locales/client.sv.yml
@@ -356,11 +356,11 @@ sv:
title: "Infoga Bild"
from_my_computer: "Från Min Enhet"
from_the_web: "Från Internet"
- add_image: "Lägg Till Bild"
+ add_title: "Lägg Till Bild"
remote_tip: "skriv in en adress till en bild i formen http://exempel.se/bild.jpg"
local_tip: "klicka för att välja en bild från din enhet."
- upload: "Ladda Upp"
- upload_file: "Laddar upp bild"
+ upload_title: "Ladda Upp"
+ uploading: "Laddar upp bild"
search:
title: "sök efter trådar, inlägg, användare, eller kategorier"
diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml
index d31655612e6..d0aee4fa5f4 100644
--- a/config/locales/client.zh_CN.yml
+++ b/config/locales/client.zh_CN.yml
@@ -496,13 +496,13 @@ zh_CN:
title: "插入图片"
from_my_computer: "来自我的设备"
from_the_web: "来自网络"
- add_image: "添加图片"
+ add_title: "添加图片"
remote_title: "网络图片"
remote_tip: "输入图片网络,格式为:http://example.com/image.jpg"
local_title: "本地图片"
local_tip: "点击从你的设备中选择一张图片。"
- upload: "上传"
- upload_file: "上传图片中"
+ upload_title: "上传"
+ uploading: "上传图片中"
search:
title: "搜索主题、帖子、用户或分类"
diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml
index e4d25ac145b..25b1886477a 100644
--- a/config/locales/client.zh_TW.yml
+++ b/config/locales/client.zh_TW.yml
@@ -419,13 +419,13 @@ zh_TW:
title: "插入圖片"
from_my_computer: "來自我的設備"
from_the_web: "來自網絡"
- add_image: "添加圖片"
+ add_title: "添加圖片"
remote_title: "網絡圖片"
remote_tip: "輸入圖片網絡,格式爲:http://example.com/image.jpg"
local_title: "本地圖片"
local_tip: "點擊從你的設備中選擇一張圖片。"
- upload: "上傳"
- upload_file: "上傳圖片中"
+ upload_title: "上傳"
+ uploading: "上傳圖片中"
search:
title: "搜索主題、帖子、用戶或分類"