沒登入也可以看到日曆,沒有開放預約時,管理者仍可以在前臺預約
This commit is contained in:
parent
c3eb6f7ac8
commit
864358bd69
|
@ -30,22 +30,26 @@ 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}"
|
||||||
if property.can_be_hired
|
if property.can_be_hired_frontend
|
||||||
hire_url = url_to_show + "?method=hire"
|
hire_url = url_to_show + "?method=hire"
|
||||||
actions << {
|
actions << {
|
||||||
"text" => t("property_hire.hire"),
|
"text" => t("property_hire.hire"),
|
||||||
"btn-class" => "btn-primary",
|
"btn-class" => "btn-primary",
|
||||||
"link" => hire_url
|
"link" => hire_url
|
||||||
}
|
}
|
||||||
unless property.disable_view_calendar_page
|
end
|
||||||
actions << {
|
unless property.disable_view_calendar_page
|
||||||
"text" => t("property_hire.view_calendar"),
|
actions << {
|
||||||
"btn-class" => "btn-info",
|
"text" => t("property_hire.view_calendar"),
|
||||||
"link" => url_to_show + "?method=view_calendar"
|
"btn-class" => "btn-info",
|
||||||
}
|
"link" => url_to_show + "?method=view_calendar"
|
||||||
end
|
}
|
||||||
if property.disable_content_page
|
end
|
||||||
|
if property.disable_content_page
|
||||||
|
if hire_url
|
||||||
url_to_show = hire_url
|
url_to_show = hire_url
|
||||||
|
elsif !property.disable_view_calendar_page
|
||||||
|
url_to_show += "?method=view_calendar"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
|
@ -157,19 +161,19 @@ class PropertyHiresController < ApplicationController
|
||||||
end
|
end
|
||||||
actions = []
|
actions = []
|
||||||
url_to_show = OrbitHelper.url_to_show(property.to_param)
|
url_to_show = OrbitHelper.url_to_show(property.to_param)
|
||||||
if property.can_be_hired
|
if property.can_be_hired_frontend
|
||||||
actions << {
|
actions << {
|
||||||
"text" => t("property_hire.hire"),
|
"text" => t("property_hire.hire"),
|
||||||
"btn-class" => "btn-primary",
|
"btn-class" => "btn-primary",
|
||||||
"link" => url_to_show + "?method=hire"
|
"link" => url_to_show + "?method=hire"
|
||||||
}
|
}
|
||||||
unless property.disable_view_calendar_page
|
end
|
||||||
actions << {
|
unless property.disable_view_calendar_page
|
||||||
"text" => t("property_hire.view_calendar"),
|
actions << {
|
||||||
"btn-class" => "btn-info",
|
"text" => t("property_hire.view_calendar"),
|
||||||
"link" => url_to_show + "?method=view_calendar"
|
"btn-class" => "btn-info",
|
||||||
}
|
"link" => url_to_show + "?method=view_calendar"
|
||||||
end
|
}
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"data" => data,
|
"data" => data,
|
||||||
|
|
|
@ -561,4 +561,8 @@ class Property
|
||||||
self.enable_fields_sort ? self.custom_field_names : self.default_field_names
|
self.enable_fields_sort ? self.custom_field_names : self.default_field_names
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def can_be_hired_frontend
|
||||||
|
user = OrbitHelper.current_user
|
||||||
|
self.can_be_hired || (user && (user.is_admin? || property.owners.include?(user.member_profile_id)))
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -327,7 +327,7 @@ ul.list-unstyled li {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% if !property.can_be_hired %>
|
<% if !property.can_be_hired_frontend %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
alert("This property is unavailable for hire.");
|
alert("This property is unavailable for hire.");
|
||||||
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% if !property.can_be_hired %>
|
<% if !property.can_be_hired_frontend %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
alert("This property is unavailable for hire.");
|
alert("This property is unavailable for hire.");
|
||||||
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
url = data["page"]
|
url = data["page"]
|
||||||
current_user = data["current_user"]
|
current_user = data["current_user"]
|
||||||
%>
|
%>
|
||||||
<% if !property.can_be_hired %>
|
<% if !property.can_be_hired_frontend %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
alert("This property is unavailable for hire.");
|
alert("This property is unavailable for hire.");
|
||||||
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
property = data["property"]
|
property = data["property"]
|
||||||
url = data["url"]
|
url = data["url"]
|
||||||
%>
|
%>
|
||||||
<% if !property.can_be_hired %>
|
<% if property.disable_view_calendar_page %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
alert("This property is unavailable for hire.");
|
alert("This property is unavailable for hire.");
|
||||||
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
||||||
|
|
Loading…
Reference in New Issue