Added details box
This commit is contained in:
@@ -36,6 +36,3 @@ module Wince::Yelp
|
||||
|
||||
end
|
||||
|
||||
#response = Wince::Yelp.search_businesses("miss saigon", "94610")
|
||||
#puts response.status_code
|
||||
#puts response.body
|
||||
|
||||
@@ -33,4 +33,12 @@ module Wince::Utils
|
||||
6
|
||||
end
|
||||
end
|
||||
|
||||
def format_address(display_address_json : JSON::Any)
|
||||
display_address_json.as_a.map { |line| line.as_s? || "" }.join("\n")
|
||||
end
|
||||
|
||||
def load_url_to_image(url : String, image : Gtk::Image)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -93,7 +93,6 @@ module Wince
|
||||
|
||||
response_json = JSON.parse(response.body)
|
||||
|
||||
SEE_DETAILS_TEXT.visible = false
|
||||
DETAILS_TITLE.text = response_json["name"].as_s? || ""
|
||||
|
||||
is_open = response_json["hours"][0]["is_open_now"].as_bool? || false
|
||||
@@ -105,7 +104,13 @@ module Wince
|
||||
end
|
||||
|
||||
DETAILS_CURRENT_HOURS.text = Utils.hours_for_day(response_json["hours"], Time.local.day_of_week)
|
||||
DETAILS_PRICING.text = response_json["price"].as_s? || ""
|
||||
DETAILS_ADDRESS.markup = Utils.format_address(response_json["location"]["display_address"])
|
||||
DETAILS_PHONE.text = response_json["display_phone"].as_s? || ""
|
||||
DETAILS_URL.uri = response_json["url"].as_s? || ""
|
||||
|
||||
DETAILS_BOX.visible = true
|
||||
LEAFLET.visible_child = DETAILS_BOX
|
||||
end
|
||||
|
||||
APP.activate_signal.connect(->activate(Adw::Application))
|
||||
|
||||
@@ -13,11 +13,14 @@ module Wince
|
||||
POWERD_BY_TEXT = Gtk::Label.cast(B_UI["poweredByText"])
|
||||
SCROLL_VIEW = Gtk::ScrolledWindow.cast(B_UI["scrollWindow"])
|
||||
LEAFLET = Adw::Leaflet.cast(B_UI["leaflet"])
|
||||
SEE_DETAILS_TEXT = Gtk::Label.cast(B_UI["seeDetailsText"])
|
||||
DETAILS_BOX = Gtk::Box.cast(B_UI["detailsBox"])
|
||||
DETAILS_TITLE = Gtk::Label.cast(B_UI["detailsTitle"])
|
||||
DETAILS_IS_OPEN = Gtk::Label.cast(B_UI["detailsIsOpen"])
|
||||
DETAILS_CURRENT_HOURS = Gtk::Label.cast(B_UI["detailsCurrentHours"])
|
||||
DETAILS_PRICING = Gtk::Label.cast(B_UI["detailsPricing"])
|
||||
DETAILS_ADDRESS = Gtk::Label.cast(B_UI["detailsAddress"])
|
||||
DETAILS_PHONE = Gtk::Label.cast(B_UI["detailsPhone"])
|
||||
DETAILS_URL = Gtk::LinkButton.cast(B_UI["detailsUrl"])
|
||||
|
||||
APP = Adw::Application.new("dev.wince", Gio::ApplicationFlags::None)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user