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
9 changes: 6 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.8
3.2.10
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
34 changes: 17 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -718,7 +718,7 @@ DEPENDENCIES
widget_renderer!

RUBY VERSION
ruby 3.2.8
ruby 3.2.10p266

BUNDLED WITH
2.7.1
8 changes: 7 additions & 1 deletion app/controllers/admin/forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
106 changes: 106 additions & 0 deletions app/views/admin/forms/all.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<% content_for :navigation_title do %>
All Forms
<% end %>

<table class="usa-table usa-table--sticky-header width-full font-sans-2xs">
<thead class="font-sans-3xs z-top">
<tr>
<th>#</th>
<th data-sortable scope="col"
data-type="organization-name">
Organization name
</th>
<th data-sortable scope="col"
data-type="name">
Name
</th>
<th data-sortable scope="col">
Questions
</th>
<th data-sortable scope="col">
Responses
</th>
<th data-sortable scope="col">
Form type
</th>
<th data-sortable scope="col">
Created at
</th>
<th data-sortable scope="col"
data-type="status">
Status
</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @forms.each_with_index do |form, index| %>
<tr>
<td class="text-center">
<%= index + 1 %>
</td>
<td>
<%= render "admin/organizations/badge", organization: form.organization %>
</td>
<td>
<%= link_to form.name, admin_form_path(form) %>
</td>
<td>
<%= form.questions_count %>
</td>
<td data-sort-value="<%= form.response_count %>">
<%= number_with_delimiter(form.response_count) %>
</td>
<td>
<%= form.kind %>
</td>
<td data-sort-value="<%= form.created_at.to_i %>">
<%= form.created_at.to_date %>
</td>
<td>
<%- if form.created? %>
<span class="usa-tag bg-cyan">
<%= form.aasm_state %>
</span>
<%- elsif form.published? %>
<span class="usa-tag bg-green">
<%= form.aasm_state %>
</span>
<% else %>
<span class="usa-tag">
<%= form.aasm_state %>
</span>
<% end %>
</td>
<td>
<ul class="usa-nav__primary float-menu usa-accordion">
<li class="usa-nav__primary-item">
<button
class="usa-accordion__button usa-nav__link usa-current"
aria-expanded="false"
aria-controls="extended-nav-section-one-<%= form.short_uuid %>"
aria-label="Show actions for <%= form.name %>">
<span class="usa-sr-only">Show actions for <%= form.name %></span>
</button>
<ul id="extended-nav-section-one-<%= form.short_uuid %>" class="usa-nav__submenu" hidden="">
<li class="usa-nav__submenu-item">
<%= link_to edit_admin_form_path(form) do %>
Edit
<% end %>
</li>
<li class="usa-nav__submenu-item">
<%= link_to 'Preview', example_admin_form_path(form), target: "_blank", rel: "noopener" %>
</li>
<li class="usa-nav__submenu-item">
<%= link_to copy_admin_form_path(form), method: :post, data: { confirm: 'Are you sure?' } do %>
Copy
<% end %>
</li>
</ul>
</li>
</ul>
</td>
</tr>
<% end %>
</tbody>
</table>
11 changes: 0 additions & 11 deletions app/views/admin/forms/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
<thead class="font-sans-3xs z-top">
<tr>
<th>#</th>
<%- if admin_permissions? %>
<th data-sortable scope="col"
data-type="organization-name">
Organization name
</th>
<% end %>
<th data-sortable scope="col"
data-type="name">
Name
Expand Down Expand Up @@ -57,11 +51,6 @@
<td class="text-center">
<%= index + 1 %>
</td>
<%- if admin_permissions? %>
<td>
<%= render "admin/organizations/badge", organization: form.organization %>
</td>
<% end %>
<td>
<%= link_to form.name, admin_form_path(form) %>
</td>
Expand Down
15 changes: 10 additions & 5 deletions app/views/admin/site/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
<span>Users</span>
</a>
</li>
<li>
<%= link_to all_admin_forms_path do %>
All Forms
<% end %>
</li>
<li>
<a href="/admin/management">
<span>Client Management</span>
Expand All @@ -53,11 +58,6 @@
<span>Manage Sidekiq</span>
</a>
</li>
<li>
<%= link_to admin_record_retention_path do %>
Record Retention
<% end %>
</li>
</ul>
</div>
<div class="grid-col-3">
Expand Down Expand Up @@ -127,6 +127,11 @@
Integrations
<% end %>
</li>
<li>
<%= link_to admin_record_retention_path do %>
Record Retention
<% end %>
</li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Rails.application.configure do
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.alert = false
Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
get 'events', to: 'forms#events', as: :events
end
collection do
get 'all', to: 'forms#all'
post 'copy', to: 'forms#copy', as: :copy_id
end
resources :form_sections, except: %i[index show edit] do
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading