Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recherche dans l'admin #2195

Open
wants to merge 489 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
489 commits
Select commit Hold shift + click to select a range
681d6a9
extract layouts
arnaudlevy Sep 6, 2024
0903043
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 6, 2024
1b813a8
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 6, 2024
c167bf6
blocks
arnaudlevy Sep 6, 2024
10a8243
fix
SebouChu Sep 9, 2024
a2369c8
trim, lower and unaccent
SebouChu Sep 9, 2024
c34ab2d
schema :)
SebouChu Sep 9, 2024
8b35d94
fix
SebouChu Sep 9, 2024
588f494
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 10, 2024
75b2233
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 10, 2024
c0b94d6
mapping
arnaudlevy Sep 10, 2024
0343742
comment
arnaudlevy Sep 10, 2024
875996f
Update app/views/admin/communication/websites/show.html.erb
arnaudlevy Sep 10, 2024
fba3a4d
fix
arnaudlevy Sep 10, 2024
9258d9b
Merge branch 'i18n-research' of github.com:osunyorg/admin into i18n-r…
arnaudlevy Sep 10, 2024
50aec03
Update app/controllers/admin/research/laboratories_controller.rb
arnaudlevy Sep 10, 2024
de324b5
fix
arnaudlevy Sep 10, 2024
33637c2
Merge branch 'i18n-research' of github.com:osunyorg/admin into i18n-r…
arnaudlevy Sep 10, 2024
c442215
paper authors
arnaudlevy Sep 10, 2024
9cb6b04
Update app/views/admin/research/journals/papers/_form.html.erb
arnaudlevy Sep 10, 2024
5e8b267
Update app/controllers/admin/research/researchers_controller.rb
arnaudlevy Sep 10, 2024
4513426
Update app/controllers/admin/research/researchers_controller.rb
arnaudlevy Sep 10, 2024
f6b6e7a
Update app/views/admin/communication/websites/show.html.erb
arnaudlevy Sep 10, 2024
708a3b9
Update app/views/admin/research/laboratories/show.html.erb
arnaudlevy Sep 10, 2024
ad24443
Update app/views/admin/research/laboratories/static.html.erb
arnaudlevy Sep 10, 2024
16359ef
Update app/views/admin/research/publications/_form.html.erb
arnaudlevy Sep 10, 2024
9a97c31
Update app/services/migrations/l10n/research/laboratory/axis.rb
arnaudlevy Sep 10, 2024
5c92d1d
Update app/services/migrations/l10n/research/laboratory/axis.rb
arnaudlevy Sep 10, 2024
52552d4
Update app/services/migrations/l10n/research/thesis.rb
arnaudlevy Sep 10, 2024
3db725c
fix
arnaudlevy Sep 10, 2024
2aa3902
fix
arnaudlevy Sep 10, 2024
f06c608
fix
arnaudlevy Sep 10, 2024
1983ab3
Update app/views/admin/research/theses/show.html.erb
arnaudlevy Sep 10, 2024
ded85fe
Update app/views/admin/research/theses/show.html.erb
arnaudlevy Sep 10, 2024
74693ca
Update app/views/admin/research/theses/show.html.erb
arnaudlevy Sep 10, 2024
8bbd312
Update app/views/admin/research/theses/_list.html.erb
arnaudlevy Sep 10, 2024
0a18323
Update app/views/admin/research/theses/_list.html.erb
arnaudlevy Sep 10, 2024
93e8b17
fix
arnaudlevy Sep 10, 2024
2426ec9
fix
arnaudlevy Sep 10, 2024
19afeb4
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 10, 2024
10c14c9
fix
arnaudlevy Sep 10, 2024
49774da
fix order
arnaudlevy Sep 11, 2024
714322c
programs
arnaudlevy Sep 11, 2024
aaf64d3
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 11, 2024
e83e9fa
Merge branch 'i18n_extranet' into better-programs
arnaudlevy Sep 11, 2024
cd7088b
fix
arnaudlevy Sep 11, 2024
2d7bcff
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 11, 2024
79f6e71
Merge branch 'i18n_extranet' into better-programs
arnaudlevy Sep 11, 2024
c3119de
wip
arnaudlevy Sep 11, 2024
4167fef
Merge branch 'better-programs' of github.com:osunyorg/admin into bett…
arnaudlevy Sep 11, 2024
8e9c3af
done
arnaudlevy Sep 11, 2024
c0b0bde
fix
arnaudlevy Sep 11, 2024
96dc488
Merge branch 'i18n_extranet' into better-programs
arnaudlevy Sep 11, 2024
605f624
fix
arnaudlevy Sep 11, 2024
b0e91ec
#2131
arnaudlevy Sep 11, 2024
6ebffb7
Localisation de la recherche (#2172)
arnaudlevy Sep 12, 2024
aea9c38
tests
arnaudlevy Sep 13, 2024
8831861
Localisation des extranets (#2175)
arnaudlevy Sep 13, 2024
7cb6c94
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
93bc9d2
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
7df9904
fix
arnaudlevy Sep 13, 2024
b982581
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
2af8c88
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
28d35c2
fix facets
pabois Sep 13, 2024
efb6d61
wip
arnaudlevy Sep 13, 2024
11c2849
fix
arnaudlevy Sep 13, 2024
3f5629e
fix
arnaudlevy Sep 13, 2024
80ccfa7
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
070b485
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
7c9c25a
wip ordered
pabois Sep 13, 2024
bf152b2
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 13, 2024
2890d23
harmonisation validates
pabois Sep 13, 2024
56448b9
last validators
pabois Sep 13, 2024
9cac094
fixes
pabois Sep 13, 2024
5289b03
adjust
pabois Sep 13, 2024
a02f404
wip
arnaudlevy Sep 13, 2024
7453721
fix
arnaudlevy Sep 13, 2024
6270de9
cool
arnaudlevy Sep 13, 2024
a6f9fc7
working
arnaudlevy Sep 13, 2024
09eaa58
new
arnaudlevy Sep 13, 2024
34841a6
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
a1a119b
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
ca1bfd0
clean
arnaudlevy Sep 13, 2024
9178b67
Merge branch 'blocks-offcanvas' of github.com:osunyorg/admin into blo…
arnaudlevy Sep 13, 2024
8510fe6
cleanup
arnaudlevy Sep 13, 2024
cd5bd9a
simplify
arnaudlevy Sep 14, 2024
daf1a99
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 16, 2024
8d13973
involvement scope
SebouChu Sep 16, 2024
74620a2
server fix
SebouChu Sep 16, 2024
06a9152
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 16, 2024
2106b6a
fix
SebouChu Sep 16, 2024
5c5e358
server fix
SebouChu Sep 16, 2024
74f3fd3
Documentation de l'API avec Swagger et rswag (#2157)
arnaudlevy Sep 10, 2024
fdec759
Fix margin
arnaudlevy Sep 11, 2024
abdb671
fix
SebouChu Sep 16, 2024
8adab54
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 16, 2024
e109bd3
fix server languages
SebouChu Sep 16, 2024
bdc9fae
fix to_s_in in server
SebouChu Sep 16, 2024
f5bc1be
Merge branch 'i18n_step_2' of github.com:osunyorg/admin into i18n_step_2
arnaudlevy Sep 16, 2024
1a7d6a7
fix research migration
SebouChu Sep 16, 2024
3e2b4b2
remove for_language_id
SebouChu Sep 16, 2024
c785c97
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 16, 2024
11cd7f3
fix
SebouChu Sep 16, 2024
4045469
Fix
arnaudlevy Sep 16, 2024
3a1802a
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 16, 2024
fc2e8e1
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 16, 2024
ba6166e
fix language
SebouChu Sep 16, 2024
4ca6a1e
fix exporters
SebouChu Sep 16, 2024
cc2ab42
fix sync
SebouChu Sep 16, 2024
ae85e14
biography text
SebouChu Sep 16, 2024
a8ad7db
bring back post legacy text
SebouChu Sep 16, 2024
d2fb669
localized tree
SebouChu Sep 16, 2024
8d935ca
refactored
arnaudlevy Sep 16, 2024
445308c
Merge branch 'blocks-offcanvas' of github.com:osunyorg/admin into blo…
arnaudlevy Sep 16, 2024
7a1e1bf
lighter
arnaudlevy Sep 16, 2024
e10fef1
fix dependencies in education + statics
SebouChu Sep 16, 2024
7235bde
school static
SebouChu Sep 16, 2024
d4ee771
annotate
SebouChu Sep 16, 2024
5b392ff
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 16, 2024
3b79c9a
fix
SebouChu Sep 16, 2024
4d88837
init
arnaudlevy Sep 17, 2024
cf50a30
fix
arnaudlevy Sep 17, 2024
308fd7a
setup
arnaudlevy Sep 17, 2024
5ffb442
wip
arnaudlevy Sep 17, 2024
1005514
orgs
arnaudlevy Sep 17, 2024
a66ac56
fix show
arnaudlevy Sep 17, 2024
f6282a2
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 17, 2024
7007a92
Merge branch 'i18n_step_2' into i18n_step_3
arnaudlevy Sep 17, 2024
6f703db
Merge branch 'i18n_step_3' into admin-search
arnaudlevy Sep 17, 2024
2f93a15
wip
arnaudlevy Sep 17, 2024
89d5dcc
working
arnaudlevy Sep 17, 2024
bfce854
title
arnaudlevy Sep 18, 2024
4b35139
à tester !
arnaudlevy Sep 18, 2024
0037e46
fix
arnaudlevy Sep 18, 2024
b471af6
fix
arnaudlevy Sep 18, 2024
754bc78
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 19, 2024
8ec708b
Merge branch 'main' into i18n_step_2
SebouChu Sep 19, 2024
b94bd7f
Fix #2203
arnaudlevy Sep 19, 2024
38e81c5
bundle
arnaudlevy Sep 21, 2024
aa380fb
Merge branch 'i18n_step_2' into better-programs
SebouChu Sep 23, 2024
0947118
I18n filters (#2206)
pabois Sep 23, 2024
fe30d84
Menu pour chaque formation (#2186)
arnaudlevy Sep 23, 2024
2c1a491
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 23, 2024
435bf11
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 23, 2024
c8dfdfc
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 23, 2024
56e3b0e
i18n: importers (#2207)
SebouChu Sep 23, 2024
68af75a
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 23, 2024
f3bde99
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 23, 2024
ed463b5
fix
pabois Sep 23, 2024
3ea30ff
clean
SebouChu Sep 23, 2024
87b99a3
adjust extranets
pabois Sep 23, 2024
0a64330
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 23, 2024
ca10dc5
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 23, 2024
6f31295
Update app/controllers/admin/education/programs/categories_controller.rb
arnaudlevy Sep 23, 2024
5de9917
Update app/models/communication/website/page/localization.rb
SebouChu Sep 23, 2024
ae97067
Update app/views/admin/education/programs/categories/show.html.erb
arnaudlevy Sep 23, 2024
5e3ae8a
clean
SebouChu Sep 23, 2024
63d202b
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 23, 2024
3d4c064
about.about => l10n.about
SebouChu Sep 23, 2024
8d79984
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
d68b1ee
Merge branch 'main' into better-programs
arnaudlevy Sep 30, 2024
3ecd104
bundle
arnaudlevy Sep 30, 2024
677619c
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
228bbe7
clean
arnaudlevy Sep 30, 2024
6d6b32b
fixes
SebouChu Sep 30, 2024
c43c119
bundle lock
SebouChu Sep 30, 2024
4e5da0e
Merge branch 'main' into better-programs
SebouChu Sep 30, 2024
38962e0
fix
SebouChu Sep 30, 2024
e6f450b
Merge branch 'blocks-offcanvas' into admin-search
arnaudlevy Sep 30, 2024
a490fb8
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
35ef372
bring back template changes
SebouChu Sep 30, 2024
1e08562
Merge branch 'main' into better-programs
SebouChu Sep 30, 2024
c4a0bac
Merge branch 'better-programs' into blocks-offcanvas
SebouChu Sep 30, 2024
5f33652
remove original_id from program categories
SebouChu Sep 30, 2024
0b237b7
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
8a65a0c
Merge branch 'blocks-offcanvas' into admin-search
arnaudlevy Sep 30, 2024
49bab65
Merge branch 'main' into blocks-offcanvas
SebouChu Sep 30, 2024
008a6d6
Merge branch 'main' into blocks-offcanvas
arnaudlevy Sep 30, 2024
89546ea
Update app/assets/javascripts/admin/commons/content_editor/offcanvas.js
SebouChu Sep 30, 2024
40cf29d
Update app/assets/javascripts/admin/commons/content_editor/offcanvas.js
SebouChu Sep 30, 2024
e100c65
i18n
arnaudlevy Sep 30, 2024
4f57b33
Merge branch 'main' into blocks-offcanvas
arnaudlevy Sep 30, 2024
c322597
Merge branch 'blocks-offcanvas' into admin-search
arnaudlevy Sep 30, 2024
5d467d2
Merge branch 'main' into admin-search
SebouChu Oct 3, 2024
e7e7b3e
Merge branch 'main' into admin-search
SebouChu Oct 4, 2024
3c566d6
Update app/models/research/journal/paper/localization.rb
SebouChu Oct 4, 2024
e05d797
Update app/models/communication/website/page/localization.rb
SebouChu Oct 4, 2024
a717df8
Update app/controllers/admin/search_controller.rb
SebouChu Oct 4, 2024
33e6ba8
Update app/models/research/journal/paper/localization.rb
SebouChu Oct 4, 2024
3d455da
Update app/models/university/person/localization.rb
SebouChu Oct 4, 2024
0140fc1
Update app/views/admin/application/components/_search.html.erb
SebouChu Oct 4, 2024
94e15a4
Update app/views/admin/search/index.html.erb
SebouChu Oct 4, 2024
c91803a
Update app/models/concerns/searchable.rb
SebouChu Oct 4, 2024
a8ac34d
Update app/models/concerns/searchable.rb
SebouChu Oct 4, 2024
28e8185
Update app/models/concerns/searchable.rb
SebouChu Oct 4, 2024
ca197d8
Update app/views/admin/search/index.html.erb
SebouChu Oct 4, 2024
088d541
Update app/views/admin/search/index.html.erb
SebouChu Oct 4, 2024
1837916
Update app/views/admin/search/index.html.erb
SebouChu Oct 4, 2024
f28fbe7
Update app/models/search.rb
SebouChu Oct 4, 2024
a4c1f76
Update app/controllers/admin/search_controller.rb
SebouChu Oct 4, 2024
d7f1579
fix hardcoded texts and english locales
SebouChu Oct 4, 2024
509f1df
Merge branch 'admin-search' of github.com:noesya/osuny into admin-search
SebouChu Oct 4, 2024
e081760
clean schema
SebouChu Oct 4, 2024
0a5bb07
fix
SebouChu Oct 4, 2024
a611cd2
Merge branch 'main' into admin-search
SebouChu Oct 4, 2024
aadc7bf
climate
SebouChu Oct 4, 2024
4078009
Merge branch 'admin-search' of github.com:noesya/osuny into admin-search
SebouChu Oct 4, 2024
7c1b576
Merge branch 'main' into admin-search
arnaudlevy Oct 11, 2024
f3bc1d3
Merge branch 'main' into admin-search
arnaudlevy Oct 15, 2024
ee471dd
Merge branch 'main' into admin-search
arnaudlevy Oct 18, 2024
503c4f8
Merge branch 'main' into admin-search
arnaudlevy Oct 21, 2024
90bd600
Merge branch 'main' into admin-search
arnaudlevy Oct 21, 2024
c7f03d9
Merge branch 'main' into admin-search
arnaudlevy Oct 22, 2024
b0d3c91
Merge branch 'main' into admin-search
arnaudlevy Oct 28, 2024
1d51ee2
Merge branch 'main' into admin-search
arnaudlevy Oct 29, 2024
3d754e5
Merge branch 'main' into admin-search
arnaudlevy Oct 29, 2024
80796d3
Merge branch 'main' into admin-search
arnaudlevy Oct 30, 2024
f72e66c
Merge branch 'main' into admin-search
arnaudlevy Oct 31, 2024
67d9980
Merge branch 'main' into admin-search
arnaudlevy Oct 31, 2024
ec435d7
Merge branch 'main' into admin-search
arnaudlevy Oct 31, 2024
d653dab
wip
arnaudlevy Oct 31, 2024
2318106
better
arnaudlevy Oct 31, 2024
7e5e945
fix
SebouChu Oct 31, 2024
5c84d7e
fixed
arnaudlevy Oct 31, 2024
990dfe1
comment
arnaudlevy Oct 31, 2024
1469535
done
arnaudlevy Oct 31, 2024
d79f37d
Merge branch 'main' into admin-search
arnaudlevy Oct 31, 2024
ca55939
Merge branch 'main' into admin-search
arnaudlevy Oct 31, 2024
1ef41f5
Merge branch 'main' into admin-search
arnaudlevy Nov 12, 2024
e8d336b
Merge branch 'main' into admin-search
arnaudlevy Nov 14, 2024
11754c0
Merge branch 'main' into admin-search
arnaudlevy Nov 15, 2024
8b850a0
Merge branch 'main' into admin-search
arnaudlevy Nov 25, 2024
551f819
Merge branch 'main' into admin-search
arnaudlevy Dec 4, 2024
77da976
Merge branch 'main' into admin-search
arnaudlevy Dec 5, 2024
5d189f2
Merge branch 'main' into admin-search
arnaudlevy Dec 5, 2024
197cd43
Merge branch 'main' into admin-search
arnaudlevy Dec 13, 2024
55cfba1
Merge branch 'main' into admin-search
arnaudlevy Dec 16, 2024
fba8576
Merge branch 'main' into admin-search
arnaudlevy Dec 18, 2024
d5de91a
Merge branch 'main' into admin-search
arnaudlevy Dec 19, 2024
6a736ae
gems
arnaudlevy Dec 19, 2024
400f184
Cleanup
arnaudlevy Dec 19, 2024
d37e6ca
Merge branch 'main' into admin-search
arnaudlevy Dec 20, 2024
4f8b651
Merge branch 'main' into admin-search
arnaudlevy Jan 2, 2025
ee51351
Merge branch 'main' into admin-search
arnaudlevy Jan 20, 2025
ae5b6c2
Merge branch 'main' into admin-search
SebouChu Jan 20, 2025
cbb230c
Merge branch 'main' into admin-search
arnaudlevy Jan 28, 2025
6bbfe95
Merge branch 'main' into admin-search
arnaudlevy Feb 5, 2025
841f761
css
arnaudlevy Feb 5, 2025
02a6d81
Merge branch 'admin-search' of github.com:osunyorg/admin into admin-s…
arnaudlevy Feb 5, 2025
15b023c
gem
arnaudlevy Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions app/assets/javascripts/admin/commons/nav.js

This file was deleted.

47 changes: 47 additions & 0 deletions app/assets/javascripts/admin/commons/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
window.osuny = window.osuny || {};
window.osuny.search = {

init: function () {
'use strict';
this.modal = document.getElementById('searchModal');
this.field = document.getElementById('searchField');
this.results = document.getElementById('searchResults');
this.modal.addEventListener('shown.bs.modal', this.open.bind(this));
this.field.addEventListener('input', this.update.bind(this));
this.request = new XMLHttpRequest();
this.endpoint = this.modal.dataset.endpoint;
},

open: function () {
this.field.focus();
},

update: function () {
this.term = this.field.value;
this.loadResults();
},

loadResults: function () {
this.query = this.endpoint + '?term=' + this.term;
this.request.abort();
this.request.open('GET', this.query, true);
this.request.addEventListener("load", this.resultsLoaded.bind(this));
this.request.send();
},

resultsLoaded: function () {
this.results.innerHTML = this.request.response;
},

invoke: function () {
'use strict';
return {
init: this.init.bind(this)
};
}
}.invoke();

document.addEventListener('DOMContentLoaded', function () {
'use strict';
window.osuny.search.init();
});
1 change: 0 additions & 1 deletion app/assets/javascripts/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
//= require summernote/summernote-bs5
//= require select2/dist/js/select2
//= require_self
//= require ./admin/commons/nav
//= require ./admin/commons/conditional
//= require ./admin/commons/default_language_selector
//= require_tree ./application/plugins
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/admin/design-system/nav.sass
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.navbar-main
> *
min-width: 300px
.navbar
.btn
color: $gray-300
Expand Down
23 changes: 23 additions & 0 deletions app/controllers/admin/search_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Admin::SearchController < Admin::ApplicationController
def index
@term = params[:term]
@results = @term.present? ? search_results: @results = Search.none
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
render layout: false
end

protected

def search_results
results = current_university.search.for_title(@term).in(current_language).limit(30)
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
results = results.where(website_id: params[:website_id]) if params.has_key?(:website_id)
results = results.where(extranet_id: params[:extranet_id]) if params.has_key?(:extranet_id)
results
end

def default_url_options
options = super
options[:website_id] = params[:website_id] if params.has_key?(:website_id)
options[:extranet_id] = params[:extranet_id] if params.has_key?(:extranet_id)
options
end
end
1 change: 1 addition & 0 deletions app/models/communication/extranet/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#
class Communication::Extranet::Document < ApplicationRecord
include Sanitizable
include Searchable
include Localizable
include LocalizableOrderByNameScope
include WithUniversity
Expand Down
1 change: 1 addition & 0 deletions app/models/communication/extranet/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#
class Communication::Extranet::Post < ApplicationRecord
include Localizable
include Searchable
include WithUniversity

belongs_to :author, class_name: 'University::Person', optional: true
Expand Down
1 change: 1 addition & 0 deletions app/models/communication/website/agenda/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Communication::Website::Agenda::Event < ApplicationRecord
include Duplicable
include Filterable
include Sanitizable
include Searchable
include Localizable
include WithMenuItemTarget
include WithTime
Expand Down
1 change: 1 addition & 0 deletions app/models/communication/website/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Communication::Website::Page < ApplicationRecord
include Duplicable
include Filterable
include Sanitizable
include Searchable
include Localizable
include WithAutomaticMenus
include WithMenuItemTarget
Expand Down
2 changes: 1 addition & 1 deletion app/models/communication/website/page/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# header_cta :boolean
# header_cta_label :string
# header_cta_url :string
# header_text :text
# header_text :string
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
# meta_description :string
# migration_identifier :string
# published :boolean
Expand Down
1 change: 1 addition & 0 deletions app/models/communication/website/portfolio/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Communication::Website::Portfolio::Project < ApplicationRecord
include Duplicable
include Filterable
include Sanitizable
include Searchable
include Localizable
include WithMenuItemTarget
include WithUniversity
Expand Down
1 change: 1 addition & 0 deletions app/models/communication/website/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Communication::Website::Post < ApplicationRecord
include Duplicable
include Filterable
include Sanitizable
include Searchable
include Localizable
include WithMenuItemTarget
include WithUniversity
Expand Down
55 changes: 55 additions & 0 deletions app/models/concerns/searchable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module Searchable
extend ActiveSupport::Concern

SEARCH_FIELDS_OPTIONAL = [
:biography,
:text,
:long_name
]

included do
after_save :save_search_data
end

protected

def save_search_data
localizations.each do |l10n|
search = Search.where(
university: university,
about_object: self,
about_localization: l10n,
website_id: search_data_website_id,
extranet_id: search_data_extranet_id,
language: l10n.language
).first_or_create
search.title = l10n.to_s
search.text = build_search_text(l10n)
search.save
end
end

def search_data_website_id
return communication_website_id if respond_to?(:communication_website_id)
return website_id if respond_to?(:website_id)
nil
end

def search_data_extranet_id
return communication_extranet_id if respond_to?(:communication_extranet_id)
return extranet_id if respond_to?(:extranet_id)
nil
end

def build_search_text(l10n)
text = l10n.to_s
SEARCH_FIELDS_OPTIONAL.each do |property|
next unless l10n.respond_to? property
value = l10n.send property
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
next unless value.present?
text += "#{value} "
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
end
text += l10n.contents_full_text
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
text
end
end
1 change: 1 addition & 0 deletions app/models/education/diploma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Education::Diploma < ApplicationRecord

include AsIndirectObject
include Sanitizable
include Searchable
include Localizable
include WithUniversity

Expand Down
1 change: 1 addition & 0 deletions app/models/education/program.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Education::Program < ApplicationRecord
include Filterable
include Localizable
include Sanitizable
include Searchable
include WebsitesLinkable
include WithAlumni
include WithDiploma
Expand Down
1 change: 1 addition & 0 deletions app/models/education/school.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Education::School < ApplicationRecord
include AsIndirectObject
include Filterable
include Sanitizable
include Searchable
include Localizable
include LocalizableOrderByNameScope
include WebsitesLinkable
Expand Down
1 change: 1 addition & 0 deletions app/models/research/journal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Research::Journal < ApplicationRecord
include Localizable
include LocalizableOrderByTitleScope
include Sanitizable
include Searchable
include WebsitesLinkable
include WithUniversity

Expand Down
1 change: 1 addition & 0 deletions app/models/research/journal/paper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Research::Journal::Paper < ApplicationRecord
include AsIndirectObject
include Localizable
include Sanitizable
include Searchable
include WithPosition
include WithUniversity

Expand Down
2 changes: 2 additions & 0 deletions app/models/research/journal/paper/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
# id :uuid not null, primary key
# abstract :string
# authors_list :text
# bibliography :text
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
# keywords :text
# meta_description :text
# published :boolean default(FALSE)
# published_at :datetime
# slug :string
# summary :text
# text :text
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
# title :string
# created_at :datetime not null
# updated_at :datetime not null
Expand Down
1 change: 1 addition & 0 deletions app/models/research/journal/volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Research::Journal::Volume < ApplicationRecord
include AsIndirectObject
include Localizable
include Sanitizable
include Searchable
include WithUniversity

belongs_to :journal,
Expand Down
1 change: 1 addition & 0 deletions app/models/research/laboratory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Research::Laboratory < ApplicationRecord
include Localizable
include LocalizableOrderByNameScope
include Sanitizable
include Searchable
include WebsitesLinkable
include WithCountry

Expand Down
59 changes: 59 additions & 0 deletions app/models/search.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# == Schema Information
#
# Table name: search
#
# id :uuid not null, primary key
# about_localization_type :string not null, indexed => [about_localization_id]
# about_object_type :string not null, indexed => [about_object_id]
# text :text
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# about_localization_id :uuid not null, indexed => [about_localization_type]
# about_object_id :uuid not null, indexed => [about_object_type]
# extranet_id :uuid indexed
# language_id :uuid not null, indexed
# university_id :uuid not null, indexed
# website_id :uuid indexed
#
# Indexes
#
# index_search_on_about_localization (about_localization_type,about_localization_id)
# index_search_on_about_object (about_object_type,about_object_id)
# index_search_on_extranet_id (extranet_id)
# index_search_on_language_id (language_id)
# index_search_on_university_id (university_id)
# index_search_on_website_id (website_id)
#
# Foreign Keys
#
# fk_rails_06e4ffc38b (website_id => communication_websites.id)
# fk_rails_62a3af3969 (extranet_id => communication_extranets.id)
# fk_rails_bab17fceaa (university_id => universities.id)
#
class Search < ApplicationRecord
self.table_name = 'search'

belongs_to :university
belongs_to :language
belongs_to :about_object, polymorphic: true
belongs_to :about_localization, polymorphic: true
belongs_to :website, optional: true
belongs_to :extranet, optional: true

scope :for_text, -> (term) {
where(
"unaccent(text) ILIKE unaccent(:term)",
term: "%#{sanitize_sql_like(term)}%"
)
}
scope :for_title, -> (term) {
where(
"unaccent(title) ILIKE unaccent(:term)",
term: "%#{sanitize_sql_like(term)}%"
)
}
scope :in, -> (language) {
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
where(language: language)
}
end
1 change: 1 addition & 0 deletions app/models/university.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class University < ApplicationRecord
has_many :active_storage_blobs, class_name: 'ActiveStorage::Blob'
has_many :imports, dependent: :destroy
has_many :apps, dependent: :destroy
has_many :search, dependent: :destroy

validates :name, presence: true
validates :sms_sender_name, presence: true, length: { maximum: 11 }
Expand Down
1 change: 1 addition & 0 deletions app/models/university/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class University::Organization < ApplicationRecord
include Localizable
include LocalizableOrderByNameScope
include Sanitizable
include Searchable
include WithCountry
include WithGeolocation
include WithUniversity
Expand Down
1 change: 1 addition & 0 deletions app/models/university/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class University::Person < ApplicationRecord
include AsIndirectObject
include Filterable
include Sanitizable
include Searchable
include Localizable
include WithBlobs
include WithCountry
Expand Down
2 changes: 1 addition & 1 deletion app/models/university/person/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Table name: university_person_localizations
#
# id :uuid not null, primary key
# biography :text
# biography :string
SebouChu marked this conversation as resolved.
Show resolved Hide resolved
# first_name :string
# last_name :string
# linkedin :string
Expand Down
1 change: 1 addition & 0 deletions app/views/admin/application/components/_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ languages = current_university.languages.ordered
Osuny
</button>
</div>
<%= render 'admin/application/components/search' %>
<div class="d-flex justify-content-end">
<% if languages.many? %>
<button class="btn btn--language"
Expand Down
Loading
Loading