Authorisation management using CanCanCan added

This commit is contained in:
Christoph Haas 2021-02-28 21:36:46 +01:00
parent 51be4a4777
commit 7a3b65fe50
24 changed files with 211 additions and 295 deletions

View file

@ -7,11 +7,11 @@
= link_to moderate_list_path
= fa_icon 'check 2x', text: 'Moderate'
// Add link if user has uploaded screenshots
- if @current_users_screenshots and @current_users_screenshots.any?
li class=('active' if controller_name=='my' and action_name=='uploads')
= link_to my_uploads_path
= fa_icon 'image 2x', text: 'My uploads'
' My uploads
/ - if @current_users_screenshots and @current_users_screenshots.any?
/ li class=('active' if controller_name=='my' and action_name=='uploads')
/ = link_to my_uploads_path
/ = fa_icon 'image 2x', text: 'My uploads'
/ ' My uploads
li
= link_to destroy_user_session_path, method: :delete

View file

@ -27,8 +27,8 @@
h2 Number of screenshots you uploaded
p = current_user.screenshots.count
- if current_user.is_admin?
h2 Admin
p Apparently you are an administrator. Be careful with that thing!
tt = current_user.inspect
/ - if current_user.is_admin?
/ h2 Admin
/ p Apparently you are an administrator. Be careful with that thing!
/ - you can moderate
/ - you can …

View file

@ -16,8 +16,8 @@
- @current_users_screenshots.each do |screenshot|
.column
/ TODO: old Paperclip style
a.black.fancybox href=screenshot.image.variant(resize_to_limit: [800,600], timestamp: false)
a.black.fancybox href=screenshot.simage_url(:large)
div.grid-thumbnail
= image_tag(screenshot.image.variant(resize_to_limit: [160,120]), alt: screenshot.caption, class: 'thumbnail')
= image_tag(screenshot.simage_url(:medium), alt: screenshot.caption, class: 'thumbnail')
div
= screenshot.description