Skip to content

Commit

Permalink
Form builder drag handles
Browse files Browse the repository at this point in the history
* use a dropdown for HISP Portfolio Managers
* update gems
* specify chrome version because CircleCI can't find the latest 115.x
  • Loading branch information
ryanwoldatwork authored Jul 19, 2023
1 parent 387c951 commit 5e6d435
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 37 deletions.
9 changes: 7 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
version: 2.1
orbs:
browser-tools: circleci/[email protected]

jobs:
build:
docker:
- image: cimg/ruby:3.1.3-browsers
- image: cimg/ruby:3.1.4-browsers
environment:
RAILS_ENV: test
PGHOST: 127.0.0.1
Expand All @@ -23,6 +26,8 @@ jobs:
working_directory: ~/repo

steps:
- browser-tools/install-browser-tools

- checkout

# Download and cache dependencies
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.1.3-slim
FROM ruby:3.1.4-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
Expand Down
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.1.3'
ruby '3.1.4'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4"
Expand Down
61 changes: 32 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,36 +96,36 @@ GEM
aes_key_wrap (1.1.0)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.783.0)
aws-partitions (1.788.0)
aws-record (2.11.0)
aws-sdk-dynamodb (~> 1, >= 1.85.0)
aws-sdk-core (3.176.1)
aws-sdk-core (3.178.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-dynamodb (1.90.0)
aws-sdk-core (~> 3, >= 3.176.0)
aws-sdk-dynamodb (1.92.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sdk-rails (3.7.1)
aws-sdk-rails (3.8.0)
aws-record (~> 2)
aws-sdk-ses (~> 1)
aws-sdk-sesv2 (~> 1)
aws-sdk-sqs (~> 1)
aws-sdk-ses (~> 1, >= 1.50.0)
aws-sdk-sesv2 (~> 1, >= 1.34.0)
aws-sdk-sqs (~> 1, >= 1.56.0)
aws-sessionstore-dynamodb (~> 2)
concurrent-ruby (~> 1)
railties (>= 5.2.0)
aws-sdk-ses (1.49.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-ses (1.54.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sdk-sesv2 (1.32.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-sesv2 (1.38.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sdk-sqs (1.53.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-sqs (1.61.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sessionstore-dynamodb (2.0.1)
aws-sdk-dynamodb (~> 1)
aws-sessionstore-dynamodb (2.1.0)
aws-sdk-dynamodb (~> 1, >= 1.85.0)
rack (~> 2)
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
Expand Down Expand Up @@ -169,7 +169,7 @@ GEM
chronic (0.10.2)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.0)
connection_pool (2.4.1)
crass (1.0.6)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
Expand Down Expand Up @@ -243,7 +243,7 @@ GEM
bindata
httpclient
jsonapi-renderer (0.2.2)
jwt (2.7.0)
jwt (2.7.1)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
Expand All @@ -262,7 +262,7 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logstop (0.3.0)
logstop (0.3.1)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -279,9 +279,9 @@ GEM
mime-types-data (3.2023.0218.1)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
mini_portile2 (2.8.4)
minitest (5.18.1)
msgpack (1.7.1)
msgpack (1.7.2)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.3.0)
Expand All @@ -294,7 +294,7 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
newrelic_rpm (9.3.0)
newrelic_rpm (9.3.1)
nio4r (2.5.9)
nokogiri (1.15.3)
mini_portile2 (~> 2.8.2)
Expand Down Expand Up @@ -330,7 +330,7 @@ GEM
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.1)
public_suffix (5.0.3)
puma (5.6.5)
nio4r (~> 2.0)
racc (1.7.1)
Expand Down Expand Up @@ -383,8 +383,8 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.8.0)
redis-namespace (1.10.0)
redis (4.8.1)
redis-namespace (1.11.0)
redis (>= 4)
regexp_parser (2.8.1)
request_store (1.5.1)
Expand All @@ -399,7 +399,7 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.3)
Expand All @@ -413,7 +413,7 @@ GEM
rspec-support (3.12.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.54.1)
rubocop (1.54.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -428,13 +428,16 @@ GEM
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-rails (2.20.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-rspec (2.19.0)
rubocop-rspec (2.22.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.13.0)
Expand Down Expand Up @@ -577,7 +580,7 @@ DEPENDENCIES
whenever

RUBY VERSION
ruby 3.1.3p185
ruby 3.1.4p223

BUNDLED WITH
2.3.12
1 change: 0 additions & 1 deletion app/assets/stylesheets/site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ span.usa-hint.save-notice {
margin: 10px 0;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
padding-top: 1px;
}
.word-break {
Expand Down
7 changes: 7 additions & 0 deletions app/views/admin/form_sections/_view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<div class="section">
<div class="section-header">
<div class="section-title-view">
<%= link_to "javascript:void(0)",
class: "usa-button usa-button--base bg-base-light drag-handle float-right margin-right-1",
data: { id: section.id },
"aria-label" => "Form section order" do %>
<i class="fa fa-solid fa-sort"></i>
<% end %>

<label class="usa-label text-uppercase font-body-3xs" style="margin-top: 0;" for="instructions">
Section title
</label>
Expand Down
9 changes: 9 additions & 0 deletions app/views/admin/questions/_question.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<%= render 'components/forms/edit/button_dropdown', { form: form, question: question } if form_permissions?(form: form) %>

<div class="question-menu-action margin-right-1">
<%= link_to "javascript:void(0)",
class: "usa-button usa-button--base bg-base-light margin-right-0 float-right drag-handle",
data: { id: question.id },
"aria-label" => "Question order" do %>
<i class="fa fa-solid fa-sort"></i>
<% end %>
</div>

<% if question.question_type == "text_field" %>
<% @form_component_path = 'components/forms/edit/question_types/text_field' %>
<% elsif question.question_type == "text_email_field" %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/service_providers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
</div>
<div class="grid-col-6">
<div class="field">
<%= form.label :portfolio_manager_email, class: "usa-label" %>
<%= form.text_field :portfolio_manager_email, class: "usa-input" %>
<%= form.label :portfolio_manager_email, "Portfolio Manager (Service Manager permissions)", class: "usa-label" %>
<%= select_tag :portfolio_manager_email, options_for_select(User.service_managers.order(:email).map { |user| [user.email, user.email] }), prompt: "Select a user", id: "add-user-id", style: "display: inline-block; margin-right: 1em;", class: "usa-select" %>
</div>

<div class="field">
Expand Down
2 changes: 2 additions & 0 deletions app/views/components/forms/edit/_builder.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ $(function() {
$(".questions").sortable({
items: '.question',
connectWith: ".questions",
handle: ".drag-handle",
distance: 20,
update: function(e, ui) {
var section_id = $(this).closest(".form-section-div").attr('data-id');
Expand All @@ -260,6 +261,7 @@ $(function() {

$(".sorting-div").sortable({
distance: 20,
handle: ".drag-handle",
update: function(e, ui) {
var url = ui.item.data("url");
$.ajax({
Expand Down
2 changes: 1 addition & 1 deletion app/views/components/forms/edit/_button_dropdown.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="question-menu-action">
<%= link_to edit_admin_form_question_path(form, question),
class: "usa-button usa-button--base margin-right-0 form-edit-question",
class: "usa-button usa-button--base margin-right-1 form-edit-question",
data: { id: question.id },
"aria-label" => "Edit" do %>
<i class="fa fa-pencil-alt"></i>
Expand Down
2 changes: 2 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
exit 1
end

Webdrivers::Chromedriver.required_version = "114.0.5735.90"

# for Capybara
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
Expand Down

0 comments on commit 5e6d435

Please sign in to comment.