Skip to content
Snippets Groups Projects
Commit 1d716373 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

fix

parent 48738ea0
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ class Admin::University::OrganizationsController < Admin::University::Applicatio
def create
@organization.university = current_university
if @organization.save_and_sync()
if @organization.save_and_sync
redirect_to admin_university_organization_path(@organization),
notice: t('admin.successfully_created_html', model: @organization.to_s)
else
......
......@@ -55,11 +55,12 @@ class Communication::Website::Page < ApplicationRecord
include WithMenuItemTarget
include WithPosition
include WithTree
include WithPath
include WithPermalink
include WithType
include WithTranslations
include WithWebsites
# WithPath overwrite the git_path method defined in WithWebsites
include WithPath
include WithUniversity
has_summernote :text # TODO: Remove text attribute
......
......@@ -10,12 +10,11 @@ module Communication::Website::WithConnections
def clean_connections!
start = Time.now
connect self
connections.where('updated_at < ?', start).destroy_all
connections.reload.where('updated_at < ?', start).delete_all
end
def connect(object)
# On ne connecte pas le site à lui-même
connect_object object unless object.is_a?(Communication::Website)
connect_object object
return unless object.respond_to?(:dependencies)
object.dependencies.each do |dependency|
connect_object dependency
......@@ -40,11 +39,15 @@ module Communication::Website::WithConnections
protected
def connect_object(object)
return if object.nil?
# On ne connecte pas le site à lui-même
return if object.is_a?(Communication::Website)
# puts "connect #{object} (#{object.class})"
connection = connections.where(university: university, object: object).first_or_create
connection.touch if connection.persisted?
end
def disconnect_object(object)
connections.where(university: university, object: object).destroy_all
connections.where(university: university, object: object).delete_all
end
end
\ No newline at end of file
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