Dropdown on details page allows image management for users and admins
This commit is contained in:
parent
263f6cd33f
commit
16999260ca
8 changed files with 75 additions and 35 deletions
14
app/views/packages/_admin_dropdown.slim
Normal file
14
app/views/packages/_admin_dropdown.slim
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Button that reveals a dropdown/modal for admins
|
||||
.text-center
|
||||
button.small.dropdown.warning.button type="button" data-toggle="admin-info-#{screenshot.id}"
|
||||
'Admin
|
||||
.dropdown-pane data-dropdown=true id="admin-info-#{screenshot.id}"
|
||||
a.button.small.alert[
|
||||
href=delete_screenshot_path(@package.name, screenshot.id)
|
||||
onclick="return confirm('Really delete the screenshot?');"
|
||||
] Delete screenshot
|
||||
|
||||
p Uploader IP=#{screenshot.uploaderip}
|
||||
p Uploader Token=#{session[:token]}
|
||||
p Uploaded #{screenshot.age_days} (#{screenshot.created_at})
|
||||
p Status: #{screenshot.status}
|
||||
17
app/views/packages/_user_dropdown.slim
Normal file
17
app/views/packages/_user_dropdown.slim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Button that reveals a dropdown/modal for users (for their own screenshots)
|
||||
.text-center
|
||||
button.small.dropdown.warning.button type="button" data-toggle="admin-info-#{screenshot.id}"
|
||||
'Manage your screenshot
|
||||
.dropdown-pane data-dropdown=true id="admin-info-#{screenshot.id}"
|
||||
a.button.small.alert[
|
||||
href=delete_screenshot_path(@package.name, screenshot.id)
|
||||
onclick="return confirm('Really delete the screenshot?');"
|
||||
] Delete screenshot
|
||||
p Write a description for this screenshot:
|
||||
= form_tag(update_screenshot_description_path(screenshot.package.name, screenshot.id))
|
||||
.input-group
|
||||
= text_field_tag 'description', nil, class: 'input-group-field', maxlength: 40
|
||||
.input-group-button
|
||||
=submit_tag 'OK', class: 'button success'
|
||||
p
|
||||
i =screenshot.status
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
.small-7.medium-7.columns.packagepage
|
||||
p.subtitle = @package.description
|
||||
- if @package.screenshots_visible_to_user(session[:token]).count > 0
|
||||
- @package.screenshots_visible_to_user(session[:token]).each do |screenshot|
|
||||
- if screenshots_visible_to_user(@package).count > 0
|
||||
- screenshots_visible_to_user(@package).each do |screenshot|
|
||||
.row.listview
|
||||
.small-12.columns
|
||||
.text-center
|
||||
|
|
@ -16,21 +16,12 @@
|
|||
// TODO: Show information only if admin
|
||||
- if user_signed_in?
|
||||
// Button that reveals a dropdown/modal for admins
|
||||
.text-center
|
||||
button.small.dropdown.warning.button type="button" data-toggle="admin-info-#{screenshot.id}"
|
||||
'Admin
|
||||
.dropdown-pane data-dropdown=true id="admin-info-#{screenshot.id}"
|
||||
a.button.tiny.alert[
|
||||
href=delete_screenshot_path(@package.name, screenshot.id)
|
||||
onclick="return confirm('Really delete the screenshot?');"
|
||||
] Delete screenshot
|
||||
|
||||
p Uploader IP=#{screenshot.uploaderip}
|
||||
p Uploaded #{screenshot.age_days} (#{screenshot.created_at})
|
||||
p Status: #{screenshot.status}
|
||||
= render(partial: 'admin_dropdown', locals: {screenshot: screenshot})
|
||||
- elsif screenshot.uploaderhash == session[:token]
|
||||
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
|
||||
|
||||
// Anonymous users can see their own screenshots
|
||||
- if not screenshot.approved
|
||||
/ - if not screenshot.approved
|
||||
|
||||
- else
|
||||
.row.listview
|
||||
|
|
@ -99,12 +90,10 @@
|
|||
' If you don't use english by default please start your application
|
||||
' from a shell using after setting "export LANG=C".
|
||||
|
||||
// TODO: Enable comment form
|
||||
//javascript:
|
||||
// $('#comment-summary').on( 'input', function() {
|
||||
// //$('#comment-content,#comment-author').fadeIn();
|
||||
// $('form.comment > *').fadeIn();
|
||||
// });
|
||||
|
||||
// TODO: allow to remove own uploads
|
||||
|
||||
// TODO: allow non-upload to report (request removal)
|
||||
|
||||
javascript:
|
||||
$(function () {
|
||||
|
|
@ -121,7 +110,6 @@ javascript:
|
|||
// Files have been selected. Tell the user what's going on and
|
||||
// submit the upload form.
|
||||
$('#fileupload').change( function () {
|
||||
// $('#upload-image').attr('src', '/images/dummy/please-wait.svg');
|
||||
upload_enabled = false;
|
||||
$('#upload-image').html('Please wait...');
|
||||
$('form').submit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue