Skip to content

Commit 0aa549f

Browse files
authored
Merge pull request #773 from CDLUC3/bug/customize
Fix bug with customizing templates
2 parents ac493a3 + 4f8d7d4 commit 0aa549f

10 files changed

Lines changed: 127 additions & 83 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## DMPTool Releases
44

5+
### v5.48
6+
- Update `template.customize?` method to allow any funder (instead of funder_only)
7+
- Added bitwise documentation to the `Org` model to help with debugging
8+
59
### v5.47
610
- Fix issue with ROR migration script
711
- Update all gem dependencies

Gemfile.lock

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ GEM
8989
minitest (>= 5.1)
9090
securerandom (>= 0.3)
9191
tzinfo (~> 2.0, >= 2.0.5)
92-
addressable (2.8.7)
93-
public_suffix (>= 2.0.2, < 7.0)
94-
airbrussh (1.5.3)
92+
addressable (2.8.8)
93+
public_suffix (>= 2.0.2, < 8.0)
94+
airbrussh (1.6.0)
9595
sshkit (>= 1.6.1, != 1.7.0)
9696
annotate (3.2.0)
9797
activerecord (>= 3.2, < 8.0)
@@ -100,37 +100,37 @@ GEM
100100
bundler (>= 1.1)
101101
anyway_config (2.7.2)
102102
ruby-next-core (~> 1.0)
103-
api-pagination (6.0.0)
103+
api-pagination (7.0.0)
104104
ast (2.4.3)
105105
autoprefixer-rails (10.4.21.0)
106106
execjs (~> 2)
107107
aws-eventstream (1.4.0)
108-
aws-partitions (1.1183.0)
109-
aws-sdk-core (3.237.0)
108+
aws-partitions (1.1190.0)
109+
aws-sdk-core (3.239.2)
110110
aws-eventstream (~> 1, >= 1.3.0)
111111
aws-partitions (~> 1, >= 1.992.0)
112112
aws-sigv4 (~> 1.9)
113113
base64
114114
bigdecimal
115115
jmespath (~> 1, >= 1.6.1)
116116
logger
117-
aws-sdk-kms (1.117.0)
118-
aws-sdk-core (~> 3, >= 3.234.0)
117+
aws-sdk-kms (1.118.0)
118+
aws-sdk-core (~> 3, >= 3.239.1)
119119
aws-sigv4 (~> 1.5)
120-
aws-sdk-s3 (1.203.1)
120+
aws-sdk-s3 (1.206.0)
121121
aws-sdk-core (~> 3, >= 3.234.0)
122122
aws-sdk-kms (~> 1)
123123
aws-sigv4 (~> 1.5)
124-
aws-sdk-ssm (1.206.0)
125-
aws-sdk-core (~> 3, >= 3.234.0)
124+
aws-sdk-ssm (1.207.0)
125+
aws-sdk-core (~> 3, >= 3.239.1)
126126
aws-sigv4 (~> 1.5)
127127
aws-sigv4 (1.12.1)
128128
aws-eventstream (~> 1, >= 1.0.2)
129129
base64 (0.3.0)
130130
bcrypt (3.1.20)
131-
bcrypt_pbkdf (1.1.1)
132-
bcrypt_pbkdf (1.1.1-arm64-darwin)
133-
bcrypt_pbkdf (1.1.1-x86_64-darwin)
131+
bcrypt_pbkdf (1.1.2)
132+
bcrypt_pbkdf (1.1.2-arm64-darwin)
133+
bcrypt_pbkdf (1.1.2-x86_64-darwin)
134134
benchmark (0.5.0)
135135
better_errors (2.10.1)
136136
erubi (>= 1.0.0)
@@ -152,17 +152,17 @@ GEM
152152
bullet (8.1.0)
153153
activesupport (>= 3.0.0)
154154
uniform_notifier (~> 1.11)
155-
bundle-audit (0.1.0)
155+
bundle-audit (0.2.0)
156156
bundler-audit
157-
bundler-audit (0.9.2)
158-
bundler (>= 1.2.0, < 3)
157+
bundler-audit (0.9.3)
158+
bundler (>= 1.2.0)
159159
thor (~> 1.0)
160160
capistrano (3.19.2)
161161
airbrussh (>= 1.0.0)
162162
i18n
163163
rake (>= 10.0.0)
164164
sshkit (>= 1.9.0)
165-
capistrano-bundler (2.1.1)
165+
capistrano-bundler (2.2.0)
166166
capistrano (~> 3.1)
167167
capistrano-git-with-submodules (2.0.6)
168168
capistrano (~> 3.7)
@@ -198,7 +198,7 @@ GEM
198198
coderay (1.1.3)
199199
colored2 (3.1.2)
200200
concurrent-ruby (1.3.5)
201-
connection_pool (2.5.4)
201+
connection_pool (3.0.2)
202202
contact_us (1.2.0)
203203
rails (>= 4.2.0)
204204
cork (0.3.0)
@@ -252,9 +252,9 @@ GEM
252252
diff-lcs (1.6.2)
253253
doorkeeper (5.8.2)
254254
railties (>= 5)
255-
dotenv (3.1.8)
256-
dotenv-rails (3.1.8)
257-
dotenv (= 3.1.8)
255+
dotenv (3.2.0)
256+
dotenv-rails (3.2.0)
257+
dotenv (= 3.2.0)
258258
railties (>= 6.1)
259259
dragonfly (1.4.1)
260260
addressable (~> 2.3)
@@ -268,15 +268,15 @@ GEM
268268
ed25519 (1.4.0)
269269
erb (6.0.0)
270270
erubi (1.13.1)
271-
excon (1.3.1)
271+
excon (1.3.2)
272272
logger
273273
execjs (2.10.0)
274274
factory_bot (6.5.6)
275275
activesupport (>= 6.1.0)
276276
factory_bot_rails (6.5.1)
277277
factory_bot (~> 6.5)
278278
railties (>= 6.1.0)
279-
faker (3.5.2)
279+
faker (3.5.3)
280280
i18n (>= 1.8.11, < 2)
281281
faraday (2.14.0)
282282
faraday-net_http (>= 2.0, < 3.5)
@@ -369,7 +369,7 @@ GEM
369369
jmespath (1.6.2)
370370
jsbundling-rails (1.3.1)
371371
railties (>= 6.0.0)
372-
json (2.16.0)
372+
json (2.17.1)
373373
json_schemer (2.4.0)
374374
bigdecimal
375375
hana (~> 1.3)
@@ -430,11 +430,11 @@ GEM
430430
nokogiri (~> 1)
431431
rake
432432
mini_mime (1.1.5)
433-
minitest (5.26.1)
433+
minitest (5.26.2)
434434
mocha (2.8.2)
435435
ruby2_keywords (>= 0.0.5)
436436
msgpack (1.8.0)
437-
multi_json (1.17.0)
437+
multi_json (1.18.0)
438438
multi_xml (0.7.2)
439439
bigdecimal (~> 3.1)
440440
mysql2 (0.5.7)
@@ -502,7 +502,7 @@ GEM
502502
omniauth-orcid (2.1.1)
503503
omniauth-oauth2 (~> 1.3)
504504
ruby_dig (~> 0.0.2)
505-
omniauth-rails_csrf_protection (1.0.2)
505+
omniauth-rails_csrf_protection (2.0.0)
506506
actionpack (>= 4.2)
507507
omniauth (~> 2.0)
508508
omniauth-shibboleth (1.3.0)
@@ -537,7 +537,7 @@ GEM
537537
psych (5.2.6)
538538
date
539539
stringio
540-
public_suffix (6.0.2)
540+
public_suffix (7.0.0)
541541
puma (7.1.0)
542542
nio4r (~> 2.0)
543543
pundit (2.5.2)
@@ -565,7 +565,7 @@ GEM
565565
rack (>= 3.0.0)
566566
rack-test (2.2.0)
567567
rack (>= 1.3)
568-
rackup (2.2.1)
568+
rackup (2.3.1)
569569
rack (>= 3)
570570
rails (7.2.3)
571571
actioncable (= 7.2.3)
@@ -608,7 +608,7 @@ GEM
608608
rb-inotify (0.11.1)
609609
ffi (~> 1.0)
610610
rchardet (1.10.0)
611-
rdoc (6.15.1)
611+
rdoc (6.16.1)
612612
erb
613613
psych (>= 4.0.0)
614614
tsort
@@ -663,7 +663,7 @@ GEM
663663
lint_roller (~> 1.1)
664664
rubocop (>= 1.75.0, < 2.0)
665665
rubocop-ast (>= 1.47.1, < 2.0)
666-
rubocop-rails (2.34.0)
666+
rubocop-rails (2.34.2)
667667
activesupport (>= 4.2.0)
668668
lint_roller (~> 1.1)
669669
rack (>= 1.1)
@@ -720,7 +720,7 @@ GEM
720720
net-sftp (>= 2.1.2)
721721
net-ssh (>= 2.8.0)
722722
ostruct
723-
stringio (3.1.8)
723+
stringio (3.1.9)
724724
terminal-table (4.0.0)
725725
unicode-display_width (>= 1.1.1, < 4)
726726
text (1.3.1)
@@ -771,7 +771,7 @@ GEM
771771
websocket-extensions (0.1.5)
772772
xpath (3.2.0)
773773
nokogiri (~> 1.8)
774-
yard (0.9.37)
774+
yard (0.9.38)
775775
yard-tomdoc (0.7.1)
776776
tomparse (>= 0.4.0)
777777
yard

