Merge pull request #1225 from ZogStriP/upload-selector-handles-attachments
uploads selector texts is now different when attachments are enabled
This commit is contained in:
commit
7c5e15966f
|
@ -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;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<div id='draft-status'></div>
|
||||
{{#if view.isUploading}}
|
||||
<div id="file-uploading">
|
||||
{{i18n upload_selector.upload_file}} {{view.uploadProgress}}% <a id="cancel-file-upload">{{i18n cancel}}</a>
|
||||
{{i18n upload_selector.uploading}} {{view.uploadProgress}}% <a id="cancel-file-upload">{{i18n cancel}}</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<ul class="nav nav-pills">
|
||||
<li title="{{i18n upload_selector.local_title}}" {{bindAttr class="localSelected:active"}}>
|
||||
<li {{bindAttr title="localTitle" class="localSelected:active"}}>
|
||||
<a href="#" {{action selectLocal}}>{{i18n upload_selector.from_my_computer}}</a>
|
||||
</li>
|
||||
<li title="{{i18n upload_selector.remote_title}}" {{bindAttr class="remoteSelected:active"}}>
|
||||
<li {{bindAttr title="remoteTitle" class="remoteSelected:active"}}>
|
||||
<a href="#" {{action selectRemote}}>{{i18n upload_selector.from_the_web}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -11,26 +11,26 @@
|
|||
<div class='modal-body'>
|
||||
<form>
|
||||
<input type="file" name="file" id="filename-input" value="browse"><br>
|
||||
<span class='description'>{{i18n upload_selector.local_tip}}</span> <br>
|
||||
<span class='description'>{{localTip}}</span> <br>
|
||||
</form>
|
||||
</div>
|
||||
<div class='modal-footer'>
|
||||
<button class='btn btn-large btn-primary' {{action upload target="view"}}>
|
||||
<span class='add-upload'><i class='icon-file-alt'></i><i class='icon-plus'></i></span>
|
||||
{{i18n upload_selector.upload}}
|
||||
{{uploadTitle}}
|
||||
</button>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class='modal-body'>
|
||||
<form>
|
||||
<input type="text" name="text" id="fileurl-input" autofocus><br>
|
||||
<span class='description'>{{i18n upload_selector.remote_tip}}</span> <br>
|
||||
<span class='description'>{{remoteTip}}</span> <br>
|
||||
</form>
|
||||
</div>
|
||||
<div class='modal-footer'>
|
||||
<button class='btn btn-large btn-primary' {{action add target="view"}}>
|
||||
<span class='add-upload'><i class='icon-file-alt'></i><i class='icon-plus'></i></span>
|
||||
{{i18n upload_selector.add_image}}
|
||||
{{addTitle}}
|
||||
</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -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') });
|
||||
|
|
|
@ -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í"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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: "주제, 게시물, 사용자, 카테고리를 검색합니다"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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: '[[ ťýƿé ýóůř šéářčĥ ťéřɱš ĥéřé ]]'
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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: условия поиска...
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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: "搜索主题、帖子、用户或分类"
|
||||
|
|
|
@ -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: "搜索主題、帖子、用戶或分類"
|
||||
|
|
Loading…
Reference in New Issue