Skip to content

Commit

Permalink
design changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nczirjak-acdh committed Jun 6, 2024
1 parent 81b9a7b commit 3b417fa
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 57 deletions.
Binary file modified .DS_Store
Binary file not shown.
57 changes: 39 additions & 18 deletions js/arche_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jQuery(function ($) {
if ($('#av-summary').text().trim().length == 0) {
$('#ad-summary').hide();
}


});

Expand Down Expand Up @@ -86,23 +86,23 @@ jQuery(function ($) {
$('.descriptionTextShort').html(truncatedText + '...' + '<a class="hasdescription-toggle-button" id="descriptionTextShortBtn">' + Drupal.t("Continue reading") + '</a>');
}
}

function redrawTabs() {
console.log("redraw tab");
// Check if there is an active tab
if ($('#arche-detail-tabs .nav-item .nav-link.active').length === 0) {
console.log("there is no active tab");
// Activate the first visible tab
var firstVisibleTab = $('#arche-detail-tabs .nav-item .nav-link:visible').first();
firstVisibleTab.addClass('active');
var firstVisibleTabId = firstVisibleTab.attr('href');
$(firstVisibleTabId).addClass('show active');
}
// Check if there is an active tab
if ($('#arche-detail-tabs .nav-item .nav-link.active').length === 0) {
console.log("there is no active tab");
// Activate the first visible tab
var firstVisibleTab = $('#arche-detail-tabs .nav-item .nav-link:visible').first();
firstVisibleTab.addClass('active');
var firstVisibleTabId = firstVisibleTab.attr('href');
$(firstVisibleTabId).addClass('show active');
}
}

function hideEmptyTabs(tab) {
$(tab).hide();
$(tab+'-content').hide();
$(tab + '-content').hide();
redrawTabs();
}

Expand Down Expand Up @@ -286,6 +286,15 @@ jQuery(function ($) {
}
}

function removeBeforeHash(str) {
let hashIndex = str.indexOf('#');
if (hashIndex !== -1) {
return str.substring(hashIndex + 1);
} else {
return str; // Return the original string if no # found
}
}


