diff --git a/Gemfile b/Gemfile index 217f80ef..5a21f0d0 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end -gem 'administrate', '~> 0.19.0' +gem 'administrate', '~> 0.20.0' gem 'aws-sdk-rails' gem 'aws-sdk-s3' gem 'aws-sdk-sqs' diff --git a/Gemfile.lock b/Gemfile.lock index 76a9d608..011617cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,12 +89,12 @@ GEM tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - administrate (0.19.0) - actionpack (>= 5.0) - actionview (>= 5.0) - activerecord (>= 5.0) - jquery-rails (>= 4.0) - kaminari (>= 1.0) + administrate (0.20.1) + actionpack (>= 6.0, < 8.0) + actionview (>= 6.0, < 8.0) + activerecord (>= 6.0, < 8.0) + jquery-rails (~> 4.6.0) + kaminari (~> 1.2.2) sassc-rails (~> 2.1) selectize-rails (~> 0.6) annotate (3.2.0) @@ -102,63 +102,38 @@ GEM rake (>= 10.4, < 14.0) ansi (1.5.0) ast (2.4.2) - aws-eventstream (1.3.0) - aws-partitions (1.1020.0) - aws-record (2.13.2) - aws-sdk-dynamodb (~> 1, >= 1.85.0) - aws-sdk-core (3.214.0) + aws-eventstream (1.3.1) + aws-partitions (1.1055.0) + aws-sdk-core (3.219.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) + base64 jmespath (~> 1, >= 1.6.1) - aws-sdk-dynamodb (1.132.0) - aws-sdk-core (~> 3, >= 3.210.0) - aws-sigv4 (~> 1.5) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.99.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-rails (4.1.0) - actionmailbox (>= 7.0.0) - aws-record (~> 2) - aws-sdk-s3 (~> 1, >= 1.123.0) - aws-sdk-ses (~> 1, >= 1.50.0) - aws-sdk-sesv2 (~> 1, >= 1.34.0) - aws-sdk-sns (~> 1, >= 1.61.0) - aws-sdk-sqs (~> 1, >= 1.56.0) - aws-sessionstore-dynamodb (~> 2) - concurrent-ruby (~> 1.3, >= 1.3.1) - railties (>= 7.0.0) - aws-sdk-s3 (1.176.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-rails (5.1.0) + aws-sdk-core (~> 3) + railties (>= 7.1.0) + aws-sdk-s3 (1.182.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sdk-ses (1.78.0) - aws-sdk-core (~> 3, >= 3.210.0) - aws-sigv4 (~> 1.5) - aws-sdk-sesv2 (1.67.0) - aws-sdk-core (~> 3, >= 3.210.0) - aws-sigv4 (~> 1.5) - aws-sdk-sns (1.92.0) - aws-sdk-core (~> 3, >= 3.210.0) - aws-sigv4 (~> 1.5) - aws-sdk-sqs (1.89.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-sqs (1.93.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sessionstore-dynamodb (2.2.0) - aws-sdk-dynamodb (~> 1, >= 1.85.0) - rack (>= 2, < 4) - rack-session (>= 1, < 3) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) bcrypt (3.1.20) benchmark (0.4.0) - bigdecimal (3.1.8) + bigdecimal (3.1.9) bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) builder (3.3.0) - bullet (8.0.0) + bullet (8.0.1) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) @@ -192,14 +167,14 @@ GEM responders warden (~> 1.2.3) docile (1.4.1) - dotenv (3.1.4) - dotenv-rails (3.1.4) - dotenv (= 3.1.4) + dotenv (3.1.7) + dotenv-rails (3.1.7) + dotenv (= 3.1.7) railties (>= 6.1) drb (2.2.1) erubi (1.13.1) execjs (2.10.0) - ffi (1.17.0) + ffi (1.17.1) flipflop (2.8.0) activesupport (>= 4.0) terminal-table (>= 1.8) @@ -218,7 +193,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.9.0) + json (2.10.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -231,16 +206,17 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.4) launchy (3.0.1) addressable (~> 2.8) childprocess (~> 5.0) letter_opener (1.10.0) launchy (>= 2.2, < 4) + lint_roller (1.1.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.2) + logger (1.6.6) lograge (0.14.0) actionpack (>= 4) activesupport (>= 4) @@ -254,10 +230,9 @@ GEM net-imap net-pop net-smtp - marc (1.2.0) + marc (1.3.0) + nokogiri (~> 1.0) rexml - scrub_rb (>= 1.0.1, < 2) - unf marcel (1.0.4) matrix (0.4.2) mini_mime (1.1.5) @@ -298,7 +273,7 @@ GEM activerecord (>= 6.1) request_store (~> 1.4) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.1) ast (~> 2.4.1) racc pg (1.5.9) @@ -309,7 +284,7 @@ GEM date stringio public_suffix (6.0.1) - puma (6.5.0) + puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) rack (2.2.11) @@ -344,7 +319,7 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - rails-mermaid_erd (0.5.0) + rails-mermaid_erd (0.6.0) rails (>= 5.2) railties (7.1.5.1) actionpack (= 7.1.5.1) @@ -361,7 +336,7 @@ GEM ffi (~> 1.0) rdoc (6.12.0) psych (>= 4.0.0) - regexp_parser (2.9.3) + regexp_parser (2.10.0) reline (0.6.0) io-console (~> 0.5) request_store (1.7.0) @@ -369,29 +344,31 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.9) - rubocop (1.69.1) + rexml (3.4.1) + rubocop (1.73.1) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.36.2, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.36.2) + rubocop-ast (1.38.1) parser (>= 3.3.1.0) - rubocop-rails (2.27.0) + rubocop-rails (2.30.2) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.52.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop (>= 1.72.1, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) ruby-saml (1.17.0) nokogiri (>= 1.13.10) rexml - rubyzip (2.3.2) + rubyzip (2.4.1) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -402,21 +379,20 @@ GEM sprockets (> 3.0) sprockets-rails tilt - scout_apm (5.4.0) + scout_apm (5.6.1) parser - scrub_rb (1.0.1) securerandom (0.4.1) selectize-rails (0.12.6) - selenium-webdriver (4.27.0) + selenium-webdriver (4.29.1) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sentry-rails (5.22.0) + sentry-rails (5.22.4) railties (>= 5.0) - sentry-ruby (~> 5.22.0) - sentry-ruby (5.22.0) + sentry-ruby (~> 5.22.4) + sentry-ruby (5.22.4) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) simple_form (5.3.1) @@ -446,12 +422,11 @@ GEM terser (1.2.5) execjs (>= 0.3.0, < 3) thor (1.3.2) - tilt (2.4.0) + tilt (2.6.0) timecop (0.9.10) timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.2.0) unicode-display_width (2.6.0) uniform_notifier (1.16.0) warden (1.2.9) @@ -476,7 +451,7 @@ PLATFORMS ruby DEPENDENCIES - administrate (~> 0.19.0) + administrate (~> 0.20.0) annotate aws-sdk-rails aws-sdk-s3 diff --git a/app/assets/stylesheets/administrate.scss b/app/assets/stylesheets/administrate.scss index cb7d06b7..fac75a80 100644 --- a/app/assets/stylesheets/administrate.scss +++ b/app/assets/stylesheets/administrate.scss @@ -13,10 +13,6 @@ } } -.new-hold-button { - margin-left: 2rem; -} - .new-submitter-button { margin-top: 1rem; } diff --git a/app/views/admin/holds/_form.html.erb b/app/views/admin/holds/_form.html.erb index 3b9f40bc..1be23840 100644 --- a/app/views/admin/holds/_form.html.erb +++ b/app/views/admin/holds/_form.html.erb @@ -21,7 +21,7 @@ and renders all form fields for a resource's editable attributes. <%= t( "administrate.form.errors", pluralized_errors: pluralize(page.resource.errors.count, t("administrate.form.error")), - resource_name: display_resource_name(page.resource_name).singularize + resource_name: display_resource_name(page.resource_name, singular: true) ) %> @@ -33,23 +33,27 @@ and renders all form fields for a resource's editable attributes. <% end %> - <% page.attributes.each do |attribute| -%> - <% if params[:thesis_id] && attribute.name == 'thesis' %> -
- <%= hidden_field_tag 'hold[thesis_id]', params[:thesis_id] %> -
Thesis info
-
- -
-
- <% else %> -
- <% if attribute.name == 'dates_thesis_files_received' %> + <% page.attributes(controller.action_name).each do |title, attributes| -%> +
"> + <% if title.present? %> + <%= t "helpers.label.#{f.object_name}.#{title}", default: title %> + <% end %> + <% attributes.each do |attribute| %> + + <% if params[:thesis_id] && attribute.name == 'thesis' %> +
+ <%= hidden_field_tag 'hold[thesis_id]', params[:thesis_id] %> +
Thesis info
+
+
    +
  • Title: <%= attribute.data.title %>
  • +
  • Author(s): <%= attribute.data.users.map { |author| author.name }.join("; ") %>
  • +
  • Degree(s): <%= attribute.data.degrees.map { |degree| degree.name_dw }.join("; ") %>
  • +
  • Degree date: <%= attribute.data.grad_date %>
  • +
