Skip to content

Commit

Permalink
only unfurl for cases, not teams.
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Aug 24, 2023
1 parent a3cc40e commit 5cbaace
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def set_current_user

def require_login
unless @current_user
# check if we are redirected from the case page, and if so lets support unfurling
# check if we are redirected from the case page, and if so support unfurling
# by populating the flash so it renders in the start.html.erb layout.
if 'core' == params[:controller] && 'index' == params[:action] && params[:id]
flash[:unfurl] = Case.find_by(id: params[:id])
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/core_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ class CoreController < ApplicationController
def index
end

# We want to distingush between a /case url and a /teams for unfurling logic.
def teams
render 'index'
end

def new
@case = current_user.cases.build case_name: "Case #{current_user.cases.size}"
@case.save!
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
get '/cases' => 'core#index'
get '/case' => 'core#index'
get '/cases/import' => 'core#index'
get '/teams(/:id)' => 'core#index', as: :teams
get '/teams(/:id)' => 'core#teams', as: :teams
get '/scorers' => 'core#index'

# Static pages
Expand Down

0 comments on commit 5cbaace

Please sign in to comment.