Commit ff5706f7 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

The menu item EditAndLoad is only enable when the record is rejected.

parent bb4834c0
......@@ -290,6 +290,7 @@
'Lost password?': 'Lost password?',
'Main layout': 'Main layout',
'MARCXML': 'MARCXML',
'Message': 'Message',
'Metric': 'Métrique',
'metrics': 'métriques',
'Missing record for conference identified by id': 'Missing record for conference identified by id',
......
......@@ -71,7 +71,8 @@
cfg = dict(groupField='txt',
sorters=['txt', 'title'])
cfg['fields'] = [{'name': 'collection', 'type': 'string'},
cfg['fields'] = [{'name': 'action', 'type': 'string'},
{'name': 'collection', 'type': 'string'},
{'name': 'title', 'type': 'string'},
{'name': 'txt', 'type': 'string'},
{'name': 'url', 'type': 'string'},
......@@ -79,7 +80,8 @@
cfg['data'] = []
for row in logs:
cfg['data'].append([row.collection,
cfg['data'].append([row.action,
row.collection,
row.title,
row.txt,
row.url,
......@@ -161,6 +163,7 @@
"trModified = '%s'" % T('Modified'),
"trRejected = '%s'" % T('Rejected'),
"trTitle = '%s'" % T('Title'),
"trTxt ='%s'" % T('Message'),
"trStatistics = '%s'" % T('Statistics'),
"trYear = '%s'" % T('Year')]
......@@ -177,8 +180,7 @@
"use strict";
var host = this.harvester.host,
li,
var li,
mask,
record = this.gridLog.getSelectionModel().getSelection()[0],
record_id;
......@@ -209,7 +211,7 @@
params: {
Edit_insert_selectorId_teams: this.harvester.id_teams,
Edit_insert_selectorId_projects: this.harvester.id_projects,
Edit_insert_selectorHost: host,
Edit_insert_selectorHost: this.harvester.host,
Edit_insert_selectorRecord_id: record_id,
Edit_insert_selectorController: this.harvester.controller,
Edit_insert_selectorId_categories: this.harvester.id_categories
......@@ -305,7 +307,7 @@
//
// instantiate the grid for the LOGs
// The row are group per database action and sorted by title.
// The rows are group per action message and sorted by title.
// Each title is rendered as an URL pointing to the publication
// in the harvester repository
//
......@@ -314,7 +316,8 @@
columns: [
{xtype: 'rownumberer'},
{text: trTitle, dataIndex: 'title', flex: 3, renderer: rTitle},
{text: trAction, dataIndex: 'txt', flex: 1, hidden: true},
{text: trAction, dataIndex: 'action', flex: 1, hidden: true},
{text: trTxt, dataIndex: 'txt', flex: 1, hidden: true},
{text: trCollection, dataIndex: 'collection', flex: 1, hidden: true},
{text: trYear, dataIndex: 'year', flex: 1, hidden: true}
],
......@@ -331,10 +334,11 @@
//
menu = Ext.create('Ext.menu.Menu', {
items : [{
text: trEditAndInsert,
iconCls: 'xaction-create',
handler: onEditAndInsert,
scope: this
iconCls: 'xaction-create',
itemId: 'editAndInsert',
scope: this,
text: trEditAndInsert
}]
});
......@@ -347,6 +351,15 @@
// The next line fixes this bug.
// (from www.sencha.com/forum/showthread.php?264961-Grid-Grouping-Bug)
view.getSelectionModel().select(view.dataSource.data.get(item.getAttribute('data-recordid')));
// the editAndInsert action is only available when the record is rejected
if (record.get('action') === 'reject') {
menu.items.get('editAndInsert').setDisabled(false);
} else {
menu.items.get('editAndInsert').setDisabled(true);
}
// show the menu
menu.showAt(event.getXY());
});
......
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