Fixes #3748. Added check to SiteController#preview to detect if (message, diary entry, diary entry comment) body is empty and if positive, returns rendered bootstrap alert "Nothing to preview" to be displayed in richtext_field.
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
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