safai 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/safai.rb +18 -0
  2. metadata +1 -1
data/lib/safai.rb CHANGED
@@ -19,6 +19,24 @@ class Safai
19
19
  i.year == Time.now.year ? i.strftime("%d-%b") : i.strftime("%d-%b-%Y")
20
20
  end
21
21
 
22
+ def smart_due_date(i)
23
+ if i == nil
24
+ return ""
25
+ elsif i.class.to_s == "Time" or i.class.to_s == "ActiveSupport::TimeWithZone"
26
+ i = i.to_date
27
+ end
28
+ if Date.today == i
29
+ return "<span style=\"background-color:#F7FAB9;padding:0px 2px 0px 2px;\">Today</span>"
30
+ elsif i - Date.today == 1
31
+ return "<span style=\"background-color:#F7FAB9;padding:0px 2px 0px 2px;\">Tomorrow</span>"
32
+ elsif Date.today - i > 0.9
33
+ return "<span style=\"background-color:#FFC7C7;padding:0px 2px 0px 2px;\">" + smart_date(i) + "</span>"
34
+ elsif Date.today - i < 1
35
+ return "<span style=\"background-color:#D2FFCC;padding:0px 2px 0px 2px;\">" + smart_date(i) + "</span>"
36
+ end
37
+ return smart_date(i)
38
+ end
39
+
22
40
  def location_summary(u)
23
41
  return Safai::Address.to_s(u)
24
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: