Refactor InfoWindowController#index
This commit is contained in:
parent
425417f8e8
commit
82ea810d74
|
@ -147,9 +147,8 @@ GEM
|
|||
rest-client (1.7.2)
|
||||
mime-types (>= 1.16, < 3.0)
|
||||
netrc (~> 0.7)
|
||||
rubocop (0.24.1)
|
||||
json (>= 1.7.7, < 2)
|
||||
parser (>= 2.2.0.pre.3, < 3.0)
|
||||
rubocop (0.25.0)
|
||||
parser (>= 2.2.0.pre.4, < 3.0)
|
||||
powerpack (~> 0.0.6)
|
||||
rainbow (>= 1.99.1, < 3.0)
|
||||
ruby-progressbar (~> 1.4)
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
class InfoWindowController < ApplicationController
|
||||
def index
|
||||
@thing = Thing.find_by_id(params[:thing_id])
|
||||
if @thing.adopted?
|
||||
if user_signed_in? && current_user == @thing.user
|
||||
render('users/thank_you')
|
||||
else
|
||||
render('users/profile')
|
||||
end
|
||||
view = if @thing.adopted?
|
||||
user_signed_in? && current_user == @thing.user ? 'users/thank_you' : 'users/profile'
|
||||
else
|
||||
if user_signed_in?
|
||||
render('things/adopt')
|
||||
else
|
||||
render('users/sign_in')
|
||||
end
|
||||
user_signed_in? ? 'things/adopt' : 'users/sign_in'
|
||||
end
|
||||
render view
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue