Rails update. Fancybox update. Migrations from Paperclip.
This commit is contained in:
parent
1d97215591
commit
7ac69a1d8a
25 changed files with 305 additions and 115 deletions
3
Gemfile
3
Gemfile
|
|
@ -99,9 +99,6 @@ gem 'will_paginate'
|
||||||
# (Does not support Foundation 6 yet.)
|
# (Does not support Foundation 6 yet.)
|
||||||
gem 'will_paginate-foundation'
|
gem 'will_paginate-foundation'
|
||||||
|
|
||||||
# Lightbox image viewer for full-sized images
|
|
||||||
gem 'fancybox-rails'
|
|
||||||
|
|
||||||
# Full-text search in PostgreSQL
|
# Full-text search in PostgreSQL
|
||||||
gem 'pg_search'
|
gem 'pg_search'
|
||||||
|
|
||||||
|
|
|
||||||
108
Gemfile.lock
108
Gemfile.lock
|
|
@ -7,58 +7,58 @@ GIT
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (6.0.3.2)
|
actioncable (6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (6.0.3.2)
|
actionmailbox (6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
activejob (= 6.0.3.2)
|
activejob (= 6.0.3.4)
|
||||||
activerecord (= 6.0.3.2)
|
activerecord (= 6.0.3.4)
|
||||||
activestorage (= 6.0.3.2)
|
activestorage (= 6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
actionmailer (6.0.3.2)
|
actionmailer (6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
actionview (= 6.0.3.2)
|
actionview (= 6.0.3.4)
|
||||||
activejob (= 6.0.3.2)
|
activejob (= 6.0.3.4)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (6.0.3.2)
|
actionpack (6.0.3.4)
|
||||||
actionview (= 6.0.3.2)
|
actionview (= 6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
rack (~> 2.0, >= 2.0.8)
|
rack (~> 2.0, >= 2.0.8)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actiontext (6.0.3.2)
|
actiontext (6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
activerecord (= 6.0.3.2)
|
activerecord (= 6.0.3.4)
|
||||||
activestorage (= 6.0.3.2)
|
activestorage (= 6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (6.0.3.2)
|
actionview (6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
active_storage_validations (0.8.9)
|
active_storage_validations (0.8.9)
|
||||||
rails (>= 5.2.0)
|
rails (>= 5.2.0)
|
||||||
activejob (6.0.3.2)
|
activejob (6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (6.0.3.2)
|
activemodel (6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
activerecord (6.0.3.2)
|
activerecord (6.0.3.4)
|
||||||
activemodel (= 6.0.3.2)
|
activemodel (= 6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
activestorage (6.0.3.2)
|
activestorage (6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
activejob (= 6.0.3.2)
|
activejob (= 6.0.3.4)
|
||||||
activerecord (= 6.0.3.2)
|
activerecord (= 6.0.3.4)
|
||||||
marcel (~> 0.3.1)
|
marcel (~> 0.3.1)
|
||||||
activesupport (6.0.3.2)
|
activesupport (6.0.3.4)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
|
|
@ -161,7 +161,7 @@ GEM
|
||||||
listen (3.0.8)
|
listen (3.0.8)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
loofah (2.6.0)
|
loofah (2.7.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
lumberjack (1.2.7)
|
lumberjack (1.2.7)
|
||||||
|
|
@ -181,7 +181,7 @@ GEM
|
||||||
mini_magick (4.10.1)
|
mini_magick (4.10.1)
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.14.1)
|
minitest (5.14.2)
|
||||||
minitest-rails (6.0.1)
|
minitest-rails (6.0.1)
|
||||||
minitest (~> 5.10)
|
minitest (~> 5.10)
|
||||||
railties (~> 6.0.0)
|
railties (~> 6.0.0)
|
||||||
|
|
@ -198,7 +198,7 @@ GEM
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
multipart-post (2.1.1)
|
multipart-post (2.1.1)
|
||||||
nenv (0.3.0)
|
nenv (0.3.0)
|
||||||
nio4r (2.5.2)
|
nio4r (2.5.4)
|
||||||
nokogiri (1.10.10)
|
nokogiri (1.10.10)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
notiffany (0.1.3)
|
notiffany (0.1.3)
|
||||||
|
|
@ -253,20 +253,20 @@ GEM
|
||||||
ruby-openid (>= 2.1.8)
|
ruby-openid (>= 2.1.8)
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (6.0.3.2)
|
rails (6.0.3.4)
|
||||||
actioncable (= 6.0.3.2)
|
actioncable (= 6.0.3.4)
|
||||||
actionmailbox (= 6.0.3.2)
|
actionmailbox (= 6.0.3.4)
|
||||||
actionmailer (= 6.0.3.2)
|
actionmailer (= 6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
actiontext (= 6.0.3.2)
|
actiontext (= 6.0.3.4)
|
||||||
actionview (= 6.0.3.2)
|
actionview (= 6.0.3.4)
|
||||||
activejob (= 6.0.3.2)
|
activejob (= 6.0.3.4)
|
||||||
activemodel (= 6.0.3.2)
|
activemodel (= 6.0.3.4)
|
||||||
activerecord (= 6.0.3.2)
|
activerecord (= 6.0.3.4)
|
||||||
activestorage (= 6.0.3.2)
|
activestorage (= 6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 6.0.3.2)
|
railties (= 6.0.3.4)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
|
@ -278,9 +278,9 @@ GEM
|
||||||
ruby-graphviz (~> 1.2)
|
ruby-graphviz (~> 1.2)
|
||||||
rails-html-sanitizer (1.3.0)
|
rails-html-sanitizer (1.3.0)
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.3)
|
||||||
railties (6.0.3.2)
|
railties (6.0.3.4)
|
||||||
actionpack (= 6.0.3.2)
|
actionpack (= 6.0.3.4)
|
||||||
activesupport (= 6.0.3.2)
|
activesupport (= 6.0.3.4)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.20.3, < 2.0)
|
thor (>= 0.20.3, < 2.0)
|
||||||
|
|
@ -362,7 +362,7 @@ GEM
|
||||||
babel-source (>= 5.8.11)
|
babel-source (>= 5.8.11)
|
||||||
babel-transpiler
|
babel-transpiler
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sprockets-rails (3.2.1)
|
sprockets-rails (3.2.2)
|
||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require foundation
|
//= require foundation
|
||||||
//= require fancybox
|
|
||||||
//= require cookies_eu
|
//= require cookies_eu
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
|
||||||
|
|
|
||||||
13
app/assets/javascripts/jquery.fancybox.min.js
vendored
Normal file
13
app/assets/javascripts/jquery.fancybox.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
36
app/assets/stylesheets/actiontext.scss
Normal file
36
app/assets/stylesheets/actiontext.scss
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
|
||||||
|
// the trix-editor content (whether displayed or under editing). Feel free to incorporate this
|
||||||
|
// inclusion directly in any other asset bundle and remove this file.
|
||||||
|
//
|
||||||
|
//= require trix/dist/trix
|
||||||
|
|
||||||
|
// We need to override trix.css’s image gallery styles to accommodate the
|
||||||
|
// <action-text-attachment> element we wrap around attachments. Otherwise,
|
||||||
|
// images in galleries will be squished by the max-width: 33%; rule.
|
||||||
|
.trix-content {
|
||||||
|
.attachment-gallery {
|
||||||
|
> action-text-attachment,
|
||||||
|
> .attachment {
|
||||||
|
flex: 1 0 33%;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
max-width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.attachment-gallery--2,
|
||||||
|
&.attachment-gallery--4 {
|
||||||
|
> action-text-attachment,
|
||||||
|
> .attachment {
|
||||||
|
flex-basis: 50%;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
action-text-attachment {
|
||||||
|
.attachment {
|
||||||
|
padding: 0 !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
*= require_self
|
*= require_self
|
||||||
*= require foundation_and_overrides
|
*= require foundation_and_overrides
|
||||||
*= require cookies_eu
|
*= require cookies_eu
|
||||||
*= require fancybox
|
|
||||||
*= require font-awesome
|
*= require font-awesome
|
||||||
*= require my_styles
|
*= require my_styles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@import "jquery.fancybox.min";
|
||||||
|
|
||||||
1
app/assets/stylesheets/jquery.fancybox.min.scss
Normal file
1
app/assets/stylesheets/jquery.fancybox.min.scss
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -488,4 +488,55 @@ a.black
|
||||||
.pkgdescription
|
.pkgdescription
|
||||||
{
|
{
|
||||||
margin-bottom: 3rem;
|
margin-bottom: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.image-with-zoom-icon-container {
|
||||||
|
position: relative;
|
||||||
|
// display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-with-zoom-icon-container img {
|
||||||
|
// opacity: 1;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
// transition: .5s ease;
|
||||||
|
// backface-visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes example {
|
||||||
|
from {opacity: 0}
|
||||||
|
to {opacity: 0.5}
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-with-zoom-icon-container .magnifying-glass-icon {
|
||||||
|
transition: .5s ease;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
text-align: center;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
font-size: 200%;
|
||||||
|
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
line-height: 1;
|
||||||
|
// opacity: 0.3;
|
||||||
|
|
||||||
|
|
||||||
|
animation-name: example;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-delay: 4s;
|
||||||
|
animation-fill-mode: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .magnifying-glass-icon:hover {
|
||||||
|
// opacity: 1;
|
||||||
|
// }
|
||||||
|
|
|
||||||
3
app/mailboxes/application_mailbox.rb
Normal file
3
app/mailboxes/application_mailbox.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationMailbox < ActionMailbox::Base
|
||||||
|
# routing /something/i => :somewhere
|
||||||
|
end
|
||||||
|
|
@ -10,15 +10,15 @@ class Screenshot < ApplicationRecord
|
||||||
validates :image, attached: true, content_type: { in: 'image/png', message: 'is not a valid PNG image file' }
|
validates :image, attached: true, content_type: { in: 'image/png', message: 'is not a valid PNG image file' }
|
||||||
|
|
||||||
# Before migration from Paperclip to ActiveStorage:
|
# Before migration from Paperclip to ActiveStorage:
|
||||||
#has_attached_file :image,
|
# has_attached_file :image,
|
||||||
# styles: { :large => '800x600>', :thumb => '160x120>' },
|
# styles: { :large => '800x600>', :thumb => '160x120>' },
|
||||||
# default_url: '/images/dummy/no-screenshots-available.svg',
|
# default_url: '/images/dummy/no-screenshots-available.svg',
|
||||||
# path: ':rails_root/public/screenshots/:id_partition/:style.png',
|
# path: ':rails_root/public/screenshots/:id_partition/:style.png',
|
||||||
# url: '/screenshots/:id_partition/:style.png'
|
# url: '/screenshots/:id_partition/:style.png'
|
||||||
#validates_attachment_content_type :image, :content_type => 'image/png'
|
# validates_attachment_content_type :image, :content_type => 'image/png'
|
||||||
#validates_with AttachmentSizeValidator, :attributes => :image, :less_than => 5.megabytes
|
# validates_with AttachmentSizeValidator, :attributes => :image, :less_than => 5.megabytes
|
||||||
# validate :validate_image_is_unique
|
# # validate :validate_image_is_unique
|
||||||
validates :delete_reason, length: { in: 5..100 }, allow_nil: true
|
# validates :delete_reason, length: { in: 5..100 }, allow_nil: true
|
||||||
|
|
||||||
# Validator that checks if the image has already been uploaded.
|
# Validator that checks if the image has already been uploaded.
|
||||||
# A generic uniqueness validator does not work because it would attribute
|
# A generic uniqueness validator does not work because it would attribute
|
||||||
|
|
@ -163,4 +163,12 @@ class Screenshot < ApplicationRecord
|
||||||
#Digest::MD5.base64digest(Net::HTTP.get(URI(url)))
|
#Digest::MD5.base64digest(Net::HTTP.get(URI(url)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def large_watermarked
|
||||||
|
if self.image.attached?
|
||||||
|
self.image.variant(combine_options: {
|
||||||
|
gravity: 'SouthEast',
|
||||||
|
draw: 'image Over 0,0 0,0 "public/logo/watermark.png"'
|
||||||
|
}).processed
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
14
app/views/active_storage/blobs/_blob.html.erb
Normal file
14
app/views/active_storage/blobs/_blob.html.erb
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
|
||||||
|
<% if blob.representable? %>
|
||||||
|
<%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<figcaption class="attachment__caption">
|
||||||
|
<% if caption = blob.try(:caption) %>
|
||||||
|
<%= caption %>
|
||||||
|
<% else %>
|
||||||
|
<span class="attachment__name"><%= blob.filename %></span>
|
||||||
|
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
|
||||||
|
<% end %>
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
@ -21,18 +21,17 @@ html
|
||||||
= render 'layouts/footer'
|
= render 'layouts/footer'
|
||||||
|
|
||||||
// Load Javascript libraries
|
// Load Javascript libraries
|
||||||
// Initialize Zurb Foundation
|
/ javascript:
|
||||||
javascript:
|
/ $(".fancybox").fancybox({
|
||||||
$(".fancybox").fancybox({
|
/ prevEffect : 'none',
|
||||||
prevEffect : 'none',
|
/ nextEffect : 'none',
|
||||||
nextEffect : 'none',
|
/ helpers : {
|
||||||
helpers : {
|
/ title : {
|
||||||
title : {
|
/ type: 'outside'
|
||||||
type: 'outside'
|
/ },
|
||||||
},
|
/ thumbs : {
|
||||||
thumbs : {
|
/ width : 50,
|
||||||
width : 50,
|
/ height : 50
|
||||||
height : 50
|
/ }
|
||||||
}
|
/ }
|
||||||
}
|
/ });
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
- @pending_screenshots.each do |screenshot|
|
- @pending_screenshots.each do |screenshot|
|
||||||
.container.listview
|
.container.listview
|
||||||
/ = screenshot.status
|
/ = screenshot.status
|
||||||
a.black.fancybox href=rails_representation_url(screenshot.image.variant("800x600")) rel='fancybox-thumb' title=screenshot.caption
|
a.black.fancybox href=screenshot.image.variant("800x600") rel='fancybox-thumb' title=screenshot.caption
|
||||||
= image_tag(screenshot.image.variant("800x600"), alt: screenshot.caption)
|
= image_tag(screenshot.image.variant("800x600"), alt: screenshot.caption)
|
||||||
.imgcaption =screenshot.caption
|
.imgcaption =screenshot.caption
|
||||||
em.imgcaption =screenshot.adminstatus
|
em.imgcaption =screenshot.adminstatus
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
- @package.screenshots.each do |screenshot|
|
- @package.screenshots.each do |screenshot|
|
||||||
- if screenshot.approved==true and screenshot.markedfordelete==false
|
- if screenshot.approved==true and screenshot.markedfordelete==false
|
||||||
.container.listview
|
.container.listview
|
||||||
a.black.fancybox href=rails_representation_url(screenshot.image.variant("800x600", timestamp: false)) rel='fancybox-thumb' title=screenshot.caption
|
a.black.fancybox href=screenshot.image.variant("800x600", timestamp: false) rel='fancybox-thumb' title=screenshot.caption
|
||||||
= image_tag(screenshot.image.variant("800x600"), alt: screenshot.caption)
|
= image_tag(screenshot.image.variant("800x600"), alt: screenshot.caption)
|
||||||
.imgcaption =screenshot.caption
|
.imgcaption =screenshot.caption
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
- @current_users_screenshots.each do |screenshot|
|
- @current_users_screenshots.each do |screenshot|
|
||||||
.column
|
.column
|
||||||
|
|
||||||
a.black.fancybox href=rails_representation_url(screenshot.image.variant(resize_to_limit: [800,600], timestamp: false))
|
a.black.fancybox href=screenshot.image.variant(resize_to_limit: [800,600], timestamp: false)
|
||||||
div.grid-thumbnail
|
div.grid-thumbnail
|
||||||
= image_tag(screenshot.image.variant(resize_to_limit: [160,120]), alt: screenshot.caption, class: 'thumbnail')
|
= image_tag(screenshot.image.variant(resize_to_limit: [160,120]), alt: screenshot.caption, class: 'thumbnail')
|
||||||
div
|
div
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,17 @@ h1 =@package.name
|
||||||
- screenshots_visible_to_user(@package).each do |screenshot|
|
- screenshots_visible_to_user(@package).each do |screenshot|
|
||||||
.listview
|
.listview
|
||||||
.text-center
|
.text-center
|
||||||
a.black.fancybox href =rails_representation_url(screenshot.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=screenshot.caption
|
/a.black.fancybox href =url_for(screenshot.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=screenshot.caption
|
||||||
= image_tag(screenshot.image.variant(resize_to_limit: [800,600]), alt: screenshot.caption)
|
/ Fancybox image viewer: http://fancyapps.com/fancybox/3/docs/#usage
|
||||||
|
|
||||||
|
a href =url_for(screenshot.large_watermarked) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery'
|
||||||
|
.image-with-zoom-icon-container
|
||||||
|
.image-with-zoom-icon
|
||||||
|
= image_tag(url_for(screenshot.image), alt: screenshot.caption)
|
||||||
|
|
||||||
|
.magnifying-glass-icon
|
||||||
|
i.fa.fa-search
|
||||||
|
|
||||||
- if screenshot.description
|
- if screenshot.description
|
||||||
.imgcaption =screenshot.description
|
.imgcaption =screenshot.description
|
||||||
// Has the unmoderated screenshot been uploaded by the current user?
|
// Has the unmoderated screenshot been uploaded by the current user?
|
||||||
|
|
@ -33,7 +42,7 @@ h1 =@package.name
|
||||||
|
|
||||||
- if screenshot.version.present?
|
- if screenshot.version.present?
|
||||||
.imgcaption
|
.imgcaption
|
||||||
| Screenshot was taken from version #{screenshot.upstream_version}
|
| Screenshot was taken from version #{screenshot.upstream_version} #{time_ago_in_words(screenshot.created_at)} ago
|
||||||
- if user_signed_in? and current_user.is_admin?
|
- if user_signed_in? and current_user.is_admin?
|
||||||
.imgcaption
|
.imgcaption
|
||||||
span.label.secondary #{screenshot.adminstatus}
|
span.label.secondary #{screenshot.adminstatus}
|
||||||
|
|
@ -45,19 +54,19 @@ h1 =@package.name
|
||||||
= screenshot.inspect
|
= screenshot.inspect
|
||||||
|
|
||||||
|
|
||||||
// Is the user an admin?
|
// Is the user an admin?
|
||||||
// TODO: fix dropdowns – do not enforce javascript
|
// TODO: fix dropdowns – do not enforce javascript
|
||||||
- if user_signed_in? and current_user.is_admin?
|
- if user_signed_in? and current_user.is_admin?
|
||||||
= render(partial: 'admin_dropdown', locals: {screenshot: screenshot})
|
= render(partial: 'admin_dropdown', locals: {screenshot: screenshot})
|
||||||
// or does the screenshot belong to the user (determined by session cookie)
|
// or does the screenshot belong to the user (determined by session cookie)
|
||||||
- elsif user_signed_in? and screenshot.user == current_user
|
- elsif user_signed_in? and screenshot.user == current_user
|
||||||
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
|
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
|
||||||
|
|
||||||
|
|
||||||
// or is the user not related to the screenshot and the screenshot is public?
|
// or is the user not related to the screenshot and the screenshot is public?
|
||||||
// TODO: Move to a seperate page with a form
|
// TODO: Move to a seperate page with a form
|
||||||
//- elsif screenshot.approved
|
//- elsif screenshot.approved
|
||||||
// = render(partial: 'report_dropdown', locals: {screenshot: screenshot})
|
// = render(partial: 'report_dropdown', locals: {screenshot: screenshot})
|
||||||
|
|
||||||
- else
|
- else
|
||||||
.listview
|
.listview
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ h1 = "Upload screenshots for #{@package.name}"
|
||||||
a.button id="file-select-button"
|
a.button id="file-select-button"
|
||||||
= fa_stacked_icon "image", base: "circle-thin"
|
= fa_stacked_icon "image", base: "circle-thin"
|
||||||
span id="file-label"
|
span id="file-label"
|
||||||
' Select screenshot file(s)
|
' Upload screenshots
|
||||||
|
|
||||||
.small-6.cell
|
.small-6.cell
|
||||||
button.button type="submit" id="file-submit"
|
button.button type="submit" id="file-submit"
|
||||||
|
|
@ -29,7 +29,7 @@ h1 = "Upload screenshots for #{@package.name}"
|
||||||
p Just for your information - these screenshots have already been uploaded:
|
p Just for your information - these screenshots have already been uploaded:
|
||||||
|
|
||||||
- @package.screenshots.all.each do |ss|
|
- @package.screenshots.all.each do |ss|
|
||||||
a.black.fancybox href=rails_representation_url(ss.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=ss.caption
|
a.black.fancybox href=url_for(ss.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=ss.caption
|
||||||
= image_tag(ss.image.variant(resize_to_limit: [160,120]), alt: ss.caption, class: 'thumbnail')
|
= image_tag(ss.image.variant(resize_to_limit: [160,120]), alt: ss.caption, class: 'thumbnail')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ p
|
||||||
h2 Who runs this site?
|
h2 Who runs this site?
|
||||||
|
|
||||||
p
|
p
|
||||||
' This site is operated by Christoph Haas.
|
' This site is run by Christoph Haas (haas). Paul Wise (pabs) helps with the
|
||||||
|
' moderation of new uploads. However almost all of the screenshots were
|
||||||
|
' contributed by countless volunteers of the open-source community.
|
||||||
'
|
'
|
||||||
' Feel free to leave
|
' Feel free to leave
|
||||||
a href="mailto:email@christoph-haas.de" feedback?
|
a href="mailto:haas@debian.org" feedback?
|
||||||
|
|
||||||
a name='cookies'
|
a name='cookies'
|
||||||
h2 Cookies and privacy
|
h2 Cookies and privacy
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
# Prepare the ingress controller used to receive mail
|
||||||
|
# config.action_mailbox.ingress = :relay
|
||||||
|
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# Code is not reloaded between requests.
|
# Code is not reloaded between requests.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
# This migration comes from action_text (originally 20180528164100)
|
||||||
|
class CreateActionTextTables < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
create_table :action_text_rich_texts do |t|
|
||||||
|
t.string :name, null: false
|
||||||
|
t.text :body, size: :long
|
||||||
|
t.references :record, null: false, polymorphic: true, index: false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
# This migration comes from action_mailbox (originally 20180917164000)
|
||||||
|
class CreateActionMailboxTables < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
create_table :action_mailbox_inbound_emails do |t|
|
||||||
|
t.integer :status, default: 0, null: false
|
||||||
|
t.string :message_id, null: false
|
||||||
|
t.string :message_checksum, null: false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.index [ :message_id, :message_checksum ], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
21
db/schema.rb
21
db/schema.rb
|
|
@ -10,11 +10,30 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2020_04_14_002409) do
|
ActiveRecord::Schema.define(version: 2020_10_01_000000) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
create_table "action_mailbox_inbound_emails", force: :cascade do |t|
|
||||||
|
t.integer "status", default: 0, null: false
|
||||||
|
t.string "message_id", null: false
|
||||||
|
t.string "message_checksum", null: false
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.index ["message_id", "message_checksum"], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||||
|
t.string "name", null: false
|
||||||
|
t.text "body"
|
||||||
|
t.string "record_type", null: false
|
||||||
|
t.bigint "record_id", null: false
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "active_storage_attachments", force: :cascade do |t|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ applications you may know most of that already.
|
||||||
|
|
||||||
These APT-gettable packages are probably required to run the application:
|
These APT-gettable packages are probably required to run the application:
|
||||||
|
|
||||||
apt install python-psycopg2 ruby sudo libssl-dev libreadline-dev \
|
sudo apt install ruby sudo libssl-dev libreadline-dev \
|
||||||
zlib1g-dev libbz2-dev libpq-dev git imagemagick
|
zlib1g-dev libbz2-dev libpq-dev git imagemagick
|
||||||
|
|
||||||
## Prepare PostgreSQL database server and user
|
## Prepare PostgreSQL database server and user
|
||||||
|
|
@ -27,9 +27,10 @@ ident-based authentication. In development mode you will likely work as your own
|
||||||
create a development database in PostgreSQL and create a database user with a password to access it.
|
create a development database in PostgreSQL and create a database user with a password to access it.
|
||||||
Put those credentials into ./config/database.yml
|
Put those credentials into ./config/database.yml
|
||||||
|
|
||||||
apt install postgresql
|
sudo apt install postgresql
|
||||||
su - postgres
|
sudo su - postgres
|
||||||
createuser -P -d debshots
|
createuser -P -d debshots
|
||||||
|
# The password will have to match that in config/database.yml
|
||||||
createdb -O debshots -E UTF8 -T template0 debshots_dev
|
createdb -O debshots -E UTF8 -T template0 debshots_dev
|
||||||
|
|
||||||
## Install the required Ruby version using rbenv
|
## Install the required Ruby version using rbenv
|
||||||
|
|
@ -46,9 +47,9 @@ To install it for your current user:
|
||||||
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
||||||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
|
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
|
||||||
|
|
||||||
As an upright Debian user we should use Debian packages. But Rails advances faster than
|
As an upright Debian user we should use Debian packages. But this application
|
||||||
Debian releases and an outdated 'rbenv' version will not be able to install newer
|
(as most web applications) requires specific versions of libraries and modules.
|
||||||
Ruby versions.
|
So rbenv isolates them from the rest of the system.
|
||||||
|
|
||||||
# Load rbenv automatically by appending
|
# Load rbenv automatically by appending
|
||||||
# the following to ~/.profile:
|
# the following to ~/.profile:
|
||||||
|
|
@ -109,8 +110,8 @@ If you get database access errors then check the *development* section in your
|
||||||
|
|
||||||
Get the latest information on packages from the Debian repositories.
|
Get the latest information on packages from the Debian repositories.
|
||||||
|
|
||||||
bundle exec rails debshots:update_from_deb_repos RAILS_ENV=production
|
bundle exec rails debshots:update_from_deb_repos
|
||||||
bundle exec rails debshots:update_longdescription_from_deb_repos RAILS_ENV=production
|
bundle exec rails debshots:update_longdescription_from_deb_repos
|
||||||
|
|
||||||
## Run the application
|
## Run the application
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@ As a cron job:
|
||||||
|
|
||||||
41 9 * * * cd $HOME/debshots ; RAILS_ENV=production /home/debshots/.rbenv/shims/bundle exec rake debshots:accesslog2visits[/var/log/nginx/cache-access.log.1]
|
41 9 * * * cd $HOME/debshots ; RAILS_ENV=production /home/debshots/.rbenv/shims/bundle exec rake debshots:accesslog2visits[/var/log/nginx/cache-access.log.1]
|
||||||
|
|
||||||
|
Get the latest information on packages from the Debian repositories.
|
||||||
|
|
||||||
|
bundle exec rails debshots:update_from_deb_repos RAILS_ENV=production
|
||||||
|
bundle exec rails debshots:update_longdescription_from_deb_repos RAILS_ENV=production
|
||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
|
|
||||||
This web application tries to avoid to create yet another directory
|
This web application tries to avoid to create yet another directory
|
||||||
|
|
@ -65,7 +70,7 @@ but registration is disabled.
|
||||||
|
|
||||||
Anonymous uploads are possible but they have to be moderated by an administrator.
|
Anonymous uploads are possible but they have to be moderated by an administrator.
|
||||||
|
|
||||||
# Authorization
|
# Authorization (not yet implemented)
|
||||||
|
|
||||||
A user can have one of these access levels.
|
A user can have one of these access levels.
|
||||||
|
|
||||||
|
|
|
||||||
BIN
public/logo/watermark.png
Normal file
BIN
public/logo/watermark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Loading…
Add table
Add a link
Reference in a new issue