app/controllers/org_admin/template_customizations_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class TemplateCustomizationsController < ApplicationController
1212
def create
1313
@template = Template.find(params[:template_id])
1414
authorize(@template, :customize?)
15+
1516
if @template.customize?(current_user.org)
1617
begin
1718
@customisation = @template.customize!(current_user.org)

app/models/org.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,27 @@ class Org < ApplicationRecord
201201
column: 'org_type',
202202
check_for_column: !Rails.env.test?
203203

204+
# -----------------------------------------------------
205+
# Bitwise key
206+
# -----------------------------------------------------
207+
# 01 - institution
208+
# 02 - funder
209+
# 03 - institution + funder
210+
# 04 - organisation
211+
# 05 - institution + organisation
212+
# 06 - funder + organisation
213+
# 07 - institution + organisation + funder
214+
# 08 - research_institute
215+
# 09 - institution + research_institute
216+
# 10 - funder + research_institute
217+
# 11 - institution + funder + research_institute
218+
# 12 - organisation + research_institute
219+
# 13 - institution + organisation + research_institute
220+
# 14 - funder + organisation + research_institute
221+
# 15 - institution + funder + organisation + research_institute
222+
# etc.
223+
224+
204225
# The default Org is the one whose guidance is auto-attached to
205226
# plans when a plan is created
206227
def self.default_orgs

app/models/template.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def generate_version?
418418
# Determines whether or not a customization for the customizing_org passed
419419
# should be generated
420420
def customize?(customizing_org)
421-
if customizing_org.is_a?(Org) && (org.funder_only? || is_default)
421+
if customizing_org.is_a?(Org) && (org.funder? || is_default)
422422
return !Template.unarchived.exists?(customization_of: family_id,
423423
org: customizing_org)
424424
end
@@ -485,7 +485,7 @@ def customize!(customizing_org)
485485
raise ArgumentError, _('customize! requires an organisation target') unless customizing_org.is_a?(Org)
486486

487487
# Assume self has org associated
488-
raise ArgumentError, _('customize! requires a template from a funder') if !org.funder_only? && !is_default
488+
raise ArgumentError, _('customize! requires a template from a funder') if !org.funder? && !is_default
489489

490490
args = {
491491
attributes: {

public/tinymce/skins/oxide/content.inline.js

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/tinymce/skins/oxide/content.js

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/tinymce/skins/oxide/skin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/tinymce/skins/oxide/skin.shadowdom.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)