mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 19:08:10 -05:00
Merge pull request #1097 from ZogStriP/blob-blob-blob
provide a way to give a default filename to pasted images...
This commit is contained in:
commit
63d967e634
17 changed files with 51 additions and 4 deletions
|
@ -1045,6 +1045,7 @@ cs:
|
||||||
deleted: 'smazáno'
|
deleted: 'smazáno'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: "Bohužel, nastala chybí při získávání obrázku."
|
fetch_failure: "Bohužel, nastala chybí při získávání obrázku."
|
||||||
unknown_image_type: "Bohužel, soubor, který se snažíte nahrát, zřejmě není obrázek."
|
unknown_image_type: "Bohužel, soubor, který se snažíte nahrát, zřejmě není obrázek."
|
||||||
|
|
|
@ -783,3 +783,6 @@ da:
|
||||||
see_more: "Se mere"
|
see_more: "Se mere"
|
||||||
search_title: "Søg efter dette emne"
|
search_title: "Søg efter dette emne"
|
||||||
search_google: "Søg Google"
|
search_google: "Søg Google"
|
||||||
|
|
||||||
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
|
|
|
@ -1005,6 +1005,7 @@ de:
|
||||||
deleted: 'gelöscht'
|
deleted: 'gelöscht'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: "Entschuldige, beim Laden des Bildes ist ein Fehler aufgetreten."
|
fetch_failure: "Entschuldige, beim Laden des Bildes ist ein Fehler aufgetreten."
|
||||||
unknown_image_type: "Entschuldige, aber die Datei die Du hochladen möchtest schein kein Bild zu sein."
|
unknown_image_type: "Entschuldige, aber die Datei die Du hochladen möchtest schein kein Bild zu sein."
|
||||||
|
|
|
@ -1039,6 +1039,7 @@ en:
|
||||||
deleted: 'deleted'
|
deleted: 'deleted'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: "Pasted image"
|
||||||
image:
|
image:
|
||||||
fetch_failure: "Sorry, there has been an error while fetching the image."
|
fetch_failure: "Sorry, there has been an error while fetching the image."
|
||||||
unknown_image_type: "Sorry, but the file you tried to upload doesn't appear to be an image."
|
unknown_image_type: "Sorry, but the file you tried to upload doesn't appear to be an image."
|
||||||
|
|
|
@ -763,3 +763,6 @@ es:
|
||||||
see_more: "Ver Más"
|
see_more: "Ver Más"
|
||||||
search_title: "Buscar por este tema"
|
search_title: "Buscar por este tema"
|
||||||
search_google: "Buscar en Google"
|
search_google: "Buscar en Google"
|
||||||
|
|
||||||
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
|
|
|
@ -944,6 +944,7 @@ fr:
|
||||||
deleted: 'supprimmé'
|
deleted: 'supprimmé'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: "Image collée"
|
||||||
image:
|
image:
|
||||||
fetch_failure: "Désolé, une erreur s'est produite lorsque nous avons essayé de récupérer l'image."
|
fetch_failure: "Désolé, une erreur s'est produite lorsque nous avons essayé de récupérer l'image."
|
||||||
unknown_image_type: "Désolé, mais le fichier que vous essayez d'envoyer ne semble pas être une image."
|
unknown_image_type: "Désolé, mais le fichier que vous essayez d'envoyer ne semble pas être une image."
|
||||||
|
|
|
@ -780,3 +780,6 @@ id:
|
||||||
see_more: "See More"
|
see_more: "See More"
|
||||||
search_title: "Search for this topic"
|
search_title: "Search for this topic"
|
||||||
search_google: "Search Google"
|
search_google: "Search Google"
|
||||||
|
|
||||||
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
|
|
|
@ -918,6 +918,7 @@ it:
|
||||||
deleted: 'cancellato'
|
deleted: 'cancellato'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: "Spiacente, si è verificato un errore nel recupero dell'immagine."
|
fetch_failure: "Spiacente, si è verificato un errore nel recupero dell'immagine."
|
||||||
unknown_image_type: "Spiacente, ma il file che hai provato a caricare non sembra un'immagine."
|
unknown_image_type: "Spiacente, ma il file che hai provato a caricare non sembra un'immagine."
|
||||||
|
|
|
@ -970,6 +970,7 @@ nl:
|
||||||
deleted: 'verwijderd'
|
deleted: 'verwijderd'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: "Er ging iets mis bij het opvragen van de afbeelding."
|
fetch_failure: "Er ging iets mis bij het opvragen van de afbeelding."
|
||||||
unknown_image_type: "Het bestand dat je wil uploaden is geen afbeelding."
|
unknown_image_type: "Het bestand dat je wil uploaden is geen afbeelding."
|
||||||
|
|
|
@ -1075,6 +1075,7 @@ pseudo:
|
||||||
áɳď ƿéřɱíťťéď áššíǧɳš. ]]'
|
áɳď ƿéřɱíťťéď áššíǧɳš. ]]'
|
||||||
deleted: '[[ ďéłéťéď ]]'
|
deleted: '[[ ďéłéťéď ]]'
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: '[[ Šóřřý, ťĥéřé ĥáš ƀééɳ áɳ éřřóř ŵĥíłé ƒéťčĥíɳǧ ťĥé íɱáǧé.
|
fetch_failure: '[[ Šóřřý, ťĥéřé ĥáš ƀééɳ áɳ éřřóř ŵĥíłé ƒéťčĥíɳǧ ťĥé íɱáǧé.
|
||||||
]]'
|
]]'
|
||||||
|
|
|
@ -682,3 +682,6 @@ pt:
|
||||||
|
|
||||||
discourse_hub:
|
discourse_hub:
|
||||||
access_token_problem: "Conta a um admin: Por-favor atualiza as configurações do site para incluir o discourse_org_access_key correto."
|
access_token_problem: "Conta a um admin: Por-favor atualiza as configurações do site para incluir o discourse_org_access_key correto."
|
||||||
|
|
||||||
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
|
|
|
@ -1023,6 +1023,7 @@ ru:
|
||||||
miscellaneous: 'This Agreement constitutes the entire agreement between %{company_short_name} and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of %{company_short_name}, or by the posting by %{company_short_name} of a revised version. Except to the extent applicable law, if any, provides otherwise, this Agreement, any access to or use of the Website will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions, and the proper venue for any disputes arising out of or relating to any of the same will be the state and federal courts located in San Francisco County, California. Except for claims for injunctive or equitable relief or claims regarding intellectual property rights (which may be brought in any competent court without the posting of a bond), any dispute arising under this Agreement shall be finally settled in accordance with the Comprehensive Arbitration Rules of the Judicial Arbitration and Mediation Service, Inc. (“JAMS”) by three arbitrators appointed in accordance with such Rules. The arbitration shall take place in San Francisco, California, in the English language and the arbitral decision may be enforced in any court. The prevailing party in any action or proceeding to enforce this Agreement shall be entitled to costs and attorneys’ fees. If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect. A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms and conditions; %{company_short_name} may assign its rights under this Agreement without condition. This Agreement will be binding upon and will inure to the benefit of the parties, their successors and permitted assigns.'
|
miscellaneous: 'This Agreement constitutes the entire agreement between %{company_short_name} and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of %{company_short_name}, or by the posting by %{company_short_name} of a revised version. Except to the extent applicable law, if any, provides otherwise, this Agreement, any access to or use of the Website will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions, and the proper venue for any disputes arising out of or relating to any of the same will be the state and federal courts located in San Francisco County, California. Except for claims for injunctive or equitable relief or claims regarding intellectual property rights (which may be brought in any competent court without the posting of a bond), any dispute arising under this Agreement shall be finally settled in accordance with the Comprehensive Arbitration Rules of the Judicial Arbitration and Mediation Service, Inc. (“JAMS”) by three arbitrators appointed in accordance with such Rules. The arbitration shall take place in San Francisco, California, in the English language and the arbitral decision may be enforced in any court. The prevailing party in any action or proceeding to enforce this Agreement shall be entitled to costs and attorneys’ fees. If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect. A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms and conditions; %{company_short_name} may assign its rights under this Agreement without condition. This Agreement will be binding upon and will inure to the benefit of the parties, their successors and permitted assigns.'
|
||||||
deleted: удалено
|
deleted: удалено
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: Извините, во время извлечения изображения произошла ошибка.
|
fetch_failure: Извините, во время извлечения изображения произошла ошибка.
|
||||||
unknown_image_type: Файл, который вы загружаете, не является изображением.
|
unknown_image_type: Файл, который вы загружаете, не является изображением.
|
||||||
|
|
|
@ -838,3 +838,6 @@ sv:
|
||||||
see_more: "See More"
|
see_more: "See More"
|
||||||
search_title: "Search for this topic"
|
search_title: "Search for this topic"
|
||||||
search_google: "Search Google"
|
search_google: "Search Google"
|
||||||
|
|
||||||
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
|
|
|
@ -932,6 +932,7 @@ zh_CN:
|
||||||
deleted: '已删除'
|
deleted: '已删除'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: "抱歉,获取图片時发生错误。"
|
fetch_failure: "抱歉,获取图片時发生错误。"
|
||||||
unknown_image_type: "抱歉,你上传的文件似乎不是一张图片。"
|
unknown_image_type: "抱歉,你上传的文件似乎不是一张图片。"
|
||||||
|
|
|
@ -918,6 +918,7 @@ zh_TW:
|
||||||
deleted: '已刪除'
|
deleted: '已刪除'
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
|
pasted_image_filename: ""
|
||||||
image:
|
image:
|
||||||
fetch_failure: "抱歉,獲取圖片時發生錯誤。"
|
fetch_failure: "抱歉,獲取圖片時發生錯誤。"
|
||||||
unknown_image_type: "抱歉,你上傳的文件似乎不是一張圖片。"
|
unknown_image_type: "抱歉,你上傳的文件似乎不是一張圖片。"
|
||||||
|
|
|
@ -141,19 +141,23 @@ class CookedPostProcessor
|
||||||
meta["class"] = "meta"
|
meta["class"] = "meta"
|
||||||
img.add_next_sibling meta
|
img.add_next_sibling meta
|
||||||
|
|
||||||
filename = upload ? upload.original_filename : File.basename(src)
|
filename = get_filename(upload, src)
|
||||||
informations = "#{original_width}x#{original_height}"
|
informations = "#{original_width}x#{original_height}"
|
||||||
informations << " | #{number_to_human_size(upload.filesize)}" if upload
|
informations << " | #{number_to_human_size(upload.filesize)}" if upload
|
||||||
|
|
||||||
meta.add_child create_span_node("filename", filename)
|
meta.add_child create_span_node("filename", filename)
|
||||||
meta.add_child create_span_node("informations", informations)
|
meta.add_child create_span_node("informations", informations)
|
||||||
meta.add_child create_span_node("expand")
|
meta.add_child create_span_node("expand")
|
||||||
# TODO: download
|
|
||||||
# TODO: views-count
|
|
||||||
|
|
||||||
@dirty = true
|
@dirty = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_filename(upload, src)
|
||||||
|
return File.basename(src) unless upload
|
||||||
|
return upload.original_filename unless upload.original_filename == "blob"
|
||||||
|
return I18n.t('upload.pasted_image_filename')
|
||||||
|
end
|
||||||
|
|
||||||
def create_span_node(klass, content=nil)
|
def create_span_node(klass, content=nil)
|
||||||
span = Nokogiri::XML::Node.new "span", @doc
|
span = Nokogiri::XML::Node.new "span", @doc
|
||||||
span.content = content if content
|
span.content = content if content
|
||||||
|
|
|
@ -218,4 +218,22 @@ describe CookedPostProcessor do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'get_filename' do
|
||||||
|
|
||||||
|
it "returns the filename of the src when there is no upload" do
|
||||||
|
cpp.get_filename(nil, "http://domain.com/image.png").should == "image.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns the original filename of the upload when there is an upload" do
|
||||||
|
upload = Fabricate.build(:upload, { original_filename: "upload.jpg" })
|
||||||
|
cpp.get_filename(upload, "http://domain.com/image.png").should == "upload.jpg"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns a generic name for pasted images" do
|
||||||
|
upload = Fabricate.build(:upload, { original_filename: "blob" })
|
||||||
|
cpp.get_filename(upload, "http://domain.com/image.png").should == I18n.t('upload.pasted_image_filename')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue