Skip to content
Snippets Groups Projects
Commit 0cd236a5 authored by pabois's avatar pabois
Browse files

remove related category for pages (replaces by blocks)

parent 70136e11
No related branches found
No related tags found
No related merge requests found
......@@ -91,7 +91,7 @@ class Admin::Communication::Websites::PagesController < Admin::Communication::We
:communication_website_id, :title, :breadcrumb_title, :bodyclass,
:description, :description_short, :header_text, :text, :slug, :published,
:featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit,
:parent_id, :related_category_id, :language_id
:parent_id, :language_id
)
.merge(university_id: current_university.id)
end
......
......@@ -23,7 +23,6 @@
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# related_category_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
......@@ -31,14 +30,12 @@
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_related_category_id (related_category_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_47b37cf8b2 (related_category_id => communication_website_categories.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
......@@ -58,9 +55,6 @@ class Communication::Website::Page < ApplicationRecord
belongs_to :website,
foreign_key: :communication_website_id
belongs_to :related_category,
class_name: 'Communication::Website::Category',
optional: true
belongs_to :parent,
class_name: 'Communication::Website::Page',
optional: true
......
......@@ -14,10 +14,6 @@
<%= f.input :description_short, input_html: { value: page.description_short&.gsub('&amp;', '&') } %>
<%= f.input :header_text, as: :string %>
<%= f.input :text, as: :summernote if page.text&.to_plain_text.present? %>
<%= f.association :related_category,
collection: collection_tree(@website.categories),
label_method: ->(p) { sanitize p[:label] },
value_method: ->(p) { p[:id] } if @website.categories.any? && page.is_regular_page? %>
</div>
</div>
<div class="card">
......
......@@ -71,15 +71,6 @@
</p>
<% end %>
<% if @page.related_category %>
<h3 class="h5"><%= Communication::Website::Page.human_attribute_name('related_category') %></h3>
<p><%= link_to_if can?(:read, @page.related_category),
@page.related_category,
admin_communication_website_category_path(
website_id: @website.id,
id: @page.related_category.id
) %></p>
<% end %>
<% if @page.children.any? %>
<h3 class="h5"><%= Communication::Website::Page.human_attribute_name('children') %></h3>
<ul class="list-unstyled mb-0">
......
......@@ -12,9 +12,6 @@ children:
- <%= child.path %>
<% end %>
<% end %>
<% if @about.related_category %>
category: "<%= @about.related_category.path %>"
<% end %>
description: >
<%= prepare_text_for_static @about.description %>
description_short: >
......
class RemovePagesRelatedCategoryId < ActiveRecord::Migration[6.1]
def change
remove_column :communication_website_pages, :related_category_id
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_05_16_095044) do
ActiveRecord::Schema.define(version: 2022_05_19_100506) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
......@@ -300,7 +300,6 @@ ActiveRecord::Schema.define(version: 2022_05_16_095044) do
t.datetime "updated_at", precision: 6, null: false
t.boolean "published", default: false
t.text "github_path"
t.uuid "related_category_id"
t.string "featured_image_alt"
t.text "text"
t.text "description_short"
......@@ -313,7 +312,6 @@ ActiveRecord::Schema.define(version: 2022_05_16_095044) do
t.index ["communication_website_id"], name: "index_communication_website_pages_on_communication_website_id"
t.index ["language_id"], name: "index_communication_website_pages_on_language_id"
t.index ["parent_id"], name: "index_communication_website_pages_on_parent_id"
t.index ["related_category_id"], name: "index_communication_website_pages_on_related_category_id"
t.index ["university_id"], name: "index_communication_website_pages_on_university_id"
end
......@@ -828,7 +826,6 @@ ActiveRecord::Schema.define(version: 2022_05_16_095044) do
add_foreign_key "communication_website_menu_items", "universities"
add_foreign_key "communication_website_menus", "communication_websites"
add_foreign_key "communication_website_menus", "universities"
add_foreign_key "communication_website_pages", "communication_website_categories", column: "related_category_id"
add_foreign_key "communication_website_pages", "communication_website_pages", column: "parent_id"
add_foreign_key "communication_website_pages", "communication_websites"
add_foreign_key "communication_website_pages", "universities"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment