Dammit… I can't remember what I changed and why

This commit is contained in:
Christoph Haas 2018-05-06 19:07:41 +02:00
parent 09b0df40f7
commit dd7527691e
20 changed files with 579 additions and 319 deletions

View file

@ -3,26 +3,18 @@
- if flash
- flash.each do |name,msg|
- case name
- when 'notice'
- flash_color = 'white'
- flash_bgcolor = 'green'
- when 'alert'
- flash_color = 'white'
- flash_bgcolor = 'red'
- when 'timedout'
- next
- else
- flash_color = 'black'
- flash_bgcolor = 'gray'
javascript:
$.amaran({
'content': {
'message' :'#{msg}',
'color' : '#{flash_color}',
'bgcolor' : '#{flash_bgcolor}'
},
'position' :'bottom right',
'theme' : 'colorful',
'delay' : 7000
});
- when 'timedout'
/ Workaround for Devise sometimes sending "true"
- next
- when 'notice'
.callout.warning data-closable=true
= fa_icon 'info-circle wobble 2x'
strong< = msg
- when 'error'
.callout.alert data-closable=true
= fa_icon 'meh-o wobble 2x'
strong< = msg
- else
.callout.primary data-closable=true
= fa_icon 'info-circle wobble 2x'
strong< = msg

View file

@ -1,14 +1,14 @@
nav.top-bar
.row
.top-bar-left
.top-bar-title
.top-bar
.top-bar-left
ul.menu
li.menu-text
a href='/'
// TODO: Make the logo depend on the virtual host
img src="/images/logos/debian.svg" width="35" alt="Debian logo"
// TODO: Use proper distribution name
' Debian Screenshots >
.top-bar-right
.top-bar-right
ul.dropdown.menu data-dropdown-menu=true
li class=('active' if controller_name=='welcome' and action_name=='home')
a href="/" Home

View file

@ -17,7 +17,7 @@
.small-6.columns
p Please moderate:
- @pending_screenshots.each do |screenshot|
.container.listview.text-center
.container.listview
/ = screenshot.status
a.black.fancybox href=screenshot.image.url(:large, timestamp: false) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)

View file

@ -13,14 +13,16 @@
/ TODO: submit - save
h2 Your email address
p = current_user.email
p.help-text
' This web site recognizes you by your email address.
' Don't worry - it will not be shown or given to anyone.
h2 Single-sign-on provider
p You logged in using #{current_user.pretty_provider}.
- unless current_user.email.blank?
h2 Your email address
p = current_user.email
p.help-text
' This web site recognizes you by your email address.
' Don't worry - it will not be shown or given to anyone.
- unless current_user.provider.blank?
h2 Single-sign-on provider
p You logged in using #{current_user.pretty_provider}.
h2 Number of screenshots you uploaded
p = current_user.screenshots.count

View file

@ -1,35 +1,33 @@
// Button that reveals a dropdown/modal for moderation/reporting
.button-bar
ul.button-group
- if not screenshot.approved
li
a.button.small.success[
href=approve_screenshot_path(screenshot.id)
method='post'
] Approve screenshot
- elsif screenshot.markedfordelete
li
a.button.small.success[
href=approve_screenshot_path(screenshot.id)
method='post'
] Keep screenshot
button-group
- if user_signed_in?
a.button.small.alert[
href=delete_screenshot_path(screenshot.id)
onclick="return confirm('Really delete the screenshot?');"
] Delete screenshot
- if user_signed_in?
li
a.button.small.alert[
href=delete_screenshot_path(screenshot.id)
onclick="return confirm('Really delete the screenshot?');"
] Delete screenshot
/ Display additional information to admins
p Status: #{screenshot.adminstatus}
p Uploader IP=#{screenshot.uploaderip}
p Uploader Token=#{session[:token]}
p Uploaded #{screenshot.age_days} (#{screenshot.created_at})
- if not screenshot.approved
a.button.small.success[
href=approve_screenshot_path(screenshot.id)
method='post'
] Approve screenshot
- elsif screenshot.markedfordelete
a.button.small.success[
href=approve_screenshot_path(screenshot.id)
method='post'
] Keep screenshot
/ TODO: Move reporting screenshots to an extra page with a form and captcha
/ - else
/ / Allow anonymous users to report inappropriate screenshots
/ = form_tag(report_screenshot_path(screenshot.id))
/ = text_area_tag 'delete_reason', nil, class: 'input-group-field', maxlength: 100, rows: 3, cols: 50
/ = submit_tag 'Request removal', class: 'button alert'
/ Display additional information to admins
p Status: #{screenshot.adminstatus}
p Uploader IP=#{screenshot.uploaderip}
p Uploader Token=#{session[:token]}
p Uploaded #{screenshot.age_days} (#{screenshot.created_at})
/ TODO: Move reporting screenshots to an extra page with a form and captcha
/ - else
/ / Allow anonymous users to report inappropriate screenshots
/ = form_tag(report_screenshot_path(screenshot.id))
/ = text_area_tag 'delete_reason', nil, class: 'input-group-field', maxlength: 100, rows: 3, cols: 50
/ = submit_tag 'Request removal', class: 'button alert'

View file

