Commit 855a1e24 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update metrics/top_citations.html to polish it.

parent 7f84f53f
......@@ -196,14 +196,16 @@ def top_citations():
orderby=~max_count,
limitby=(0, selector.top))
data = [[
el.teams.domain,
el.teams.team,
el.projects.project,
f"{el.publications.title}, "
f"{el.publishers.abbreviation} {el.publications.volume} "
f"({el.publications.year}) {el.publications.pages}",
el._extra["MAX(`citations`.`count`)"]
data = [
[
el.teams.domain,
el.teams.team,
el.projects.project,
f"{el.publications.title}, "
f"{el.publishers.abbreviation} {el.publications.volume} "
f"({el.publications.year}) {el.publications.pages}",
el._extra["MAX(`citations`.`count`)"],
el.publications.year
] for el in irows]
fields = [
......@@ -211,7 +213,8 @@ def top_citations():
{"name": "team", "type": "string"},
{"name": "project", "type": "string"},
{"name": "reference", "type": "string"},
{"name": "citations", "type": "int"}]
{"name": "citations", "type": "int"},
{"name": "year", "type": "int"}]
cfg = dict(fields=fields, data=data)
......@@ -220,14 +223,20 @@ def top_citations():
{"xtype": "rownumberer"},
{"text": T("domain"), "dataIndex": "domain", "flex": 1},
{"text": T("team"), "dataIndex": "team", "flex": 0.9},
{"text": T("project"), "dataIndex": "project", "flex": 0.5},
{
"text": T("project"),
"dataIndex": "project",
"flex": 0.5,
"hidden": True
},
{"text": T("reference"), "dataIndex": "reference", "flex": 2.5},
{
"text": T("citations"),
"dataIndex": "citations",
"flex": 0.5,
"align": "end"
}
},
{"text": T("year"), "dataIndex": "year", "flex": 0.5}
]
return dict(cfg_store=json.dumps(cfg, cls=JSONEncoder),
......
......@@ -634,6 +634,7 @@
'Review': 'Revue',
'Revue': 'Revue',
'Revues': 'Revues',
'Right click on the grid to extract data in a CSV file.': 'Click droit pour extraire les données dans un fichier CSV.',
'Role': 'Rôle',
'Row': 'Ligne',
'Rows': 'Lignes',
......
......@@ -443,8 +443,7 @@ class ViewportUi(object):
top_citations_panel = to_panelWithUrlSelector(
virtdb.top_citations_selector,
baseUrl=URL("metrics", "top_citations"),
plugins=["pMathJax"])
baseUrl=URL("metrics", "top_citations"))
add_child = node.add_child
add_child(T("dashboard"), dashboard_panel)
......
......@@ -25,11 +25,12 @@
title = "%s %s" % (T("Top citations"), team_project)
=H2(title, _class="dbui-h2 dbui-small-cap")
=DIV(_id=divgrid)
=P(T("Right click on the grid to extract data in a CSV file."), _class="dbui-p")
#
# The footer, procesing time for the request
#
delta = (datetime.now()-request.now).total_seconds()
delta = T('Page generated in %s seconds') % round(delta, 2)
=P(delta, BR(), request.now.strftime("%d %b %Y %H:%M"), _class="dbui-p")
......@@ -41,7 +42,7 @@
var cfgStore = {{=XML(cfg_store)}},
columns = {{=XML(columns)}},
divgrid = '{{=divgrid}}',
grid;
grid, menu;
//
// check that the Ext JS library is loaded
......@@ -55,19 +56,31 @@
// data can be extracted via the plugin pGridExport
//
grid = Ext.create('Dbui.grid.Panel', {
plugins: ['pGridExport',
plugins: [
{
ptype: 'pGridExport',
id: 'top_citations_export'
}, {
ptype: 'rowexpander',
rowBodyTpl: new Ext.Template('<p>{reference}</p>')
}, {
ptype: 'pMathJax'
}
],
store: Ext.create('Ext.data.ArrayStore', cfgStore),
columns: columns,
forceFit: true,
height: 400,
hideHeaders: false,
padding: "0 25 20 30",
renderTo: divgrid
padding: "0 25 20 25",
renderTo: divgrid,
scrollable: "y"
});
// inhibit LaTex and PDF items in export menu
menu = grid.getPlugin('top_citations_export').menu;
menu.items.items[1].hide();
menu.items.items[2].hide();
</script>
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