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

people

parent f6595e95
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,11 @@ module Communication::Website::WithDependencies
end
def blocks
Communication::Block.where(about_type: 'Communication::Website::Page', about_id: pages)
@blocks ||= Communication::Block.where(about_type: 'Communication::Website::Page', about_id: pages)
end
def blocks_dependencies
blocks_dependencies ||= blocks.collect(&:git_dependencies).flatten.compact.uniq
end
def education_programs
......@@ -54,7 +58,11 @@ module Communication::Website::WithDependencies
end
def people_in_blocks
[] # TODO
blocks_dependencies.reject { |dependency| !dependency.is_a? University::Person }
end
def people_with_facets_in_blocks
blocks_dependencies.reject { |dependency| !dependency.class.to_s.start_with?('University::Person') }
end
def people
......@@ -71,12 +79,13 @@ module Communication::Website::WithDependencies
def people_with_facets
@people_with_facets ||= begin
people = []
people += authors + authors.compact.map(&:author) if has_authors?
people += teachers + teachers.map(&:teacher) if has_teachers?
people += administrators + administrators.map(&:administrator) if has_administrators?
people += researchers + researchers.map(&:researcher) if has_researchers?
people.uniq.compact
people_with_facets = people
people_with_facets += authors.compact.map(&:author) if has_authors?
people_with_facets += teachers.compact.map(&:teacher) if has_teachers?
people_with_facets += administrators.compact.map(&:administrator) if has_administrators?
people_with_facets += researchers.compact.map(&:researcher) if has_researchers?
people_with_facets += people_with_facets_in_blocks if has_people_in_blocks?
people_with_facets.uniq.compact
end
end
......@@ -110,7 +119,6 @@ module Communication::Website::WithDependencies
end
def has_people_in_blocks?
# TODO
people_in_blocks.compact.any?
end
......
......@@ -27,12 +27,14 @@
<td><i class="fa fa-bars handle"></i></td>
<% end %>
<td><%= link_to_if can?(:read, block),
block,
block.to_s.truncate(50),
admin_communication_block_path(block) %></td>
<td><%= block.template_kind_i18n %></td>
<td class="text-end">
<%= edit_link block %>
<%= destroy_link block %>
<div class="btn-group" role="group">
<%= edit_link block %>
<%= destroy_link block %>
</div>
</td>
</tr>
<% end %>
......
......@@ -488,6 +488,23 @@ ActiveRecord::Schema.define(version: 2022_04_21_093107) do
t.index ["university_id"], name: "index_education_schools_on_university_id"
end
create_table "external_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "title"
t.text "description"
t.string "address"
t.string "zipcode"
t.string "city"
t.string "country"
t.string "website"
t.string "phone"
t.string "mail"
t.boolean "active"
t.string "sirene"
t.integer "kind"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "name"
t.string "iso_code"
......
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