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