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

init

parent e0f9f184
No related branches found
No related tags found
No related merge requests found
module AsBacklinkable
extend ActiveSupport::Concern
def backlinks_pages(website)
backlinks(
Communication::Website::Page,
website
)
.collect(&:direct_source)
.compact
.reject { |page| page.is_special_page? }
.reject { |page| !page.published? }
end
def backlinks_posts(website)
backlinks(
Communication::Website::Post,
website
)
.collect(&:direct_source)
.compact
.reject { |page| !page.published? }
end
def backlinks_agenda_events(website)
backlinks(
Communication::Website::Agenda::Event,
website
)
.collect(&:direct_source)
.compact
.reject { |event| !event.published? }
end
protected
def backlinks(kind, website)
connections.where(
direct_source_type: kind.to_s,
website_id: website.id
)
end
end
\ No newline at end of file
......@@ -47,6 +47,7 @@
# fk_rails_5af11ea0cc (original_id => university_organizations.id)
#
class University::Organization < ApplicationRecord
include AsBacklinkable
include AsIndirectObject
include Sanitizable
include WithBlobs
......
backlinks:
current_website:
id: <%= @website.id %>
name: "<%= @website %>"
pages:
<% @about.backlinks_pages(@website).each do |element| %>
- path: "<%= element.path %>"
file: "<%= element.git_path(@website) %>"
<% end %>
posts:
<% @about.backlinks_posts(@website).each do |element| %>
- path: "<%= element.static_path %>"
file: "<%= element.git_path(@website) %>"
<% end %>
events:
<% @about.backlinks_agenda_events(@website).each do |element| %>
- path: "<%= element.current_permalink_in_website(@website)&.path %>"
file: "<%= element.git_path(@website) %>"
<% end %>
......@@ -170,6 +170,7 @@
</div>
<% end if @organization.experiences.any? %>
<%= render 'admin/application/connections/list', about: @organization %>
<% content_for :action_bar_left do %>
<%= destroy_link @organization %>
......
......@@ -55,6 +55,7 @@ logo_on_dark_background: "<%= @about.logo_on_dark_background.blob.id %>"
<% end %>
<%= render 'admin/application/meta_description/static' %>
<%= render 'admin/application/summary/static' %>
<%= render 'admin/application/connections/backlinks' %>
<%= render 'admin/communication/blocks/content/static', about: @about %>
---
<%= prepare_html_for_static @about.text, @about.university %>
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