@ -0,0 +1,22 @@
/ Render this callout on top of the package's details page
/ if images have just been uploaded.
- if (@valid_images and @valid_images.any?) or (@invalid_images and @invalid_images.any?)
.row
.callout.warning
- if @invalid_images.any?
= fa_icon 'exclamation-circle 2x pull-left'
p These images were not accepted:
ul
- @invalid_images.each do |image|
li
' #{image.image_file_name} (#{image.errors[:image].join(' and the image ')})
- if @valid_images.any?
= fa_icon 'check-circle 2x pull-left'
p
' #{pluralize(@valid_images.length, 'screenshot')} received successfully.
' Please review the images and add a description for each image. Thanks.

View file

@ -1,13 +1,17 @@
// TODO: Can be deleted?
//
// Button that reveals a dropdown/modal for users (for their own screenshots)
.text-right
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(screenshot.id)
onclick="return confirm('Really delete the screenshot?');"
] Delete screenshot
p
i =screenshot.status
/ Ask the user to add a description if not yet done
- if screenshot.description.blank?
/ TODO: Allow the user to edit the screenshot's description again?
div
= form_for screenshot, url: update_screenshot_description_path(screenshot) do |f|
label for='description' Please add a short description of this screenshot:
.input-group
span.input-group-label = fa_icon 'edit wobble'
= f.text_field 'description', class: 'input-group-field', maxlength: 80
.input-group-button
= f.submit '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

View file

@ -1,4 +1,6 @@
/ = link_to 'Back', :back, class: 'button small'
/ If images were just uploaded then show upload success/errors
/ in a callout.
= render 'receive_upload'
.row.packagepage
.small-12.columns
@ -10,7 +12,7 @@
- if screenshots_visible_to_user(@package).count > 0
- screenshots_visible_to_user(@package).each do |screenshot|
.row.listview
.text-center
/ .text-center
a.black.fancybox href=screenshot.image.url(:large, timestamp: false) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)
- if screenshot.description
@ -26,22 +28,9 @@
- if user_signed_in? and current_user.is_admin?
= 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})
/ Ask the user to add a description if not yet done
- if screenshot.description.blank?
.imgcaption
p Please add a brief 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
- elsif user_signed_in? and screenshot.user == current_user
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
// or is the user not related to the screenshot and the screenshot is public?
// TODO: Move to a seperate page with a form

View file

@ -26,7 +26,7 @@
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)
- if pkg.screenshots.length > 1
a.black href=package_path(name: pkg.name)
.text-center and #{pluralize(pkg.screenshots.length-1, 'screenshot')} more…
'and #{pluralize(pkg.screenshots.length-1, 'screenshot')} more…
- else
a href=package_path(name: pkg.name)
img.screenshot src="/images/dummy/no-screenshots-upload-one.svg"

View file

@ -1,3 +1,5 @@
= render 'receive_upload'
.row
h1 = "Upload screenshots for #{@package.name}"

View file

@ -1,59 +1,23 @@
/ This page only gets displayed if there was invalid uploads.
/ Otherwise the user gets redirected to the upload_review page directly.
.row
h1 Some images feel wrong…
h1 Nothing to see here!
.row
p
' Thanks for your upload. Just wanted to let you know that
' these images were not accepted:
ul
- @invalid_images.each do |image|
li
' #{image.image_file_name} (#{image.errors[:image].join(' and the image ')})
- if @valid_images.any?
p
' But do not worry. #{pluralize(@valid_images.length, 'screenshot')} seems good.
' Let us take a look at them.
p
a.button href=package_path Okay
/
/ = form_for :screenshot, url: upload_review2_path do |f|
/
/ p 'Please check the images and add
/ ' short one-line descriptions that describe each of the images.
/
/ - @valid_images.each do |screenshot|
/
/ / Show upload success/errors and load details view.
/ .row
/ .callout
/
/ - if @invalid_images.any?
/ p These images were not accepted:
/
/ ul
/ - @invalid_images.each do |image|
/ li
/ ' #{image.image_file_name} (#{image.errors[:image].join(' and the image ')})
/
/
/
/ - if @valid_images.any?
/ .row
/
/ .small-4.columns
/ a.black.fancybox href=screenshot.image.url(:large, timestamp: false) title='Uploaded image'
/ = image_tag(screenshot.image.url(:large, timestamp: false), alt: 'Uploaded image')
/ .small-8.columns
/ em Your file name:
/ p
/ = screenshot.image_file_name
/
/ em Description:
/ p
/ = text_field_tag "description-#{screenshot.id}"
/
/ em Delete this image?
/ p
/ = check_box "delete-#{screenshot.id}", "Delete this image"
/
/ .row
/ button.button type="submit" id="file-submit"
/ = fa_stacked_icon "check", base: "circle-thin"
/ ' Done
/
/ - else
/ .row
/ a.button href=upload_path Back to upload form
/ p
/ ' #{pluralize(@valid_images.length, 'screenshot')} received successfully.
/ ' Please review the images and add a description for each image. Thanks.
/
/ = render 'packages/details.slim'

View file

@ -23,7 +23,6 @@
input.button.postfix type="submit" value="Search"
div.row
hr
div.large-4.medium-12.small-12.columns.text-center
h2 Newest upload
a.black href=package_path(@newest_upload.package.name)
@ -47,7 +46,7 @@ div.row
a href=upload_path(@most_wanted_package.name)
img src="/images/dummy/no-screenshots-upload-one.svg" width="160"
p
' We lack a screenshot for the
' We lack a screenshot for the
strong =>@most_wanted_package.name
' package. Can you
a href=package_path(@most_wanted_package.name) provide one