Skip to content

Commit

Permalink
Merge branch 'dev' into dis_max
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasfranck committed May 27, 2021
2 parents e76dfa4 + 3963a55 commit bd5dd59
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cpanfile
Expand Up @@ -25,7 +25,7 @@ requires 'Catmandu', '>=1.2002';
requires 'Catmandu::FileStore', '1.16';
requires 'Catmandu::ArXiv', '0.211';
requires 'Catmandu::BagIt' , '0.234';
requires 'Catmandu::BibTeX', '>=0.14';
requires 'Catmandu::BibTeX', '>=0.20';
requires 'Catmandu::DBI', '>=0.09';
requires 'Catmandu::Exporter::Table';
requires 'Catmandu::Fix::Date';
Expand All @@ -46,8 +46,8 @@ requires 'Search::Elasticsearch::Client::6_0';
requires 'Dancer';
requires 'Dancer::Plugin';
requires 'Dancer::FileUtils';
requires 'Dancer::Plugin::Catmandu::OAI', '>=0.0504';
requires 'Dancer::Plugin::Catmandu::SRU', '0.0403';
requires 'Dancer::Plugin::Catmandu::OAI', '>=0.0508';
requires 'Dancer::Plugin::Catmandu::SRU', '>=0.0504';
requires 'Dancer::Plugin::Auth::Tiny';
requires 'Dancer::Plugin::StreamData';
requires 'Dancer::Logger::Log4perl';
Expand Down Expand Up @@ -127,4 +127,4 @@ requires 'Tie::IxHash', '1.23';
requires 'Module::Find','0.15';

#LWP::UserAgent has method "patch" since version 6.42
requires "LWP::UserAgent","6.42";
requires "LWP::UserAgent","6.42";
1 change: 1 addition & 0 deletions fixes/licenses.fix
Expand Up @@ -4,4 +4,5 @@ if exists(license)
move(license, tmp)
lookup_in_config(tmp, locale.en.licenses)
move(tmp.deed_url, license)
rm(tmp)
end
6 changes: 3 additions & 3 deletions lib/LibreCat/App/Catalogue/Controller/Permission.pm
Expand Up @@ -26,7 +26,7 @@ sub get_cached_publication {

my $pub = cache()->get( "RECORD_${id}" );
my $set_cache = !$pub;
$pub //= h->main_publication->get($id);
$pub //= h->publication->get($id);

cache()->set( "RECORD_${id}", $pub) if $set_cache;

Expand Down Expand Up @@ -63,7 +63,7 @@ sub _can_do_action {

return 0 unless defined($user_id) && defined($role);

my $pub = $opts->{live} ? h->main_publication->get($id) : get_cached_publication($id);
my $pub = $opts->{live} ? h->publication->get($id) : get_cached_publication($id);

is_hash_ref($pub) or return 0;

Expand Down Expand Up @@ -238,7 +238,7 @@ sub can_download {
is_string($id) or return (0, "");
is_hash_ref($opts) or return (0, "");

my $pub = $opts->{live} ? h->main_publication->get($id) : get_cached_publication($id);
my $pub = $opts->{live} ? h->publication->get($id) : get_cached_publication($id);

is_hash_ref($pub) or return (0,"");

Expand Down
16 changes: 9 additions & 7 deletions lib/LibreCat/App/Search/Route/ajax.pm
Expand Up @@ -7,7 +7,7 @@ LibreCat::App::Search::Route::ajax - handles routes for asynchronous requests
=cut

use Catmandu::Sane;
use Catmandu::Util qw(join_path);
use Catmandu::Util qw(join_path :is);
use Dancer qw/:syntax/;
use Dancer::Plugin::Ajax;
use HTML::Entities;
Expand Down Expand Up @@ -93,7 +93,7 @@ ajax '/authority_user/:id' => sub {

ajax '/get_alias/:id/:alias' => sub {
my $term = params->{'alias'} || "";
my $id = params->{'id'};
my $id = params->{'id'};

my %search_params = (cql => ["alias=$term", "id<>$id"]);
h->log->debug("executing user->search: " . to_dumper(\%search_params));
Expand Down Expand Up @@ -126,10 +126,12 @@ ajax '/get_project' => sub {
h->log->debug($hits->{total} . " hits");

if ($hits->{total}) {
my $map;
@$map
= map {{id => $_->{_id}, label => $_->{name}};} @{$hits->{hits}};
return to_json $map;
my @map = map {
my $label = $_->{name};
$label = "$_->{acronym}: $label" if is_string($_->{acronym});
+{ id => $_->{_id}, label => $label };
} @{$hits->{hits}};
return to_json \@map;
}
else {
return to_json [];
Expand All @@ -141,7 +143,7 @@ ajax '/get_project' => sub {
=cut

ajax '/get_department' => sub {
my $term = params->{term} // '';
my $term = params->{term} // '';
my $limit = length($term) ? 100 : 1000;

my @terms = split('\s', $term);
Expand Down
5 changes: 3 additions & 2 deletions views/filters.tt
Expand Up @@ -4,8 +4,9 @@

<!-- BEGIN filters.tt -->
[%- USE JSON.Escape %]
<div id="filters" class="anchor"></div>
<div id="export"></div>
<!--these are anchors-->
<span id="filters"></span>
<span id="export"></span>

<div class="hidden-sm hidden-md hidden-lg"><hr></div>

Expand Down

0 comments on commit bd5dd59

Please sign in to comment.