diff --git a/app/controllers/admin/communication/extranets/documents/application_controller.rb b/app/controllers/admin/communication/extranets/documents/application_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..7491d21833e9f378fa47ca1492d77a8762748e36 --- /dev/null +++ b/app/controllers/admin/communication/extranets/documents/application_controller.rb @@ -0,0 +1,8 @@ +class Admin::Communication::Extranets::Documents::ApplicationController < Admin::Communication::Extranets::ApplicationController + protected + + def breadcrumb + super + add_breadcrumb Communication::Extranet.human_attribute_name(:feature_library), admin_communication_extranet_documents_path + end +end \ No newline at end of file diff --git a/app/controllers/admin/communication/extranets/documents/categories_controller.rb b/app/controllers/admin/communication/extranets/documents/categories_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..5e265cb29c8f9fcd760884edda1a6c98a87cf963 --- /dev/null +++ b/app/controllers/admin/communication/extranets/documents/categories_controller.rb @@ -0,0 +1,67 @@ +class Admin::Communication::Extranets::Documents::CategoriesController < Admin::Communication::Extranets::ApplicationController + load_and_authorize_resource class: Communication::Extranet::Document::Category, through: :extranet, through_association: :document_categories + + def index + @categories = @categories.ordered + breadcrumb + end + + def show + @documents = @category.documents.ordered.page params[:page] + breadcrumb + end + + def new + breadcrumb + end + + def edit + breadcrumb + add_breadcrumb t('edit') + end + + def create + if @category.save + redirect_to admin_communication_extranet_document_category_path(@category), notice: t('admin.successfully_created_html', model: @category.to_s) + else + breadcrumb + render :new, status: :unprocessable_entity + end + end + + def update + if @category.update(category_params) + redirect_to admin_communication_extranet_document_category_path(@category), notice: t('admin.successfully_updated_html', model: @category.to_s) + else + breadcrumb + add_breadcrumb t('edit') + render :edit, status: :unprocessable_entity + end + end + + def destroy + @category.destroy + redirect_to admin_communication_extranet_document_categories_url, notice: t('admin.successfully_destroyed_html', model: @category.to_s) + end + + protected + + def breadcrumb + super + add_breadcrumb Communication::Extranet.human_attribute_name(:feature_library), admin_communication_extranet_documents_path + add_breadcrumb Communication::Extranet::Document::Category.model_name.human(count: 2), admin_communication_extranet_document_categories_path + breadcrumb_for @category + end + + def category_params + params.require(:communication_extranet_document_category) + .permit( + :name, + :slug, + ) + .merge( + university_id: current_university.id + ) + end + +end \ No newline at end of file diff --git a/app/controllers/admin/communication/extranets/documents/kinds_controller.rb b/app/controllers/admin/communication/extranets/documents/kinds_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..45245939632cf869612bd2da00eb14599ebab4df --- /dev/null +++ b/app/controllers/admin/communication/extranets/documents/kinds_controller.rb @@ -0,0 +1,66 @@ +class Admin::Communication::Extranets::Documents::KindsController < Admin::Communication::Extranets::Documents::ApplicationController + load_and_authorize_resource class: Communication::Extranet::Document::Kind, through: :extranet, through_association: :document_kinds + + def index + @kinds = @kinds.ordered + breadcrumb + end + + def show + @documents = @kind.documents.ordered.page params[:page] + breadcrumb + end + + def new + breadcrumb + end + + def edit + breadcrumb + add_breadcrumb t('edit') + end + + def create + if @kind.save + redirect_to admin_communication_extranet_document_kind_path(@kind), notice: t('admin.successfully_created_html', model: @kind.to_s) + else + breadcrumb + render :new, status: :unprocessable_entity + end + end + + def update + if @kind.update(kind_params) + redirect_to admin_communication_extranet_document_kind_path(@kind), notice: t('admin.successfully_updated_html', model: @kind.to_s) + else + breadcrumb + add_breadcrumb t('edit') + render :edit, status: :unprocessable_entity + end + end + + def destroy + @kind.destroy + redirect_to admin_communication_extranet_document_kinds_url, notice: t('admin.successfully_destroyed_html', model: @kind.to_s) + end + + protected + + def breadcrumb + super + add_breadcrumb Communication::Extranet::Document::Kind.model_name.human(count: 2), admin_communication_extranet_document_kinds_path + breadcrumb_for @kind + end + + def kind_params + params.require(:communication_extranet_document_kind) + .permit( + :name, + :slug, + ) + .merge( + university_id: current_university.id + ) + end + +end \ No newline at end of file diff --git a/app/controllers/admin/communication/extranets/documents_controller.rb b/app/controllers/admin/communication/extranets/documents_controller.rb index 124981dd684b81afdf566884f6881d8355930625..dd96762fce3a07251f3dc951a2768eec962609e7 100644 --- a/app/controllers/admin/communication/extranets/documents_controller.rb +++ b/app/controllers/admin/communication/extranets/documents_controller.rb @@ -3,6 +3,8 @@ class Admin::Communication::Extranets::DocumentsController < Admin::Communicatio def index @documents = @documents.ordered.page params[:page] + @categories = @extranet.document_categories.ordered + @kinds = @extranet.document_kinds.ordered breadcrumb end diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index faabfae4280d7d6a74fa33af518642da3104aaf4..c8ab92c466d3180edc318ed5d12aec0055b7ab65 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -60,6 +60,8 @@ class Communication::Extranet < ApplicationRecord has_many :posts has_many :post_categories, class_name: 'Communication::Extranet::Post::Category' has_many :documents + has_many :document_categories, class_name: 'Communication::Extranet::Document::Category' + has_many :document_kinds, class_name: 'Communication::Extranet::Document::Kind' validates_presence_of :name, :host validates :logo, size: { less_than: 1.megabytes } diff --git a/app/models/communication/extranet/document.rb b/app/models/communication/extranet/document.rb index 30a353f9f0e1bc72338072f57042b31978c816b4..9b332be81ebbaf763b0c4202fc428b07a1b3a046 100644 --- a/app/models/communication/extranet/document.rb +++ b/app/models/communication/extranet/document.rb @@ -33,6 +33,8 @@ class Communication::Extranet::Document < ApplicationRecord include WithUniversity belongs_to :extranet, class_name: 'Communication::Extranet' + belongs_to :category + belongs_to :kind has_one_attached_deletable :file diff --git a/app/models/communication/extranet/document/category.rb b/app/models/communication/extranet/document/category.rb index d153fb4012e04d3289fcfa2ab583393184bbd5b1..91f8d0214a7c43a1855d10d939a118d9cb68f77a 100644 --- a/app/models/communication/extranet/document/category.rb +++ b/app/models/communication/extranet/document/category.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # name :string +# slug :string # created_at :datetime not null # updated_at :datetime not null # extranet_id :uuid not null, indexed @@ -20,6 +21,27 @@ # fk_rails_76e327b90f (extranet_id => communication_extranets.id) # class Communication::Extranet::Document::Category < ApplicationRecord - belongs_to :extranet - belongs_to :university + include WithSlug + include WithUniversity + + belongs_to :extranet, class_name: 'Communication::Extranet' + + has_many :documents + + validates :name, presence: true + + scope :ordered, -> { order(:name) } + + def to_s + "#{name}" + end + + protected + + def slug_unavailable?(slug) + self.class.unscoped + .where(extranet_id: self.extranet_id, slug: slug) + .where.not(id: self.id) + .exists? + end end diff --git a/app/models/communication/extranet/document/kind.rb b/app/models/communication/extranet/document/kind.rb index d13f6fcbfd91fc07ac924904a8f374ff9369af94..7f3afa35591e32ab62a3f2e4c046eac1e3a8aa71 100644 --- a/app/models/communication/extranet/document/kind.rb +++ b/app/models/communication/extranet/document/kind.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # name :string +# slug :string # created_at :datetime not null # updated_at :datetime not null # extranet_id :uuid not null, indexed @@ -20,6 +21,27 @@ # fk_rails_2a55cf899a (university_id => universities.id) # class Communication::Extranet::Document::Kind < ApplicationRecord - belongs_to :extranet - belongs_to :university + include WithSlug + include WithUniversity + + belongs_to :extranet, class_name: 'Communication::Extranet' + + has_many :documents + + validates :name, presence: true + + scope :ordered, -> { order(:name) } + + def to_s + "#{name}" + end + + protected + + def slug_unavailable?(slug) + self.class.unscoped + .where(extranet_id: self.extranet_id, slug: slug) + .where.not(id: self.id) + .exists? + end end diff --git a/app/views/admin/communication/extranets/documents/categories/_form.html.erb b/app/views/admin/communication/extranets/documents/categories/_form.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1dd744a49671ffd31d4c5f43f83c4129a48eed2b --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/_form.html.erb @@ -0,0 +1,25 @@ +<%= simple_form_for [:admin, category] do |f| %> + <%= f.error_notification %> + <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> + + <div class="row"> + <div class="col-md-8"> + <%= osuny_panel t('content') do %> + <%= f.input :name %> + <% end %> + </div> + <div class="col-md-4"> + <%= osuny_panel t('metadata') do %> + <%= f.input :slug, + as: :string, + input_html: category.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#communication_extranet_document_category_name' } + } %> + <% end %> + </div> + </div> + <% content_for :action_bar_right do %> + <%= submit f %> + <% end %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/categories/_list.html.erb b/app/views/admin/communication/extranets/documents/categories/_list.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..3bf6eb7f295abf96a37d0cbc8939d6b808328f75 --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/_list.html.erb @@ -0,0 +1,30 @@ +<div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> + <tr> + <th class="ps-0" width="60%"><%= Communication::Extranet::Document::Category.human_attribute_name('name') %></th> + <th></th> + </tr> + </thead> + <tbody> + <% categories.each do |category| %> + <tr> + <td class="ps-0"><%= link_to category, admin_communication_extranet_document_category_path(extranet_id: category.extranet.id, id: category.id) %></td> + + <td> + <div class="btn-group" role="group"> + <%= link_to t('edit'), + edit_admin_communication_extranet_document_category_path(extranet_id: category.extranet.id, id: category.id), + class: button_classes if can?(:update, category) %> + <%= link_to t('delete'), + admin_communication_extranet_document_category_path(extranet_id: category.extranet.id, id: category.id), + method: :delete, + data: { confirm: t('please_confirm') }, + class: button_classes_danger if can?(:destroy, category) %> + </div> + </td> + </tr> + <% end %> + </tbody> + </table> +</div> diff --git a/app/views/admin/communication/extranets/documents/categories/edit.html.erb b/app/views/admin/communication/extranets/documents/categories/edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..213c0056b51e4ccbfb3ed8619a16bf3b0af53ef7 --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/edit.html.erb @@ -0,0 +1,5 @@ +<% content_for :title, @category %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'form', category: @category %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/categories/index.html.erb b/app/views/admin/communication/extranets/documents/categories/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c4e9bfba613d2bf744d2a034431016385ae93f44 --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/index.html.erb @@ -0,0 +1,9 @@ +<% content_for :title, Communication::Extranet::Post::Category.model_name.human(count: 2) %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'admin/communication/extranets/documents/categories/list', categories: @categories %> +<% end %> + +<% content_for :action_bar_right do %> + <%= create_link Communication::Extranet::Post::Category %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/extranets/documents/categories/new.html.erb b/app/views/admin/communication/extranets/documents/categories/new.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..dffe93cc2bb91a5bb9d56144cb362177247fb42d --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/new.html.erb @@ -0,0 +1,5 @@ +<% content_for :title, Communication::Extranet::Post::Category.model_name.human %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'form', category: @category %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/categories/preview.html.erb b/app/views/admin/communication/extranets/documents/categories/preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..14bd7cd482e0666eb021ef6bb70d0732497bf91f --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/preview.html.erb @@ -0,0 +1,3 @@ +<% content_for :title, @post.title %> +<% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> +<%= render 'admin/communication/blocks/preview', about: @post %> diff --git a/app/views/admin/communication/extranets/documents/categories/show.html.erb b/app/views/admin/communication/extranets/documents/categories/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..96479dd7bca2a8f93f3b67de054e91e2c25249ea --- /dev/null +++ b/app/views/admin/communication/extranets/documents/categories/show.html.erb @@ -0,0 +1,14 @@ +<% content_for :title, @category %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'admin/communication/extranets/documents/list', documents: @documents %> + <%= paginate @documents, theme: 'bootstrap-5' %> +<% end %> + +<% content_for :action_bar_left do %> + <%= destroy_link @category %> +<% end %> + +<% content_for :action_bar_right do %> + <%= edit_link @category %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/index.html.erb b/app/views/admin/communication/extranets/documents/index.html.erb index 40ec6ed9a75ee524b5dd85ef886ebdcdd295b875..9f92cca16e2086581089c28d1e41141220fd983e 100644 --- a/app/views/admin/communication/extranets/documents/index.html.erb +++ b/app/views/admin/communication/extranets/documents/index.html.erb @@ -1,8 +1,21 @@ <% content_for :title, Communication::Extranet.human_attribute_name(:feature_library) %> <%= render 'admin/communication/extranets/sidebar' do %> - <%= render 'admin/communication/extranets/documents/list', documents: @documents %> - <%= paginate @documents, theme: 'bootstrap-5' %> + <section class="mb-5"> + <%= render 'admin/communication/extranets/documents/list', documents: @documents %> + <%= paginate @documents, theme: 'bootstrap-5' %> + </section> + + <% action = link_to t('create'), new_admin_communication_extranet_document_category_path, class: button_classes %> + <%= osuny_panel Communication::Extranet::Document::Category.model_name.human(count: 2), action: action do %> + <%= render 'admin/communication/extranets/documents/categories/list', categories: @categories %> + <% end %> + + <% action = link_to t('create'), new_admin_communication_extranet_document_kind_path, class: button_classes %> + <%= osuny_panel Communication::Extranet::Document::Kind.model_name.human(count: 2), action: action do %> + <%= render 'admin/communication/extranets/documents/kinds/list', kinds: @kinds %> + <% end %> + <% end %> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/extranets/documents/kinds/_form.html.erb b/app/views/admin/communication/extranets/documents/kinds/_form.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..bfb75b8b56c062f9553f167c988e856abf834528 --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/_form.html.erb @@ -0,0 +1,25 @@ +<%= simple_form_for [:admin, kind] do |f| %> + <%= f.error_notification %> + <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> + + <div class="row"> + <div class="col-md-8"> + <%= osuny_panel t('content') do %> + <%= f.input :name %> + <% end %> + </div> + <div class="col-md-4"> + <%= osuny_panel t('metadata') do %> + <%= f.input :slug, + as: :string, + input_html: kind.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#communication_extranet_document_kind_name' } + } %> + <% end %> + </div> + </div> + <% content_for :action_bar_right do %> + <%= submit f %> + <% end %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/kinds/_list.html.erb b/app/views/admin/communication/extranets/documents/kinds/_list.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..602b8e38b23c23ba48d63f00264cfe4c2e74a03c --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/_list.html.erb @@ -0,0 +1,30 @@ +<div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> + <tr> + <th class="ps-0" width="60%"><%= Communication::Extranet::Post::Category.human_attribute_name('name') %></th> + <th></th> + </tr> + </thead> + <tbody> + <% kinds.each do |kind| %> + <tr> + <td class="ps-0"><%= link_to kind, admin_communication_extranet_document_kind_path(extranet_id: kind.extranet.id, id: kind.id) %></td> + + <td> + <div class="btn-group" role="group"> + <%= link_to t('edit'), + edit_admin_communication_extranet_document_kind_path(extranet_id: kind.extranet.id, id: kind.id), + class: button_classes if can?(:update, kind) %> + <%= link_to t('delete'), + admin_communication_extranet_document_kind_path(extranet_id: kind.extranet.id, id: kind.id), + method: :delete, + data: { confirm: t('please_confirm') }, + class: button_classes_danger if can?(:destroy, kind) %> + </div> + </td> + </tr> + <% end %> + </tbody> + </table> +</div> diff --git a/app/views/admin/communication/extranets/documents/kinds/edit.html.erb b/app/views/admin/communication/extranets/documents/kinds/edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..6a33b3912c1e57e0337b0ef8ff0b202e5e09595e --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/edit.html.erb @@ -0,0 +1,5 @@ +<% content_for :title, @kind %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'form', kind: @kind %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/kinds/index.html.erb b/app/views/admin/communication/extranets/documents/kinds/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c10c021d7b3b1ec146b83f22e2389bdf7561c33d --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/index.html.erb @@ -0,0 +1,9 @@ +<% content_for :title, Communication::Extranet::Document::Kind.model_name.human(count: 2) %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'admin/communication/extranets/documents/kinds/list', kinds: @kinds %> +<% end %> + +<% content_for :action_bar_right do %> + <%= create_link Communication::Extranet::Document::Kind %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/extranets/documents/kinds/new.html.erb b/app/views/admin/communication/extranets/documents/kinds/new.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c7b31afd7a099e13ffd44860b148f0c3392f5e7a --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/new.html.erb @@ -0,0 +1,5 @@ +<% content_for :title, Communication::Extranet::Document::Kind.model_name.human %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'form', kind: @kind %> +<% end %> diff --git a/app/views/admin/communication/extranets/documents/kinds/preview.html.erb b/app/views/admin/communication/extranets/documents/kinds/preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..14bd7cd482e0666eb021ef6bb70d0732497bf91f --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/preview.html.erb @@ -0,0 +1,3 @@ +<% content_for :title, @post.title %> +<% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> +<%= render 'admin/communication/blocks/preview', about: @post %> diff --git a/app/views/admin/communication/extranets/documents/kinds/show.html.erb b/app/views/admin/communication/extranets/documents/kinds/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..2710035a8ef85b51f65dea9ea464c2a9e9c27a7b --- /dev/null +++ b/app/views/admin/communication/extranets/documents/kinds/show.html.erb @@ -0,0 +1,14 @@ +<% content_for :title, @kind %> + +<%= render 'admin/communication/extranets/sidebar' do %> + <%= render 'admin/communication/extranets/documents/list', documents: @documents %> + <%= paginate @documents, theme: 'bootstrap-5' %> +<% end %> + +<% content_for :action_bar_left do %> + <%= destroy_link @kind %> +<% end %> + +<% content_for :action_bar_right do %> + <%= edit_link @kind %> +<% end %> diff --git a/app/views/admin/communication/extranets/posts/index.html.erb b/app/views/admin/communication/extranets/posts/index.html.erb index cbf3d5fdf58b1c078afbc51d21172c1a77405044..831db566e252c86810ec325102f5c81317ef42f2 100644 --- a/app/views/admin/communication/extranets/posts/index.html.erb +++ b/app/views/admin/communication/extranets/posts/index.html.erb @@ -7,8 +7,7 @@ </section> <% action = link_to t('create'), new_admin_communication_extranet_post_category_path, class: button_classes %> - <%# action = create_link Communication::Website::Category %> - <%= osuny_panel Communication::Website::Category.model_name.human(count: 2), action: action do %> + <%= osuny_panel Communication::Extranet::Post::Category.model_name.human(count: 2), action: action do %> <%= render 'admin/communication/extranets/posts/categories/list', categories: @categories %> <% end %> <% end %> diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb index 5db6d8e7f5f1afcaa5be3d48e3afd530010e5dee..1be8ac580fcc562aaac80aa273418d850349f356 100644 --- a/config/routes/admin/communication.rb +++ b/config/routes/admin/communication.rb @@ -73,8 +73,6 @@ namespace :communication do post :disconnect end end - namespace :posts do - end resources :posts, controller: 'extranets/posts' do collection do resources :categories, controller: 'extranets/posts/categories', as: 'post_categories' @@ -85,7 +83,12 @@ namespace :communication do end # Automatic routes based on feature names get 'library' => 'extranets/documents#index', as: :library - resources :documents, controller: 'extranets/documents' + resources :documents, controller: 'extranets/documents' do + collection do + resources :categories, controller: 'extranets/documents/categories', as: 'document_categories' + resources :kinds, controller: 'extranets/documents/kinds', as: 'document_kinds' + end + end resources :jobs, controller: 'extranets/jobs' end resources :alumni do diff --git a/db/migrate/20230310083029_add_slugs_to_document_categories_and_kinds.rb b/db/migrate/20230310083029_add_slugs_to_document_categories_and_kinds.rb new file mode 100644 index 0000000000000000000000000000000000000000..1e64b54ce376330e0d2f8457a8265bf4f0d51565 --- /dev/null +++ b/db/migrate/20230310083029_add_slugs_to_document_categories_and_kinds.rb @@ -0,0 +1,6 @@ +class AddSlugsToDocumentCategoriesAndKinds < ActiveRecord::Migration[7.0] + def change + add_column :communication_extranet_document_categories, :slug, :string + add_column :communication_extranet_document_kinds, :slug, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 139e940000b7367c7c1aebf156baea743f74cc9e..e8777f0bc621a360385e022e8e5a31ad57029770 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_03_10_081530) do +ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -111,6 +111,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_081530) do t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "slug" t.index ["extranet_id"], name: "index_communication_extranet_document_categories_on_extranet_id" t.index ["university_id"], name: "extranet_document_categories_universities" end @@ -121,6 +122,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_081530) do t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "slug" t.index ["extranet_id"], name: "index_communication_extranet_document_kinds_on_extranet_id" t.index ["university_id"], name: "extranet_document_kinds_universities" end diff --git a/test/fixtures/communication/extranet/document/categories.yml b/test/fixtures/communication/extranet/document/categories.yml index 5d73fea1434e3c756c7a79a47f8c49586568f3b8..db2c02aa9d63f0605450cda38919189323f00489 100644 --- a/test/fixtures/communication/extranet/document/categories.yml +++ b/test/fixtures/communication/extranet/document/categories.yml @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # name :string +# slug :string # created_at :datetime not null # updated_at :datetime not null # extranet_id :uuid not null, indexed @@ -19,7 +20,6 @@ # fk_rails_6f2232d9f8 (university_id => universities.id) # fk_rails_76e327b90f (extranet_id => communication_extranets.id) # -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: extranet: one diff --git a/test/fixtures/communication/extranet/document/kinds.yml b/test/fixtures/communication/extranet/document/kinds.yml index bae066a93b07f05cc2c4ddf888e28bbe0ac47812..480abfc3a3f956f364e177f076727962d5eb094a 100644 --- a/test/fixtures/communication/extranet/document/kinds.yml +++ b/test/fixtures/communication/extranet/document/kinds.yml @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # name :string +# slug :string # created_at :datetime not null # updated_at :datetime not null # extranet_id :uuid not null, indexed @@ -19,7 +20,6 @@ # fk_rails_27a9b91ed8 (extranet_id => communication_extranets.id) # fk_rails_2a55cf899a (university_id => universities.id) # -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: extranet: one diff --git a/test/models/communication/extranet/document/category_test.rb b/test/models/communication/extranet/document/category_test.rb index ef2a3270727a9033b4e31f66716bd61f45644a77..6c922f2461aa953d17d095c6576465dd40bf673a 100644 --- a/test/models/communication/extranet/document/category_test.rb +++ b/test/models/communication/extranet/document/category_test.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # name :string +# slug :string # created_at :datetime not null # updated_at :datetime not null # extranet_id :uuid not null, indexed diff --git a/test/models/communication/extranet/document/kind_test.rb b/test/models/communication/extranet/document/kind_test.rb index 7c37fe74c3ece2cb3724e6a0fe1e82dd6a6c94b8..acca11c4caa41646a8789d1eacd0952b3e64a41a 100644 --- a/test/models/communication/extranet/document/kind_test.rb +++ b/test/models/communication/extranet/document/kind_test.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # name :string +# slug :string # created_at :datetime not null # updated_at :datetime not null # extranet_id :uuid not null, indexed