Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This project is the core community building portion of the Better Together platf
For system overviews, flows, and diagrams, see the docs index:

- docs: docs/README.md
- Exchange (Joatu), Notifications, Models & Concerns, and more with Mermaid diagrams (PNG rendered).

## Dependencies

Expand Down
12 changes: 12 additions & 0 deletions app/helpers/better_together/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ module BetterTogether
module ApplicationHelper # rubocop:todo Metrics/ModuleLength
include MetricsHelper

# Returns the page title for the current page, combining any page-specific title with the platform name
def page_title(title = nil)
title_parts = []
title_parts << title if title.present?
title_parts << host_platform.name if host_platform.present? && !turbo_native_app?
title_parts.compact.join(' | ')
end

# Returns the base URL configured for BetterTogether.
def base_url
::BetterTogether.base_url
Expand Down Expand Up @@ -205,6 +213,10 @@ def better_together_url_helper?(method)
method.to_s.end_with?('_path', '_url') && BetterTogether::Engine.routes.url_helpers.respond_to?(method)
end

def turbo_native_app?
request.user_agent.to_s.include?('Turbo Native')
end

# Returns the appropriate icon and color for an event based on the person's relationship to it
def event_relationship_icon(person, event) # rubocop:todo Metrics/MethodLength
relationship = person.event_relationship_for(event)
Expand Down
6 changes: 4 additions & 2 deletions app/models/better_together/navigation_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,15 @@ def self.permitted_attributes(id: false, destroy: false) # rubocop:todo Metrics/
super + attrs
end

def url
def url(path_only: false)
fallback_url = "##{identifier}"

if linkable.present?
linkable.url
elsif route_name.present? # If the route_name is present, use the dynamic route
retrieve_route(route_name)
route = route_name
route = route_name.sub('url', 'path') if path_only
retrieve_route(route)
else
read_attribute(:url) or fallback_url
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/better_together/_navbar_brand.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<%= cache ['header_branding', host_community.cache_key_with_version] do %>
<!-- Branding Element -->
<%= link_to base_url_with_locale, class: 'navbar-brand' do %>
<%= link_to base_path_with_locale, class: 'navbar-brand' do %>
<% if host_community_logo_url %>
<%= image_tag host_community_logo_url, class: "#{dom_class(host_community, :host)}_logo", title: host_community.name, alt: host_community.name %>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/better_together/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- Custom Head Javascript from Host App -->
<%= render 'layouts/better_together/custom_head_javascript' %>

<title><%= (yield(:page_title) + ' | ') if content_for?(:page_title) %><%= host_platform.name %></title>
<title><%= page_title(content_for(:page_title) || nil) %></title>
<%= open_graph_meta_tags %>
<%= seo_meta_tags %>
<%= robots_meta_tag %>
Expand Down
Loading