This commit is contained in:
Christoph Haas 2017-08-14 08:09:23 +02:00
parent 098afc1924
commit 193d44f89a
27 changed files with 331 additions and 707 deletions

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
// Place all the styles related to the admin controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,10 @@
class AdminController < ApplicationController
def status
end
def screenshots
end
def integration
end
end

View file

@ -57,11 +57,6 @@ class PackagesController < ApplicationController
# redirect_to package_path
end
# Receive the descriptions from upload_review and update them
def upload_review2
end
# Legacy action to upload an image along with metadata.
# This was used in Debshots 1.x as the default upload method.
# This method allows that old-style way to upload screenshots.

View file

@ -0,0 +1,2 @@
module AdminHelper
end

2
app/helpers/my_helper.rb Normal file
View file

@ -0,0 +1,2 @@
module MyHelper
end

View file

@ -82,6 +82,11 @@ class Package < ApplicationRecord
return sorted_screenshots.last
end
# Return the part of the version up to the first - or +
def upstream_version
self.version.split(/[\-\+]/).first
end
private
def version_compare(x,y)

View file

@ -116,7 +116,7 @@ class Screenshot < ApplicationRecord
# Publish a screenshot from the moderation queue
def approve_screenshot!
self.delete_reason = nil
self.markedfordelete = false
self.approved = true
@ -164,4 +164,9 @@ class Screenshot < ApplicationRecord
false
end
# Return the part of the version up to the first - or +
def upstream_version
self.version.split(/[\-\+]/).first
end
end

View file

@ -0,0 +1,2 @@
h1 Admin#integration
p Find me in app/views/admin/integration.html.slim

View file

@ -0,0 +1,2 @@
h1 Admin#screenshots
p Find me in app/views/admin/screenshots.html.slim

View file

@ -0,0 +1,2 @@
h1 Admin#status
p Find me in app/views/admin/status.html.slim

View file

@ -22,9 +22,6 @@
h2 Single-sign-on provider
p You logged in using #{current_user.pretty_provider}.
h2 The first time you were here was
p = current_user.created_at.to_formatted_s(:long_ordinal)
h2 Number of screenshots you uploaded
p = current_user.screenshots.count

View file

@ -39,7 +39,7 @@
p
- if pkg.visits > 0
' #{pkg.visits} other people were interested in this package here.
' The newest known version of this software is #{pkg.version}
' The newest known version of this software is #{pkg.upstream_version}
- if pkg.updated_at
' (Information last updated #{time_ago_in_words(pkg.updated_at)} ago.)
// show which distributions have this package available

View file

@ -17,13 +17,13 @@
.imgcaption =screenshot.description
- if screenshot.version.present?
.imgcaption
em from version #{screenshot.version}
- if user_signed_in?
em from version #{screenshot.upstream_version}
- if user_signed_in? and current_user.is_admin?
.imgcaption
em Admin status: #{screenshot.adminstatus}
span.label.secondary #{screenshot.adminstatus}
// Is the user an admin?
- if user_signed_in?
- 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]