Created
December 21, 2015 20:43
-
-
Save chris-roerig/66aa25e5c1b9cbcce989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
class ExpectedDeliveryDateRow | |
include Helper::Date | |
include KioskDashboardCard::ViewHelpers | |
def initialize(is_deliverd, delivery_date) | |
@is_deliverd = is_deliverd | |
@delivery_date = delivery_date | |
end | |
def to_s | |
"#{displayed_icon} #{text}" | |
end | |
private | |
def displayed_icon | |
shipped = icon("ico-check-circle", class: "ok") | |
in_transit = icon("ico-truck", class: "warning") | |
(@is_delivered == 1) ? shipped : in_transit | |
end | |
def text | |
month_day_year(DateTime.strptime(@delivery_date ,"%Y-%m-%d %H:%M:%S")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment