From c0261a90d8295c0e7c618ad242cb3e91b0c238d2 Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 25 Oct 2021 18:29:03 +0800 Subject: [PATCH] Fix bug. --- app/controllers/property_hires_controller.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/property_hires_controller.rb b/app/controllers/property_hires_controller.rb index b4c4181..d54eab1 100644 --- a/app/controllers/property_hires_controller.rb +++ b/app/controllers/property_hires_controller.rb @@ -128,17 +128,20 @@ 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" - } - 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=hire" } + unless property.disable_view_calendar_page + actions << { + "text" => t("property_hire.view_calendar"), + "btn-class" => "btn-info", + "link" => url_to_show + "?method=view_calendar" + } + end end { "data" => data, @@ -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