Skip to content

Commit

Permalink
Merge pull request #603 from CDLUC3/bug/fix-yarn-build
Browse files Browse the repository at this point in the history
Bug/fix yarn build
  • Loading branch information
briri committed Jun 25, 2024
2 parents 313a544 + ffe59b6 commit 96d8987
Show file tree
Hide file tree
Showing 31 changed files with 1,180 additions and 9,034 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_footers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
border-radius:0px;
z-index: 1;
ul {
padding-right: $grid-gutter-width / 2;
padding-right: calc($grid-gutter-width / 2);
}
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_labels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* RADIO BUTTONS */
.radio label {
margin-right: $grid-gutter-width / 2;
margin-right: calc($grid-gutter-width / 2);
}

/* Remove mandatory * from check_box_tag in Admin search */
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

/* LIST STYLING */
span.sublist {
margin-left: $grid-gutter-width / -2;
margin-left: calc($grid-gutter-width / -2);
margin-right: 25px;
}
4 changes: 2 additions & 2 deletions app/assets/stylesheets/blocks/_logos.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* HEADER LOGOS */
.app-logo {
height: 50px;
padding-right: $grid-gutter-width / 2;
padding-right: calc($grid-gutter-width / 2);
}

.org-logo {
height: 100px;
padding-right: $grid-gutter-width / 2;
padding-right: calc($grid-gutter-width / 2);
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_modal_permissions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
/* Overrides list-group-item */
#modal-permissions .list-group-item {
height: 30px;
padding: 5px $grid-gutter-width / 2;
padding: 5px calc($grid-gutter-width / 2);
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_navbars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
}
#org-navbar .org-links {
padding-top: $grid-gutter-width / 2;
padding-top: calc($grid-gutter-width / 2);
}
#org-navbar .org-a {
line-height: 36px !important;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_new_plans_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// we should provide utility classes which can provide the desired style to this object
#new_plan {
.create-plan-or {
padding: 5px 0 0 $grid-gutter-width / 2;
padding: 5px 0 0 calc($grid-gutter-width / 2);
}
.create-plan-checkbox {
margin-left: -40px;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_org_links.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: Refactor this. Instead of writing specific CSS rules for particular objects,
// we should provide utility classes which can provide the desired style to this object
.remove-org-link i {
margin-left: $grid-gutter-width / -2;
margin-left: calc($grid-gutter-width / 2);
margin-top: $grid-gutter-width;
}
4 changes: 2 additions & 2 deletions app/assets/stylesheets/blocks/_panels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

.panel-title a {
display: block;
padding: 8px $grid-gutter-width / 2;
margin: -10px $grid-gutter-width / -2;
padding: 8px calc($grid-gutter-width / 2);
margin: -10px calc($grid-gutter-width / -2);
background-color: $color-primary-background;
color: $color-primary-text;
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_profile_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// we should provide utility classes which can provide the desired style to this object
.org-logo-controls {
display: inline-block;
margin-left: $grid-gutter-width / 2;
margin-left: calc($grid-gutter-width / 2);
input { display: inline-block; }
strong { margin: 0 10px; }
}
4 changes: 2 additions & 2 deletions app/assets/stylesheets/blocks/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ thead th.table-scope {

a {
color: $color-secondary-text;
padding: 2px ($grid-gutter-width / 2) 2px 2px;
padding: 2px calc($grid-gutter-width / 2) 2px 2px;
}
}

Expand All @@ -35,7 +35,7 @@ th.download-column {
/* Fix issues with dropdwon within tables being cut off */
.table-responsive > .table {
width: 100%;
margin-bottom: $grid-gutter-width / 2;
margin-bottom: calc($grid-gutter-width / 2);
overflow: auto;
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/blocks/_template_filters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
@use "../../../../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss" as *;
.template-table-filters .navbar-nav > li > a {
color: $color-secondary-text;
padding: 5px ($grid-gutter-width / 2) 5px 5px;
padding: 5px calc($grid-gutter-width / 2) 5px 5px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@function fade($color, $amnt) {
@if $amnt > 1 {
$amnt: $amnt / 100; // convert to percentage if int
$amnt: calc($amnt / 100); // convert to percentage if int
}
@return rgba($color, $amnt);
}
Expand Down
13 changes: 5 additions & 8 deletions app/controllers/answers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def create_or_update
# rubocop:enable Layout/LineLength
return
end

q = Question.find(p_params[:question_id])

# rubocop:disable Metrics/BlockLength
Expand Down Expand Up @@ -67,6 +68,7 @@ def create_or_update
@answer = Answer.new(args.merge(user_id: current_user.id))
@answer.lock_version = 1
authorize @answer

if q.question_format.rda_metadata?
@answer.update_answer_hash(
JSON.parse(standards.to_json), args[:text]
Expand All @@ -86,15 +88,10 @@ def create_or_update
# 200 with an empty body. We should update to send back some JSON. The
# check should probably happen on create/update
# rubocop:disable Style/GuardClause

if @answer.present?
@plan = Plan.includes(
sections: {
questions: %i[
answers
question_format
]
}
).find(p_params[:plan_id])
@plan = Plan.includes(answers: { question: :question_format }).find(p_params[:plan_id])

@question = @answer.question
@section = @plan.sections.find_by(id: @question.section_id)
template = @section.phase.template
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/dmptool/public_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def plan_index
search_term = process_search
sort_by = process_sort_by

puts sort_by

# Fetch the plan ids that match the user's search criteria
# NOTE: changing the order of columns in `pluck` will impact drop_unused_facets()
plan_ids = ::Plan.joins(roles: [user: [:org]])
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,11 @@ def answer

# GET /plans/:id/download
def download
@plan = Plan.find(params[:id])
@plan = Plan.includes(:research_outputs, :related_identifiers, template: [:phases], roles: [:user])
.find(params[:id])
@has_related_identifiers = @plan.related_identifiers.any?
@has_research_outputs = @plan.research_outputs.any?

authorize @plan
@phase_options = @plan.phases.order(:number).pluck(:title, :id)
@phase_options.insert(0, ['All phases', 'All']) if @phase_options.length > 1
Expand Down
19 changes: 15 additions & 4 deletions app/controllers/registry_orgs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def find_by_search_term(term:, **options)
registry_matches.reject { |match| match.org_id.nil? } if restricting

# Filter out any RegistryOrgs that are also in the Orgs, we only want to return one!
registry_matches = registry_matches.reject { |r_org| org_matches.map(&:id).include?(r_org.org_id) }
registry_matches = (registry_matches - org_matches) + org_matches

matches = (registry_matches + org_matches).flatten.compact.uniq
matches = deduplicate(term: term, list: matches)
matches.map(&:name).flatten.compact.uniq
Expand All @@ -85,7 +86,12 @@ def find_by_search_term(term:, **options)
def orgs_search(term:, **options)
return [] if options[:unknown_only]

matches = Org.includes(:users).search(term)
matches = Org.left_joins(:users)
.search(term)
.select('orgs.*, COUNT(users.id) AS user_count')
.group('orgs.id')
.limit(500)

if options[:template_owner_only]
matches = matches.joins(:templates)
.where('templates.published = true')
Expand All @@ -107,7 +113,12 @@ def registry_orgs_search(term:, **options)
# If we only want Orgs with a template, skip the RegistryOrg search
return [] if options[:template_owner_only]

matches = RegistryOrg.includes(org: :users).search(term)
matches = RegistryOrg.left_joins(org: :users)
.search(term)
.select('registry_orgs.*, COUNT(users.id) AS user_count')
.group('registry_orgs.id')
.limit(500)

# If we are only allowing known Orgs then filter by org_id presence
matches = matches.where.not(org_id: nil) if options.fetch(:known_only, false)
matches = matches.where(org_id: nil) if options.fetch(:unknown_only, false)
Expand Down Expand Up @@ -159,7 +170,7 @@ def deduplicate(term:, list: [])
hashes = list.map do |item|
{
normalized: item.name.downcase.strip,
user_count: item.respond_to?(:users) ? item.users.count : 0,
user_count: item.respond_to?(:user_count) ? item.user_count : 0,
weight: weigh(term: term, org: item),
original: item
}
Expand Down
4 changes: 2 additions & 2 deletions app/views/branded/plans/_download_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
<% end %>
</div>
<% end %>
<% if @plan.research_outputs.any? %>
<% if @has_research_outputs %>
<div class="checkbox">
<%= label_tag 'export[research_outputs]' do %>
<%= check_box_tag 'export[research_outputs]', true, true %>
<%= _('include a table of your research outputs') %>
<% end %>
</div>
<% end %>
<% if @plan.related_identifiers.any? %>
<% if @has_related_identifiers %>
<div class="checkbox">
<%= label_tag 'export[related_identifiers]' do %>
<%= check_box_tag 'export[related_identifiers]', true, false %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/branded/shared/export/_plan_styling.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ end
%>

<style>
@import 'https://fonts.googleapis.com/css?family=<%= font_face.downcase.include?('times') ? 'Times' : 'Roboto' %>';
@import 'https://fonts.googleapis.com/css?family=<%= font_face.downcase.include?('tinos') ? 'Tinos' : 'Roboto' %>';

html body {
font-family: <%= font_face %>;
font-size: <%= converted_size %>;
font-size: <%= font_size # converted_size %>;
line-height: 150%;
}

Expand Down
6 changes: 6 additions & 0 deletions app/views/branded/static_pages/editorial_board.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
IACUC Liaison, Health Sciences Library System, University of Pittsburgh
</div>
</div>
<div class="row">
<div class="col-md-2"><%= image_tag "Nick_Ruhs.jpg", alt: 'Nick Ruhs photo' %></div>
<div class="col-md-10 board-bio">
<strong>Nick Ruhs PhD</strong><br>Research Data Management Librarian, STEM Data Fellowship Coordinator, Florida State University Libraries
</div>
</div>
<div class="row">
<div class="col-md-2"><%= image_tag "Sackmann_Anna_hr.jpg", alt: 'Anna Sackmann photo' %></div>
<div class="col-md-10 board-bio">
Expand Down
8 changes: 4 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ module.exports = function(api) {
isTestEnv && 'babel-plugin-dynamic-import-node',
'@babel/plugin-transform-destructuring',
[
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-class-properties',
{
loose: true
}
],
[
'@babel/plugin-proposal-private-property-in-object',
'@babel/plugin-transform-private-property-in-object',
{
loose: true
}
],
[
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-object-rest-spread',
{
useBuiltIns: true
}
Expand All @@ -74,7 +74,7 @@ module.exports = function(api) {
}
],
[
'@babel/plugin-proposal-private-methods',
'@babel/plugin-transform-private-methods',
{
loose: true
}
Expand Down
11 changes: 0 additions & 11 deletions config/webpack/loaders/erb.js

This file was deleted.

2 changes: 0 additions & 2 deletions config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const erbLoader = require('./loaders/erb');

const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production';
console.log(`Webpack running in ${mode} mode.`);
Expand All @@ -19,7 +18,6 @@ module.exports = {
test: /\.(sa|sc|c)ss$/,
use: ["style-loader", "css-loader", "sass-loader"]
},
erbLoader,
],
},
entry: {
Expand Down
3 changes: 0 additions & 3 deletions config/webpacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ default: &default
- .woff2

extensions:
# DMPTool customization to add JS.ERB
- .js.erb
- .erb
- .mjs
- .js
- .sass
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20240617115900_add_index_to_settings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddIndexToSettings < ActiveRecord::Migration[6.1]
def change
add_index :settings, [:target_id, :target_type], name: 'settings_target'
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@
t.string "target_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["target_id", "target_type"], name: "settings_target"
end

create_table "stats", id: :integer, charset: "utf8mb3", force: :cascade do |t|
Expand Down
Loading

0 comments on commit 96d8987

Please sign in to comment.