function fetchPublications() {
var limit = 10;
Expand All @@ -311,7 +320,7 @@ jQuery(function ($) {
console.log('response error');
console.log(error);
//$('.child-elements-div').hide();
hideEmptyTabs('#associated-publications-tab');
//hideEmptyTabs('#associated-publications-tab');
return;
}
console.log('response: ');
Expand All @@ -322,7 +331,7 @@ jQuery(function ($) {
console.log('error');
console.log(error);
$('.publications-elements-div').hide();
hideEmptyTabs('#associated-publications-tab');
//hideEmptyTabs('#associated-publications-tab');
}
},
'columns': [
Expand All @@ -333,7 +342,13 @@ jQuery(function ($) {
return "";
}
},
{data: 'property', visible: true},
{data: 'property', render: function (data, type, row, meta) {
if (row.property) {
return removeBeforeHash(row.property);
}
return "";
}
},
{data: 'title', visible: false},
{data: 'type', visible: false},
{data: 'acdhid', visible: false}
Expand Down Expand Up @@ -367,7 +382,7 @@ jQuery(function ($) {
if (response === undefined) {
console.log('response error');
console.log(error);
hideEmptyTabs('#associated-coll-res-tab');
//hideEmptyTabs('#associated-coll-res-tab');
//$('.child-elements-div').hide();
return;
}
Expand All @@ -378,7 +393,7 @@ jQuery(function ($) {
//$(".loader-versions-div").hide();
console.log('error');
console.log(error);
hideEmptyTabs('#associated-coll-res-tab');
//hideEmptyTabs('#associated-coll-res-tab');
$('.rcr-elements-div').hide();
}
},
Expand All @@ -402,7 +417,13 @@ jQuery(function ($) {
return text;
}
},
{data: 'property', visible: true},
{data: 'property', render: function (data, type, row, meta) {
if (row.property) {
return removeBeforeHash(row.property);
}
return "";
}
},
{data: 'type', visible: true},
{data: 'acdhid', visible: false}
],
Expand Down
77 changes: 38 additions & 39 deletions templates/arche-detail.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
<div class="container-fluid" id="meta-content-container">
<!-- Available Date and type -->
<div class="row">
<div class="col-lg-6">
<div class="col-6">
<p class="mb-0">{{ "Available since"|trans }} {{ data.getAvailableDate() }}</p>
</div>
<div class="col-lg-6 flex-gap-col flex-reverse mb-0" >
<div class="col-6 flex-gap-col flex-reverse mb-0" >
{% if data.getAcdhType %}
<img src="{{arche_tooltip_ico}}" class="tooltip-icon">
<p class="btn-detail-type-gray no-btn" >{{ data.getAcdhType() }}</p>
Expand Down Expand Up @@ -135,20 +135,51 @@


<ul class="nav nav-tabs" id="arche-detail-tabs">
<li class="nav-item" id="collection-content-tab">
<a class="nav-link active" data-bs-toggle="tab" href="#collection-content-tab-content">{{ "Collection Content"|trans }}</a>
</li>
<li class="nav-item" id="associated-publications-tab">
<a class="nav-link active" data-bs-toggle="tab" href="#associated-publications-tab-content">{{ "Associated Publications"|trans }}</a>
<a class="nav-link" data-bs-toggle="tab" href="#associated-publications-tab-content">{{ "Associated Publications"|trans }}</a>
</li>
<li class="nav-item" id="associated-coll-res-tab">
<a class="nav-link" data-bs-toggle="tab" href="#associated-coll-res-tab-content">{{ "Associated Collections and Resources"|trans }}</a>
</li>
<li class="nav-item" id="collection-content-tab">
<a class="nav-link" data-bs-toggle="tab" href="#collection-content-tab-content">{{ "Collection Content"|trans }}</a>
</li>

</ul>

<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane container active" id="associated-publications-tab-content">
<div class="tab-pane container active" id="collection-content-tab-content">
<!-- Collection Contents -->
<div class="row basic-inside-content-div child-elements-div">
<div class="col-lg-12 child-tree-div">
<div id="child-tree" class="tree-view-container"></div>
</div>

<!--
<div class="col-lg-12 ">
<div class="basic-inside-content-div" id="childDtDiv">
<table class="child-table table row-border" cellspacing="0" width="100%" id='childDT'>
<div style="font-size: 14px; font-weight: bold;">
<label>{{ "Order the result by"|trans }}:</label>
<select name="sortBy" id="sortBy" class="form-control form-control-sm">
<option value="1-0">{{ "Title (ASC)"|trans }}</option>
<option value="1-1">{{ "Title (DESC)"|trans }}</option>
</select>
</div>
<br>
<tbody>
</tbody>
</table>
</div>
</div>-->
</div>

</div>
<div class="tab-pane container fade" id="associated-publications-tab-content">
<div class="row basic-inside-content-div publications-elements-div">

<div class="col-lg-12 publications-table-div">
Expand Down Expand Up @@ -182,38 +213,6 @@
</div>
</div>
</div>

<div class="tab-pane container fade" id="collection-content-tab-content">
<!-- Collection Contents -->
<div class="row basic-inside-content-div child-elements-div">
<div class="col-lg-12 child-tree-div">
<div id="child-tree" class="tree-view-container"></div>
</div>

<!--
<div class="col-lg-12 ">
<div class="basic-inside-content-div" id="childDtDiv">
<table class="child-table table row-border" cellspacing="0" width="100%" id='childDT'>
<div style="font-size: 14px; font-weight: bold;">
<label>{{ "Order the result by"|trans }}:</label>
<select name="sortBy" id="sortBy" class="form-control form-control-sm">
<option value="1-0">{{ "Title (ASC)"|trans }}</option>
<option value="1-1">{{ "Title (DESC)"|trans }}</option>
</select>
</div>
<br>
<tbody>
</tbody>
</table>
</div>
</div>-->
</div>

</div>

</div>

</div>
Expand Down

0 comments on commit 3b417fa

Please sign in to comment.