13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/effective/classifieds_controller.rb', line 13
def show
@classified = resource_scope.find(params[:id])
if @classified.respond_to?(:roles_permit?)
raise Effective::AccessDenied.new('Access Denied', :show, @classified) unless @classified.roles_permit?(current_user)
end
EffectiveResources.authorize!(self, :show, @classified)
if EffectiveResources.authorized?(self, :admin, :effective_classifieds)
flash.now[:warning] = [
'Hi Admin!',
('You are viewing a hidden posting.' unless @classified.published?),
("<a href='#{effective_classifieds.edit_admin_classified_path(@classified)}' class='alert-link'>Click here to edit settings</a>.")
].compact.join(' ')
end
@page_title ||= @classified.to_s
respond_to do |format|
format.html { }
format.js { render('show', formats: :js) }
end
end
|