1.設定 不可預約 的資料只有登入的會員才能查看(查詢目前已預約狀況)。
2.設定 不可預約 的資料只有管理者帳號才能預約租借(線上預約)。 3.可以設定未登入的使用者無法查看查詢目前已預約狀況
This commit is contained in:
parent
864358bd69
commit
6ad48313ed
|
@ -30,6 +30,7 @@ class PropertyHiresController < ApplicationController
|
||||||
data = properties.collect do |property|
|
data = properties.collect do |property|
|
||||||
actions = []
|
actions = []
|
||||||
url_to_show = "#{url}/#{property.to_param}"
|
url_to_show = "#{url}/#{property.to_param}"
|
||||||
|
hire_url = nil
|
||||||
if property.can_be_hired_frontend
|
if property.can_be_hired_frontend
|
||||||
hire_url = url_to_show + "?method=hire"
|
hire_url = url_to_show + "?method=hire"
|
||||||
actions << {
|
actions << {
|
||||||
|
@ -38,7 +39,7 @@ class PropertyHiresController < ApplicationController
|
||||||
"link" => hire_url
|
"link" => hire_url
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
unless property.disable_view_calendar_page
|
if !property.disable_view_calendar_page && property.can_be_show_frontend
|
||||||
actions << {
|
actions << {
|
||||||
"text" => t("property_hire.view_calendar"),
|
"text" => t("property_hire.view_calendar"),
|
||||||
"btn-class" => "btn-info",
|
"btn-class" => "btn-info",
|
||||||
|
@ -48,7 +49,7 @@ class PropertyHiresController < ApplicationController
|
||||||
if property.disable_content_page
|
if property.disable_content_page
|
||||||
if hire_url
|
if hire_url
|
||||||
url_to_show = hire_url
|
url_to_show = hire_url
|
||||||
elsif !property.disable_view_calendar_page
|
elsif !property.disable_view_calendar_page && property.can_be_show_frontend
|
||||||
url_to_show += "?method=view_calendar"
|
url_to_show += "?method=view_calendar"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -168,7 +169,7 @@ class PropertyHiresController < ApplicationController
|
||||||
"link" => url_to_show + "?method=hire"
|
"link" => url_to_show + "?method=hire"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
unless property.disable_view_calendar_page
|
if !property.disable_view_calendar_page && property.can_be_show_frontend
|
||||||
actions << {
|
actions << {
|
||||||
"text" => t("property_hire.view_calendar"),
|
"text" => t("property_hire.view_calendar"),
|
||||||
"btn-class" => "btn-info",
|
"btn-class" => "btn-info",
|
||||||
|
@ -190,6 +191,9 @@ class PropertyHiresController < ApplicationController
|
||||||
def view_calendar
|
def view_calendar
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
property = Property.where(:uid => params[:uid]).first rescue nil
|
property = Property.where(:uid => params[:uid]).first rescue nil
|
||||||
|
if property.disable_view_calendar_page || !property.can_be_show_frontend
|
||||||
|
return nil
|
||||||
|
end
|
||||||
page = Page.where(:page_id => params[:page_id]).first
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
return {} if property.nil?
|
return {} if property.nil?
|
||||||
{
|
{
|
||||||
|
@ -297,6 +301,9 @@ class PropertyHiresController < ApplicationController
|
||||||
def hire
|
def hire
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
property = Property.where(:uid => params[:uid]).first rescue nil
|
property = Property.where(:uid => params[:uid]).first rescue nil
|
||||||
|
if !property.can_be_hired_frontend
|
||||||
|
return nil
|
||||||
|
end
|
||||||
page = Page.where(:page_id => params[:page_id]).first
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
return {} if property.nil?
|
return {} if property.nil?
|
||||||
hire = nil
|
hire = nil
|
||||||
|
|
|
@ -158,9 +158,11 @@ class Property
|
||||||
if setting
|
if setting
|
||||||
@@disable_content_page = setting.disable_content_page rescue false
|
@@disable_content_page = setting.disable_content_page rescue false
|
||||||
@@disable_view_calendar_page = setting.disable_view_calendar_page rescue false
|
@@disable_view_calendar_page = setting.disable_view_calendar_page rescue false
|
||||||
|
@@disable_no_logins_view_calendar = setting.disable_no_logins_view_calendar rescue false
|
||||||
else
|
else
|
||||||
@@disable_content_page = false
|
@@disable_content_page = false
|
||||||
@@disable_view_calendar_page = false
|
@@disable_view_calendar_page = false
|
||||||
|
@@disable_no_logins_view_calendar = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
init_class_variables
|
init_class_variables
|
||||||
|
@ -170,6 +172,9 @@ class Property
|
||||||
def disable_view_calendar_page
|
def disable_view_calendar_page
|
||||||
@@disable_view_calendar_page
|
@@disable_view_calendar_page
|
||||||
end
|
end
|
||||||
|
def disable_no_logins_view_calendar
|
||||||
|
@@disable_no_logins_view_calendar
|
||||||
|
end
|
||||||
def custom_text(field_name,type="name",locale=nil)
|
def custom_text(field_name,type="name",locale=nil)
|
||||||
locale = locale || I18n.locale
|
locale = locale || I18n.locale
|
||||||
default_text = I18n.with_locale(locale){I18n.t("property_hire.#{field_name}")}
|
default_text = I18n.with_locale(locale){I18n.t("property_hire.#{field_name}")}
|
||||||
|
@ -565,4 +570,8 @@ class Property
|
||||||
user = OrbitHelper.current_user
|
user = OrbitHelper.current_user
|
||||||
self.can_be_hired || (user && (user.is_admin? || property.owners.include?(user.member_profile_id)))
|
self.can_be_hired || (user && (user.is_admin? || property.owners.include?(user.member_profile_id)))
|
||||||
end
|
end
|
||||||
|
def can_be_show_frontend
|
||||||
|
user = OrbitHelper.current_user
|
||||||
|
(!disable_no_logins_view_calendar && self.can_be_hired) || user
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -6,6 +6,7 @@ class PropertyHireSetting
|
||||||
field :carousel_image_width, type: String, :default => "75%"
|
field :carousel_image_width, type: String, :default => "75%"
|
||||||
field :disable_content_page, type: Boolean, :default => false
|
field :disable_content_page, type: Boolean, :default => false
|
||||||
field :disable_view_calendar_page, type: Boolean, :default => false
|
field :disable_view_calendar_page, type: Boolean, :default => false
|
||||||
|
field :disable_no_logins_view_calendar, type: Boolean, :default => false
|
||||||
field :allow_no_logins_user, type: Boolean, :default => false
|
field :allow_no_logins_user, type: Boolean, :default => false
|
||||||
field :calendar_type, type: Integer, default: 0 # 0=> 顯示, 1=> 不顯示
|
field :calendar_type, type: Integer, default: 0 # 0=> 顯示, 1=> 不顯示
|
||||||
def self.auto_approve_enabled?
|
def self.auto_approve_enabled?
|
||||||
|
|
|
@ -65,6 +65,12 @@
|
||||||
<%= f.check_box :disable_view_calendar_page %>
|
<%= f.check_box :disable_view_calendar_page %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :disable_no_logins_view_calendar, t("property_hire.disable_no_logins_view_calendar"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.check_box :disable_no_logins_view_calendar %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :carousel_image_width, t("property_hire.default_carousel_image_width"), :class => "control-label muted" %>
|
<%= f.label :carousel_image_width, t("property_hire.default_carousel_image_width"), :class => "control-label muted" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
|
@ -44,6 +44,7 @@ en:
|
||||||
files_links: "Files, Links"
|
files_links: "Files, Links"
|
||||||
disable_content_page: Disable content page
|
disable_content_page: Disable content page
|
||||||
disable_view_calendar_page: 'Disable "Calendar" page'
|
disable_view_calendar_page: 'Disable "Calendar" page'
|
||||||
|
disable_no_logins_view_calendar: 'Disable Calendar page for no logins user'
|
||||||
display_img: Display Cover Image in Content Page
|
display_img: Display Cover Image in Content Page
|
||||||
carousel_image: Carousel Image
|
carousel_image: Carousel Image
|
||||||
carousel_image_title: Carousel Image(display at the bottom of show page)
|
carousel_image_title: Carousel Image(display at the bottom of show page)
|
||||||
|
|
|
@ -44,6 +44,7 @@ zh_tw:
|
||||||
files_links: "檔案與連結"
|
files_links: "檔案與連結"
|
||||||
disable_content_page: 關閉內容頁
|
disable_content_page: 關閉內容頁
|
||||||
disable_view_calendar_page: '關閉"查詢目前預約狀況"頁面'
|
disable_view_calendar_page: '關閉"查詢目前預約狀況"頁面'
|
||||||
|
disable_no_logins_view_calendar: '關閉未登入使用者"查詢目前預約狀況"頁面'
|
||||||
display_img: 內容頁顯示封面圖片
|
display_img: 內容頁顯示封面圖片
|
||||||
carousel_image: 輪播圖片
|
carousel_image: 輪播圖片
|
||||||
carousel_image_title: 輪播圖片(在show頁面底部顯示)
|
carousel_image_title: 輪播圖片(在show頁面底部顯示)
|
||||||
|
|
Loading…
Reference in New Issue