Skip to content

Commit

Permalink
updates to registry screens
Browse files Browse the repository at this point in the history
* updates to open-api spec file
* update DigitalServiceAccounts
* add linktree to Service Accounts
* show parent and child organizations on an Org
* update gems
* don't require federal register url for CX Data Collections
  • Loading branch information
ryanwoldatwork authored May 10, 2023
1 parent 07b508a commit 0ec9e4f
Show file tree
Hide file tree
Showing 18 changed files with 924 additions and 222 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ group :test do
gem 'factory_bot_rails'
gem 'rails-controller-testing'
gem 'rspec-rails'
gem 'selenium-webdriver'
gem 'selenium-webdriver', "4.8.6"
gem 'simplecov', require: false
gem 'webdrivers', '>= 5.1.0'
end
42 changes: 21 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ GEM
aes_key_wrap (1.1.0)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.749.0)
aws-partitions (1.762.0)
aws-record (2.10.1)
aws-sdk-dynamodb (~> 1.18)
aws-sdk-core (3.171.0)
aws-sdk-core (3.172.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -220,12 +220,12 @@ GEM
activesupport (>= 5.0)
hashie (5.0.0)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
importmap-rails (1.1.5)
importmap-rails (1.1.6)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
jbuilder (2.11.5)
Expand Down Expand Up @@ -262,7 +262,7 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logstop (0.3.0)
loofah (2.20.0)
loofah (2.21.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.1)
Expand All @@ -278,7 +278,7 @@ GEM
mime-types-data (3.2023.0218.1)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
mini_portile2 (2.8.2)
minitest (5.18.0)
msgpack (1.7.0)
multi_json (1.15.0)
Expand All @@ -293,7 +293,7 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
newrelic_rpm (9.2.0)
newrelic_rpm (9.2.2)
nio4r (2.5.9)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
Expand Down Expand Up @@ -322,20 +322,20 @@ GEM
activerecord (>= 5.2)
request_store (~> 1.1)
parallel (1.23.0)
parser (3.2.2.0)
parser (3.2.2.1)
ast (~> 2.4.1)
pg (1.4.6)
pg (1.5.3)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.1)
puma (5.6.5)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
rack (2.2.7)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-protection (3.0.5)
rack-protection (3.0.6)
rack
rack-test (2.1.0)
rack (>= 1.3)
Expand Down Expand Up @@ -390,22 +390,22 @@ GEM
railties (>= 5.2)
rexml (3.2.5)
rolify (6.0.1)
rspec-core (3.12.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.1)
rspec-rails (6.0.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.11)
rspec-expectations (~> 3.11)
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.0)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
Expand All @@ -419,7 +419,7 @@ GEM
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.0)
rubocop-ast (1.28.1)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.1)
rubocop (~> 1.41)
Expand Down Expand Up @@ -504,7 +504,7 @@ GEM
chronic (>= 0.6.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.7)
zeitwerk (2.6.8)

PLATFORMS
ruby
Expand Down Expand Up @@ -560,7 +560,7 @@ DEPENDENCIES
rubocop-rails
rubocop-rspec
sass-rails (>= 6.0.0)
selenium-webdriver
selenium-webdriver (= 4.8.6)
sidekiq
simplecov
sprockets-rails
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/admin/digital_products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def edit

def create
@digital_product = DigitalProduct.new(digital_product_params)
@digital_product.organization_list.add(current_user.organization_id)
organization = current_user.organization
@digital_product.organization_list.add(organization.id)
@digital_product.organization_list.add(organization.parent.id) if organization.parent

if @digital_product.save
Event.log_event(Event.names[:digital_product_created], 'Digital Product', @digital_product.id, "Digital Product #{@digital_product.name} created at #{DateTime.now}", current_user.id)
Expand Down Expand Up @@ -111,7 +113,9 @@ def remove_tag

def add_organization
ensure_digital_product_permissions(digital_product: @digital_product)
@digital_product.organization_list.add(params[:organization_id])
organization = Organization.find(params[:organization_id])
@digital_product.organization_list.add(organization.id)
@digital_product.organization_list.add(organization.parent.id) if organization.parent
@digital_product.save
set_sponsoring_agency_options
end
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/admin/digital_service_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def edit

def create
@digital_service_account = DigitalServiceAccount.new(digital_service_account_params)
@digital_service_account.organization_list.add(current_user.organization_id)
organization = Organization.find(current_user.organization_id)
@digital_service_account.organization_list.add(organization.id)
@digital_service_account.organization_list.add(organization.parent.id) if organization.parent

if @digital_service_account.save
current_user.add_role(:contact, @digital_service_account)
Expand Down Expand Up @@ -131,7 +133,9 @@ def remove_tag

def add_organization
ensure_digital_service_account_permissions(digital_service_account: @digital_service_account)
@digital_service_account.organization_list.add(params[:organization_id])
organization = Organization.find(params[:organization_id])
@digital_service_account.organization_list.add(organization.id)
@digital_service_account.organization_list.add(organization.parent.id) if organization.parent
@digital_service_account.save
set_sponsoring_agency_options
end
Expand Down
1 change: 1 addition & 0 deletions app/models/digital_service_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def self.list
'Ideascale',
'Instagram',
'Linkedin',
'Linktree',
'Livestream',
'Mastodon',
'Medium',
Expand Down
4 changes: 4 additions & 0 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class Organization < ApplicationRecord
def parent
parent_id ? Organization.find(parent_id) : nil
end

def children
Organization.where(parent_id: self.id)
end

def slug
abbreviation.downcase
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/digital_product_versions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>

