]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'pull/5023'
authorAnton Khorev <tony29@yandex.ru>
Sun, 4 Aug 2024 15:46:25 +0000 (18:46 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sun, 4 Aug 2024 15:46:25 +0000 (18:46 +0300)
app/controllers/site_controller.rb
config/locales/en.yml

index 5d63e79fd3937fc178791920477b3668129e92ce..58f0a11c9340bbd796082622f3d6dcdbe852d13d 100644 (file)
@@ -138,7 +138,12 @@ class SiteController < ApplicationController
   end
 
   def preview
-    render :html => RichText.new(params[:type], params[:text]).to_html
+    if params[:text].blank?
+      flash.now[:warning] = t("layouts.nothing_to_preview")
+      render :partial => "layouts/flash"
+    else
+      render :html => RichText.new(params[:type], params[:text]).to_html
+    end
   end
 
   def id
index 278edf3644e824c9af803cec5e617577c21c11d3..a694163377f100a3c3a89261d07d1d8ad0a3ecb1 100644 (file)
@@ -1586,6 +1586,7 @@ en:
     tou: "Terms of Use"
     osm_offline: "The OpenStreetMap database is currently offline while essential database maintenance work is carried out."
     osm_read_only: "The OpenStreetMap database is currently in read-only mode while essential database maintenance work is carried out."
+    nothing_to_preview: "Nothing to preview."
     donate: "Support OpenStreetMap by %{link} to the Hardware Upgrade Fund."
     help: Help
     about: About