Skip to content

Commit c879e75

Browse files
committed
Merge upstream
2 parents bb4b6b8 + 4a261c1 commit c879e75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+448
-124
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ commands:
66
steps:
77
- checkout
88

9+
# Install bundler
10+
- run: gem install bundler:2.1.4
11+
912
# Restore Cached Dependencies
1013
- restore_cache:
1114
name: Restore bundle cache
@@ -50,6 +53,7 @@ jobs:
5053
PGHOST: localhost
5154
PGUSER: administrate
5255
RAILS_ENV: test
56+
BUNDLER_VERSION: 2.1.4
5357
- image: postgres:10.1-alpine
5458
environment:
5559
POSTGRES_USER: administrate
@@ -70,10 +74,24 @@ jobs:
7074
POSTGRES_DB: ruby26
7175
POSTGRES_PASSWORD: ""
7276

77+
ruby-27:
78+
<<: *default_job
79+
docker:
80+
- image: circleci/ruby:2.7-node-browsers-legacy
81+
environment:
82+
PGHOST: localhost
83+
PGUSER: administrate
84+
RAILS_ENV: test
85+
- image: postgres:10.1-alpine
86+
environment:
87+
POSTGRES_USER: administrate
88+
POSTGRES_DB: ruby27
89+
POSTGRES_PASSWORD: ""
7390

7491
workflows:
7592
version: 2
7693
multiple-rubies:
7794
jobs:
95+
- ruby-27
7896
- ruby-26
7997
- ruby-25

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.3
1+
2.7.2

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ source 'https://rubygems.org'
33
gemspec
44

55
gem "administrate-field-image"
6-
gem "autoprefixer-rails"
76
gem "faker"
87
gem "front_matter_parser"
98
gem "globalid"
9+
gem "kaminari-i18n"
1010
gem "pg"
1111
gem "redcarpet"
1212
gem "sentry-raven"

Gemfile.lock

