This commit is contained in:
BoHung Chiu 2021-10-25 18:29:03 +08:00
parent 74881746ab
commit c0261a90d8
1 changed files with 10 additions and 7 deletions

View File

@ -128,18 +128,21 @@ class PropertyHiresController < ApplicationController
}
end
actions = []
url_to_show = OrbitHelper.url_to_show(property.to_param)
if property.can_be_hired
actions << {
"text" => t("property_hire.hire"),
"btn-class" => "btn-primary",
"link" => OrbitHelper.url_to_show(property.to_param) + "?method=hire"
"link" => url_to_show + "?method=hire"
}
unless property.disable_view_calendar_page
actions << {
"text" => t("property_hire.view_calendar"),
"btn-class" => "btn-info",
"link" => OrbitHelper.url_to_show(property.to_param) + "?method=view_calendar"
"link" => url_to_show + "?method=view_calendar"
}
end
end
{
"data" => data,
"actions" => actions,
@ -167,7 +170,7 @@ class PropertyHiresController < ApplicationController
params = OrbitHelper.params
@property = Property.where(:uid => params[:uid]).first rescue nil
page = OrbitHelper.page rescue Page.where(:page_id => params[:page_id]).first
back_url = (page.url + (params[:slug].present? ? "/#{params[:slug]}" : "") rescue "#")
back_url = (page.url + (params[:slug].present? ? "/#{params[:slug]}#{property.disable_content_page ? "?method=hire" : ""}" : "") rescue "#")
{"back_url"=>back_url}
end
def make_booking