Update to Rails 7.2
This commit is contained in:
parent
932a43daac
commit
25672aabb0
31 changed files with 836 additions and 435 deletions
1
app/assets/builds/application.css
Normal file
1
app/assets/builds/application.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
4
app/assets/config/manifest.js
Normal file
4
app/assets/config/manifest.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
//= link_tree ../images
|
||||
//= link_directory ../javascripts .js
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link application.js
|
||||
|
|
@ -58,8 +58,9 @@
|
|||
// 53. Title Bar
|
||||
// 54. Tooltip
|
||||
// 55. Top Bar
|
||||
// 56. Xy Grid
|
||||
// 57. Xy Grid
|
||||
|
||||
@use "sass:color";
|
||||
@import 'util/util';
|
||||
|
||||
// 1. Global
|
||||
|
|
@ -69,22 +70,21 @@ $global-font-size: 100%;
|
|||
$global-width: rem-calc(1200);
|
||||
$global-lineheight: 1.5;
|
||||
$foundation-palette: (
|
||||
primary: #c70338,
|
||||
secondary: #767676,
|
||||
success: #3adb76,
|
||||
warning: #ffae00,
|
||||
alert: #cc4b37,
|
||||
"primary": #1779ba,
|
||||
"secondary": #767676,
|
||||
"success": #3adb76,
|
||||
"warning": #ffae00,
|
||||
"alert": #cc4b37,
|
||||
);
|
||||
$light-gray: #e6e6e6;
|
||||
$medium-gray: #cacaca;
|
||||
$dark-gray: #8a8a8a;
|
||||
$black: #0a0a0a;
|
||||
$white: #fefefe;
|
||||
// $body-background: $white;
|
||||
$body-background: #f2f2f2;
|
||||
$body-background: $white;
|
||||
$body-font-color: $black;
|
||||
$body-font-family: 'Droid Sans', sans-serif;
|
||||
// $body-font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
|
||||
$body-font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
|
||||
$body-safe-padding: false;
|
||||
$body-antialiased: true;
|
||||
$global-margin: 1rem;
|
||||
$global-padding: 1rem;
|
||||
|
|
@ -92,8 +92,7 @@ $global-position: 1rem;
|
|||
$global-weight-normal: normal;
|
||||
$global-weight-bold: bold;
|
||||
$global-radius: 0;
|
||||
$global-menu-padding: 0.3rem 0.5rem;
|
||||
// $global-menu-padding: 0.7rem 1rem;
|
||||
$global-menu-padding: 0.7rem 1rem;
|
||||
$global-menu-nested-margin: 1rem;
|
||||
$global-text-direction: ltr;
|
||||
$global-flexbox: true;
|
||||
|
|
@ -101,18 +100,27 @@ $global-prototype-breakpoints: false;
|
|||
$global-button-cursor: auto;
|
||||
$global-color-pick-contrast-tolerance: 0;
|
||||
$print-transparent-backgrounds: true;
|
||||
$print-hrefs: true;
|
||||
|
||||
@include add-foundation-colors;
|
||||
|
||||
// 2. Breakpoints
|
||||
// --------------
|
||||
|
||||
$-zf-size: null;
|
||||
$breakpoints: (
|
||||
small: 0,
|
||||
medium: 640px,
|
||||
large: 1024px,
|
||||
xlarge: 1200px,
|
||||
xxlarge: 1440px,
|
||||
"small": 0,
|
||||
"medium": 640px,
|
||||
"large": 1024px,
|
||||
"xlarge": 1200px,
|
||||
"xxlarge": 1440px,
|
||||
);
|
||||
$breakpoints-hidpi: (
|
||||
"hidpi-1": 1,
|
||||
"hidpi-1-5": 1.5,
|
||||
"hidpi-2": 2,
|
||||
"retina": 2,
|
||||
"hidpi-3": 3
|
||||
);
|
||||
$print-breakpoint: large;
|
||||
$breakpoint-classes: (small medium large);
|
||||
|
|
@ -143,19 +151,19 @@ $header-margin-bottom: 0.5rem;
|
|||
$header-styles: (
|
||||
small: (
|
||||
'h1': ('font-size': 24),
|
||||
'h2': ('font-size': 16),
|
||||
'h3': ('font-size': 14),
|
||||
'h4': ('font-size': 13),
|
||||
'h5': ('font-size': 12),
|
||||
'h6': ('font-size': 11),
|
||||
'h2': ('font-size': 20),
|
||||
'h3': ('font-size': 19),
|
||||
'h4': ('font-size': 18),
|
||||
'h5': ('font-size': 17),
|
||||
'h6': ('font-size': 16),
|
||||
),
|
||||
medium: (
|
||||
'h1': ('font-size': 40),
|
||||
'h2': ('font-size': 32),
|
||||
'h3': ('font-size': 28),
|
||||
'h4': ('font-size': 26),
|
||||
'h5': ('font-size': 24),
|
||||
'h6': ('font-size': 22),
|
||||
'h1': ('font-size': 48),
|
||||
'h2': ('font-size': 40),
|
||||
'h3': ('font-size': 31),
|
||||
'h4': ('font-size': 25),
|
||||
'h5': ('font-size': 20),
|
||||
'h6': ('font-size': 16),
|
||||
),
|
||||
);
|
||||
$header-text-rendering: optimizeLegibility;
|
||||
|
|
@ -164,12 +172,7 @@ $header-small-font-color: $medium-gray;
|
|||
$paragraph-lineheight: 1.6;
|
||||
$paragraph-margin-bottom: 1rem;
|
||||
$paragraph-text-rendering: optimizeLegibility;
|
||||
$code-color: $black;
|
||||
$code-font-family: $font-family-monospace;
|
||||
$code-font-weight: $global-weight-normal;
|
||||
$code-background: $light-gray;
|
||||
$code-border: 1px solid $medium-gray;
|
||||
$code-padding: rem-calc(2 5 1);
|
||||
$enable-code-inline: true;
|
||||
$anchor-color: $primary-color;
|
||||
$anchor-color-hover: scale-color($anchor-color, $lightness: -14%);
|
||||
$anchor-text-decoration: none;
|
||||
|
|
@ -189,9 +192,7 @@ $defnlist-term-margin-bottom: 0.3rem;
|
|||
$blockquote-color: $dark-gray;
|
||||
$blockquote-padding: rem-calc(9 20 0 19);
|
||||
$blockquote-border: 1px solid $medium-gray;
|
||||
$cite-font-size: rem-calc(13);
|
||||
$cite-color: $dark-gray;
|
||||
$cite-pseudo-content: '\2014 \0020';
|
||||
$enable-cite-block: true;
|
||||
$keystroke-font: $font-family-monospace;
|
||||
$keystroke-color: $black;
|
||||
$keystroke-background: $light-gray;
|
||||
|
|
@ -210,6 +211,17 @@ $subheader-font-weight: $global-weight-normal;
|
|||
$subheader-margin-top: 0.2rem;
|
||||
$subheader-margin-bottom: 0.5rem;
|
||||
$stat-font-size: 2.5rem;
|
||||
$cite-color: $dark-gray;
|
||||
$cite-font-size: rem-calc(13);
|
||||
$cite-pseudo-content: '\2014 \0020';
|
||||
$code-color: $black;
|
||||
$code-font-family: $font-family-monospace;
|
||||
$code-font-weight: $global-weight-normal;
|
||||
$code-background: $light-gray;
|
||||
$code-border: 1px solid $medium-gray;
|
||||
$code-padding: rem-calc(2 5 1);
|
||||
$code-block-padding: 1rem;
|
||||
$code-block-margin-bottom: 1.5rem;
|
||||
|
||||
// 6. Abide
|
||||
// --------
|
||||
|
|
@ -227,6 +239,8 @@ $input-error-font-weight: $global-weight-bold;
|
|||
|
||||
$accordion-background: $white;
|
||||
$accordion-plusminus: true;
|
||||
$accordion-plus-content: '\002B';
|
||||
$accordion-minus-content: '\2013';
|
||||
$accordion-title-font-size: rem-calc(12);
|
||||
$accordion-item-color: $primary-color;
|
||||
$accordion-item-background-hover: $light-gray;
|
||||
|
|
@ -282,6 +296,7 @@ $breadcrumbs-item-separator-color: $medium-gray;
|
|||
// ----------
|
||||
|
||||
$button-font-family: inherit;
|
||||
$button-font-weight: null;
|
||||
$button-padding: 0.85em 1em;
|
||||
$button-margin: 0 0 $global-margin 0;
|
||||
$button-fill: solid;
|
||||
|
|
@ -289,8 +304,8 @@ $button-background: $primary-color;
|
|||
$button-background-hover: scale-color($button-background, $lightness: -15%);
|
||||
$button-color: $white;
|
||||
$button-color-alt: $black;
|
||||
//$button-radius: $global-radius;
|
||||
$button-radius: 0.5rem;
|
||||
$button-radius: $global-radius;
|
||||
$button-border: 1px solid transparent;
|
||||
$button-hollow-border-width: 1px;
|
||||
$button-sizes: (
|
||||
tiny: 0.6rem,
|
||||
|
|
@ -303,6 +318,7 @@ $button-opacity-disabled: 0.25;
|
|||
$button-background-hover-lightness: -20%;
|
||||
$button-hollow-hover-lightness: -50%;
|
||||
$button-transition: background-color 0.25s ease-out, color 0.25s ease-out;
|
||||
$button-responsive-expanded: false;
|
||||
|
||||
// 12. Button Group
|
||||
// ----------------
|
||||
|
|
@ -320,7 +336,11 @@ $callout-background: $white;
|
|||
$callout-background-fade: 85%;
|
||||
$callout-border: 1px solid rgba($black, 0.25);
|
||||
$callout-margin: 0 0 1rem 0;
|
||||
$callout-padding: 1rem;
|
||||
$callout-sizes: (
|
||||
small: 0.5rem,
|
||||
default: 1rem,
|
||||
large: 3rem,
|
||||
);
|
||||
$callout-font-color: $body-font-color;
|
||||
$callout-font-color-alt: $body-background;
|
||||
$callout-radius: $global-radius;
|
||||
|
|
@ -342,6 +362,8 @@ $card-margin-bottom: $global-margin;
|
|||
// ----------------
|
||||
|
||||
$closebutton-position: right top;
|
||||
$closebutton-z-index: 10;
|
||||
$closebutton-default-size: medium;
|
||||
$closebutton-offset-horizontal: (
|
||||
small: 0.66rem,
|
||||
medium: 1rem,
|
||||
|
|
@ -394,8 +416,8 @@ $dropdownmenu-arrow-color: $anchor-color;
|
|||
$dropdownmenu-arrow-size: 6px;
|
||||
$dropdownmenu-arrow-padding: 1.5rem;
|
||||
$dropdownmenu-min-width: 200px;
|
||||
$dropdownmenu-background: $white;
|
||||
$dropdownmenu-submenu-background: $dropdownmenu-background;
|
||||
$dropdownmenu-background: null;
|
||||
$dropdownmenu-submenu-background: $white;
|
||||
$dropdownmenu-padding: $global-menu-padding;
|
||||
$dropdownmenu-nested-margin: 0;
|
||||
$dropdownmenu-submenu-padding: $dropdownmenu-padding;
|
||||
|
|
@ -442,7 +464,7 @@ $input-background-focus: $white;
|
|||
$input-background-disabled: $light-gray;
|
||||
$input-border: 1px solid $medium-gray;
|
||||
$input-border-focus: 1px solid $dark-gray;
|
||||
$input-padding: $form-spacing / 2;
|
||||
$input-padding: $form-spacing * 0.5;
|
||||
$input-shadow: inset 0 1px 2px rgba($black, 0.1);
|
||||
$input-shadow-focus: 0 0 5px $medium-gray;
|
||||
$input-cursor-disabled: not-allowed;
|
||||
|
|
@ -477,9 +499,9 @@ $menu-nested-margin: $global-menu-nested-margin;
|
|||
$menu-items-padding: $global-menu-padding;
|
||||
$menu-simple-margin: 1rem;
|
||||
$menu-item-color-active: $white;
|
||||
$menu-item-color-alt-active: $black;
|
||||
$menu-item-background-active: get-color(primary);
|
||||
$menu-icon-spacing: 0.25rem;
|
||||
$menu-item-background-hover: $light-gray;
|
||||
$menu-state-back-compat: true;
|
||||
$menu-centered-back-compat: true;
|
||||
$menu-icons-back-compat: true;
|
||||
|
|
@ -549,6 +571,8 @@ $pagination-ellipsis-color: $black;
|
|||
$pagination-mobile-items: false;
|
||||
$pagination-mobile-current-item: false;
|
||||
$pagination-arrows: true;
|
||||
$pagination-arrow-previous: '\00AB';
|
||||
$pagination-arrow-next: '\00BB';
|
||||
|
||||
// 28. Progress Bar
|
||||
// ----------------
|
||||
|
|
@ -670,8 +694,7 @@ $prototype-separator-margin-top: $global-margin;
|
|||
// --------------------
|
||||
|
||||
$prototype-shadow-breakpoints: $global-prototype-breakpoints;
|
||||
$prototype-box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),
|
||||
0 2px 10px 0 rgba(0,0,0,.12);
|
||||
$prototype-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
|
||||
// 41. Prototype Sizing
|
||||
// --------------------
|
||||
|
|
@ -759,7 +782,9 @@ $slider-radius: $global-radius;
|
|||
// ----------
|
||||
|
||||
$switch-background: $medium-gray;
|
||||
$switch-background-focus: scale-color($switch-background, $lightness: -10%);
|
||||
$switch-background-active: $primary-color;
|
||||
$switch-background-active-focus: scale-color($switch-background-active, $lightness: -15%);
|
||||
$switch-height: 2rem;
|
||||
$switch-height-tiny: 1.5rem;
|
||||
$switch-height-small: 1.75rem;
|
||||
|
|
@ -770,6 +795,8 @@ $switch-paddle-background: $white;
|
|||
$switch-paddle-offset: 0.25rem;
|
||||
$switch-paddle-radius: $global-radius;
|
||||
$switch-paddle-transition: all 0.25s ease-out;
|
||||
$switch-opacity-disabled: 0.5;
|
||||
$switch-cursor-disabled: not-allowed;
|
||||
|
||||
// 50. Table
|
||||
// ---------
|
||||
|
|
@ -779,15 +806,15 @@ $table-color-scale: 5%;
|
|||
$table-border: 1px solid smart-scale($table-background, $table-color-scale);
|
||||
$table-padding: rem-calc(8 10 10);
|
||||
$table-hover-scale: 2%;
|
||||
$table-row-hover: darken($table-background, $table-hover-scale);
|
||||
$table-row-stripe-hover: darken($table-background, $table-color-scale + $table-hover-scale);
|
||||
$table-row-hover: color.adjust($table-background, $lightness: -$table-hover-scale);
|
||||
$table-row-stripe-hover: color.adjust($table-background, $lightness: -($table-color-scale + $table-hover-scale));
|
||||
$table-is-striped: true;
|
||||
$table-striped-background: smart-scale($table-background, $table-color-scale);
|
||||
$table-stripe: even;
|
||||
$table-head-background: smart-scale($table-background, $table-color-scale / 2);
|
||||
$table-head-row-hover: darken($table-head-background, $table-hover-scale);
|
||||
$table-head-background: smart-scale($table-background, $table-color-scale * 0.5);
|
||||
$table-head-row-hover: color.adjust($table-head-background, $lightness: -$table-hover-scale);
|
||||
$table-foot-background: smart-scale($table-background, $table-color-scale);
|
||||
$table-foot-row-hover: darken($table-foot-background, $table-hover-scale);
|
||||
$table-foot-row-hover: color.adjust($table-foot-background, $lightness: -$table-hover-scale);
|
||||
$table-head-font-color: $body-font-color;
|
||||
$table-foot-font-color: $body-font-color;
|
||||
$show-header-for-stacked: false;
|
||||
|
|
@ -804,7 +831,6 @@ $tab-active-color: $primary-color;
|
|||
$tab-item-font-size: rem-calc(12);
|
||||
$tab-item-background-hover: $white;
|
||||
$tab-item-padding: 1.25rem 1.5rem;
|
||||
$tab-expand-max: 6;
|
||||
$tab-content-background: $white;
|
||||
$tab-content-border: $light-gray;
|
||||
$tab-content-color: $body-font-color;
|
||||
|
|
@ -813,7 +839,7 @@ $tab-content-padding: 1rem;
|
|||
// 52. Thumbnail
|
||||
// -------------
|
||||
|
||||
$thumbnail-border: solid 4px $white;
|
||||
$thumbnail-border: 4px solid $white;
|
||||
$thumbnail-margin-bottom: $global-margin;
|
||||
$thumbnail-shadow: 0 0 0 1px rgba($black, 0.2);
|
||||
$thumbnail-shadow-hover: 0 0 6px 1px rgba($primary-color, 0.5);
|
||||
|
|
@ -849,23 +875,22 @@ $tooltip-radius: $global-radius;
|
|||
// 55. Top Bar
|
||||
// -----------
|
||||
|
||||
$topbar-padding: 0;
|
||||
// $topbar-background: $light-gray;
|
||||
$topbar-background: #d8d8d8;
|
||||
$topbar-padding: 0.5rem;
|
||||
$topbar-background: $light-gray;
|
||||
$topbar-submenu-background: $topbar-background;
|
||||
$topbar-title-spacing: 0.5rem 1rem 0.5rem 0;
|
||||
$topbar-input-width: 200px;
|
||||
$topbar-unstack-breakpoint: medium;
|
||||
|
||||
// 56. Xy Grid
|
||||
// 57. Xy Grid
|
||||
// -----------
|
||||
|
||||
$xy-grid: true;
|
||||
$grid-container: $global-width;
|
||||
$grid-columns: 12;
|
||||
$grid-margin-gutters: (
|
||||
small: 20px,
|
||||
medium: 30px
|
||||
"small": 20px,
|
||||
"medium": 30px
|
||||
);
|
||||
$grid-padding-gutters: $grid-margin-gutters;
|
||||
$grid-container-padding: $grid-padding-gutters;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
* compiled file, but it's generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_self
|
||||
//= require foundation_and_overrides
|
||||
|
||||
*= require foundation_and_overrides
|
||||
*= require font-awesome
|
||||
*= require my_styles
|
||||
|
|
|
|||
4
app/assets/stylesheets/browserslist
Normal file
4
app/assets/stylesheets/browserslist
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
last 2 versions
|
||||
ie >= 9
|
||||
Android >= 2.3
|
||||
ios >= 7
|
||||
|
|
@ -341,7 +341,7 @@ class PackagesController < ApplicationController
|
|||
|
||||
# Return packages matching the criteria given by parameters
|
||||
def query_packages
|
||||
packages = Package.order(visits: :desc)
|
||||
packages = Package #.order(visits: :desc)
|
||||
|
||||
# text search
|
||||
if params[:search].present?
|
||||
|
|
@ -352,7 +352,7 @@ class PackagesController < ApplicationController
|
|||
case params[:show]
|
||||
when 'with'
|
||||
# Enrich the result with the screenshots readable by the current user (CanCanCan)
|
||||
packages = packages.with_screenshots
|
||||
packages = packages.with_public_screenshots
|
||||
logger.debug 'Limiting packages to those with screenshots'
|
||||
when 'without'
|
||||
packages = packages.without_screenshots
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ class WelcomeController < ApplicationController
|
|||
def home
|
||||
@newest_upload = Screenshot.where(approved: true).first
|
||||
|
||||
@most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
||||
#@most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
||||
@random_pick = Package.with_public_screenshots.order("RANDOM()").first
|
||||
|
||||
@package_count = Package.count
|
||||
|
||||
# Get up 100 screenshots where the packages have the most visits
|
||||
query = Package.without_screenshots.order(visits: :desc)
|
||||
query = Package.without_screenshots #.order(visits: :desc)
|
||||
count = query.count
|
||||
random_offset = rand( [100, count].min )
|
||||
@most_wanted_package = query.offset(random_offset).first
|
||||
|
|
|
|||
|
|
@ -51,6 +51,13 @@ class Package < ApplicationRecord
|
|||
where(id: subselect)
|
||||
end
|
||||
|
||||
# Return a query of all packages that have approved screenshots
|
||||
def self.with_public_screenshots
|
||||
# Query for all packages who's ID appears in a screenshot's "package_id" field
|
||||
subselect = Screenshot.visible.approved.select(:package_id)
|
||||
where(id: subselect)
|
||||
end
|
||||
|
||||
# Return a list of packages that have screenshots to be moderated
|
||||
def self.need_moderation
|
||||
Package.joins(:screenshots).where('screenshots.approved=false').distinct(:name)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class Screenshot < ApplicationRecord
|
|||
default_scope { order(approved: :asc, hidden: :asc, created_at: :desc) }
|
||||
|
||||
scope :approved, -> { where(approved: true) }
|
||||
scope :visible, -> { where(hidden: false) }
|
||||
|
||||
# Shrine
|
||||
include ImageUploader::Attachment(:simage) # adds an `simage` virtual attribute
|
||||
|
|
|
|||
19
app/views/layouts/application.html.erb___
Normal file
19
app/views/layouts/application.html.erb___
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
|
||||
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -39,19 +39,19 @@
|
|||
|
||||
|
||||
.small-12.medium-4.cell
|
||||
h2.text-center Most popular
|
||||
h2.text-center Random pick
|
||||
.pkgcard
|
||||
.image
|
||||
- if @most_popular_package
|
||||
a href=package_path(@most_popular_package.name)
|
||||
= small_img(@most_popular_package.screenshots.first)
|
||||
- if @random_pick
|
||||
a href=package_path(@random_pick.name)
|
||||
= small_img(@random_pick.screenshots.first)
|
||||
- else
|
||||
'No uploaded screenshots yet.
|
||||
.text
|
||||
strong
|
||||
=@most_popular_package.name
|
||||
=@random_pick.name
|
||||
' :
|
||||
=@most_popular_package.description
|
||||
=@random_pick.description
|
||||
|
||||
.small-12.medium-4.cell
|
||||
h2.text-center Your help needed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue