Skip to content

Commit

Permalink
Merge branch 'main' of github.com:adrienpoly/rubyvideo
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpoly committed Jan 8, 2025
2 parents 5a988b0 + 42083c8 commit 4d98815
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ def back_path
@back_path || root_path
end

def back_to_from_request
# remove the back_to params from the query string to avoid creating recusive redirects
uri = URI.parse(request.fullpath)
uri.query = uri.query&.split("&")&.reject { |param| param.start_with?("back_to=") }&.join("&")
uri.to_s
end

def active_link_to(text = nil, path = nil, active_class: "", **options, &)
path ||= text

Expand Down
2 changes: 1 addition & 1 deletion app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
locals: {
favoritable: true,
user_favorite_talks_ids: @user_favorite_talks_ids,
back_to: request.fullpath,
back_to: back_to_from_request,
back_to_title: @event.name
},
as: :talk %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/speakers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<% if @topics.any? %>
<div class="mt-9 mb-3">
<%= render partial: "topics/badge_list", locals: {topics: @topics, back_to_url: request.fullpath, back_to_title: @speaker.name} %>
<%= render partial: "topics/badge_list", locals: {topics: @topics, back_to_url: back_to_from_request, back_to_title: @speaker.name} %>
</div>
<% end %>

Expand All @@ -25,7 +25,7 @@
favoritable: true,
user_favorite_talks_ids: @user_favorite_talks_ids,
watched_talks_ids: user_watched_talks_ids,
back_to: request.fullpath,
back_to: back_to_from_request,
back_to_title: @speaker.name
} %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/talks/_talk.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
<% end %>

<% if talk.approved_topics.any? %>
<%= render partial: "topics/badge_list", locals: {topics: talk.approved_topics, back_to_url: request.fullpath, back_to_title: talk.title} %>
<%= render partial: "topics/badge_list", locals: {topics: talk.approved_topics, back_to_url: back_to_from_request, back_to_title: talk.title} %>
<% end %>

<div role="tablist" class="tabs tabs-bordered mt-6">
Expand Down
2 changes: 1 addition & 1 deletion app/views/talks/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
locals: {
favoritable: true,
user_favorite_talks_ids: @user_favorite_talks_ids,
back_to: request.fullpath
back_to: back_to_from_request
} %>
</div>
<div class="flex mt-4 w-full">
Expand Down
2 changes: 1 addition & 1 deletion app/views/topics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
favoritable: true,
user_favorite_talks_ids: @user_favorite_talks_ids,
watched_talks_ids: user_watched_talks_ids,
back_to: request.fullpath,
back_to: back_to_from_request,
back_to_title: @topic.name
} %>
</div>
Expand Down

0 comments on commit 4d98815

Please sign in to comment.