Skip to content
Snippets Groups Projects
Unverified Commit 7cf804f7 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

Merge branch 'master' of github.com:noesya/osuny

parents 2ccf3fad 2855eee0
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
# #
class Communication::Website::Category < ApplicationRecord class Communication::Website::Category < ApplicationRecord
include WithGithubFiles include WithGithubFiles
include WithMenuItemTarget
include WithSlug include WithSlug
include WithTree include WithTree
......
...@@ -39,15 +39,13 @@ ...@@ -39,15 +39,13 @@
class Communication::Website::Page < ApplicationRecord class Communication::Website::Page < ApplicationRecord
include Communication::Website::WithMedia include Communication::Website::WithMedia
include WithGithubFiles include WithGithubFiles
include WithMenuItemTarget
include WithSlug include WithSlug
include WithTree include WithTree
has_rich_text :text has_rich_text :text
has_one_attached_deletable :featured_image has_one_attached_deletable :featured_image
has_one :imported_page,
class_name: 'Communication::Website::Imported::Page',
dependent: :destroy
belongs_to :university belongs_to :university
belongs_to :website, belongs_to :website,
foreign_key: :communication_website_id foreign_key: :communication_website_id
...@@ -57,13 +55,14 @@ class Communication::Website::Page < ApplicationRecord ...@@ -57,13 +55,14 @@ class Communication::Website::Page < ApplicationRecord
belongs_to :parent, belongs_to :parent,
class_name: 'Communication::Website::Page', class_name: 'Communication::Website::Page',
optional: true optional: true
has_one :imported_page,
class_name: 'Communication::Website::Imported::Page',
dependent: :nullify
has_many :children, has_many :children,
class_name: 'Communication::Website::Page', class_name: 'Communication::Website::Page',
foreign_key: :parent_id, foreign_key: :parent_id,
dependent: :nullify dependent: :nullify
has_one :imported_page,
class_name: 'Communication::Website::Imported::Page',
dependent: :nullify
validates :title, presence: true validates :title, presence: true
validates :slug, uniqueness: { scope: :communication_website_id } validates :slug, uniqueness: { scope: :communication_website_id }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
class Communication::Website::Post < ApplicationRecord class Communication::Website::Post < ApplicationRecord
include Communication::Website::WithMedia include Communication::Website::WithMedia
include WithGithubFiles include WithGithubFiles
include WithMenuItemTarget
include WithSlug include WithSlug
has_rich_text :text 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 @@ ...@@ -28,6 +28,7 @@
# #
class Education::Program < ApplicationRecord class Education::Program < ApplicationRecord
include WithGithubFiles include WithGithubFiles
include WithMenuItemTarget
include WithTree include WithTree
attr_accessor :skip_websites_categories_callback attr_accessor :skip_websites_categories_callback
......
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
<h5 class="card-title mb-0"><%= t('metadata') %></h5> <h5 class="card-title mb-0"><%= t('metadata') %></h5>
</div> </div>
<div class="card-body"> <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> </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