Skip to content

Commit b1cbaed

Browse files
committed
Link to profile pages on Search for subjects and MNs in UI
1 parent 7398b5d commit b1cbaed

File tree

8 files changed

+92
-31
lines changed

8 files changed

+92
-31
lines changed

gmn/src/d1_gmn/app/settings_default.py

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
SYSMETA_REFRESH_MAX_ATTEMPTS = 24
9595

9696
DATAONE_ROOT = d1_common.const.URL_DATAONE_ROOT
97+
DATAONE_SEARCH = d1_common.const.URL_DATAONE_SEARCH
9798

9899
DATAONE_TRUSTED_SUBJECTS = set([])
99100

gmn/src/d1_gmn/app/static/ui/d1type.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ body {
2626

2727
.header-left {
2828
grid-area: header-left;
29-
align-self: center;
29+
align-self: self-start;
3030
justify-self: center;
3131
}
3232

3333
.header-right {
3434
grid-area: header-right;
35-
align-self: center;
35+
align-self: self-start;
3636
justify-items: start;
3737
}
3838

gmn/src/d1_gmn/app/static/ui/xslt/intermediate.xsl

+15-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@
154154
<a>
155155
<xsl:call-template name="add_href_and_text">
156156
<xsl:with-param name="abs_url"
157-
select="concat($env_root_url, 'v2/node')"/>
158-
<xsl:with-param name="rel_url" select="."/>
157+
select="concat($search_root_url, 'profile')"/>
158+
<xsl:with-param name="rel_url" select="substring-after(substring-after(.,':'),':')"/>
159+
<xsl:with-param name="text" select="."/>
159160
<xsl:with-param name="noencode" select="'y'"/>
160161
</xsl:call-template>
161162
</a>
@@ -164,7 +165,17 @@
164165

165166
<!-- subject, value -->
166167
<xsl:template match="node()|@*" mode="format_subject">
167-
<!--TODO: Find out if there's somewhere we can link to for subjects-->
168+
<xsl:element name="{ name() }">
169+
<a>
170+
<xsl:call-template name="add_href_and_text">
171+
<xsl:with-param name="abs_url"
172+
select="concat($search_root_url, 'profile')"/>
173+
<xsl:with-param name="rel_url" select="."/>
174+
<!--<xsl:with-param name="text" select="."/>-->
175+
<!--<xsl:with-param name="noencode" select="'y'"/>-->
176+
</xsl:call-template>
177+
</a>
178+
</xsl:element>
168179
<!--<xsl:element name="{ name() }">-->
169180
<!--<a>-->
170181
<!--<xsl:call-template name="add_href_and_text">-->
@@ -173,7 +184,7 @@
173184
<!--</xsl:call-template>-->
174185
<!--</a>-->
175186
<!--</xsl:element>-->
176-
<xsl:apply-templates select="." mode="format_short_text"/>
187+
<!--<xsl:apply-templates select="." mode="format_short_text"/>-->
177188
</xsl:template>
178189

179190
<!-- dateTime, value -->

gmn/src/d1_gmn/app/static/ui/xslt/node.xsl

+1-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@
188188
</xsl:template>
189189

190190
<xsl:template match="schedule/@*">
191-
<xsl:value-of select="name()"/>:
192-
<xsl:value-of select="."/>
191+
<xsl:value-of select="concat(name(), ':', .)"/>
193192
<xsl:if test="position() != last()">
194193
<xsl:value-of select="' '"/>
195194
</xsl:if>

gmn/src/d1_gmn/app/static/ui/xslt/util.xsl

+35
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,39 @@
137137
select="concat(format-number($integer, '###,###,###,###,###', 'US'), ' ', $units)"/>
138138
</xsl:template>
139139

140+
<!--Split string-->
141+
142+
<xsl:variable name="delimiter">
143+
<xsl:text>:</xsl:text>
144+
</xsl:variable>
145+
146+
<xsl:template match="mark">
147+
<xsl:variable name="dataList">
148+
<xsl:value-of select="."/>
149+
</xsl:variable>
150+
<xsl:call-template name="processingTemplate">
151+
<xsl:with-param name="datalist" select="$dataList"/>
152+
</xsl:call-template>
153+
</xsl:template>
154+
155+
<xsl:template name="processingTemplate">
156+
<xsl:param name="datalist"/>
157+
<xsl:choose>
158+
<xsl:when test="contains($datalist,$delimiter) ">
159+
<xsl:element name="processedItem">
160+
<xsl:value-of select="substring-before($datalist,$delimiter) * 10"/>
161+
</xsl:element>
162+
<xsl:call-template name="processingTemplate">
163+
<xsl:with-param name="datalist"
164+
select="substring-after($datalist,$delimiter)"/>
165+
</xsl:call-template>
166+
</xsl:when>
167+
<xsl:when test="string-length($datalist)=1">
168+
<xsl:element name="processedItem">
169+
<xsl:value-of select="$datalist * 10"/>
170+
</xsl:element>
171+
</xsl:when>
172+
</xsl:choose>
173+
</xsl:template>
174+
140175
</xsl:stylesheet>

gmn/src/d1_gmn/app/templates/home.xsl

+35-23
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<xsl:param name="static_root_url">{% static '/' %}</xsl:param>
1717
<xsl:param name="base_url">{{ baseUrl }}/</xsl:param>
1818
<xsl:param name="env_root_url">{{ envRootUrl }}/</xsl:param>
19+
<xsl:param name="search_root_url">{{ searchRootUrl }}/</xsl:param>
1920
<xsl:param name="node_id">{{ nodeId }}</xsl:param>
2021
<xsl:param name="mn_logo_url">{{ mnLogoUrl }}</xsl:param>
2122
<xsl:param name="node_name">{{ nodeName }}</xsl:param>
@@ -34,26 +35,24 @@
3435
<body>
3536
<div class="container">
3637
<!--<div class="flex-head">-->
37-
3838
<div class="container-grid">
3939
<div class="header-left">
40-
<div class="mn-logo">
41-
<xsl:call-template name="insert_logo">
42-
<xsl:with-param name="url" select="$mn_logo_url"/>
43-
</xsl:call-template>
44-
</div>
4540
</div>
4641
<div class="header-right">
47-
<div class="mn-name">
48-
<xsl:value-of select="$node_name"/>
49-
</div>
5042
</div>
5143

5244
<div class="sidebar">
53-
5445
<div class="flex-vert">
46+
5547
<!--left panel top-->
5648
<div>
49+
<div class="nav-outer">
50+
<div class="mn-logo">
51+
<xsl:call-template name="insert_logo">
52+
<xsl:with-param name="url" select="$mn_logo_url"/>
53+
</xsl:call-template>
54+
</div>
55+
</div>
5756

5857
<div class="nav-outer">
5958
<div>
@@ -62,21 +61,18 @@
6261
Status
6362
</a>
6463
</div>
65-
6664
<div>
6765
<a class="nav-button"
6866
href="{ concat($base_url, 'v2/node') }">
6967
Node
7068
</a>
7169
</div>
72-
7370
<div>
7471
<a class="nav-button"
7572
href="{ concat($base_url, 'v2/object') }">
7673
Objects
7774
</a>
7875
</div>
79-
8076
<div>
8177
<a class="nav-button"
8278
href="{ concat($base_url, 'v2/log') }">
@@ -86,13 +82,11 @@
8682
</div>
8783

8884
<div class="nav-outer">
89-
9085
<div class="d1-logo">
9186
<xsl:call-template name="insert_logo">
9287
<xsl:with-param name="url" select="$d1_logo_url"/>
9388
</xsl:call-template>
9489
</div>
95-
9690
<div>
9791
<a class="nav-button"
9892
href="https://search.dataone.org/data">
@@ -114,6 +108,7 @@
114108
Member Nodes
115109
</a>
116110
</div>
111+
117112
<div class="nav-outer">
118113
<div class="gmn-logo">
119114
<xsl:call-template name="insert_logo">
@@ -135,20 +130,36 @@
135130
</div>
136131

137132
<!-- left panel bottom -->
138-
<div>
139-
</div>
140-
133+
<!--<div>-->
134+
<!--</div>-->
141135
</div>
142136

143137
<!--right panel-->
144-
<div class="d1-type">
145-
<xsl:call-template name="d1_type_to_xhtml_grid"/>
138+
<div class="flex-vert">
139+
<div>
140+
<div class="nav-outer">
141+
<div class="mn-name">
142+
<xsl:value-of select="$node_name"/>
143+
</div>
144+
</div>
145+
<div class="nav-outer">
146+
<div class="d1-type">
147+
<xsl:call-template name="d1_type_to_xhtml_grid"/>
148+
</div>
149+
</div>
150+
</div>
146151
</div>
152+
153+
<!-- right panel bottom -->
154+
<!--<div>-->
155+
<!--</div>-->
156+
147157
<div class="footer">
148158
<div class="copyright">
149159
© Copyright 2018 Participating institutions in DataONE
150160
</div>
151161
</div>
162+
152163
</div>
153164
</div>
154165
</body>
@@ -158,12 +169,13 @@
158169
<xsl:template name="document_header">
159170
<head>
160171
<title>
161-
<xsl:value-of select="$node_name"/></title>
172+
<xsl:value-of select="$node_name"/>
173+
</title>
162174
<script
163175
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"
164176
type="text/javascript"/>
165-
166-
<link href="{% static '/ui/d1type.css' %}" rel="stylesheet" type="text/css"/>
177+
<link href="{% static '/ui/d1type.css' %}" rel="stylesheet"
178+
type="text/css"/>
167179
<script src="{% static '/ui/d1type.js' %}" type="text/javascript"/>
168180
</head>
169181
</xsl:template>

gmn/src/d1_gmn/app/views/internal.py

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ def get_context_dict():
127127
django.conf.settings.NODE_BASEURL,
128128
'envRootUrl':
129129
django.conf.settings.DATAONE_ROOT,
130+
'searchRootUrl':
131+
django.conf.settings.DATAONE_SEARCH,
130132
'nodeId':
131133
django.conf.settings.NODE_IDENTIFIER,
132134
'nodeName':

lib_common/src/d1_common/const.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
DEFAULT_MN_BASEURL = ''.join(
3636
(DEFAULT_MN_PROTOCOL, '://', DEFAULT_MN_HOST, DEFAULT_MN_PATH)
3737
)
38+
URL_DATAONE_SEARCH = 'https://search.dataone.org'
3839

3940
# Version of the DataONE Python stack
4041
VERSION = '3.2.0'

0 commit comments

Comments
 (0)