Commit 410ce306 authored by Mathias Goebel's avatar Mathias Goebel 🎠

Merge branch 'bugfix/fix-news-display-#60' into 'develop'

Bugfix/fix news display #60

Closes #60

See merge request !53
parents b189a485 38b28128
......@@ -98,24 +98,24 @@ return
:
:)
declare function app:recentlyPublished($node as node(), $model as map(*), $howmany) as map(*)* {
let $collection-uri := $config:app-root || "/" || config:get("project-id") || "/meta"
return if( not(xmldb:collection-available($collection-uri)) ) then () else
let $last-resources :=
for $resource in xmldb:get-child-resources($collection-uri)
let $last-modified := xmldb:last-modified($collection-uri, $resource)
order by $last-modified descending
return
$resource
let $collection-uri := $config:app-root || "/" || config:get("project-id") || "/meta"
return if( not(xmldb:collection-available($collection-uri)) ) then () else
let $last-resources :=
for $resource in xmldb:get-child-resources($collection-uri)
let $last-modified := xmldb:last-modified($collection-uri, $resource)
order by $last-modified descending
return
$resource
let $metadata := $last-resources[1,2,3] ! doc( $collection-uri || "/" || . )
return
map { "last-resources": $metadata[1,2,3] }
let $metadata := $last-resources[1,2,3] ! doc( $collection-uri || "/" || . )
return
map { "last-resources": $metadata[1,2,3] }
};
declare function app:recentlyPublished-link($node as node(), $model as map(*), $num as xs:integer) {
<a href="./{$model("last-resources")[$num]//tgmd:textgridUri/string() => replace(":", "%3A")}">
<img class="media-object" src="~assets/generic/icons/{replace($model("last-resources")[$num]//tgmd:format, "/", "-")}.svg" alt="{string($model("last-resources")[$num]//tgmd:format)}"/>
</a>
<a href="./{$model("last-resources")[$num]//tgmd:textgridUri/string() => replace(":", "%3A")}">
<img class="media-object" src="~assets/generic/icons/{replace($model("last-resources")[$num]//tgmd:format, "/", "-")}.svg" alt="{string($model("last-resources")[$num]//tgmd:format)}"/>
</a>
};
declare function app:recentlyPublished-title($node as node(), $model as map(*), $num as xs:integer) {
......@@ -123,41 +123,41 @@ declare function app:recentlyPublished-title($node as node(), $model as map(*),
};
declare function app:recentlyPublished-description($node as node(), $model as map(*), $num as xs:integer) {
let $lastModinLab := $model("last-resources")[$num]//tgmd:lastModified/substring-before(., ".")
let $info := if($lastModinLab = "") then () else
"This document was last modified in the Lab at "
|| $lastModinLab
|| "."
let $root-name := ($model("last-resources")[$num]//tgrel:rootElementLocalPart/string(.))[1]
let $namespace := ($model("last-resources")[$num]//tgrel:rootElementNamespace/string(@rdf:resource))[1]
let $additionalInfo := if($root-name = "") then () else
"Its root element ("
|| $root-name
|| ") is in the »"
|| $namespace
|| "« namespace."
let $lastModinLab := $model("last-resources")[$num]//tgmd:lastModified/substring-before(., ".")
let $info := if($lastModinLab = "") then () else
"This document was last modified in the Lab at "
|| $lastModinLab
|| "."
let $root-name := ($model("last-resources")[$num]//tgrel:rootElementLocalPart/string(.))[1]
let $namespace := ($model("last-resources")[$num]//tgrel:rootElementNamespace/string(@rdf:resource))[1]
let $additionalInfo := if($root-name = "") then () else
"Its root element ("
|| $root-name
|| ") is in the »"
|| $namespace
|| "« namespace."
return
$info || $additionalInfo
return
$info || $additionalInfo
};
declare
function app:featuredWorks($node as node(), $model as map(*)) {
let $collection-uri := $config:app-root || "/" || config:get("project-id") || "/meta"
return if( not(xmldb:collection-available($collection-uri)) ) then () else
let $largest-resources :=
for $extent in collection($collection-uri)//tgmd:extent
order by number($extent/text()) descending
return
$extent/ancestor::tgmd:MetadataContainerType
let $collection-uri := $config:app-root || "/" || config:get("project-id") || "/meta"
return if( not(xmldb:collection-available($collection-uri)) ) then () else
let $largest-resources :=
for $extent in collection($collection-uri)//tgmd:extent
order by number($extent/text()) descending
return
$extent/ancestor::tgmd:MetadataContainerType
return
map {
"largest-resources": $largest-resources[1,2,3,4],
"largest-extent": $largest-resources[1]//tgmd:extent/string()
}
return
map {
"largest-resources": $largest-resources[1,2,3,4],
"largest-extent": $largest-resources[1]//tgmd:extent/string()
}
};
declare function app:featuredWorks-a($node as node(), $model as map(*)) {
......@@ -475,19 +475,30 @@ declare function app:current-version($node as node(), $model as map(*)) {
string($config:expath-descriptor/@version)
};
(:~
: Display new features and bugfixes on the index-page.
: In case we're in a develop repo we want to show the latest changes (since we bump the
: version number of the develop repo immediately after a new release). on master we only
: show the changes that fit to the master's version number. :)
declare function app:new-features($node as node(), $model as map(*)) {
<div class="alert alert-light" role="alert">
<h4>The current version encompasses the following <strong>new features</strong>:</h4>
{$config:repo-descriptor//repo:change
[@version = string($config:expath-descriptor/@version)]
//xhtml:li[@class="feat"]/*}
{
if(contains($config:expath-descriptor/@abbrev, "develop")) then
$config:repo-descriptor//repo:change[1]//xhtml:li[@class="feat"]/*
else
$config:repo-descriptor//repo:change[@version = string($config:expath-descriptor/@version)]//xhtml:li[@class="feat"]/*
}
</div>,
<div class="alert alert-light" role="alert">
<h4>The following <strong>bugs</strong> have been seen to:</h4>
{$config:repo-descriptor//repo:change
[@version = string($config:expath-descriptor/@version)]
//xhtml:li[@class="bugs"]/*}
{
if(contains($config:expath-descriptor/@abbrev, "develop")) then
$config:repo-descriptor//repo:change[1]//xhtml:li[@class="bugs"]/*
else
$config:repo-descriptor//repo:change[@version = string($config:expath-descriptor/@version)]//xhtml:li[@class="bugs"]/*
}
</div>
};
......
......@@ -25,6 +25,7 @@
<ul>
<li>Test for invalid fork names (e.g. 'develop' and all present targets)</li>
<li>Escape ':' in links containing a TextGrid URI</li>
<li>Fix new display on index.html (master shows new features that fit to the current version number while develop shows the latest entry in changelog)</li>
</ul>
</li>
</ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment