diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b51fb518..3b4acc64d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ version: 2.1 jobs: build: docker: - - image: cimg/ruby:3.2.8-node # Matches deployed Ruby version in CF + - image: cimg/ruby:3.2.10-node steps: - run: @@ -73,9 +73,12 @@ jobs: - run: name: Install gems + # Limit bundler to 2 parallel jobs to avoid CPU exhaustion on CircleCI Docker medium container + # Limit make tool for compiling native extensions to 2 jobs as well command: | bundle config set deployment true - bundle install + bundle config set jobs 2 + MAKE="make -j2" bundle install - save_cache: paths: @@ -96,7 +99,7 @@ jobs: test: docker: - - image: cimg/ruby:3.2.8-browsers # Matches deployed Ruby version in CF + - image: cimg/ruby:3.2.10-browsers environment: RAILS_ENV: test PGHOST: 127.0.0.1 diff --git a/.ruby-version b/.ruby-version index f092941a7..f15386a5d 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.8 +3.2.10 diff --git a/Gemfile b/Gemfile index c764d3cf0..0f2e37065 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.2.8' +ruby '3.2.10' # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem 'rails', '~> 8.0' diff --git a/Gemfile.lock b/Gemfile.lock index 93a3b557d..ea566967d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -228,14 +228,14 @@ GEM railties (>= 6.1.0) faker (3.5.2) i18n (>= 1.8.11, < 2) - faraday (2.13.4) + faraday (2.14.1) faraday-net_http (>= 2.0, < 3.5) json logger faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) - faraday-net_http (3.4.1) - net-http (>= 0.5.0) + faraday-net_http (3.4.2) + net-http (~> 0.5) ffi (1.17.2-aarch64-linux-gnu) ffi (1.17.2-aarch64-linux-musl) ffi (1.17.2-arm-linux-gnu) @@ -289,7 +289,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.13.2) + json (2.18.1) json-jwt (1.17.0) activesupport (>= 4.2) aes_key_wrap @@ -345,8 +345,8 @@ GEM multi_json (1.17.0) multi_xml (0.8.1) bigdecimal (>= 3.1, < 5) - net-http (0.6.0) - uri + net-http (0.9.1) + uri (>= 0.11.1) net-imap (0.5.10) date net-protocol @@ -358,21 +358,21 @@ GEM net-protocol newrelic_rpm (9.21.0) nio4r (2.7.4) - nokogiri (1.18.9-aarch64-linux-gnu) + nokogiri (1.19.1-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.9-aarch64-linux-musl) + nokogiri (1.19.1-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.18.9-arm-linux-gnu) + nokogiri (1.19.1-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.18.9-arm-linux-musl) + nokogiri (1.19.1-arm-linux-musl) racc (~> 1.4) - nokogiri (1.18.9-arm64-darwin) + nokogiri (1.19.1-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.9-x86_64-darwin) + nokogiri (1.19.1-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.9-x86_64-linux-gnu) + nokogiri (1.19.1-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.9-x86_64-linux-musl) + nokogiri (1.19.1-x86_64-linux-musl) racc (~> 1.4) oauth2 (2.0.14) faraday (>= 0.17.3, < 4.0) @@ -425,7 +425,7 @@ GEM puma (6.6.1) nio4r (~> 2.0) racc (1.8.1) - rack (3.2.3) + rack (3.2.5) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (3.0.0) @@ -615,7 +615,7 @@ GEM unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) uniform_notifier (1.18.0) - uri (1.0.4) + uri (1.1.1) useragent (0.16.11) version_gem (1.1.9) virtus (2.0.0) @@ -718,7 +718,7 @@ DEPENDENCIES widget_renderer! RUBY VERSION - ruby 3.2.8 + ruby 3.2.10p266 BUNDLED WITH 2.7.1 diff --git a/app/controllers/admin/forms_controller.rb b/app/controllers/admin/forms_controller.rb index 2ea10a59f..472e8e5e2 100644 --- a/app/controllers/admin/forms_controller.rb +++ b/app/controllers/admin/forms_controller.rb @@ -51,7 +51,13 @@ def index params[:aasm_state] = @status # set the filter and dropdown by default end - @forms = Form.filtered_forms(@current_user, @status) + @forms = Form.my_forms(@current_user, @status) + @tags = @forms.collect(&:tag_list).flatten.uniq.sort + end + + def all + ensure_admin + @forms = Form.all.non_templates @tags = @forms.collect(&:tag_list).flatten.uniq.sort end diff --git a/app/models/form.rb b/app/models/form.rb index 52d59d001..7ee3328ab 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -40,10 +40,8 @@ class Form < ApplicationRecord mount_uploader :logo, LogoUploader - def self.filtered_forms(user, aasm_state) - if user.admin? - items = all - elsif user.organizational_form_approver? + def self.my_forms(user, aasm_state) + if user.organizational_form_approver? items = user.organization.forms else items = user.forms.order('organization_id ASC').order('name ASC') diff --git a/app/views/admin/forms/all.html.erb b/app/views/admin/forms/all.html.erb new file mode 100644 index 000000000..58ec7478c --- /dev/null +++ b/app/views/admin/forms/all.html.erb @@ -0,0 +1,106 @@ +<% content_for :navigation_title do %> + All Forms +<% end %> + +
| # | ++ Organization name + | ++ Name + | ++ Questions + | ++ Responses + | ++ Form type + | ++ Created at + | ++ Status + | +Actions | +
|---|---|---|---|---|---|---|---|---|
| + <%= index + 1 %> + | ++ <%= render "admin/organizations/badge", organization: form.organization %> + | ++ <%= link_to form.name, admin_form_path(form) %> + | ++ <%= form.questions_count %> + | ++ <%= number_with_delimiter(form.response_count) %> + | ++ <%= form.kind %> + | ++ <%= form.created_at.to_date %> + | ++ <%- if form.created? %> + + <%= form.aasm_state %> + + <%- elsif form.published? %> + + <%= form.aasm_state %> + + <% else %> + + <%= form.aasm_state %> + + <% end %> + | ++ + | +