+
+
+ <% elsif attribute.name == 'dates_thesis_files_received'%>
@@ -57,10 +61,19 @@ and renders all form fields for a resource's editable attributes.
<% else %> - <%= render_field attribute, f: f %> +
+ <%= render_field attribute, f: f %> + + <% hint_key = "administrate.field_hints.#{page.resource_name}.#{attribute.name}" %> + <% if I18n.exists?(hint_key) -%> +
+ <%= I18n.t(hint_key) %> +
+ <% end -%> +
<% end %> - - <% end %> + <% end %> + <% end %>
diff --git a/app/views/admin/theses/show.html.erb b/app/views/admin/theses/show.html.erb index 7d1184fb..01f35a2c 100644 --- a/app/views/admin/theses/show.html.erb +++ b/app/views/admin/theses/show.html.erb @@ -30,8 +30,13 @@ as well as a link to its edit page. [:edit, namespace, page.resource], class: "button", ) if accessible_action?(page.resource, :edit) %> -
-
+ <%= link_to( + t("administrate.actions.destroy"), + [namespace, page.resource], + class: "button button--danger", + method: :delete, + data: { confirm: t("administrate.actions.confirm") } + ) if accessible_action?(page.resource, :destroy) %> <%= link_to( t("administrate.actions.new_resource", name: 'hold'), [:new, namespace, :hold, {thesis_id: page.resource.id}], @@ -42,16 +47,24 @@ as well as a link to its edit page.
- <% page.attributes.each do |attribute| %> -
- <%= t( - "helpers.label.#{resource_name}.#{attribute.name}", - default: page.resource.class.human_attribute_name(attribute.name), - ) %> -
- -
<%= render_field attribute, page: page %>
+ <% page.attributes.each do |title, attributes| %> +
"> + <% if title.present? %> + <%= t "helpers.label.#{page.resource_name}.#{title}", default: title %> + <% end %> + + <% attributes.each do |attribute| %> +
+ <%= t( + "helpers.label.#{resource_name}.#{attribute.name}", + default: page.resource.class.human_attribute_name(attribute.name), + ) %> +
+ +
<%= render_field attribute, page: page %>
+ <% end %> +
<% end %>
diff --git a/db/schema.rb b/db/schema.rb index 751c2c51..1d1610c4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -29,7 +29,7 @@ t.string "filename", null: false t.string "content_type" t.text "metadata" - t.bigint "byte_size", null: false + t.integer "byte_size", null: false t.string "checksum" t.datetime "created_at", precision: nil, null: false t.string "service_name", null: false @@ -276,8 +276,9 @@ end create_table "versions", force: :cascade do |t| - t.string "item_type", null: false - t.bigint "item_id", null: false + t.string "item_type" + t.string "{:null=>false}" + t.integer "item_id", null: false t.string "event", null: false t.string "whodunnit" t.datetime "created_at", precision: nil diff --git a/test/integration/admin/admin_hold_test.rb b/test/integration/admin/admin_hold_test.rb index d00122fb..3439de6f 100644 --- a/test/integration/admin/admin_hold_test.rb +++ b/test/integration/admin/admin_hold_test.rb @@ -170,10 +170,11 @@ def teardown get "/admin/holds/new?thesis_id=#{t.id}" assert_response :success assert_select 'div.panel-heading', text: 'Thesis info' + assert_select 'div.panel-body', true assert_select 'div.panel-body', text: "Title: MyString - Author(s): Yobot, Yo - Degree(s): Master of Fine Arts - Degree date: 2017-09-01" + Author(s): Yobot, Yo + Degree(s): Master of Fine Arts + Degree date: 2017-09-01" assert_select 'select[name=?]', 'hold[thesis_id]', false end