app/helpers/poodle/display_helper.rb in poodle-rb-0.0.2 vs app/helpers/poodle/display_helper.rb in poodle-rb-0.0.3
- old
+ new
@@ -1,9 +1,11 @@
module Poodle
module DisplayHelper
-
- def scrap_word(text, char_count_limit, more_text = nil, more_link = nil,style='')
+ # Example
+ # scrap_word(long_text, 120)
+ # scrap_word(long_text, 120, "Read More", read_more_url)
+ def scrap_word(text, char_count_limit, more_text = nil, more_link = nil, style='')
# remove HTML tags
text = text.to_s.gsub(/<\/?[^>]*>/, " ")
# remove additional spaces
text = text.to_s.gsub(/[ ]+/, " ")
if text.length < char_count_limit
@@ -26,11 +28,10 @@
end
end
return teaser
end
- def display_time(disp_time, class_name = nil)
- return distance_of_time_in_words_to_now(disp_time) + " ago"
+ def display_time(time)
+ distance_of_time_in_words_to_now(time) + (time > Time.now ? " from now" : " ago")
end
-
end
end
\ No newline at end of file