diff --git a/app/javascript/packs/vue/legacy/tags_modal.js b/app/javascript/packs/vue/legacy/tags_modal.js index f1524fa2f..176b2305d 100644 --- a/app/javascript/packs/vue/legacy/tags_modal.js +++ b/app/javascript/packs/vue/legacy/tags_modal.js @@ -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); } }); } diff --git a/app/serializers/lists/my_module_serializer.rb b/app/serializers/lists/my_module_serializer.rb index d3af4c922..36425ab67 100644 --- a/app/serializers/lists/my_module_serializer.rb +++ b/app/serializers/lists/my_module_serializer.rb @@ -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] {