Skip to content

Commit

Permalink
lightbox added and search improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nczirjak-acdh committed Apr 13, 2021
1 parent b3d6202 commit 815ecdc
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 72 deletions.
4 changes: 4 additions & 0 deletions acdh_repo_gui.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repo-styles:
css/dataTables.bootstrap4.min.css: {}
css/font-awesome/css/font-awesome.min.css: {}
css/jqtree/themes/default/style.min.css: {}
css/lightbox.css: {}
js:
js/jquery-1.12.3.min.js: {}
js/citation-js-0.5.0.min.js: {}
Expand All @@ -16,6 +17,7 @@ repo-styles:
js/dataTables.bootstrap4.min.js: {}
js/datatable_init.js: {}
js/acdh_repo_gui_pager.js: {}
js/lightbox.js: {}
dependencies:
- core/drupal
- core/drupal.form
Expand All @@ -25,9 +27,11 @@ repo-root-view:
css:
base:
css/acdh_repo_gui.css: {}
css/lightbox.css: {}
js:
js/jquery-1.12.3.min.js: {}
js/acdh_repo_gui_pager.js: {}
js/lightbox.js: {}
dependencies:
- core/drupal
- core/drupal.form
Expand Down
6 changes: 3 additions & 3 deletions inst/dbfunctions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,13 @@ CASE
CREATE TEMPORARY TABLE type_data AS (
WITH type_data as (
SELECT
DISTINCT(fts.id),
DISTINCT(cd.acdhid) as id,
cd.headline_title,
cd.headline_desc,
cd.headline_binary
FROM collection_data as cd
LEFT JOIN full_text_search as fts on cd.acdhid = fts.id
LEFT JOIN metadata as m on m.mid = fts.mid
LEFT JOIN metadata as m on m.id = cd.acdhid
LEFT JOIN full_text_search as fts on m.mid = fts.mid
WHERE
(
m.property = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
Expand Down
24 changes: 24 additions & 0 deletions src/Object/ResourceObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,30 @@ public function getTitleImage(string $width = '200px'): string
return '';
}

/**
* Get the titleimage URL
* @param string $width
* @return string
*/
public function getTitleImageUrl(string $width = '200px'): string
{
$img = '';
$imgBinary = '';
$width = str_replace('px', '', $width);
//check the thumbnail service first
if ($acdhid = $this->getAcdhID()) {
$acdhid = str_replace('http://', '', $acdhid);
$acdhid = str_replace('https://', '', $acdhid);
if ($file = @fopen($this->thumbUrl.$acdhid, "r")) {
$type = fgets($file, 40);
if (!empty($type)) {
return $this->thumbUrl.$acdhid.'?width='.$width;
}
}
}
return '';
}

/**
* Check if we have a titleimage id or not
* @return bool
Expand Down
48 changes: 27 additions & 21 deletions templates/acdh-repo-gui-detail-basic.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
},
'acdh:hasIdentifier': {
'icon': 'label',
'label': 'Identifier(s)'
'label': 'Identifier(s)',
'delimiter': ',<br>'
},
'acdh:hasRelatedProject': {
'icon': 'track_changes',
Expand All @@ -121,14 +122,14 @@
}
}
%}

<div class="arche-detail-view" >
<div class="arche-detail-main" id="arche-dv-main">
{% set titleimage = basic.getTitleImage() %}
{% if titleimage %}
<div class='row'>
<div class="res-inside-wrap col-lg-8 ">
{% endif%}
{% if titleimage %}
<div class='row'>
<div class="res-inside-wrap col-lg-8 ">
{% endif%}

{% if basic.getTitle() %}
<div class="res-property">
Expand All @@ -149,7 +150,7 @@
{% for value in basic.getRdfTypes() %}
<a href="/browser/search/type={{ value }}&payload=false/titleasc/10/1">{{ value }}</a>
{% endfor %}

</span>
</div>
{% endif%}
Expand All @@ -160,24 +161,29 @@
{'data': basic.getData('acdh:hasAlternativeTitle'), 'icon': "title", 'label': "Alternative Title" } ) }}
</div>
{% endif%}

{% for key, value in properties %}
{% if basic.getData(key) %}
{{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': basic.getData(key), 'icon': value.icon, 'label': value.label, 'type': value.type, 'dateformat': value.dateformat, 'delimiter': value.delimiter } ) }}
{% endif%}
{% endfor %}

{% if titleimage %}</div>{% endif%}

{% if titleimage %}</div>{% endif%}

{% if titleimage %}
<div class="res-inside-wrap col-lg-4 ">
<div class="single-res-thumb">
<a id='archeHref' href="/browser/oeaw_detail/{{ basic.getRepoId() }}">
{{ titleimage|raw }}
</a>
</div>
<div class="res-inside-wrap col-lg-4 ">
<div class="single-res-thumb">
<a href="{{ basic.getTitleImageUrl('600px') }}" data-lightbox="detail-titleimage">
{{ titleimage|raw }}
</a>
</div>
</div>
{% endif%}
</div>
{% endif%}

<div class='row'>
<div class="res-inside-wrap col-lg-12 ">
{% for key, value in properties %}
{% if basic.getData(key) %}
{{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': basic.getData(key), 'icon': value.icon, 'label': value.label, 'type': value.type, 'dateformat': value.dateformat, 'delimiter': value.delimiter } ) }}
{% endif%}
{% endfor %}
</div>
</div>
</div>
</div>
93 changes: 46 additions & 47 deletions templates/acdh-repo-gui-main.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

{{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }}
{% for item in data %}
{% if item.getTitle() %}
<div class="res-el col-block col-lg-12">
{% set titleimage = item.getTitleImage('150px') %}
{% if titleimage %}<div class="res-inside-wrap col-lg-6 "> {% endif%}
{{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }}

{% for item in data %}
{% if item.getTitle() %}
<div class="res-el col-block col-lg-12">
{% set titleimage = item.getTitleImage('150px') %}
{% if titleimage %}<div class="res-inside-wrap col-lg-6 "> {% endif%}

{% if item.getTitle() %}
<div class="res-property">
Expand All @@ -15,7 +15,7 @@
</span>
</div>
{% endif%}

{% if item.getRdfTypes() %}
<div class="res-property">
<i class="material-icons">&#xE54E;</i>
Expand All @@ -36,49 +36,48 @@
{% endif%}
{% endif%}
{% endif%}


{% if titleimage %}</div>{% endif%}

{% if titleimage %}

<div class="res-inside-wrap col-lg-6 ">
<div class="single-res-thumb">

<a href="/browser/oeaw_detail/{{ item.getRepoId() }}">
{{ titleimage|raw }}
</a>
</div>
</div>
{% endif%}

<div class="res-inside-wrap col-lg-12">
<div class="res-actions">
{% if item.getData('acdh:hasDescription') %}
<div class="res-act-button res-act-button-summary closed" >
<i class="material-icons">&#xE145;</i>
<span class="show_summary" id="show_summary_{{ item.getRepoId() }}">{{ "Show Summary"|trans }}</span>
<span class="hide_summary" id="summary_{{ item.getRepoId() }}">{{ "Hide Summary"|trans }}</span>
</div>
{% endif%}
{% if titleimage %}</div>{% endif%}

<div class="res-act-button">
<a href="/browser/oeaw_detail/{{ item.getRepoId() }}">
<i class="material-icons">&#xE873;</i>
<span>{{ "Detailed View"|trans }}</span>
</a>
</div>
{% if titleimage %}

<div class="res-inside-wrap col-lg-6 ">
<div class="single-res-thumb">
<a href="{{ item.getTitleImageUrl('600px') }}" data-lightbox="detail-titleimage-{{ item.getRepoId() }}">
{{ titleimage|raw }}
</a>
</div>
</div>
{% endif%}

<div class="res-inside-wrap col-lg-12">
<div class="res-actions">
{% if item.getData('acdh:hasDescription') %}
<div class="res-property res-property-desc" id="res-property-desc-{{ item.getRepoId() }}">
<span class="res-description">
{{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': item.getData('acdh:hasDescription') , 'icon': 'info' } ) }}
</span>
<div class="res-act-button res-act-button-summary closed" >
<i class="material-icons">&#xE145;</i>
<span class="show_summary" id="show_summary_{{ item.getRepoId() }}">{{ "Show Summary"|trans }}</span>
<span class="hide_summary" id="summary_{{ item.getRepoId() }}">{{ "Hide Summary"|trans }}</span>
</div>
{% endif%}
</div>
</div>

{% endif %}
{% endfor %}
{{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }}

<div class="res-act-button">
<a href="/browser/oeaw_detail/{{ item.getRepoId() }}">
<i class="material-icons">&#xE873;</i>
<span>{{ "Detailed View"|trans }}</span>
</a>
</div>
</div>
{% if item.getData('acdh:hasDescription') %}
<div class="res-property res-property-desc" id="res-property-desc-{{ item.getRepoId() }}">
<span class="res-description">
{{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': item.getData('acdh:hasDescription') , 'icon': 'info' } ) }}
</span>
</div>
{% endif%}
</div>
</div>

{% endif %}
{% endfor %}
{{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }}
2 changes: 1 addition & 1 deletion templates/acdh-repo-gui-search-full.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<div class="res-inside-wrap col-lg-4 ">
<div class="single-res-thumb">
<a href="/browser/oeaw_detail/{{ item.getRepoId() }}">
<a href="{{ item.getTitleImageUrl('600px') }}" data-lightbox="detail-titleimage-{{ item.getRepoId() }}">
{{ titleimage|raw }}
</a>
</div>
Expand Down

0 comments on commit 815ecdc

Please sign in to comment.