Skip to content

Commit c89a1ca

Browse files
authored
Merge pull request #1491 from MITLibraries/update-dependencies
Upgrade administrate to v1
2 parents 9788711 + 70a1e65 commit c89a1ca

File tree

5 files changed

+54
-41
lines changed

5 files changed

+54
-41
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ git_source(:github) do |repo_name|
66
"https://github.com/#{repo_name}.git"
77
end
88

9-
gem 'administrate', '~> 0.20.0'
9+
gem 'administrate', '~> 1.0.0'
1010
gem 'aws-sdk-rails'
1111
gem 'aws-sdk-s3'
1212
gem 'aws-sdk-sqs'
@@ -17,6 +17,7 @@ gem 'csv'
1717
gem 'delayed_job_active_record'
1818
gem 'devise'
1919
gem 'flipflop'
20+
gem 'jquery-rails'
2021
gem 'json'
2122
gem 'kaminari'
2223
gem 'lograge'

Gemfile.lock

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,11 @@ GEM
8585
tzinfo (~> 2.0, >= 2.0.5)
8686
addressable (2.8.8)
8787
public_suffix (>= 2.0.2, < 8.0)
88-
administrate (0.20.1)
89-
actionpack (>= 6.0, < 8.0)
90-
actionview (>= 6.0, < 8.0)
91-
activerecord (>= 6.0, < 8.0)
92-
jquery-rails (~> 4.6.0)
88+
administrate (1.0.0)
89+
actionpack (>= 6.0, < 9.0)
90+
actionview (>= 6.0, < 9.0)
91+
activerecord (>= 6.0, < 9.0)
9392
kaminari (~> 1.2.2)
94-
sassc-rails (~> 2.1)
95-
selectize-rails (~> 0.6)
9693
annotate (3.2.0)
9794
activerecord (>= 3.2, < 8.0)
9895
rake (>= 10.4, < 14.0)
@@ -178,7 +175,7 @@ GEM
178175
erb (6.0.1)
179176
erubi (1.13.1)
180177
execjs (2.10.0)
181-
ffi (1.17.1)
178+
ffi (1.17.3)
182179
flipflop (2.8.0)
183180
activesupport (>= 4.0)
184181
terminal-table (>= 1.8)
@@ -195,7 +192,7 @@ GEM
195192
rdoc (>= 4.0.0)
196193
reline (>= 0.4.2)
197194
jmespath (1.6.2)
198-
jquery-rails (4.6.0)
195+
jquery-rails (4.6.1)
199196
rails-dom-testing (>= 1, < 3)
200197
railties (>= 4.2.0)
201198
thor (>= 0.14, < 2.0)
@@ -397,7 +394,6 @@ GEM
397394
scout_apm (6.0.2)
398395
parser
399396
securerandom (0.4.1)
400-
selectize-rails (0.12.6)
401397
selenium-webdriver (4.39.0)
402398
base64 (~> 0.2)
403399
logger (~> 1.4)
@@ -422,8 +418,9 @@ GEM
422418
simplecov_json_formatter (0.1.4)
423419
skylight (7.0.0)
424420
activesupport (>= 7.1.0)
425-
sprockets (4.2.1)
421+
sprockets (4.2.2)
426422
concurrent-ruby (~> 1.0)
423+
logger
427424
rack (>= 2.2.4, < 4)
428425
sprockets-rails (3.5.2)
429426
actionpack (>= 6.1)
@@ -437,7 +434,7 @@ GEM
437434
terser (1.2.6)
438435
execjs (>= 0.3.0, < 3)
439436
thor (1.5.0)
440-
tilt (2.6.0)
437+
tilt (2.7.0)
441438
timecop (0.9.10)
442439
timeout (0.6.0)
443440
tsort (0.2.0)
@@ -473,7 +470,7 @@ PLATFORMS
473470
ruby
474471

475472
DEPENDENCIES
476-
administrate (~> 0.20.0)
473+
administrate (~> 1.0.0)
477474
annotate
478475
aws-sdk-rails
479476
aws-sdk-s3
@@ -491,6 +488,7 @@ DEPENDENCIES
491488
devise
492489
dotenv-rails
493490
flipflop
491+
jquery-rails
494492
json
495493
kaminari
496494
letter_opener

app/views/admin/holds/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ and renders all form fields for a resource's editable attributes.
1414
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form
1515
%>
1616

