Removed user dropdown - adding description field and delete button directly into details view

This commit is contained in:
Christoph Haas 2016-07-15 20:10:19 +02:00
parent 5a203415b0
commit e2c73511bc
2 changed files with 17 additions and 7 deletions

View file

@ -7,11 +7,5 @@
href=delete_screenshot_path(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

View file

@ -27,7 +27,23 @@
= render(partial: 'admin_dropdown', locals: {screenshot: screenshot})
// or does the screenshot belong to the user (determined by session cookie)
- elsif screenshot.uploaderhash == session[:token]
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
/ = render(partial: 'user_dropdown', locals: {screenshot: screenshot})
/ Ask the user to add a description if not yet done
- if screenshot.description.blank?
.imgcaption
p Please add a brief a description of 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: 80
.input-group-button
=submit_tag 'Save', class: 'button success'
/ Offer to delete the screenshot
a.button.small.alert[
href=delete_screenshot_path(screenshot.id)
onclick="return confirm('Really delete your screenshot again?');"
] Delete your screenshot
// or is the user not related to the screenshot and the screenshot is public?
- elsif screenshot.approved
= render(partial: 'report_dropdown', locals: {screenshot: screenshot})