Lines changed: 86 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ PATH
55
actionpack (>= 5.0)
66
actionview (>= 5.0)
77
activerecord (>= 5.0)
8-
autoprefixer-rails (>= 6.0)
98
datetime_picker_rails (~> 0.0.7)
109
jquery-rails (>= 4.0)
1110
kaminari (>= 1.0)
@@ -16,25 +15,56 @@ PATH
1615
GEM
1716
remote: https://rubygems.org/
1817
specs:
19-
actionpack (6.0.3.2)
20-
actionview (= 6.0.3.2)
21-
activesupport (= 6.0.3.2)
18+
actioncable (6.0.3.4)
19+
actionpack (= 6.0.3.4)
20+
nio4r (~> 2.0)
21+
websocket-driver (>= 0.6.1)
22+
actionmailbox (6.0.3.4)
23+
actionpack (= 6.0.3.4)
24+
activejob (= 6.0.3.4)
25+
activerecord (= 6.0.3.4)
26+
activestorage (= 6.0.3.4)
27+
activesupport (= 6.0.3.4)
28+
mail (>= 2.7.1)
29+
actionmailer (6.0.3.4)
30+
actionpack (= 6.0.3.4)
31+
actionview (= 6.0.3.4)
32+
activejob (= 6.0.3.4)
33+
mail (~> 2.5, >= 2.5.4)
34+
rails-dom-testing (~> 2.0)
35+
actionpack (6.0.3.4)
36+
actionview (= 6.0.3.4)
37+
activesupport (= 6.0.3.4)
2238
rack (~> 2.0, >= 2.0.8)
2339
rack-test (>= 0.6.3)
2440
rails-dom-testing (~> 2.0)
2541
rails-html-sanitizer (~> 1.0, >= 1.2.0)
26-
actionview (6.0.3.2)
27-
activesupport (= 6.0.3.2)
42+
actiontext (6.0.3.4)
43+
actionpack (= 6.0.3.4)
44+
activerecord (= 6.0.3.4)
45+
activestorage (= 6.0.3.4)
46+
activesupport (= 6.0.3.4)
47+
nokogiri (>= 1.8.5)
48+
actionview (6.0.3.4)
49+
activesupport (= 6.0.3.4)
2850
builder (~> 3.1)
2951
erubi (~> 1.4)
3052
rails-dom-testing (~> 2.0)
3153
rails-html-sanitizer (~> 1.1, >= 1.2.0)
32-
activemodel (6.0.3.2)
33-
activesupport (= 6.0.3.2)
34-
activerecord (6.0.3.2)
35-
activemodel (= 6.0.3.2)
36-
activesupport (= 6.0.3.2)
37-
activesupport (6.0.3.2)
54+
activejob (6.0.3.4)
55+
activesupport (= 6.0.3.4)
56+
globalid (>= 0.3.6)
57+
activemodel (6.0.3.4)
58+
activesupport (= 6.0.3.4)
59+
activerecord (6.0.3.4)
60+
activemodel (= 6.0.3.4)
61+
activesupport (= 6.0.3.4)
62+
activestorage (6.0.3.4)
63+
actionpack (= 6.0.3.4)
64+
activejob (= 6.0.3.4)
65+
activerecord (= 6.0.3.4)
66+
marcel (~> 0.3.1)
67+
activesupport (6.0.3.4)
3868
concurrent-ruby (~> 1.0, >= 1.0.2)
3969
i18n (>= 0.7, < 2)
4070
minitest (~> 5.1)
@@ -53,8 +83,6 @@ GEM
5383
rake
5484
thor (>= 0.14.0)
5585
ast (2.4.0)
56-
autoprefixer-rails (9.8.6.1)
57-
execjs
5886
awesome_print (1.8.0)
5987
builder (3.2.4)
6088
bundler-audit (0.7.0.1)
@@ -71,7 +99,7 @@ GEM
7199
xpath (~> 3.2)
72100
childprocess (3.0.0)
73101
coderay (1.1.2)
74-
concurrent-ruby (1.1.6)
102+
concurrent-ruby (1.1.7)
75103
crack (0.4.3)
76104
safe_yaml (~> 1.0.0)
77105
crass (1.0.6)
@@ -90,7 +118,7 @@ GEM
90118
factory_bot_rails (6.1.0)
91119
factory_bot (~> 6.1.0)
92120
railties (>= 5.0.0)
93-
faker (2.13.0)
121+
faker (2.14.0)
94122
i18n (>= 1.6, < 2)
95123
faraday (1.0.1)
96124
multipart-post (>= 1.2, < 3)
@@ -104,7 +132,7 @@ GEM
104132
activesupport (>= 4.2.0)
105133
hashdiff (1.0.1)
106134
highline (2.0.3)
107-
i18n (1.8.3)
135+
i18n (1.8.5)
108136
concurrent-ruby (~> 1.0)
109137
i18n-tasks (0.9.31)
110138
activesupport (>= 4.0.2)
@@ -132,19 +160,28 @@ GEM
132160
activerecord
133161
kaminari-core (= 1.2.1)
134162
kaminari-core (1.2.1)
163+
kaminari-i18n (0.5.0)
164+
kaminari
165+
rails
135166
kgio (2.11.3)
136167
launchy (2.5.0)
137168
addressable (~> 2.7)
138-
loofah (2.6.0)
169+
loofah (2.7.0)
139170
crass (~> 1.0.2)
140171
nokogiri (>= 1.5.9)
172+
mail (2.7.1)
173+
mini_mime (>= 0.1.1)
174+
marcel (0.3.3)
175+
mimemagic (~> 0.3.2)
141176
method_source (0.9.2)
177+
mimemagic (0.3.5)
142178
mini_mime (1.0.2)
143179
mini_portile2 (2.4.0)
144-
minitest (5.14.1)
180+
minitest (5.14.2)
145181
momentjs-rails (2.20.1)
146182
railties (>= 3.1)
147183
multipart-post (2.1.1)
184+
nio4r (2.5.4)
148185
nokogiri (1.10.10)
149186
mini_portile2 (~> 2.4.0)
150187
parser (2.7.0.4)
@@ -155,13 +192,28 @@ GEM
155192
method_source (~> 0.9.0)
156193
pry-rails (0.3.9)
157194
pry (>= 0.10.4)
158-
public_suffix (4.0.5)
195+
public_suffix (4.0.6)
159196
pundit (2.1.0)
160197
activesupport (>= 3.0.0)
161198
rack (2.2.3)
162199
rack-test (1.1.0)
163200
rack (>= 1.0, < 3)
164201
rack-timeout (0.6.0)
202+
rails (6.0.3.4)
203+
actioncable (= 6.0.3.4)
204+
actionmailbox (= 6.0.3.4)
205+
actionmailer (= 6.0.3.4)
206+
actionpack (= 6.0.3.4)
207+
actiontext (= 6.0.3.4)
208+
actionview (= 6.0.3.4)
209+
activejob (= 6.0.3.4)
210+
activemodel (= 6.0.3.4)
211+
activerecord (= 6.0.3.4)
212+
activestorage (= 6.0.3.4)
213+
activesupport (= 6.0.3.4)
214+
bundler (>= 1.3.0)
215+
railties (= 6.0.3.4)
216+
sprockets-rails (>= 2.0.0)
165217
rails-dom-testing (2.0.3)
166218
activesupport (>= 4.2.0)
167219
nokogiri (>= 1.6)
@@ -170,9 +222,9 @@ GEM
170222
rails-i18n (6.0.0)
171223
i18n (>= 0.7, < 2)
172224
railties (>= 6.0.0, < 7)
173-
railties (6.0.3.2)
174-
actionpack (= 6.0.3.2)
175-
activesupport (= 6.0.3.2)
225+
railties (6.0.3.4)
226+
actionpack (= 6.0.3.4)
227+
activesupport (= 6.0.3.4)
176228
method_source
177229
rake (>= 0.8.7)
178230
thor (>= 0.20.3, < 2.0)
@@ -212,14 +264,14 @@ GEM
212264
selenium-webdriver (3.142.7)
213265
childprocess (>= 0.5, < 4.0)
214266
rubyzip (>= 1.2.2)
215-
sentry-raven (3.0.2)
267+
sentry-raven (3.1.1)
216268
faraday (>= 1.0)
217-
shoulda-matchers (4.3.0)
269+
shoulda-matchers (4.4.1)
218270
activesupport (>= 4.2.0)
219271
sprockets (4.0.2)
220272
concurrent-ruby (~> 1.0)
221273
rack (> 1, < 3)
222-
sprockets-rails (3.2.1)
274+
sprockets-rails (3.2.2)
223275
actionpack (>= 4.0)
224276
activesupport (>= 4.0)
225277
sprockets (>= 3.0.0)
@@ -234,17 +286,20 @@ GEM
234286
uglifier (4.2.0)
235287
execjs (>= 0.3.0, < 3)
236288
unicode-display_width (1.6.1)
237-
unicorn (5.6.0)
289+
unicorn (5.7.0)
238290
kgio (~> 2.6)
239291
raindrops (~> 0.7)
240-
webmock (3.8.3)
292+
webmock (3.9.1)
241293
addressable (>= 2.3.6)
242294
crack (>= 0.3.2)
243295
hashdiff (>= 0.4.0, < 2.0.0)
296+
websocket-driver (0.7.3)
297+
websocket-extensions (>= 0.1.0)
298+
websocket-extensions (0.1.5)
244299
xpath (3.2.0)
245300
nokogiri (~> 1.8)
246301
yard (0.9.25)
247-
zeitwerk (2.3.1)
302+
zeitwerk (2.4.0)
248303

