@@ -38,8 +36,9 @@
<% column.metadata.each do |k, v| %>
<%= "data-metadata-#{k}=#{v}" %>
<% end %>
- <%= "data-items-url=#{items_repository_repository_columns_checklist_column_path(repository, column)}" if column.data_type == 'RepositoryChecklistValue' %>
- <%= "data-items-url=#{items_repository_repository_columns_list_column_path(repository, column)}" if column.data_type == 'RepositoryListValue' %>
+ <%= "data-items-url=#{items_repository_repository_columns_checklist_column_path(repository, column)}" if column.repository_checklist_value? %>
+ <%= "data-items-url=#{items_repository_repository_columns_list_column_path(repository, column)}" if column.repository_list_value? %>
+ <%= "data-items-url=#{items_repository_repository_columns_status_column_path(repository, column)}" if column.repository_status_value? %>
>
<%= display_tooltip(column.name) %>
diff --git a/config/routes.rb b/config/routes.rb
index 755456f06..a75991270 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -581,31 +581,30 @@ Rails.application.routes.draw do
namespace :repository_columns do
resources :text_columns, only: %i(create update destroy)
resources :number_columns, only: %i(create update destroy)
+ resources :asset_columns, only: %i(create update destroy)
+ resources :date_columns, only: %i(create update destroy)
+ resources :date_time_columns, only: %i(create update destroy)
resources :list_columns, only: %i(create update destroy) do
member do
get 'items'
end
end
- resources :asset_columns, only: %i(create update destroy)
- resources :date_columns, only: %i(create update destroy)
- resources :status_columns, only: %i(create update destroy)
- resources :date_time_columns, only: %i(create update destroy)
resources :checklist_columns, only: %i(create update destroy) do
member do
get 'items'
end
end
+ resources :status_columns, only: %i(create update destroy) do
+ member do
+ get 'items'
+ end
+ end
end
end
post 'available_rows', to: 'repository_rows#available_rows',
defaults: { format: 'json' }
- post 'repository_list_items', to: 'repository_list_items#search',
- defaults: { format: 'json' }
-
- get 'repository_status_items', to: 'repository_status_items#search'
-
get 'repository_rows/:id', to: 'repository_rows#show',
as: :repository_row,
defaults: { format: 'json' }
diff --git a/spec/controllers/repository_columns/status_columns_controller_spec.rb b/spec/controllers/repository_columns/status_columns_controller_spec.rb
index a9250642b..b1ff322cc 100644
--- a/spec/controllers/repository_columns/status_columns_controller_spec.rb
+++ b/spec/controllers/repository_columns/status_columns_controller_spec.rb
@@ -231,4 +231,49 @@ RSpec.describe RepositoryColumns::StatusColumnsController, type: :controller do
end
end
end
+
+ describe 'GET repository_status_column, #items' do
+ let(:action) { get :items, params: params }
+
+ let(:params) do
+ {
+ repository_id: repository.id,
+ id: repository_column.id
+ }
+ end
+
+ it 'respons with status 200' do
+ action
+
+ expect(response).to(have_http_status(200))
+ end
+
+ context 'when column is not found' do
+ let(:params) do
+ {
+ repository_id: repository.id,
+ id: -1
+ }
+ end
+
+ it 'respons with status 404' do
+ action
+
+ expect(response).to(have_http_status(404))
+ end
+ end
+
+ context 'when user does not have permissions' do
+ before do
+ user_team.role = :guest
+ user_team.save
+ end
+
+ it 'respons with status 403' do
+ action
+
+ expect(response).to(have_http_status(403))
+ end
+ end
+ end
end