Skip to content
Snippets Groups Projects
Commit 2855eee0 authored by pabois's avatar pabois
Browse files

wip

parent afc86f3b
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@
#
class Communication::Website::Category < ApplicationRecord
include WithGithubFiles
include WithMenuItemTarget
include WithSlug
include WithTree
......
......@@ -39,15 +39,13 @@
class Communication::Website::Page < ApplicationRecord
include Communication::Website::WithMedia
include WithGithubFiles
include WithMenuItemTarget
include WithSlug
include WithTree
has_rich_text :text
has_one_attached_deletable :featured_image
has_one :imported_page,
class_name: 'Communication::Website::Imported::Page',
dependent: :destroy
belongs_to :university
belongs_to :website,
foreign_key: :communication_website_id
......@@ -57,13 +55,14 @@ class Communication::Website::Page < ApplicationRecord
belongs_to :parent,
class_name: 'Communication::Website::Page',
optional: true
has_one :imported_page,
class_name: 'Communication::Website::Imported::Page',
dependent: :nullify
has_many :children,
class_name: 'Communication::Website::Page',
foreign_key: :parent_id,
dependent: :nullify
has_one :imported_page,
class_name: 'Communication::Website::Imported::Page',
dependent: :nullify
validates :title, presence: true
validates :slug, uniqueness: { scope: :communication_website_id }
......
......@@ -31,6 +31,7 @@
class Communication::Website::Post < ApplicationRecord
include Communication::Website::WithMedia
include WithGithubFiles
include WithMenuItemTarget
include WithSlug
has_rich_text :text
......
module WithMenuItemTarget
extend ActiveSupport::Concern
included do
has_many :menu_items,
as: :about,
class_name: 'Communication::Website::Menu::Item',
dependent: :destroy
end
end
......@@ -28,6 +28,7 @@
#
class Education::Program < ApplicationRecord
include WithGithubFiles
include WithMenuItemTarget
include WithTree
attr_accessor :skip_websites_categories_callback
......
......@@ -16,7 +16,11 @@
<h5 class="card-title mb-0"><%= t('metadata') %></h5>
</div>
<div class="card-body">
<%= f.input :identifier if can?(:create, menu) %>
<%= f.input :identifier,
input_html: menu.persisted? ? {} : {
class: 'js-slug-input',
data: { source: '#communication_website_menu_title' }
} if can?(:create, menu) %>
</div>
</div>
</div>
......
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