diff --git a/app/assets/images/communication/blocks/templates/pages/cards.png b/app/assets/images/communication/blocks/templates/pages/cards.png new file mode 100644 index 0000000000000000000000000000000000000000..ed9736d2345e6cef341922794bc84c1cfde498ba Binary files /dev/null and b/app/assets/images/communication/blocks/templates/pages/cards.png differ diff --git a/app/assets/images/communication/blocks/templates/pages/grid.png b/app/assets/images/communication/blocks/templates/pages/grid.png new file mode 100644 index 0000000000000000000000000000000000000000..1a4c8c09c66707d73601cd22b37bf1634a85b853 Binary files /dev/null and b/app/assets/images/communication/blocks/templates/pages/grid.png differ diff --git a/app/assets/images/communication/blocks/templates/pages/list.png b/app/assets/images/communication/blocks/templates/pages/list.png new file mode 100644 index 0000000000000000000000000000000000000000..2c9bf9b8c6267b543e165f16c7f27dadac5af22e Binary files /dev/null and b/app/assets/images/communication/blocks/templates/pages/list.png differ diff --git a/app/assets/stylesheets/commons/_summernote.sass b/app/assets/stylesheets/commons/_summernote.sass index 0018e401ec1b29d547203852007272c47d4690e5..a18ae77033305ecdc3b41647250af2223dc2a553 100644 --- a/app/assets/stylesheets/commons/_summernote.sass +++ b/app/assets/stylesheets/commons/_summernote.sass @@ -17,4 +17,14 @@ .note-editable > h2:first-of-type margin-top: 0 .note-editing-area - background: white \ No newline at end of file + background: white + .sn-checkbox-open-in-new-window + label + padding: 0 + input + margin-right: 10px + vertical-align: text-top + .sn-checkbox-use-protocol + display: none + .note-modal-footer + height: 52px diff --git a/app/controllers/admin/university/alumni/imports_controller.rb b/app/controllers/admin/university/alumni/imports_controller.rb index 6de670ed80e5bf1553e35da571b3d1bea1f5a2e1..1743ace145fc8f70c6d32211d6db846064b3da89 100644 --- a/app/controllers/admin/university/alumni/imports_controller.rb +++ b/app/controllers/admin/university/alumni/imports_controller.rb @@ -1,14 +1,18 @@ class Admin::University::Alumni::ImportsController < Admin::University::ApplicationController - load_and_authorize_resource class: University::Person::Alumnus::Import, + load_and_authorize_resource class: Import, through: :current_university, - through_association: :person_alumnus_imports + through_association: :imports + + has_scope :for_status def index + @imports = apply_scopes(@imports.kind_alumni).ordered.page(params[:page]) breadcrumb end def show breadcrumb + render 'admin/imports/show' end def new @@ -16,11 +20,14 @@ class Admin::University::Alumni::ImportsController < Admin::University::Applicat end def create + @import.kind = :alumni @import.university = current_university @import.user = current_user if @import.save - redirect_to [:admin, @import], notice: "Import was successfully created." + redirect_to admin_university_alumni_import_path(@import), + notice: t('admin.successfully_created_html', model: @import.to_s) else + breadcrumb render :new, status: :unprocessable_entity end end @@ -31,7 +38,7 @@ class Admin::University::Alumni::ImportsController < Admin::University::Applicat super add_breadcrumb University::Person::Alumnus.model_name.human(count: 2), admin_university_alumni_path - add_breadcrumb University::Person::Alumnus::Import.model_name.human(count: 2), + add_breadcrumb Import.model_name.human(count: 2), admin_university_alumni_imports_path return unless @import @import.persisted? ? add_breadcrumb(@import, admin_university_alumni_import_path(@import)) @@ -39,7 +46,7 @@ class Admin::University::Alumni::ImportsController < Admin::University::Applicat end def import_params - params.require(:university_person_alumnus_import) + params.require(:import) .permit(:file) end end diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb new file mode 100644 index 0000000000000000000000000000000000000000..1b8521d1b5b1f90c2fdee4cb31e4ac7c514f7e42 --- /dev/null +++ b/app/mailers/notification_mailer.rb @@ -0,0 +1,16 @@ +class NotificationMailer < ApplicationMailer + helper :application # gives access to all helpers defined within `application_helper`. + default template_path: 'mailers/notifications' + + def import(import) + merge_with_university_infos(import.university, {}) + I18n.locale = import.user.language.iso_code + subject = import.finished_with_errors? ? t('mailers.notifications.import.subject_with_errors') : + t('mailers.notifications.import.subject_without_errors') + + @import = import + @url = send(import.url_pattern, import) + mail(from: import.university.mail_from[:full], to: import.user.email, subject: subject) + end + +end diff --git a/app/models/communication/block/template/call_to_action.rb b/app/models/communication/block/template/call_to_action.rb index 5f8c6fe1cd4b09b0e96d7b3fbde136b244304e75..0bbdb6071d59135e6c50bc7cd6bb51e16cb378ce 100644 --- a/app/models/communication/block/template/call_to_action.rb +++ b/app/models/communication/block/template/call_to_action.rb @@ -2,12 +2,15 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ def sanitized_data { "text" => Osuny::Sanitizer.sanitize(text), - "url" => url, "button" => Osuny::Sanitizer.sanitize(button, 'string'), - "url_secondary" => url_secondary, "button_secondary" => Osuny::Sanitizer.sanitize(button_secondary, 'string'), - "url_tertiary" => url_tertiary, "button_tertiary" => Osuny::Sanitizer.sanitize(button_tertiary, 'string'), + "url" => url, + "url_secondary" => url_secondary, + "url_tertiary" => url_tertiary, + "target_blank" => target_blank, + "target_blank_secondary" => target_blank_secondary, + "target_blank_tertiary" => target_blank_tertiary, "image" => data['image'], "image_alt" => Osuny::Sanitizer.sanitize(data['image_alt'], 'string'), "image_credit" => Osuny::Sanitizer.sanitize(data['image_credit'], 'string') @@ -30,6 +33,10 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ "#{data['button']}" end + def target_blank + data['target_blank'] == true + end + def url_secondary "#{data['url_secondary']}" end @@ -38,10 +45,18 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ "#{data['button_secondary']}" end + def target_blank_secondary + data['target_blank_secondary'] == true + end + def url_tertiary "#{data['url_tertiary']}" end + def target_blank_tertiary + data['target_blank_tertiary'] == true + end + def button_tertiary "#{data['button_tertiary']}" end diff --git a/app/models/communication/block/template/page.rb b/app/models/communication/block/template/page.rb index 41b048fdb26117ddb85ffd3bbcf43b3509d5d797..108f5501e371b751cbff5ffafb113c6ab8c79278 100644 --- a/app/models/communication/block/template/page.rb +++ b/app/models/communication/block/template/page.rb @@ -16,6 +16,10 @@ class Communication::Block::Template::Page < Communication::Block::Template @main_page ||= page(data['page_id']) end + def layout + data['layout'] || 'grid' + end + def show_main_description data['show_main_description'] || false end diff --git a/app/models/concerns/importable.rb b/app/models/concerns/importable.rb deleted file mode 100644 index e2976a1a2c9b7db5f8a6668628923a241e5333cd..0000000000000000000000000000000000000000 --- a/app/models/concerns/importable.rb +++ /dev/null @@ -1,36 +0,0 @@ -module Importable - extend ActiveSupport::Concern - - included do - belongs_to :user - - has_one_attached :file - - after_commit :parse_async - end - - def lines - csv.count - rescue - 'NA' - end - - def to_s - "#{user}, #{I18n.l created_at}" - end - - protected - - def parse_async - parse - end - handle_asynchronously :parse_async, queue: 'default' - - def parse - raise NotImplementedError - end - - def csv - @csv ||= CSV.parse file.blob.download, headers: true - end -end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 8d8f698bee4a8cc9d70977a1a6ceb49fc34046c8..1b7aec093edc21d99e1a8256e13a326020f10bf6 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -65,8 +65,7 @@ class Education::Program < ApplicationRecord include WithWebsites include WithTeam - rich_text_areas_with_inheritance :main_information, - :accessibility, + rich_text_areas_with_inheritance :accessibility, :contacts, :duration, :evaluation, diff --git a/app/models/import.rb b/app/models/import.rb index 0d1181faaed9439c0aa406643bda74b564d52e09..d04d85645593e29b0b8f15c7142f33b96ae6fbc3 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -56,6 +56,12 @@ class Import < ApplicationRecord super(value) end + def url_pattern + kind_alumni? ? + 'admin_university_alumni_import_url' : + 'admin_university_organizations_import_url' + end + private def file_validation @@ -74,13 +80,11 @@ class Import < ApplicationRecord end def send_mail_to_creator - # TODO - # ImportsMailer.companies(self).deliver_later + NotificationMailer.import(self).deliver_later end def status_changed_from_pending? saved_change_to_status? && status_before_last_save == 'pending' end - end diff --git a/app/models/university/organization/import.rb b/app/models/university/organization/import.rb deleted file mode 100644 index 46f51178f73850836e626576f74352c27404124d..0000000000000000000000000000000000000000 --- a/app/models/university/organization/import.rb +++ /dev/null @@ -1,70 +0,0 @@ -# == Schema Information -# -# Table name: university_organization_imports -# -# id :uuid not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid not null, indexed -# -# Indexes -# -# index_university_organization_imports_on_university_id (university_id) -# index_university_organization_imports_on_user_id (user_id) -# -# Foreign Keys -# -# fk_rails_31152af0cd (university_id => universities.id) -# fk_rails_da057ff44d (user_id => users.id) -# -class University::Organization::Import < ApplicationRecord - include WithUniversity - - belongs_to :user - - has_one_attached :file - - after_save :parse - - def lines - csv.count - rescue - 'NA' - end - - def to_s - "#{user}, #{I18n.l created_at}" - end - - protected - - def parse - csv.each do |row| - university.organizations.where(university: university, name: row['name']).first_or_create do |o| - [ - :long_name, - :kind, - :siren, - :nic, - :description, - :address, - :zipcode, - :city, - :country, - :email, - :phone, - :url, - ].each do |property| - o[property] = row[property.to_s] - end - o.kind ||= :company - end - end - end - handle_asynchronously :parse, queue: 'default' - - def csv - @csv ||= CSV.parse file.blob.download, headers: true - end -end diff --git a/app/models/university/person/alumnus/import.rb b/app/models/university/person/alumnus/import.rb deleted file mode 100644 index 43e09d84c535aea87095ba0e7a799619369d8d39..0000000000000000000000000000000000000000 --- a/app/models/university/person/alumnus/import.rb +++ /dev/null @@ -1,179 +0,0 @@ -# == Schema Information -# -# Table name: university_person_alumnus_imports -# -# id :uuid not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid not null, indexed -# -# Indexes -# -# index_university_person_alumnus_imports_on_university_id (university_id) -# index_university_person_alumnus_imports_on_user_id (user_id) -# -# Foreign Keys -# -# fk_rails_3ff74ac195 (user_id => users.id) -# fk_rails_d14eb003f9 (university_id => universities.id) -# -class University::Person::Alumnus::Import < ApplicationRecord - include WithUniversity - include Importable - - def self.table_name - 'university_person_alumnus_imports' - end - - protected - - def parse - csv.each do |row| - person = import_person row - next unless person - import_cohort row, person - organization = import_organization row - next unless organization - import_experience row, person, organization - end - end - - def import_person(row) - first_name = clean_encoding row['first_name'] - last_name = clean_encoding row['last_name'] - email = clean_encoding(row['mail']).to_s.downcase - return if first_name.blank? && last_name.blank? && email.blank? - url = clean_encoding row['url'] - if email.present? - person = university.people - .where(email: email) - .first_or_create - person.first_name = first_name - person.last_name = last_name - elsif first_name.present? && last_name.present? - person = university.people - .where(first_name: first_name, last_name: last_name) - .first_or_create - end - return if person.nil? - # TODO all fields - # gender - # birth - # address - # zipcode - # city - # country - person.is_alumnus = true - person.url = url - person.slug = person.to_s.parameterize.dasherize - person.twitter ||= row['social_twitter'] - person.linkedin ||= row['social_linkedin'] - person.biography ||= clean_encoding row['biography'] - person.phone ||= row['mobile'] - person.phone ||= row['phone_personal'] - person.phone ||= row['phone_professional'] - byebug unless person.valid? - person.save - add_picture person, row['photo'] - person - end - - def import_cohort(row, person) - program = program_with_id row['program'] - return if program.nil? - academic_year = university.academic_years - .where(year: row['year']) - .first_or_create - cohort = university.education_cohorts - .where(program: program, academic_year: academic_year) - .first_or_create - person.add_to_cohort cohort - end - - def import_organization(row) - name = clean_encoding row['company_name'] - siren = clean_encoding row['company_siren'] - nic = clean_encoding row['company_nic'] - return if name.blank? - if !siren.blank? && !nic.blank? - organization = university.organizations - .find_by siren: siren, - nic: nic - elsif !siren.blank? - organization ||= university.organizations - .find_by siren: siren - end - organization ||= university.organizations - .find_by name: name - organization ||= university.organizations - .where( name: name, - siren: siren, - nic: nic) - .first_or_create - organization - end - - def import_experience(row, person, organization) - job = row['experience_job'] - from = row['experience_from'] - to = row['experience_to'] - experience = person.experiences - .where(university: university, - organization: organization, - from_year: from) - .first_or_create - experience.description = job - experience.to_year = to - experience.save - experience - end - - def add_picture(person, photo) - return if photo.nil? - return if person.picture.attached? - return unless photo.end_with?('.jpg') || photo.end_with?('.png') - begin - file = URI.open photo - filename = File.basename photo - person.picture.attach(io: file, filename: filename) - rescue - end - end - - def program_with_id(id) - if Rails.env.development? - # substitute local data for testing - substitutes = { - # Arnaud - 'c6b78fac-0a5f-4c44-ad22-4ee68ed382bb' => '23279cab-8bc1-4c75-bcd8-1fccaa03ad55', # DUT MMI - 'ae3e067a-63b4-4c3f-ba9c-468ade0e4182' => '863b8c9c-1ed1-4af7-b92c-7264dfb6b4da', # MASTER IJBA - 'f4d4a92f-8b8f-4778-a127-9293684666be' => '8dfaee2a-c876-4b1c-8e4e-8380d720c71f', # DU_BILINGUE - '6df53074-195c-4299-8b49-bbc9d7cad41a' => 'be3cb0b2-7f66-4c5f-b8d7-6a39a0480c46', # DU_JRI - '0d81d3a2-a12c-4326-a395-fd0df4a3ea4f' => '56a50383-3ef7-43f6-8e98-daf279e86802' # DUT_JOURNALISME - # Alex - # 'c6b78fac-0a5f-4c44-ad22-4ee68ed382bb' => '02e6f703-d15b-4841-ac95-3c47d88e21b5', # DUT MMI - # 'ae3e067a-63b4-4c3f-ba9c-468ade0e4182' => '8fdfafb7-11fd-456c-9f47-7fd76dddb373', # MASTER IJBA - # 'f4d4a92f-8b8f-4778-a127-9293684666be' => 'fab9b86c-8872-4df5-9a97-0e30b104a837', # DU_BILINGUE - # '6df53074-195c-4299-8b49-bbc9d7cad41a' => 'cb1a26b9-fe5c-4ad1-9715-71cec4642910', # DU_JRI - # '0d81d3a2-a12c-4326-a395-fd0df4a3ea4f' => '91c44fd2-f0a4-4189-a3f5-311322b7b472' # DUT_JOURNALISME - # Sebou - # 'c6b78fac-0a5f-4c44-ad22-4ee68ed382bb' => 'ea5d32be-b86a-4257-984a-4d84717dd1d6', # DUT MMI - # 'ae3e067a-63b4-4c3f-ba9c-468ade0e4182' => '701c3a4f-3585-4152-b866-da17f4e80e77', # MASTER IJBA - # 'f4d4a92f-8b8f-4778-a127-9293684666be' => '0c05b690-ebd1-4efa-862c-81ea0978fb0b', # DU_BILINGUE - # '6df53074-195c-4299-8b49-bbc9d7cad41a' => '4ded6dfa-2fab-4e77-b58d-0d97344a04d1', # DU_JRI - # '0d81d3a2-a12c-4326-a395-fd0df4a3ea4f' => '4edac5cd-6564-4e47-a18c-960d3e5de54e' # DUT_JOURNALISME - } - id = substitutes[id] if substitutes.has_key? id - end - university.education_programs.find_by(id: id) - end - - def clean_encoding(value) - return if value.nil? - if value.encoding != 'UTF-8' - value = value.force_encoding 'UTF-8' - end - value.strip - end -end diff --git a/app/models/university/with_people_and_organizations.rb b/app/models/university/with_people_and_organizations.rb index d543dcbc338c7725159976683c8fc4982b7bfbea..ac0d78e4c340b3f0f7e7b083e5a38e4aee2445ee 100644 --- a/app/models/university/with_people_and_organizations.rb +++ b/app/models/university/with_people_and_organizations.rb @@ -11,6 +11,6 @@ module University::WithPeopleAndOrganizations class_name: 'University::Organization', dependent: :destroy alias_attribute :organizations, :university_organizations - end + end diff --git a/app/services/filters/admin/university/alumni/imports.rb b/app/services/filters/admin/university/alumni/imports.rb new file mode 100644 index 0000000000000000000000000000000000000000..89a24e691125873a992eda0f29314108a006b676 --- /dev/null +++ b/app/services/filters/admin/university/alumni/imports.rb @@ -0,0 +1,13 @@ +module Filters + class Admin::University::Alumni::Imports < Filters::Base + def initialize(user) + super + add :for_status, + ::Import::statuses.keys.map { |r| { to_s: I18n.t("enums.import.status.#{r}"), id: r } }, + I18n.t( + 'filters.attributes.element', + element: Import.human_attribute_name('status').downcase + ) + end + end +end diff --git a/app/services/importers/alumni.rb b/app/services/importers/alumni.rb new file mode 100644 index 0000000000000000000000000000000000000000..e483c69c63f34fb10ecb6ba1983a1946e643057d --- /dev/null +++ b/app/services/importers/alumni.rb @@ -0,0 +1,134 @@ +module Importers + class Alumni < Base + + protected + + def analyze_hash(hash, index) + hash_to_alumnus = HashToAlumnus.new(@university, hash) + add_error(hash_to_alumnus.error, index + 1) unless hash_to_alumnus.valid? + end + + end + + class HashToAlumnus + def initialize(university, hash) + @university = university + @hash = hash + @error = nil + extract_variables + if valid? + person.save + # manage picture + end + end + + def valid? + if country_not_found? + @error = "Country #{@country} not found" + elsif !person.valid? + @error = "Unable to create the person: #{person.errors.full_messages}" + end + @error.nil? + end + + def error + @error + end + + def organization_name + @organization_name ||= @hash[0].to_s.strip + end + + def program + @program ||= @hash[0].to_s.strip + end + + protected + + def extract_variables + @program_id = @hash[0].to_s.strip + @year = @hash[1].to_s.strip + @first_name = @hash[2].to_s.strip + @last_name = @hash[3].to_s.strip + @gender = @hash[4].to_s.strip + @birth = @hash[5].to_s.strip + @email = @hash[6].to_s.strip + @photo = @hash[7].to_s.strip + @url = @hash[8].to_s.strip + @phone_professional = @hash[9].to_s.strip + @phone_personal = @hash[10].to_s.strip + @mobile = @hash[11].to_s.strip + @address = @hash[12].to_s.strip + @zipcode = @hash[13].to_s.strip + @city = @hash[14].to_s.strip + @country = @hash[15].to_s.strip + @biography = @hash[16].to_s.strip + @social_twitter = @hash[17].to_s.strip + @social_linkedin = @hash[18].to_s.strip + @company_name = @hash[19].to_s.strip + @company_siren = @hash[20].to_s.strip + @company_nic = @hash[21].to_s.strip + @experience_job = @hash[22].to_s.strip + @experience_from = @hash[23].to_s.strip + @experience_to = @hash[24].to_s.strip + end + + def country_not_found? + ISO3166::Country[@country].nil? + end + + def person + # TODO: add missing properties + @person ||= begin + if @email.present? + person = university.people + .where(email: @email) + .first_or_initialize + elsif @first_name.present? && @last_name.present? + person = university.people + .where(first_name: @first_name, last_name: @last_name) + .first_or_initialize + end + person.first_name = @first_name + person.last_name = @last_name + # person.gender = @gender + # person.birth = @birth + person.email = @mail + person.url = @url + # person.phone_professional = @phone_professional + # person.phone_personal = @phone_personal + person.phone = @mobile + # person.address = @address + # person.zipcode = @zipcode + # person.city = @city + # person.country = @country + person.biography = @biography + person.twitter = @social_twitter + person.linkedin = @social_linkedin + person.is_alumnus = true + person.slug = person.to_s.parameterize.dasherize + person + end + end + + def organization + unless @organization + @organization = University::Organization.where(university_id: @university.id, name: organization_name).first_or_initialize + @organization.long_name = @long_name + @organization.kind = @kind.to_sym + @organization.siren = @siren + @organization.nic = @nic + @organization.description = @description + @organization.address = @address + @organization.zipcode = @zipcode + @organization.city = @city + @organization.country = @country + @organization.email = @email + @organization.phone = @phone + @organization.url = @url + end + @organization + end + + end +end diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb index 209a0b71b7bf1cfa67961af5288c54097be6b24d..7928bd7b92afbb70081cdf7cc137fb1e4ccc622d 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb @@ -57,43 +57,56 @@ placeholder="<%= t '.image_credit_placeholder' %>" /> </div> </div> -<h2><%= t '.buttons' %></h2> -<div class="row"> - <div class="col-xxl-4 col-md-6 mb-4"> - <h3 class="h4"><%= t '.button_1' %></h3> - +<h3 class="h4"><%= t '.button_1' %></h3> +<div class="row mb-5"> + <div class="col-lg-3"> <label class="form-label" for="button"> <%= t '.button_label' %> </label> <input id="button" type="text" - class="form-control" + class="form-control mb-3" v-model="data.button" placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" for="url"> + </div> + <div class="col-lg-5"> + <label class="form-label" for="url"> <%= t '.url_label' %> </label> - <input id="url" + <input id="url" type="url" class="form-control" v-model="data.url" placeholder="<%= t '.url_placeholder' %>" /> - </div> - <div class="col-xxl-4 col-md-6 mb-4"> - <h3 class="h4"><%= t '.button_2' %></h3> + <div class="col-lg-4"> + <label class="form-label"> </label> + <div class="form-check"> + <input id="target_blank" + type="checkbox" + class="form-check-input boolean optional" + v-model="data.target_blank"> + <label class="form-label" for="target_blank"> + <%= t 'admin.communication.blocks.components.link.target_blank' %> + </label> + </div> + </div> +</div> +<h3 class="h4"><%= t '.button_2' %></h3> +<div class="row mb-5"> + <div class="col-lg-3"> <label class="form-label" for="button_secondary"> <%= t '.button_label' %> </label> <input id="button_secondary" type="text" - class="form-control" + class="form-control mb-3" v-model="data.button_secondary" placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" for="url_secondary"> + </div> + <div class="col-lg-5"> + <label class="form-label" for="url_secondary"> <%= t '.url_label' %> </label> <input id="url_secondary" @@ -102,19 +115,35 @@ v-model="data.url_secondary" placeholder="<%= t '.url_placeholder' %>" /> </div> - <div class="col-xxl-4 col-md-6 mb-4"> - <h3 class="h4"><%= t '.button_3' %></h3> + <div class="col-lg-4"> + <label class="form-label"> </label> + <div class="form-check"> + <input id="target_blank_secondary" + type="checkbox" + class="form-check-input boolean optional" + v-model="data.target_blank_secondary"> + <label class="form-label" for="target_blank_secondary"> + <%= t 'admin.communication.blocks.components.link.target_blank' %> + </label> + </div> + </div> +</div> + +<h3 class="h4"><%= t '.button_3' %></h3> +<div class="row mb-5"> + <div class="col-lg-3"> <label class="form-label" for="button_tertiary"> <%= t '.button_label' %> </label> <input id="button_tertiary" type="text" - class="form-control" + class="form-control mb-3" v-model="data.button_tertiary" placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" for="url_tertiary"> + </div> + <div class="col-lg-5"> + <label class="form-label" for="url_tertiary"> <%= t '.url_label' %> </label> <input id="url_tertiary" @@ -123,4 +152,16 @@ v-model="data.url_tertiary" placeholder="<%= t '.url_placeholder' %>" /> </div> + <div class="col-lg-4"> + <label class="form-label"> </label> + <div class="form-check"> + <input id="target_blank_tertiary" + type="checkbox" + class="form-check-input boolean optional" + v-model="data.target_blank_tertiary"> + <label class="form-label" for="target_blank_tertiary"> + <%= t 'admin.communication.blocks.components.link.target_blank' %> + </label> + </div> + </div> </div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb index c2c514ca009cbb50c034c1ecaddcd88584190d0d..cbc779dcec1065b5351677e4eedcca6cebee80f3 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb @@ -12,13 +12,16 @@ <%= prepare_text_for_static block.template.button, 5 %> url: >- <%= prepare_text_for_static block.template.url, 5 %> + target_blank: <%= block.template.target_blank %> button_secondary: text: >- <%= prepare_text_for_static block.template.button_secondary, 5 %> url: >- <%= prepare_text_for_static block.template.url_secondary, 5 %> + target_blank: <%= block.template.target_blank_secondary %> button_tertiary: text: >- <%= prepare_text_for_static block.template.button_tertiary, 5 %> url: >- <%= prepare_text_for_static block.template.url_tertiary, 5 %> + target_blank: <%= block.template.target_blank_tertiary %> diff --git a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb index 2e9fe6ef48799468c63c32716f109e4308167c70..bb6af5961b2d91a57fef9acbd682778658df6b7c 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -2,28 +2,83 @@ <div class="row mb-4"> <div class="col-md-6"> - <h2 class="h3">Type de liste</h2> - <div class="form-check form-check-inline mb-3"> - <input class="form-check-input" - type="radio" - name="kind" - v-model="data.kind" - value="children" - id="kind-children"> - <label class="form-check-label" for="kind-children"> - La page principale et ses enfants - </label> + <div class="mb-4"> + <h2 class="h3">Type de liste</h2> + <div class="form-check form-check-inline mb-3"> + <input class="form-check-input" + type="radio" + name="kind" + v-model="data.kind" + value="children" + id="kind-children"> + <label class="form-check-label" for="kind-children"> + La page principale et ses enfants + </label> + </div> + <div class="form-check form-check-inline"> + <input class="form-check-input" + type="radio" + name="kind" + v-model="data.kind" + value="selection" + id="kind-selection"> + <label class="form-check-label" for="kind-selection"> + Une sélection spécifique de pages + </label> + </div> </div> - <div class="form-check form-check-inline"> - <input class="form-check-input" - type="radio" - name="kind" - v-model="data.kind" - value="selection" - id="kind-selection"> - <label class="form-check-label" for="kind-selection"> - Une sélection spécifique de pages - </label> + + <div class="mb-4"> + <h2 class="h3">Page principale</h2> + <label class="form-label" + for="page_id">Sélectionnez une page principale</label> + <select id="page_id" + class="form-select select" + v-model="data.page_id"> + <option value="">Aucune page sélectionnée</option> + <% pages.each_with_index do |page, index| %> + <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> + <% end %> + </select> + <div class="form-text">Cette page principale définira le titre et le lien du bloc. Si vous choisissez une page sans remplir le titre ci-dessus, le titre de la page sera utilisé. Si le titre est rempli, il remplacera le titre de la page sélectionnée, en utilisant le lien de la page.</div> + </div> + + <div class="mb-4" v-if="data.kind == 'selection'"> + <h2 class="h3">Pages sélectionnées</h2> + <a class="<%= button_classes('mb-3') %>" + v-on:click="data.elements.push({id: ''})"> + <%= t '.add_page' %> + </a> + <draggable :list="data.elements" handle=".dragHandle" class="list-group"> + <div v-for="(page, index) in data.elements" class="list-group-item"> + <div class="d-flex"> + <div> + <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <label class="form-label d-none" + :for="'page-' + index + '-name'">Page</label> + <select :id="'page-' + index + '-name'" + class="form-select select" + v-model="page.id"> + <option value="" disabled>Aucune page</option> + <% pages.each_with_index do |page, index| %> + <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> + <% end %> + </select> + </div> + <div> + <a class="btn btn-sm btn-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" + title="Supprimer"> + <i class="fas fa-times"></i> + </a> + </div> + </div> + </div> + </draggable> </div> </div> <div class="col-md-6"> @@ -58,59 +113,57 @@ Afficher les images des pages </label> </div> - </div> -</div> + <hr> -<div class="row"> - <div class="col-md-6"> - <h2 class="h3">Page principale</h2> - <label class="form-label" - for="page_id">Sélectionnez une page principale</label> - <select id="page_id" - class="form-select select" - v-model="data.page_id"> - <option value="">Aucune page sélectionnée</option> - <% pages.each_with_index do |page, index| %> - <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> - <% end %> - </select> - <div class="form-text">Cette page principale définira le titre et le lien du bloc. Si vous choisissez une page sans remplir le titre ci-dessus, le titre de la page sera utilisé. Si le titre est rempli, il remplacera le titre de la page sélectionnée, en utilisant le lien de la page.</div> - </div> - <div class="col-md-6" v-if="data.kind == 'selection'"> - <h2 class="h3">Pages sélectionnées</h2> - <a class="<%= button_classes('mb-3') %>" - v-on:click="data.elements.push({id: ''})"> - <%= t '.add_page' %> - </a> - <draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(page, index) in data.elements" class="list-group-item"> - <div class="d-flex"> - <div> - <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <label class="form-label d-none" - :for="'page-' + index + '-name'">Page</label> - <select :id="'page-' + index + '-name'" - class="form-select select" - v-model="page.id"> - <option value="" disabled>Aucune page</option> - <% pages.each_with_index do |page, index| %> - <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> - <% end %> - </select> - </div> - <div> - <a class="btn btn-sm btn-danger ms-3" - v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" - title="Supprimer"> - <i class="fas fa-times"></i> - </a> - </div> + <div class="row"> + <div class="col-md-4"> + <div class="form-check form-check-inline mb-3"> + <input class="form-check-input" + type="radio" + name="layout" + v-model="data.layout" + value="grid" + id="layout-grid"> + <label class="form-check-label" for="layout-grid"> + Grille + <%= image_tag 'communication/blocks/templates/pages/grid.png', + alt: 'Grille', + class: 'img-fluid' %> + </label> </div> </div> - </draggable> + <div class="col-md-4"> + <div class="form-check form-check-inline"> + <input class="form-check-input" + type="radio" + name="layout" + v-model="data.layout" + value="list" + id="layout-list"> + <label class="form-check-label" for="layout-list"> + Liste + <%= image_tag 'communication/blocks/templates/pages/list.png', + alt: 'Liste', + class: 'img-fluid' %> + </label> + </div> + </div> + <div class="col-md-4"> + <div class="form-check form-check-inline"> + <input class="form-check-input" + type="radio" + name="layout" + v-model="data.layout" + value="cards" + id="layout-cards"> + <label class="form-check-label" for="layout-cards"> + Cartes + <%= image_tag 'communication/blocks/templates/pages/cards.png', + alt: 'Grille', + class: 'img-fluid' %> + </label> + </div> + </div> + </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/pages/_static.html.erb b/app/views/admin/communication/blocks/templates/pages/_static.html.erb index d6fe87c3325603d33639cdea8da7341917770bf1..a56323f243b547239cd14a2caf03810da76320fc 100644 --- a/app/views/admin/communication/blocks/templates/pages/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_static.html.erb @@ -4,6 +4,7 @@ show_main_description: <%= block.template.show_main_description %> show_descriptions: <%= block.template.show_description %> show_images: <%= block.template.show_image %> + layout: <%= block.template.layout %> pages: <% block.template.selected_pages.each do |element| %> - page: <%= element.generated_path %> diff --git a/app/views/admin/university/alumni/imports/index.html.erb b/app/views/admin/university/alumni/imports/index.html.erb index e48aa45f47054e8801ebd5f80b4619903487e9c9..1003d9497790d97ec652901df072f0190068dced 100644 --- a/app/views/admin/university/alumni/imports/index.html.erb +++ b/app/views/admin/university/alumni/imports/index.html.erb @@ -1,22 +1,11 @@ -<% content_for :title, University::Person::Alumnus::Import.model_name.human(count: 2) %> +<% content_for :title, Import.model_name.human(count: 2) %> -<table class="<%= table_classes %>"> - <thead> - <tr> - <th><%= University::Person::Alumnus::Import.human_attribute_name('name') %></th> - </tr> - </thead> - <tbody> - <% @imports.each do |import| %> - <tr> - <td><%= link_to import, admin_university_alumni_import_path(import) %></td> - </tr> - <% end %> - </tbody> -</table> +<%= render 'filters', current_path: admin_university_alumni_imports_path, filters: @filters if @filters.any? %> + +<%= render 'admin/imports/list', imports: @imports, path_pattern: 'admin_university_alumni_import_path' %> <% content_for :action_bar_right do %> - <%= link_to_if can?(:create, University::Person::Alumnus::Import), + <%= link_to_if can?(:create, University::Person::Alumnus), t('create'), new_admin_university_alumni_import_path, class: button_classes %> diff --git a/app/views/admin/university/alumni/imports/new.html.erb b/app/views/admin/university/alumni/imports/new.html.erb index 84e9abb84c5048841d2a70a1f553647f45a12ad0..6a5cafff2b1df5d0fe9245be208c00ff0712bd99 100644 --- a/app/views/admin/university/alumni/imports/new.html.erb +++ b/app/views/admin/university/alumni/imports/new.html.erb @@ -1,21 +1,23 @@ -<% content_for :title, University::Organization::Import.model_name.human %> +<% content_for :title, Import.model_name.human %> <div class="row"> <div class="col-md-6"> <p> - Les données doivent être au format csv, comme l'exemple suivant.<br> - La première ligne doit être dédiée aux entêtes.<br> - Les noms des entêtes sont obligatoires et doivent être respectés strictement.<br> - Les champs marqués d'une astérisque sont obligatoires.<br> - Les caractères doivent être encodés en UTF-8.<br> - Les valeurs pour gender peuvent être m (masculin), f (féminin) et n (non binaire). + <%= t('imports.hint_html') %> + <br> + <%= t('university.alumni.import_hint_html') %> </p> <%= simple_form_for @import, url: admin_university_alumni_imports_path do |f| %> + <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> + <%# as file can be empty the global object can be unset. To prevent crash in controller add an (unused) hidden field %> + <%= f.input :id, as: :hidden %> + <%= f.input :file %> + <% content_for :action_bar_right do %> <%= submit f %> <% end %> diff --git a/app/views/admin/university/alumni/imports/show.html.erb b/app/views/admin/university/alumni/imports/show.html.erb deleted file mode 100644 index d3fec028c9c4e6dd9403ec227b056fc50b0f49ab..0000000000000000000000000000000000000000 --- a/app/views/admin/university/alumni/imports/show.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% content_for :title, @import %> - -<p><%= @import.lines %> lines</p> - -<%= link_to "#{@import.file.filename} (#{number_to_human_size @import.file.byte_size})", - url_for(@import.file), - class: button_classes %> diff --git a/app/views/admin/university/organizations/imports/new.html.erb b/app/views/admin/university/organizations/imports/new.html.erb index 2ff9088b483cbbc2ed49e9c66cf708b97411d30f..805435dcde20d0cc4966bc435927ca1def9b27e6 100644 --- a/app/views/admin/university/organizations/imports/new.html.erb +++ b/app/views/admin/university/organizations/imports/new.html.erb @@ -5,15 +5,17 @@ <p> <%= t('imports.hint_html') %> <br> - <%= t('university.import_hint_html') %> + <%= t('university.organization.import_hint_html') %> </p> <%= simple_form_for @import, url: admin_university_organizations_imports_path do |f| %> - <%# as file can be empty the global object can be unset. To prevent crash in controller add an (unused) hidden field %> - <%= f.input :id, as: :hidden %> + <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> + <%# as file can be empty the global object can be unset. To prevent crash in controller add an (unused) hidden field %> + <%= f.input :id, as: :hidden %> + <%= f.input :file %> <% content_for :action_bar_right do %> diff --git a/app/views/mailers/notifications/import.html.erb b/app/views/mailers/notifications/import.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1fef88cdf8ebdf31ac35cf56c6181f3eb80df873 --- /dev/null +++ b/app/views/mailers/notifications/import.html.erb @@ -0,0 +1,15 @@ +<p><%= t('mailers.notifications.import.text_line_1_html') %></p> +<p><%= t('mailers.notifications.import.text_line_2_html', url: @url) %></p> +<p><%= t('mailers.notifications.import.text_line_3_html', number: @import.number_of_lines) %></p> +<% if @import.finished_with_errors? %> + <p> + <%= t('mailers.notifications.import.text_errors_title') %> + <br/> + <ul> + <% @import.processing_errors.each do |obj| %> + <li><%= t('mailers.notifications.import.text_error_msg', line: obj['line'], error: obj['error']) %></li> + <% end %> + </ul> + </p> +<% end %> +<p><%= t('mailers.yours') %></p> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index ff37343833bfc9a1a5205221dee0c99744d7e481..cd6b7dba1818fa50c32c0aee7086652725a5f7bf 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -138,12 +138,15 @@ en: label: Credit placeholder: Enter credit file: - not_linked: Pas de fichier lié + not_linked: No linked file + link: + target_blank: Open in new window template_kinds: call_to_action: edit: button_1: Primary button button_2: Secondary button + button_3: Tertiary button button_label: Text button_placeholder: Enter the button text here buttons: Action buttons diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 61518c6a4da67b012d4333cf5140740d37508cd3..838825281a4c80cbd5ae665e2b8a039cb4846064 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -139,12 +139,15 @@ fr: placeholder: Entrer le crédit file: not_linked: Pas de fichier lié + link: + target_blank: Ouvrir dans une nouvelle fenêtre templates: call_to_action: edit: button_1: Bouton principal button_2: Bouton secondaire + button_3: Bouton tertiaire button_label: Texte button_placeholder: Entrer le texte du bouton ici buttons: Boutons d'action diff --git a/config/locales/en.yml b/config/locales/en.yml index ae85766c00f31affb07c56859f306619ba527e4a..89f02117d620a10ed598b5b91bd2eee71609c4d3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -150,7 +150,7 @@ en: import: error_msg: "Line %{line}: %{error}" errors: Errors - hint_html: "File must be an .xlsx excel file.<br>The first line must contain the headers.<br>The hearders are mandatory and must be strictly respected.<br>All characters must be encoded as UTF-8." + hint_html: "File must be an .xlsx excel file.<br>The first line must contain the headers.<br>The hearders are mandatory and must be strictly respected.<br>All characters must be encoded as UTF-8.<br>Fields marked with an asterisk are mandatory." initiated_by: "Initiated by:" number_of_lines: "Number of lines in the file:" status: "Status:" @@ -169,6 +169,17 @@ en: sign_in_with_credentials: Sign in with credentials sign_in_with_sso: Sign in through SSO subtitle: Sign in to your account to continue + mailers: + notifications: + import: + subject_with_errors: Your import has been processed with errors + subject_without_errors: Your import has been processed + text_line_1_html: Your import has been processed. + text_line_2_html: "You can check the result by clicking <a href=\"%{url}\">here</a>." + text_line_3_html: "Number of lines in the file: %{number}." + text_error_msg: "Line %{line}: %{error}" + text_errors_title: "Some errors have occured:" + yours: Yours. menu: admin: Admin profile: Profile diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e034e354a2545a95656cc836e24e4c14fc2acb15..b4894dbc4aa5c49196bb192a9d7d2d70bdf4823c 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -150,7 +150,7 @@ fr: imports: error_msg: "Ligne %{line} : %{error}" errors: Erreurs - hint_html: "Les données doivent être au format xlsx.<br>La première ligne doit être dédiée aux entêtes.<br>Les noms des entêtes sont obligatoires et doivent être respectés strictement.<br>Les caractères doivent être encodés en UTF-8." + hint_html: "Les données doivent être au format xlsx.<br>La première ligne doit être dédiée aux entêtes.<br>Les noms des entêtes sont obligatoires et doivent être respectés strictement.<br>Les caractères doivent être encodés en UTF-8.<br>Les champs marqués d'une astérisque sont obligatoires." initiated_by: "Initié par :" number_of_lines: "Nombre de lignes dans le fichier :" status: "Status :" @@ -169,6 +169,17 @@ fr: sign_in_with_credentials: Se connecter avec ses identifiants sign_in_with_sso: Se connecter en SSO subtitle: Vous devez être authentifié pour continuer + mailers: + notifications: + import: + subject_with_errors: Votre import a bien été traité mais comporte des erreurs + subject_without_errors: Votre import a bien été traité + text_line_1_html: Votre import a bien été traité. + text_line_2_html: "Vous pouvez voir le détail de l'import en cliquant <a href=\"%{url}\">ici</a>." + text_line_3_html: "Nombre de lignes traitées : %{number}." + text_error_msg: "Ligne %{line} : %{error}" + text_errors_title: "Des erreurs sont survenues :" + yours: Cordialement. menu: admin: Admin profile: Profil diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index be8382d7db62dc7c1bd40fcc6c98ccfb31febcfc..32a353dbc188c25ecf76c8475cd6113f1b0ddccb 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -137,12 +137,15 @@ en: non_profit: Association government: Government university: - import_hint_html: "Name field is mandatory.<br>Possible values for kind are: company, non_profit, government.<br>Siren, nic, zipcode and phone fields must have a text format, not numbers.<br>Country field must contain the ISO 3166 code of the country, so to upcase characters (<a href=\"https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes\" target=\_blank\">list</a>)" + alumni: + import_hint_html: "Possible values for gender are: m (male), f (female) and n (non binary).<br>Phone_professional, phone_personal, mobile and zipcode fields must have a text format, not numbers.<br>Country field must contain the ISO 3166 code of the country, so to upcase characters (<a href=\"https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes\" target=\_blank\">list</a>)<br>Social_twitter field should have no @." internal_key: Internal Key invoice_informations: Invoice informations manage_alumni: Manage alumni manage_cohorts: Manage cohorts manage_experiences: Manage experiences + organisation: + import_hint_html: "Possible values for kind are: company, non_profit, government.<br>Siren, nic, zipcode and phone fields must have a text format, not numbers.<br>Country field must contain the ISO 3166 code of the country, so to upcase characters (<a href=\"https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes\" target=\_blank\">list</a>)" person: administrator_roles: Administrator roles experience: diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 38e9bf9f645b76d007cc7d4d072eca243b83aaf9..17bda962d850482b513d839a5660ff723cc01f9b 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -137,12 +137,15 @@ fr: non_profit: Association government: Structure gouvernementale university: - import_hint_html: "Le champ name est obligatoire.<br>Les valeurs possibles pour kind sont : company, non_profit, government.<br>Les champs siren, nic, zipcode et phone doivent être au format texte, pas nombre.<br>Le champ pays doit contenir le code ISO 3166 du pays, sur 2 caratères en majuscule (<a href=\"https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes\" target=\_blank\">liste</a>)" + alumni: + import_hint_html: "Les valeurs pour gender peuvent être m (masculin), f (féminin) et n (non binaire).<br>Les champs phone_professional, phone_personal, mobile et zipcode doivent être au format texte, pas nombre.<br>Le champ pays doit contenir le code ISO 3166 du pays, sur 2 caratères en majuscule (<a href=\"https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes\" target=\_blank\">liste</a>)<br>Le champ social_twitter ne doit pas contenir d'@." internal_key: Clé interne invoice_informations: Données de facturation manage_alumni: Gérer les alumni manage_cohorts: Gérer les promotions manage_experiences: Gérer les expériences professionnelles + organization: + import_hint_html: "Les valeurs possibles pour kind sont : company, non_profit, government.<br>Les champs siren, nic, zipcode et phone doivent être au format texte, pas nombre.<br>Le champ pays doit contenir le code ISO 3166 du pays, sur 2 caratères en majuscule (<a href=\"https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes\" target=\_blank\">liste</a>)" person: administrator_roles: Rôles administratifs experience: diff --git a/db/migrate/20220523172753_remove_unused_imports_tables.rb b/db/migrate/20220523172753_remove_unused_imports_tables.rb new file mode 100644 index 0000000000000000000000000000000000000000..2682a07ca11339962a63c6ccc1b1f5c9925dc439 --- /dev/null +++ b/db/migrate/20220523172753_remove_unused_imports_tables.rb @@ -0,0 +1,6 @@ +class RemoveUnusedImportsTables < ActiveRecord::Migration[6.1] + def change + drop_table :university_organization_imports + drop_table :university_person_alumnus_imports + end +end diff --git a/db/schema.rb b/db/schema.rb index a60ad030a0537dc12d5ecd9fdb13471e1ced5bc5..c610b826c5264de7942abc49c59bd96df5ce1118 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_05_23_102030) do +ActiveRecord::Schema.define(version: 2022_05_23_172753) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -502,6 +502,23 @@ ActiveRecord::Schema.define(version: 2022_05_23_102030) 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 "imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "number_of_lines" t.jsonb "processing_errors" @@ -651,15 +668,6 @@ ActiveRecord::Schema.define(version: 2022_05_23_102030) do t.jsonb "sso_mapping" end - create_table "university_organization_imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.uuid "university_id", null: false - t.uuid "user_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["university_id"], name: "index_university_organization_imports_on_university_id" - t.index ["user_id"], name: "index_university_organization_imports_on_user_id" - end - create_table "university_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" @@ -705,21 +713,12 @@ ActiveRecord::Schema.define(version: 2022_05_23_102030) do t.string "linkedin" t.boolean "is_alumnus", default: false t.text "description_short" - t.boolean "is_author" t.string "name" + t.boolean "is_author" t.index ["university_id"], name: "index_university_people_on_university_id" t.index ["user_id"], name: "index_university_people_on_user_id" end - create_table "university_person_alumnus_imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.uuid "university_id", null: false - t.uuid "user_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["university_id"], name: "index_university_person_alumnus_imports_on_university_id" - t.index ["user_id"], name: "index_university_person_alumnus_imports_on_user_id" - end - create_table "university_person_experiences", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false @@ -872,13 +871,9 @@ ActiveRecord::Schema.define(version: 2022_05_23_102030) do add_foreign_key "research_theses", "universities" add_foreign_key "research_theses", "university_people", column: "author_id" add_foreign_key "research_theses", "university_people", column: "director_id" - add_foreign_key "university_organization_imports", "universities" - add_foreign_key "university_organization_imports", "users" add_foreign_key "university_organizations", "universities" add_foreign_key "university_people", "universities" add_foreign_key "university_people", "users" - add_foreign_key "university_person_alumnus_imports", "universities" - add_foreign_key "university_person_alumnus_imports", "users" add_foreign_key "university_person_experiences", "universities" add_foreign_key "university_person_experiences", "university_organizations", column: "organization_id" add_foreign_key "university_person_experiences", "university_people", column: "person_id"