Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
EIP
Project Forum
Project Forum
Commits
cf3e78f5
Commit
cf3e78f5
authored
Sep 15, 2022
by
Taico Aerts
Browse files
Merge branch 'development' into 'master'
Project Forum Release v2.8.9 - 13-09-2022 See merge request
!866
parents
01ce4156
4090baff
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/controllers/admin/course_editions_controller.rb
View file @
cf3e78f5
...
...
@@ -87,6 +87,8 @@ module Admin
@course_edition
.
course_specific_roles
.
push
csr
.
dup
end
@override_tags
=
old_course_edition
.
tags
.
sort_by_name
@override_staff_roles
=
{}
old_course_edition
.
staffmembers
.
each
do
|
staffmember
|
r
=
nil
...
...
app/models/project.rb
View file @
cf3e78f5
...
...
@@ -136,6 +136,7 @@ class Project < ApplicationRecord
end
copy_recurrent_course_specific_roles
(
course_edition
,
new_project
,
validation_attribute
,
validation_object
)
copy_recurrent_tags
(
course_edition
,
new_project
,
validation_attribute
,
validation_object
)
User
.
with_role
(
:client
,
self
).
each
do
|
user
|
user
.
add_role
(
:client
,
new_project
)
...
...
@@ -487,4 +488,15 @@ class Project < ApplicationRecord
"the '
#{
display_name
}
' project"
end
end
def
copy_recurrent_tags
(
course_edition
,
new_project
,
validation_attribute
,
validation_object
)
if
course_edition
.
tags
.
map
(
&
:id
).
sort
!=
self
.
course_edition
.
tags
.
map
(
&
:id
).
sort
validation_object
.
errors
.
add
validation_attribute
,
"'
#{
course_edition
.
display_name
}
' must have identical project tags "
\
"to '
#{
self
.
course_edition
.
display_name
}
'"
return
end
new_project
.
tags
=
tags
.
to_a
end
end
app/views/admin/course_editions/edit/_project_tags.html.erb
View file @
cf3e78f5
...
...
@@ -22,6 +22,12 @@
<%
end
%>
<%
end
%>
<%
@override_tags
&
.
each
do
|
tag
|
%>
<%=
f_tags
.
fields_for
(
tag
.
id
+
1000000
).
to_s
,
tag
do
|
f_tag
|
%>
<%=
render
'admin/application/tag_fields_new'
,
f:
f_tag
%>
<%
end
%>
<%
end
%>
<a
class=
"list-group-item list-group-item--button add_fields"
data-association-insertion-node=
"this"
data-association=
"tag"
data-associations=
"tags"
id=
"tag_add"
data-association-insertion-template=
"
...
...
db/migrate/20220915114808_fix_recurrent_project_tags.rb
0 → 100644
View file @
cf3e78f5
class
FixRecurrentProjectTags
<
ActiveRecord
::
Migration
[
6.1
]
def
up
# Copy tags of recurrent course editions to descendent editions
CourseEdition
.
recurrent
.
each
do
|
recurrent_edition
|
CourseEdition
.
descendants_of
(
recurrent_edition
).
each
do
|
edition
|
recurrent_edition
.
tags
.
each
do
|
tag
|
edition
.
tags
<<
tag
end
edition
.
save!
end
end
# Copy recurrent project tags
CourseEdition
.
recurrent
.
each
do
|
recurrent_edition
|
recurrent_edition
.
projects
.
each
do
|
recurrent_project
|
recurrent_project
.
copies
.
each
do
|
project
|
recurrent_project
.
tags
.
each
do
|
tag
|
project
.
tags
<<
tag
end
project
.
save!
end
end
end
end
end
db/schema.rb
View file @
cf3e78f5
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2022_0
8_30_133912
)
do
ActiveRecord
::
Schema
.
define
(
version:
2022_0
9_15_114808
)
do
create_table
"active_storage_attachments"
,
force: :cascade
do
|
t
|
t
.
string
"name"
,
null:
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment