have everything moved to module

pull/6834/head
Jens Ulferts 6 years ago
parent f651c3534d
commit 38e9c55c38
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 9
      config/locales/en.yml
  2. 25
      config/locales/js-en.yml
  3. 0
      modules/grids/app/contracts/grids/base_contract.rb
  4. 0
      modules/grids/app/contracts/grids/create_contract.rb
  5. 0
      modules/grids/app/contracts/grids/update_contract.rb
  6. 0
      modules/grids/app/controllers/api/v3/grids/create_form_api.rb
  7. 0
      modules/grids/app/controllers/api/v3/grids/create_form_representer.rb
  8. 0
      modules/grids/app/controllers/api/v3/grids/form_representer.rb
  9. 0
      modules/grids/app/controllers/api/v3/grids/grid_collection_representer.rb
  10. 0
      modules/grids/app/controllers/api/v3/grids/grid_payload_representer.rb
  11. 0
      modules/grids/app/controllers/api/v3/grids/grid_representer.rb
  12. 0
      modules/grids/app/controllers/api/v3/grids/grids_api.rb
  13. 2
      modules/grids/app/controllers/api/v3/grids/schemas/grid_schema_api.rb
  14. 0
      modules/grids/app/controllers/api/v3/grids/schemas/grid_schema_representer.rb
  15. 0
      modules/grids/app/controllers/api/v3/grids/update_form_api.rb
  16. 0
      modules/grids/app/controllers/api/v3/grids/update_form_representer.rb
  17. 0
      modules/grids/app/controllers/api/v3/grids/widget_representer.rb
  18. 0
      modules/grids/app/services/grids/create_service.rb
  19. 0
      modules/grids/app/services/grids/set_attributes_service.rb
  20. 0
      modules/grids/app/services/grids/update_service.rb
  21. 14
      modules/grids/config/locales/en.yml
  22. 26
      modules/grids/config/locales/js-en.yml
  23. 2
      modules/grids/lib/grids/engine.rb
  24. 7
      modules/grids/spec/factories/grid_factory.rb
  25. 4
      modules/grids/spec/factories/grid_widget_factory.rb
  26. 0
      modules/grids/spec/features/my/my_page_accountable_spec.rb
  27. 0
      modules/grids/spec/features/my/my_page_assigned_to_me_spec.rb
  28. 0
      modules/grids/spec/features/my/my_page_documents_spec.rb
  29. 0
      modules/grids/spec/features/my/my_page_news_spec.rb
  30. 0
      modules/grids/spec/features/my/my_page_spec.rb
  31. 0
      modules/grids/spec/features/my/my_page_time_entries_current_user_spec.rb
  32. 0
      modules/grids/spec/lib/api/v3/grids/grid_payload_representer_parsing_spec.rb
  33. 0
      modules/grids/spec/lib/api/v3/grids/grid_representer_rendering_spec.rb
  34. 14
      modules/grids/spec/lib/api/v3/grids/schemas/grid_schema_representer_spec.rb
  35. 4
      modules/grids/spec/models/grids/grid_spec.rb
  36. 2
      modules/grids/spec/models/grids/my_page_spec.rb
  37. 4
      modules/grids/spec/models/grids/shared_model.rb
  38. 6
      modules/grids/spec/models/grids/widget_spec.rb
  39. 0
      modules/grids/spec/requests/api/v3/grids/grids_create_form_resource_spec.rb
  40. 20
      modules/grids/spec/requests/api/v3/grids/grids_resource_spec.rb
  41. 0
      modules/grids/spec/requests/api/v3/grids/grids_schema_resource_spec.rb
  42. 4
      modules/grids/spec/requests/api/v3/grids/grids_update_form_resource_spec.rb
  43. 7
      spec/factories/grid_factory.rb
  44. 4
      spec/factories/grid_widget_factory.rb

@ -360,11 +360,6 @@ en:
subscriber: "Subscriber"
encoded_token: "Enterprise support token"
active_user_count_restriction: "Maximum active users"
grid:
page: "Page"
row_count: "Number of rows"
column_count: "Number of columns"
widgets: "Widgets"
relation:
delay: "Delay"
from: "Work package"
@ -507,10 +502,6 @@ en:
greater_than_or_equal_to: "(%{name}) must be greater than or equal to %{count}."
enterprise_token:
unreadable: "can't be read. Are you sure it is a support token?"
grid:
overlaps: 'overlap.'
outside: 'is outside of the grid.'
end_before_start: 'end value needs to be larger than the start value.'
parse_schema_filter_params_service:
attributes:
base:

@ -172,31 +172,6 @@ en:
general_text_No: "No"
general_text_Yes: "Yes"
grid:
add_modal:
choose_widget: 'Choose widget'
widgets:
documents:
title: 'Documents'
no_results: 'No documents yet.'
news:
title: 'News'
at: 'at'
no_results: 'Nothing new to report.'
time_entries_current_user:
title: 'Spent time (last 7 days)'
no_results: 'No time entries for the last 7 days.'
work_packages_accountable:
title: "Work packages I am accountable for"
work_packages_assigned:
title: 'Work packages assigned to me'
work_packages_created:
title: 'Work packages created by me'
work_packages_watched:
title: 'Work packages watched by me'
work_packages_calendar:
title: 'Calendar'
label_activate: "Activate"
label_activity_no: "Activity entry number %{activityNo}"
label_activity_with_comment_no: "Activity entry number %{activityNo}. Has a user comment."

@ -33,7 +33,7 @@ module API
class GridSchemaAPI < ::API::OpenProjectAPI
resources :schema do
get do
contract = ::Grids::CreateContract.new(Grid.new, current_user)
contract = ::Grids::CreateContract.new(::Grids::Grid.new, current_user)
::API::V3::Grids::Schemas::GridSchemaRepresenter.new(contract,
api_v3_paths.grid_schema,

@ -0,0 +1,14 @@
en:
activerecord:
attributes:
grids/grid:
page: "Page"
row_count: "Number of rows"
column_count: "Number of columns"
widgets: "Widgets"
errors:
models:
grids/grid:
overlaps: 'overlap.'
outside: 'is outside of the grid.'
end_before_start: 'end value needs to be larger than the start value.'

@ -0,0 +1,26 @@
en:
js:
grid:
add_modal:
choose_widget: 'Choose widget'
widgets:
documents:
title: 'Documents'
no_results: 'No documents yet.'
news:
title: 'News'
at: 'at'
no_results: 'Nothing new to report.'
time_entries_current_user:
title: 'Spent time (last 7 days)'
no_results: 'No time entries for the last 7 days.'
work_packages_accountable:
title: "Work packages I am accountable for"
work_packages_assigned:
title: 'Work packages assigned to me'
work_packages_created:
title: 'Work packages created by me'
work_packages_watched:
title: 'Work packages watched by me'
work_packages_calendar:
title: 'Calendar'

@ -2,7 +2,7 @@ module Grids
class Engine < ::Rails::Engine
isolate_namespace Grids
config.autoload_paths << File.expand_path("app/queries", __FILE__)
include OpenProject::Plugins::ActsAsOpEngine
config.to_prepare do
query = Grids::Query

@ -0,0 +1,7 @@
FactoryBot.define do
factory :grid, class: Grids::Grid do
end
factory :my_page_grid, class: Grids::MyPage do
end
end

@ -0,0 +1,4 @@
FactoryBot.define do
factory :grid_widget, class: Grids::Widget do
end
end

@ -107,7 +107,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
it_behaves_like 'has basic schema properties' do
let(:type) { 'Integer' }
let(:name) { Grid.human_attribute_name(:row_count) }
let(:name) { Grids::Grid.human_attribute_name(:row_count) }
let(:required) { true }
let(:writable) { true }
end
@ -120,7 +120,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
it_behaves_like 'has basic schema properties' do
let(:type) { 'Integer' }
let(:name) { Grid.human_attribute_name(:column_count) }
let(:name) { Grids::Grid.human_attribute_name(:column_count) }
let(:required) { true }
let(:writable) { true }
end
@ -133,7 +133,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
it_behaves_like 'has basic schema properties' do
let(:type) { 'DateTime' }
let(:name) { Grid.human_attribute_name('created_at') }
let(:name) { Grids::Grid.human_attribute_name('created_at') }
let(:required) { true }
let(:writable) { false }
end
@ -146,7 +146,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
it_behaves_like 'has basic schema properties' do
let(:type) { 'DateTime' }
let(:name) { Grid.human_attribute_name('updated_at') }
let(:name) { Grids::Grid.human_attribute_name('updated_at') }
let(:required) { true }
let(:writable) { false }
end
@ -159,7 +159,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
it_behaves_like 'has basic schema properties' do
let(:type) { '[]GridWidget' }
let(:name) { Grid.human_attribute_name('widgets') }
let(:name) { Grids::Grid.human_attribute_name('widgets') }
let(:required) { true }
let(:writable) { true }
end
@ -192,7 +192,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
context 'when having a new record' do
it_behaves_like 'has basic schema properties' do
let(:type) { 'Href' }
let(:name) { Grid.human_attribute_name('page') }
let(:name) { Grids::Grid.human_attribute_name('page') }
let(:required) { true }
let(:writable) { true }
end
@ -228,7 +228,7 @@ describe ::API::V3::Grids::Schemas::GridSchemaRepresenter do
it_behaves_like 'has basic schema properties' do
let(:type) { 'Href' }
let(:name) { Grid.human_attribute_name('page') }
let(:name) { Grids::Grid.human_attribute_name('page') }
let(:required) { true }
let(:writable) { false }
end

@ -29,8 +29,8 @@
require 'spec_helper'
require_relative './shared_model'
describe Grid, type: :model do
let(:instance) { Grid.new }
describe Grids::Grid, type: :model do
let(:instance) { Grids::Grid.new }
it_behaves_like 'grid attributes'
end

@ -30,7 +30,7 @@ require 'spec_helper'
require_relative './shared_model'
describe MyPageGrid, type: :model do
describe Grids::MyPage, type: :model do
let(:instance) { described_class.new }
it_behaves_like 'grid attributes'

@ -42,8 +42,8 @@ shared_examples_for 'grid attributes' do
it '#widgets' do
widgets = [
GridWidget.new(start_row: 2),
GridWidget.new(start_row: 5)
Grids::Widget.new(start_row: 2),
Grids::Widget.new(start_row: 5)
]
instance.widgets = widgets

@ -28,8 +28,8 @@
require 'spec_helper'
describe GridWidget, type: :model do
let(:instance) { GridWidget.new }
describe Grids::Widget, type: :model do
let(:instance) { Grids::Widget.new }
describe 'attributes' do
it '#start_row' do
@ -76,7 +76,7 @@ describe GridWidget, type: :model do
end
it '#grid' do
grid = Grid.new
grid = Grids::Grid.new
instance.grid = grid
expect(instance.grid)
.to eql grid

@ -38,7 +38,7 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
end
let(:my_page_grid) do
grid = MyPageGrid.new_default(current_user)
grid = Grids::MyPage.new_default(current_user)
grid.save!
grid
end
@ -46,7 +46,7 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
FactoryBot.create(:user)
end
let(:other_my_page_grid) do
MyPageGrid.new_default(other_user).save
Grids::MyPage.new_default(other_user).save
end
before do
@ -89,11 +89,13 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
context 'with a filter on the page attribute' do
shared_let(:other_grid) do
grid = Grid.new(row_count: 20,
column_count: 20)
grid = Grids::Grid.new(row_count: 20,
column_count: 20)
grid.save
Grid.where(id: grid.id).update_all(user_id: current_user.id)
Grids::Grid
.where(id: grid.id)
.update_all(user_id: current_user.id)
grid
end
@ -266,7 +268,7 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
it 'does not persist the changes to widgets' do
expect(my_page_grid.reload.widgets.count)
.to eql MyPageGrid.new_default(current_user).widgets.size
.to eql Grids::MyPage.new_default(current_user).widgets.size
end
end
@ -363,7 +365,7 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
end
it 'persists the grid' do
expect(Grid.count)
expect(Grids::Grid.count)
.to eql(1)
end
@ -392,7 +394,7 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
end
it 'does not create a grid' do
expect(Grid.count)
expect(Grids::Grid.count)
.to eql(0)
end
@ -435,7 +437,7 @@ describe 'API v3 Grids resource', type: :request, content_type: :json do
end
it 'does not create a grid' do
expect(Grid.count)
expect(Grids::Grid.count)
.to eql(0)
end

@ -38,7 +38,7 @@ describe "PATCH /api/v3/grids/:id/form", type: :request, content_type: :json do
end
let(:grid) do
grid = MyPageGrid.new_default(current_user)
grid = Grids::MyPage.new_default(current_user)
grid.save!
grid
end
@ -170,7 +170,7 @@ describe "PATCH /api/v3/grids/:id/form", type: :request, content_type: :json do
context 'for another user\'s grid' do
let(:other_user) { FactoryBot.create(:user) }
let(:other_grid) do
grid = MyPageGrid.new_default(other_user)
grid = Grids::MyPage.new_default(other_user)
grid.save!
grid
end

@ -1,7 +0,0 @@
FactoryBot.define do
factory :grid do
end
factory :my_page_grid do
end
end

@ -1,4 +0,0 @@
FactoryBot.define do
factory :grid_widget do
end
end
Loading…
Cancel
Save