mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-08 07:21:03 +08:00
Add new tags controller [SCI-12286]
This commit is contained in:
parent
d7b772be13
commit
a31b6788f2
5 changed files with 19 additions and 10 deletions
7
app/controllers/tags_controller.rb
Normal file
7
app/controllers/tags_controller.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class TagsController < ApplicationController
|
||||
def index
|
||||
@tags = current_team.tags.order(:name)
|
||||
end
|
||||
end
|
||||
|
|
@ -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;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
7
app/views/tags/index.json.jbuilder
Normal file
7
app/views/tags/index.json.jbuilder
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue