app/models/product.rb
# assuming long description is in plain text, tries to convert to HTML with bullet points
assuming long description is in plain text, tries to convert to HTML with bullet points
assuming long description is in plain text tries to convert to HTML with bullet points
def html_description
    if long_description.nil?
      paragraphs = []
    else
      paragraphs = long_description.delete("\r").gsub("\n\n", "\n").split("\n")
    end
    str = paragraphs.map { |x| "<p>#{x}</p>" }.join
    str += "\n<!--product-details-->\n"
    bullets = []
    (1..10).each do |x|
      point = get_property("Bullet #{x}")
      bullets << point unless point.blank?
    end
    if bullets.length > 0
      str += "<ul>"
      str += bullets.map { |x| "<li>#{x}</li>" }.join
      str += "</ul>"
    end
    str += "\n<!--sizing-->\n"
    str += get_property("sizing info")
    str += "\n<!--care-instructions-->\n"
    str += "<p>" + get_property("Care Instructions") + "</p>"
  end
def html_description if long_description . nil? paragraphs = [ ] else paragraphs = long_description . delete ( "\r" ) . gsub ( "\n\n" , "\n" ) . split ( "\n" ) end str = paragraphs . map { | x | "<p>#{x}</p>" } . join str += "\n<!--product-details-->\n" bullets = [ ] ( 1 .. 10 ) . each do | x | point = get_property ( "Bullet #{x}" ) bullets << point unless point . blank? end if bullets . length > 0 str += "<ul>" str += bullets . map { | x | "<li>#{x}</li>" } . join str += "</ul>" end str += "\n<!--sizing-->\n" str += get_property ( "sizing info" ) str += "\n<!--care-instructions-->\n" str += "<p>" + get_property ( "Care Instructions" ) + "</p>" end
assuming long description is in plain text, tries to convert to HTML with bullet points
assuming long description is in plain text tries to convert to HTML with bullet points