249304
PLATFORMS
250305
ruby
@@ -254,7 +309,6 @@ DEPENDENCIES
254309
administrate-field-image
255310
ammeter
256311
appraisal
257-
autoprefixer-rails
258312
awesome_print
259313
bundler-audit
260314
byebug
@@ -267,6 +321,7 @@ DEPENDENCIES
267321
front_matter_parser
268322
globalid
269323
i18n-tasks (= 0.9.31)
324+
kaminari-i18n
270325
launchy
271326
pg
272327
pry-rails
@@ -285,4 +340,4 @@ DEPENDENCIES
285340
yard
286341

287342
BUNDLED WITH
288-
1.17.3
343+
2.1.4

administrate.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
1818
s.add_dependency "actionview", ">= 5.0"
1919
s.add_dependency "activerecord", ">= 5.0"
2020

21-
s.add_dependency "autoprefixer-rails", ">= 6.0"
2221
s.add_dependency "datetime_picker_rails", "~> 0.0.7"
2322
s.add_dependency "jquery-rails", ">= 4.0"
2423
s.add_dependency "kaminari", ">= 1.0"

app/assets/stylesheets/administrate/components/_attributes.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
margin-bottom: $base-spacing;
1919
margin-left: 2rem;
2020
width: calc(80% - 1rem);
21+
word-break: break-word;
2122
}
2223

2324
.attribute--nested {

app/controllers/administrate/application_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def read_param_value(data)
172172
to: :resource_resolver
173173
helper_method :namespace
174174
helper_method :resource_name
175+
helper_method :resource_class
175176

176177
def resource_resolver
177178
@resource_resolver ||=

app/helpers/administrate/application_helper.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Administrate
22
module ApplicationHelper
33
PLURAL_MANY_COUNT = 2.1
4+
SINGULAR_COUNT = 1
45

56
def application_title
67
if Rails::VERSION::MAJOR <= 5
@@ -43,10 +44,10 @@ def model_from_resource(resource_name)
4344
dashboard.try(:model) || resource_name.to_sym
4445
end
4546

46-
def display_resource_name(resource_name)
47+
def display_resource_name(resource_name, opts = {})
4748
dashboard_from_resource(resource_name).resource_name(
48-
count: PLURAL_MANY_COUNT,
49-
default: default_resource_name(resource_name),
49+
count: opts[:singular] ? SINGULAR_COUNT : PLURAL_MANY_COUNT,
50+
default: default_resource_name(resource_name, opts),
5051
)
5152
end
5253

@@ -81,8 +82,9 @@ def clear_search_params
8182

8283
private
8384

84-
def default_resource_name(resource_name)
85-
resource_name.to_s.pluralize.gsub("/", "_").titleize
85+
def default_resource_name(name, opts = {})
86+
resource_name = (opts[:singular] ? name.to_s : name.to_s.pluralize)
87+
resource_name.gsub("/", "_").titleize
8688
end
8789
end
8890
end

app/views/administrate/application/_collection.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ to display a collection of resources in an HTML table.
3333
)) do %>
3434
<%= t(
3535
"helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
36-
default: attr_name.to_s,
36+
default: resource_class.human_attribute_name(attr_name),
3737
).titleize %>
3838
<% if collection_presenter.ordered_by?(attr_name) %>
3939
<span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">

app/views/administrate/application/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ and renders all form fields for a resource's editable attributes.
2121
<%= t(
2222
"administrate.form.errors",
2323
pluralized_errors: pluralize(page.resource.errors.count, t("administrate.form.error")),
24-
resource_name: display_resource_name(page.resource_name).singularize
24+
resource_name: display_resource_name(page.resource_name, singular: true)
2525
) %>
2626
</h2>
2727

0 commit comments

Comments
 (0)