Add new tags controller [SCI-12286]

This commit is contained in:
Anton 2025-09-02 17:23:40 +02:00
parent d7b772be13
commit a31b6788f2
5 changed files with 19 additions and 10 deletions

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class TagsController < ApplicationController
def index
@tags = current_team.tags.order(:name)
end
end

View file

@ -44,7 +44,7 @@
import axios from '../../packs/custom_axios.js';
import GeneralDropdown from './general_dropdown.vue';
import {
list_users_settings_team_tags_path,
tags_path
} from '../../routes.js';
export default {
@ -59,9 +59,6 @@ export default {
GeneralDropdown,
},
computed: {
tagsUrl() {
return list_users_settings_team_tags_path({team_id: this.subject.attributes.team_id});
},
tagResourceUrl() {
return this.subject.attributes.urls.tag_resource;
},
@ -83,7 +80,7 @@ export default {
},
methods: {
loadAllTags() {
axios.get(this.tagsUrl).then((response) => {
axios.get(tags_path()).then((response) => {
this.allTags = response.data.data;
});
},

View file

@ -6,7 +6,7 @@ class MyModuleSerializer < ActiveModel::Serializer
include ApplicationHelper
include ActionView::Helpers::TextHelper
attributes :name, :description, :permissions, :description_view, :urls, :last_modified_by_name, :created_at, :updated_at, :tags, :team_id,
attributes :name, :description, :permissions, :description_view, :urls, :last_modified_by_name, :created_at, :updated_at, :tags,
:project_name, :experiment_name, :created_by_name, :is_creator_current_user, :code, :designated_user_ids, :due_date_cell, :start_date_cell, :completed_on
def project_name
@ -17,10 +17,6 @@ class MyModuleSerializer < ActiveModel::Serializer
object.experiment.name
end
def team_id
object.team.id
end
def created_by_name
object.created_by&.full_name
end

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
json.data do
json.array! @tags do |t|
json.array! [t.id, t.name, t.color]
end
end

View file

@ -225,6 +225,8 @@ Rails.application.routes.draw do
to: 'zip_exports#file_expired',
as: 'file_expired'
resources :tags, only: :index
resources :teams do
resources :repositories, only: %i(index create destroy update) do
collection do