Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.generators
*.pyc
*.rbc
*.sassc
**.orig
.bundle
.byebug_history
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ gem 'pg'
gem 'phonelib'
gem 'premailer-rails', '>= 1.12.0'
gem 'profanity_filter'
gem 'propshaft'
gem 'rack', '>= 2.2.3.1'
gem 'rack-attack', '>= 6.2.1'
gem 'rack-cors', '>= 1.0.5', require: 'rack/cors'
Expand All @@ -62,6 +61,7 @@ gem 'safe_target_blank', '>= 1.0.2'
gem 'saml_idp', github: '18F/saml_idp', tag: '0.18.2-18f'
gem 'scrypt'
gem 'simple_form', '>= 5.0.2'
gem 'sprockets-rails'
gem 'stringex', require: false
gem 'strong_migrations', '>= 0.4.2'
gem 'subprocess', require: false
Expand All @@ -85,7 +85,6 @@ group :development do
gem 'guard-rspec', require: false
gem 'irb'
gem 'letter_opener', '~> 1.8'
gem 'listen'
gem 'octokit', '>= 4.25.0'
gem 'rack-mini-profiler', '>= 1.1.3', require: false
gem 'rails-erd', '>= 1.6.0'
Expand Down
15 changes: 8 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,6 @@ GEM
net-smtp
premailer (~> 1.7, >= 1.7.9)
profanity_filter (0.1.1)
propshaft (0.7.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -640,6 +635,13 @@ GEM
simpleidn (0.2.1)
unf (~> 0.1.4)
smart_properties (1.17.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stringex (2.8.5)
strong_migrations (0.8.0)
activerecord (>= 5.2)
Expand Down Expand Up @@ -764,7 +766,6 @@ DEPENDENCIES
jwt
knapsack
letter_opener (~> 1.8)
listen
lograge (>= 0.11.2)
lookbook (~> 1.5.3)
lru_redux
Expand All @@ -780,7 +781,6 @@ DEPENDENCIES
phonelib
premailer-rails (>= 1.12.0)
profanity_filter
propshaft
pry-byebug
pry-doc
pry-rails
Expand Down Expand Up @@ -819,6 +819,7 @@ DEPENDENCIES
simplecov (~> 0.21.0)
simplecov-cobertura
simplecov_json_formatter
sprockets-rails
stringex
strong_migrations (>= 0.4.2)
subprocess
Expand Down
10 changes: 10 additions & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//= link_tree ../images
//= link_tree ../fonts

//= link intl-tel-input/build/css/intlTelInput.css
//= link intl-tel-input/build/img/flags.png
//= link intl-tel-input/build/img/flags@2x.png

//= link_tree ../../../node_modules/@18f/identity-design-system/dist/assets/img
//= link_tree ../../../node_modules/@18f/identity-design-system/dist/assets/fonts
//= link_tree ../builds
4 changes: 2 additions & 2 deletions app/assets/stylesheets/_required.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use 'uswds-core' with (
$theme-body-font-size: 'sm',
$theme-font-path: '',
$theme-image-path: '',
$theme-font-path: '.',
$theme-image-path: '@18f/identity-design-system/dist/assets/img',
$theme-global-border-box-sizing: true,
$theme-global-link-styles: true,
$theme-grid-container-max-width: 'tablet-lg',
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/_alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
font-weight: bold;

&::before {
background-image: url('/alert/info-white.svg');
background-image: url('alert/info-white.svg');
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/_icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $icon-min-padding: 2px;

&-success {
&::before {
background-image: url('/alert/success.svg');
background-image: url('alert/success.svg');
content: '';
display: block;
height: $h4;
Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/components/_language-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
}

&::after {
background-image: url('/angle-arrow-up.svg');
background-image: url(@18f/identity-design-system/dist/assets/img/angle-arrow-up.svg);

@include at-media('tablet') {
background-image: url('/angle-arrow-up-white.svg');
background-image: url(@18f/identity-design-system/dist/assets/img/angle-arrow-up-white.svg);
}
}
}
Expand All @@ -79,7 +79,7 @@
color: color('white');

&::after {
background-image: url('/angle-arrow-down-white.svg');
background-image: url(@18f/identity-design-system/dist/assets/img/angle-arrow-down-white.svg);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
padding: 1rem 1rem 1rem 0;

&::before {
background-image: url('/alert/success.svg');
background-image: url('alert/success.svg');
background-repeat: no-repeat;
content: '';
display: inline-block;
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/components/_personal-key.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.personal-key-block {
@include u-padding-y(2);
background-image: url('/personal-key/pkey-block.svg');
background-image: url('personal-key/pkey-block.svg');
background-position: center;
background-repeat: no-repeat;

Expand All @@ -28,7 +28,7 @@

.bg-personal-key {
height: 145px;
background-image: url('/personal-key/shield.svg');
background-image: url('personal-key/shield.svg');
background-position: center;
background-repeat: no-repeat;
background-size: 145px 145px;
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/components/_phone-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ lg-phone-input {
}

.iti__flag {
background-image: url('/flags.png');
background-image: url('intl-tel-input/build/img/flags.png');

/* stylelint-disable-next-line media-feature-name-no-vendor-prefix */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
background-image: url('/flags@2x.png');
background-image: url('intl-tel-input/build/img/flags@2x.png');
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/_step-indicator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ lg-step-indicator {

.step-indicator__step--complete::before {
background-color: color('white');
background-image: url('/alert/success.svg');
background-image: url('alert/success.svg');
}

.step-indicator__step:not(:last-child)::after {
Expand Down
4 changes: 3 additions & 1 deletion app/components/icon_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class IconComponent < BaseComponent
include AssetHelper

# See: https://github.com/uswds/uswds/tree/develop/src/img/usa-icons
ICONS = %i[
accessibility_new
Expand Down Expand Up @@ -254,7 +256,7 @@ def initialize(icon:, **tag_options)
end

def icon_path
asset_path([asset_path('sprite.svg'), '#', icon].join, host: asset_host)
asset_path([design_system_asset_path('img/sprite.svg'), '#', icon].join, host: asset_host)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/components/phone_input_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
},
) %>
<% end %>
<%= stylesheet_link_tag 'intlTelInput' %>
<%= stylesheet_link_tag 'intl-tel-input/build/css/intlTelInput' %>
2 changes: 0 additions & 2 deletions app/decorators/service_provider_session_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def s3_logo_url(service_provider)
def legacy_logo_url
logo = sp_logo
ActionController::Base.helpers.image_path("sp-logos/#{logo}")
rescue Propshaft::MissingAssetError
''
end

def new_session_heading
Expand Down
7 changes: 7 additions & 0 deletions app/helpers/asset_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module AssetHelper
DESIGN_SYSTEM_ASSET_ROOT = '@18f/identity-design-system/dist/assets'.freeze

def design_system_asset_path(path)
File.join(DESIGN_SYSTEM_ASSET_ROOT, path)
end
end
2 changes: 1 addition & 1 deletion app/helpers/script_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def render_javascript_pack_once_tags(*names)
private

SAME_ORIGIN_ASSETS = %w[
sprite.svg
@18f/identity-design-system/dist/assets/img/sprite.svg
].to_set.freeze

def local_crossorigin_sources?
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packages/components/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getAssetPath } from '@18f/identity-assets';

const SPRITE_URL = getAssetPath('sprite.svg');
const SPRITE_URL = getAssetPath('@18f/identity-design-system/dist/assets/img/sprite.svg');

export type DesignSystemIcon =
| 'accessibility_new'
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/_unphishable_badge.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="lg-verification-badge">
<%= image_tag(
asset_path('alerts/unphishable.svg'),
design_system_asset_path('img/alerts/unphishable.svg'),
size: 16,
class: 'text-middle',
alt: '',
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/_verified_account_badge.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="lg-verification-badge">
<%= image_tag(
asset_path('alerts/success.svg'),
design_system_asset_path('img/alerts/success.svg'),
size: 16,
class: 'text-middle',
alt: '',
Expand Down
8 changes: 4 additions & 4 deletions app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
<%= csrf_meta_tags %>

<%= favicon_link_tag(
asset_path('favicons/apple-touch-icon.png'),
design_system_asset_path('img/favicons/apple-touch-icon.png'),
rel: 'apple-touch-icon',
sizes: '180x180',
type: 'image/png',
) %>
<%= favicon_link_tag(
asset_path('favicons/favicon-40.png'),
design_system_asset_path('img/favicons/favicon-40.png'),
rel: 'icon',
sizes: '40x40',
type: 'image/png',
) %>
<%= favicon_link_tag(
asset_path('favicons/favicon-16.png'),
design_system_asset_path('img/favicons/favicon-16.png'),
rel: 'icon',
sizes: '16x16',
type: 'image/png',
) %>
<%= favicon_link_tag(
asset_path('favicons/safari-pinned-tab.svg'),
design_system_asset_path('img/favicons/safari-pinned-tab.svg'),
rel: 'mask-icon',
color: '#e21c3d',
type: nil,
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_banner-lock-icon.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= image_tag(
asset_path('lock.svg'),
design_system_asset_path('img/lock.svg'),
width: 9,
height: 12,
class: 'usa-banner__lock-image',
Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'action_view/railtie'
require 'action_mailer/railtie'
require 'rails/test_unit/railtie'
require 'sprockets/railtie'
require 'identity/logging/railtie'

require_relative '../lib/asset_sources'
Expand Down Expand Up @@ -55,6 +56,8 @@ class Application < Rails::Application
config.load_defaults '7.0'
config.active_record.belongs_to_required_by_default = false
config.active_record.legacy_connection_handling = false
config.assets.unknown_asset_fallback = true
config.assets.resolve_assets_in_css_urls = true
config.active_job.queue_adapter = :good_job

FileUtils.mkdir_p(Rails.root.join('log'))
Expand Down
5 changes: 4 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
config.consider_all_requests_local = true
config.active_support.deprecation = :log
config.active_record.migration_error = :page_load
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.assets.debug = true
config.assets.digest = true
config.assets.gzip = false
config.assets.raise_runtime_errors = true
config.i18n.raise_on_missing_translations = true

# Raise exceptions for disallowed deprecations.
Expand Down
9 changes: 8 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
config.action_controller.perform_caching = true
config.force_ssl = true

config.asset_host = IdentityConfig.store.asset_host.presence || IdentityConfig.store.domain_name
config.asset_host = proc do |_source, request|
# we want precompiled assets to have domain-agnostic URLs
# and request is nil during asset precompilation
(IdentityConfig.store.asset_host.presence || IdentityConfig.store.domain_name) if request
end
config.assets.compile = false
config.assets.digest = true
config.assets.gzip = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.active_record.dump_schema_after_migration = false
Expand Down
5 changes: 5 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
config.action_controller.allow_forgery_protection = false
config.active_support.test_order = :random
config.active_support.deprecation = :stderr
config.assets.gzip = false
config.i18n.raise_on_missing_translations = true

config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: IdentityConfig.store.domain_name }
config.action_mailer.asset_host = IdentityConfig.store.mailer_domain_name

config.assets.debug = false

# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise

Expand All @@ -29,6 +32,8 @@

config.action_controller.asset_host = ENV['RAILS_ASSET_HOST'] if ENV.key?('RAILS_ASSET_HOST')

config.assets.digest = ENV.key?('RAILS_DISABLE_ASSET_DIGEST') ? false : true

config.middleware.use RackSessionAccess::Middleware

config.after_initialize do
Expand Down
11 changes: 8 additions & 3 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

# Add additional assets to the asset load path
Rails.application.config.assets.paths.push(
'node_modules/intl-tel-input/build/img',
'node_modules/intl-tel-input/build/css',
'node_modules/@18f/identity-design-system/dist/assets/img',
'node_modules',
'node_modules/@18f/identity-design-system/dist/assets/fonts',
)

# Fix sassc sometimes segfaulting
Rails.application.config.assets.configure do |env|
env.export_concurrent = false
end

Sprockets.export_concurrent = Rails.env.test?
Loading