From: Anton Khorev Date: Sun, 4 Aug 2024 15:46:25 +0000 (+0300) Subject: Merge branch 'pull/5023' X-Git-Tag: live~962 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/fa9654fe90bc3352f16bb2924191af2217a83663?hp=1e15b89f763d103cc33acbf5be21db912c080528 Merge branch 'pull/5023' --- diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 5d63e79fd..58f0a11c9 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index 278edf364..a69416337 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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