Fix reloading of tags on canvas [SCI-10687]

This commit is contained in:
Martin Artnik 2024-06-06 10:54:09 +02:00
parent 84605cf0b6
commit 65c276b97b
2 changed files with 17 additions and 7 deletions

View file

@ -8,8 +8,8 @@ const app = createApp({
data() {
return {
myModuleParams: null,
myModuleUrl: null,
tagsModalOpen: false,
tagsUrl: null
};
},
mounted() {
@ -20,6 +20,7 @@ const app = createApp({
},
methods: {
open(myModuleUrl) {
this.myModuleUrl = myModuleUrl;
$.ajax({
url: myModuleUrl,
type: 'GET',
@ -32,6 +33,7 @@ const app = createApp({
},
close() {
this.myModuleParams = null;
this.myModuleUrl = null;
this.tagsModalOpen = false;
},
syncTags(tags) {
@ -52,15 +54,13 @@ const app = createApp({
// Canvas
if ($('#canvas-container').length) {
$.ajax({
url: this.tagsUrl,
url: this.myModuleUrl,
type: 'GET',
dataType: 'json',
success(data) {
$.each(data.my_modules, (index, myModule) => {
$(`div.panel[data-module-id='${myModule.id}']`)
.find('.edit-tags-link')
.html(myModule.tags_html);
});
$(`div.panel[data-module-id='${data.data.id}']`)
.find('.edit-tags-link')
.html(data.data.attributes.tags_html);
}
});
}

View file

@ -19,6 +19,7 @@ module Lists
status
designated_users
tags
tags_html
comments
due_date_formatted
permissions
@ -142,6 +143,15 @@ module Lists
end
end
def tags_html
# legacy canvas support
ApplicationController.new.render_to_string(
partial: 'canvas/tags',
locals: { my_module: object },
formats: :html
)
end
def comments
@user = scope[:user] || @instance_options[:user]
{