Class: Ishapi::GalleriesController
Instance Method Summary
collapse
#home, #long_term_token, #vote
Instance Method Details
#index ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/ishapi/galleries_controller.rb', line 9
def index
@galleries = Gallery.all
authorize! :index, Gallery
if params[:domain]
@site = Site.find_by( :domain => params[:domain], :lang => 'en' )
@galleries = @galleries.where( :site => @site )
end
@galleries = @galleries.page( params[:galleries_page] ).per( 10 )
end
|
#show ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/ishapi/galleries_controller.rb', line 19
def show
@gallery = ::Gallery.unscoped.find_by :slug => params[:slug]
authorize! :show, @gallery
if @gallery.premium?
if @current_user&.profile&.has_premium_purchase( @gallery )
render 'show_premium_unlocked'
else
render 'show_premium_locked'
end
else
render 'show'
end
end
|