From e98009f6590d7a64ac31a3b2d320dc8a761e6a4f Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 25 Oct 2021 18:36:12 +0800 Subject: [PATCH] Fix bug. --- app/controllers/property_hires_controller.rb | 9 +++++++-- app/views/property_hires/hire_success.html.erb | 3 ++- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/controllers/property_hires_controller.rb b/app/controllers/property_hires_controller.rb index d54eab1..a606650 100644 --- a/app/controllers/property_hires_controller.rb +++ b/app/controllers/property_hires_controller.rb @@ -170,8 +170,13 @@ 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]}#{property.disable_content_page ? "?method=hire" : ""}" : "") rescue "#") - {"back_url"=>back_url} + back_button_text = I18n.t("property_hire.go_to_infos_page") + back_url = (page.url + (params[:slug].present? ? "/#{params[:slug]}" : "") rescue "#") + if @property.disable_content_page + back_url += "?method=hire" if params[:slug].present? + back_button_text = I18n.t("property_hire.back_to_hire_page") + end + {"back_url"=>back_url,"back_button_text"=>back_button_text} end def make_booking booking_p = booking_params diff --git a/app/views/property_hires/hire_success.html.erb b/app/views/property_hires/hire_success.html.erb index 4e1583f..9a9bf4e 100644 --- a/app/views/property_hires/hire_success.html.erb +++ b/app/views/property_hires/hire_success.html.erb @@ -1,8 +1,9 @@ <% data = action_data back_url = data["back_url"] + back_button_text = data["back_button_text"] %>

<%=t("property_hire.the_reservation_was_successfully_sent")%>

- <%=t("property_hire.go_to_infos_page")%> + <%=back_button_text%>
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index d8fd97c..73d6505 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,6 +5,7 @@ en: restful_actions: fields_display_order: "Fields display order" property_hire: + back_to_hire_page: "Back to Reserve Page" apply_default_time_settings: Apply default time settings default_time_settings: Default time settings the_reservation_was_successfully_sent: "The reservation was successfully sent!Please see email to get more information" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index fdb564b..312e738 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -5,6 +5,7 @@ zh_tw: restful_actions: fields_display_order: "欄位顯示順序" property_hire: + back_to_hire_page: "回到預約頁面" apply_default_time_settings: 套用預設時段設定 default_time_settings: 預設時段設定 the_reservation_was_successfully_sent: "預約成功送出,請查看Email確認預約資訊!"