17-
<%= form_for([namespace, page.resource], html: { class: "form" }) do |f| %>
17+
<%= form_with(model: page.resource, url: [namespace, page.resource], scope: page.resource, local: true, class: "form") do |f| %>
1818
<% if page.resource.errors.any? %>
1919
<div id="error_explanation">
2020
<h2>

app/views/admin/theses/show.html.erb

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,69 @@ as well as a link to its edit page.
1616
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
1717
%>
1818

19-
<% content_for(:title) { t("administrate.actions.show_resource", name: page.resource.title) } %>
19+
<% content_for(:title) { t("administrate.actions.show_resource", name: page.page_title) } %>
2020
<% content_for(:custom_stylesheets) { stylesheet_link_tag "administrate" } %>
2121

2222
<header class="main-content__header">
2323
<h1 class="main-content__page-title">
2424
<%= content_for(:title) %>
2525
</h1>
2626

27+
<%= content_for(:header_middle) %>
28+
2729
<div>
2830
<%= link_to(
29-
t("administrate.actions.edit_resource", name: page.resource.title),
31+
t("administrate.actions.edit_resource", name: page.page_title),
3032
[:edit, namespace, page.resource],
3133
class: "button",
3234
) if accessible_action?(page.resource, :edit) %>
33-
<%= link_to(
35+
36+
<%= button_to(
3437
t("administrate.actions.destroy"),
3538
[namespace, page.resource],
3639
class: "button button--danger",
3740
method: :delete,
38-
data: { confirm: t("administrate.actions.confirm") }
41+
data: { turbo_confirm: t("administrate.actions.confirm") }
3942
) if accessible_action?(page.resource, :destroy) %>
4043
<%= link_to(
4144
t("administrate.actions.new_resource", name: 'hold'),
4245
[:new, namespace, :hold, {thesis_id: page.resource.id}],
4346
class: "button",
4447
) if accessible_action?('hold', :new) %>
4548
</div>
49+
50+
<%= content_for(:header_last) %>
4651
</header>
4752

48-
<section class="main-content__body">
49-
<dl>
50-
<% page.attributes.each do |title, attributes| %>
51-
<fieldset class="<%= "field-unit--nested" if title.present? %>">
52-
<% if title.present? %>
53-
<legend><%= t "helpers.label.#{page.resource_name}.#{title}", default: title %></legend>
54-
<% end %>
53+
<%= content_for(:before_main) %>
54+
55+
<% if content_for?(:main) %>
56+
<%= content_for(:main) %>
57+
<% else %>
58+
<section class="main-content__body">
59+
<dl>
60+
<% page.attributes.each do |title, attributes| %>
61+
<fieldset class="<%= "field-unit--nested" if title.present? %>">
62+
<% if title.present? %>
63+
<legend><%= t "helpers.label.#{page.resource_name}.#{title}", default: title %></legend>
64+
<% end %>
65+
66+
<% attributes.each do |attribute| %>
67+
<dt class="attribute-label" id="<%= attribute.name %>">
68+
<%= t(
69+
"helpers.label.#{resource_name}.#{attribute.name}",
70+
default: page.resource.class.human_attribute_name(attribute.name),
71+
) %>
72+
</dt>
5573

56-
<% attributes.each do |attribute| %>
57-
<dt class="attribute-label" id="<%= attribute.name %>">
58-
<%= t(
59-
"helpers.label.#{resource_name}.#{attribute.name}",
60-
default: page.resource.class.human_attribute_name(attribute.name),
61-
) %>
62-
</dt>
74+
<dd class="attribute-data attribute-data--<%=attribute.html_class%>">
75+
<%= render_field attribute, page: page %>
76+
</dd>
77+
<% end %>
78+
</fieldset>
79+
<% end %>
80+
</dl>
81+
</section>
82+
<% end %>
6383

64-
<dd class="attribute-data attribute-data--<%=attribute.html_class%>"
65-
><%= render_field attribute, page: page %></dd>
66-
<% end %>
67-
</fieldset>
68-
<% end %>
69-
</dl>
70-
</section>
84+
<%= content_for(:after_main) %>

app/views/layouts/admin/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ By default, it renders:
2222
<%= content_for(:title) %> - <%= application_title %>
2323
</title>
2424
<%= render "stylesheet" %>
25-
<%= stylesheet_link_tag "administrate" %>
25+
<%= stylesheet_link_tag "administrate", data: { turbo_track: "reload" } %>
2626
<%= csrf_meta_tags %>
2727
<%= csp_meta_tag if defined?(csp_meta_tag) %>
2828
</head>

0 commit comments

Comments
 (0)