Merge branch 'master' of git.workaround.org:chaas/debshots

This commit is contained in:
Christoph Haas 2016-11-02 20:05:46 +01:00
commit 396f3a7751
25 changed files with 395 additions and 257 deletions

View file

@ -912,4 +912,9 @@ a.black
}
.inputfile + label {
cursor: pointer; /* "hand" cursor */
}
}
/* Foundation sets file buttons to 100% width. Fix that */
[type='file'] {
width: inherit !important;
}

View file

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

View file

@ -34,7 +34,10 @@ class PackagesController < ApplicationController
@images = []
# Save the images already if they are valid.
params[:screenshot][:image].each do |img|
# params[:screenshot][:image].each do |img|
successful_upload_count = 0
params[:file].each do |img|
new_screenshot = @package.screenshots.new(image: img)
# Check if the image was valid

View file

@ -0,0 +1,2 @@
class ApplicationJob < ActiveJob::Base
end

View file

@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

View file

@ -1,6 +1,6 @@
# require 'pry'
class Log < ActiveRecord::Base
class Log < ApplicationRecord
validates :message, presence: true
validates :section, presence: true

View file

@ -1,7 +1,7 @@
require 'open-uri' # allows to load URLs using open()
require 'json'
class Package < ActiveRecord::Base
class Package < ApplicationRecord
# PostgreSQL-based full-text search:
# https://github.com/Casecommons/pg_search
include PgSearch

View file

@ -1,4 +1,4 @@
class Screenshot < ActiveRecord::Base
class Screenshot < ApplicationRecord
belongs_to :package, :inverse_of=>:screenshots
has_attached_file :image,

View file

@ -1,4 +1,4 @@
class User < ActiveRecord::Base
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,

View file

@ -1,5 +1,5 @@
.row
h1 = "Upload a screenshot for #{@package.name}"
h1 = "Upload screenshots for #{@package.name}"
.row
.small-7.columns
@ -7,20 +7,33 @@
p
' You are about to upload a screenshot for the #{@package.name}
' package. Thanks for your contribution.
- if @package.screenshots.any?
p
= form_tag(upload_image_path, multipart: true)
.row
.small-6.columns
input.hidden-inputfile type="file" name="file[]" id="file" multiple=true
label for="file"
a.button id="file-select-button"
= fa_stacked_icon "image", base: "circle-thin"
span id="file-label"
' Select screenshot file(s)
.small-6.columns
button.button type="submit" id="file-submit"
= fa_stacked_icon "upload", base: "circle-thin"
' Start upload
p
- if @package.screenshots.any?
' Just for your information - these screenshots have already been uploaded.
.small-up-1.medium-up-3.large-up-4.grid-thumbnails
- @package.screenshots.all.each do |ss|
a.black.fancybox href=ss.image.url(:large, timestamp: false) rel='fancybox-thumb' title=ss.caption
= image_tag(ss.image.url(:thumb, timestamp: false), alt: ss.caption, class: 'thumbnail')
// = render partial: 'packages/grid_thumbnail', locals: { pkg: pkg }
- else
' There are no screenshots yet for #{@package.name}.
.small-up-1.medium-up-3.large-up-4.grid-thumbnails
- @package.screenshots.all.each do |ss|
a.black.fancybox href=ss.image.url(:large, timestamp: false) rel='fancybox-thumb' title=ss.caption
= image_tag(ss.image.url(:thumb, timestamp: false), alt: ss.caption, class: 'thumbnail')
// <<<<<<< HEAD
= form_for :screenshot, url: upload_image_path, html: { multipart: true, id: 'file-form' } do |f|
/ = form_tag(upload_image_path, multipart: true, id: 'file-form')
@ -34,11 +47,14 @@
= fa_stacked_icon "image", base: "circle-thin"
span id="file-label"
' Select screenshot files
// =======
// = render partial: 'packages/grid_thumbnail', locals: { pkg: pkg }
//- else
// ' There are no screenshots yet for #{@package.name}. Your upload will
// ' be the first.
// >>>>>>> 652c2d4126c628403bb8223ffd5f6fb633da95de
.small-6.columns
button.button type="submit" id="file-submit"
= fa_stacked_icon "upload", base: "circle-thin"
' Start upload
.small-5.columns.bigpanel
@ -58,7 +74,7 @@
li
' will be reduced if it is lager than 800x600 pixels.
' So don't try to capture too much detail in a screenshot. It may become
' unreadable. Shrink the applications window if possible.
' unreadable. Shrink the application's window if possible.
li
' will be made public and can freely be used by anyone.
li