<% if digital_product_permissions?(digital_product: @digital_product, user: current_user) %>
<%= link_to "New digital product version", new_admin_digital_product_digital_product_version_path(@digital_product), class: "usa-button" %>
<%= link_to "New digital product version", new_admin_digital_product_digital_product_version_path(@digital_product), class: "usa-button full-width" %>
<% end %>

<table class="usa-table width-full">
Expand Down
14 changes: 11 additions & 3 deletions app/views/admin/digital_products/_tags.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
<%= label_tag :tags, nil, class: "usa-label" %>

<% if digital_product_permissions?(digital_product: digital_product, user: current_user) %>
<%= f.text_field :tag_list, placeholder: "Add a tag" , value: nil, class: "usa-input tag-input" %>
<ul class="usa-button-group">
<li class="usa-button-group__item">
<%= f.text_field :tag_list, placeholder: "Add a tag" , value: nil, class: "usa-input tag-input margin-top-0" %>
</li>
<li class="usa-button-group__item">
<%= f.button id: "tag_list_add_button", class: "usa-button", style: "display: inline;", "aria-label" => "Add tag" do %>
<span class="fa fa-plus"></span>
<% end %>
</li>
</ul>
<% end %>

<div class="tag-list">
Expand Down Expand Up @@ -32,7 +41,7 @@
<script>
$(function() {

$(".tag-input").on("blur", function(event) {
$("#tag_list_add_button").on("click", function(event) {
event.preventDefault();

var thisForm = $(this).closest("form");
Expand All @@ -43,7 +52,6 @@
}).done(function(data) {
event.target.focus();
});

});

// return on Enter
Expand Down
1 change: 1 addition & 0 deletions app/views/admin/digital_products/add_tag.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$(".tags-div").html("<%= escape_javascript render(partial: 'admin/digital_products/tags', locals: { digital_product: @digital_product }) %>");
$("#digital_product_tag_list").focus()
2 changes: 2 additions & 0 deletions app/views/admin/digital_products/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<tr>
<th data-sortable scope="col">Organization</th>
<th data-sortable scope="col">Name</th>
<th data-sortable scope="col">Contacts</th>
<th data-sortable scope="col">Status</th>
</tr>
</thead>
Expand All @@ -35,6 +36,7 @@
<tr>
<td><%= link_to digital_product.name, admin_digital_product_path(digital_product) %></td>
<td><%= digital_product.name %></td>
<td><%= digital_product.contacts.collect(&:email).join(", ") %></td>
<td><%= digital_product.aasm_state %></td>
</tr>
<% end %>
Expand Down
18 changes: 14 additions & 4 deletions app/views/admin/digital_service_accounts/_tags.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
<div class="grid-col-6">
<%= label_tag "Tags", nil, class: "usa-label" %>

<% if digital_service_account_permissions?(digital_service_account: @digital_service_account, user: current_user) %>
<%= f.text_field :tag_list, placeholder: "Add a tag" , value: nil, class: "usa-input tag-input" %>
<% if digital_service_account_permissions?(digital_service_account: @digital_service_account, user: current_user) %>
<ul class="usa-button-group">
<li class="usa-button-group__item">
<%= f.text_field :tag_list, placeholder: "Add a tag" , value: nil, class: "usa-input tag-input margin-top-0" %>
</li>
<li class="usa-button-group__item">
<%= f.button id: "tag_list_add_button", class: "usa-button", style: "display: inline;", "aria-label" => "Add tag" do %>
<span class="fa fa-plus"></span>
<% end %>
</li>
</ul>
<% end %>

<div class="tag-list margin-top-1">
Expand All @@ -31,7 +40,7 @@
<% if digital_service_account_permissions?(digital_service_account: @digital_service_account, user: current_user) %>
<script>
$(function() {
$(".tag-input").on("blur", function(event) {
$("#tag_list_add_button").on("click", function(event) {
event.preventDefault();
var thisForm = $(this).closest("form");
$.ajax({
Expand All @@ -41,14 +50,15 @@
});
});

// return on Enter
$(".tag-input").on("keypress", function (e) {
if (e.which == 13) {
document.activeElement.blur();
return false;
}
});

$(".remove-tag-link").on("click", function(e) {
$(".tag-list .remove-tag-link").on("click", function(e) {
event.preventDefault();
var thisForm = $(this).closest("form");
$.ajax({
Expand Down
1 change: 1 addition & 0 deletions app/views/admin/digital_service_accounts/add_tag.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$(".tags-div").html("<%= escape_javascript render(partial: 'admin/digital_service_accounts/tags', locals: { digital_service_account: @digital_service_account }) %>");
$("#digital_service_account_tag_list").focus()
2 changes: 2 additions & 0 deletions app/views/admin/digital_service_accounts/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<tr>
<th data-sortable scope="col">Platform</th>
<th data-sortable scope="col">Account name</th>
<th data-sortable scope="col">Contacts</th>
<th data-sortable scope="col">Status</th>
</tr>
</thead>
Expand All @@ -41,6 +42,7 @@
<% end %>
</td>
<td><%= digital_service_account.name %></td>
<td><%= digital_service_account.contacts.collect(&:email).join(", ") %></td>
<td><%= digital_service_account.aasm_state %></td>
</tr>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<p class="font-sans-2xs text-muted">
Enter the <a href="https://www.reginfo.gov/" target="_blank">reginfo.gov</a> URL for the survey form.
</p>
<%= form.url_field :federal_register_url, class: "usa-input", placeholder: "https://www.reginfo.gov/...", required: true %>
<%= form.url_field :federal_register_url, class: "usa-input", placeholder: "https://www.reginfo.gov/..." %>
</div>
<div class="field">
<%= form.label :operational_metrics, class: "usa-label" %>
Expand Down
Loading

0 comments on commit 0ec9e4f

Please sign in to comment.