Skip to content

Commit 2b77bbf

Browse files
committed
api_public endpoint fixes
1 parent 9c26ba6 commit 2b77bbf

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

app/controllers/api_public/v1/properties_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def search
3636
properties = Pwb::Current.website.listed_properties.properties_search(**args)
3737

3838
# Filter by highlighted/featured if requested
39-
if params[:highlighted] == 'true'
39+
if params[:highlighted] == 'true' || params[:featured] == 'true'
4040
properties = properties.where(highlighted: true)
4141
end
4242

app/models/concerns/listed_property/pricing.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,13 @@ def lowest_short_term_price
9090
].reject { |p| p.nil? || p.cents < 1 }
9191
prices.min
9292
end
93+
94+
# Returns a formatted price string for display
95+
# Automatically detects whether to show sale or rental price
96+
# @return [String, nil] formatted price string with currency
97+
def formatted_price
98+
rent_or_sale = for_rent ? "for_rent" : "for_sale"
99+
contextual_price_with_currency(rent_or_sale)
100+
end
93101
end
94102
end

app/models/pwb/link.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ def resolved_url
9292
elsif link_path.present?
9393
# Generate a basic path from the route helper name
9494
path_name = link_path.gsub('_path', '')
95-
"/#{I18n.locale}/#{path_name}"
95+
# Use link_path_params if available (e.g., for show_page_path with a slug)
96+
if link_path_params.present?
97+
"/#{I18n.locale}/#{link_path_params}"
98+
else
99+
"/#{I18n.locale}/#{path_name}"
100+
end
96101
elsif page_slug.present?
97102
"/#{I18n.locale}/#{page_slug}"
98103
else

0 commit comments

Comments
 (0)