Added feature to create column containing Q values (#2378)
* Added feature to create column containing Q values * Defined better language for adding IDs column * Fixed notations * Add id column final fix * Add id column final fix Co-authored-by: Hammad Aamer <hammad.aamer97@gmail.com>
This commit is contained in:
parent
4477fc15a5
commit
e8f2a98cf0
@ -516,6 +516,9 @@
|
||||
"core-views/custom-text-facet": "Custom text facet",
|
||||
"core-views/custom-facets": "Customized facets",
|
||||
"core-views/word-facet": "Word facet",
|
||||
"core-views/add-id-column": "Add entity identifiers column",
|
||||
"core-views/add-id-column2": "Add a column containing entity identifiers from items",
|
||||
"core-views/add-id-col": "Add column containing entity identifiers on $1",
|
||||
"core-views/duplicates-facet": "Duplicates facet",
|
||||
"core-views/numeric-log-facet": "Numeric log facet",
|
||||
"core-views/bounded-log-facet": "1-bounded numeric log facet",
|
||||
|
@ -0,0 +1,17 @@
|
||||
<div class="dialog-frame" style="width: 700px;">
|
||||
<div class="dialog-border">
|
||||
<div class="dialog-header" bind="dialogHeader"></div>
|
||||
<div class="dialog-body" bind="dialogBody">
|
||||
<div class="grid-layout layout-normal layout-full"><table cols="2">
|
||||
<tr>
|
||||
<td width="1%" style="white-space: pre;" bind="or_views_newCol"></td>
|
||||
<td><input bind="columnNameInput" size="40" /></td>
|
||||
</tr>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="dialog-footer" bind="dialogFooter">
|
||||
<button class="button" bind="okButton"> OK </button>
|
||||
<button class="button" bind="cancelButton">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -32,6 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var columnIndex = Refine.columnNameToColumnIndex(column.name);
|
||||
var doReconcile = function() {
|
||||
new ReconDialog(column);
|
||||
};
|
||||
@ -188,6 +189,49 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var level = DialogSystem.showDialog(frame);
|
||||
};
|
||||
|
||||
var doAddIdcolumn = function() {
|
||||
var frame = $(
|
||||
DOM.loadHTML("core", "scripts/views/data-table/add-q-column-dialog.html"));
|
||||
|
||||
var elmts = DOM.bind(frame);
|
||||
elmts.dialogHeader.text($.i18n('core-views/add-id-col', column.name));
|
||||
|
||||
elmts.or_views_newCol.text($.i18n('core-views/new-col-name'));
|
||||
elmts.okButton.html($.i18n('core-buttons/ok'));
|
||||
elmts.cancelButton.text($.i18n('core-buttons/cancel'));
|
||||
|
||||
var level = DialogSystem.showDialog(frame);
|
||||
var dismiss = function() { DialogSystem.dismissUntil(level - 1); };
|
||||
|
||||
var o = DataTableView.sampleVisibleRows(column);
|
||||
|
||||
elmts.cancelButton.click(dismiss);
|
||||
elmts.okButton.click(function() {
|
||||
var columnName = $.trim(elmts.columnNameInput[0].value);
|
||||
if (!columnName.length) {
|
||||
alert($.i18n('core-views/warning-col-name'));
|
||||
return;
|
||||
}
|
||||
|
||||
Refine.postCoreProcess(
|
||||
"add-column",
|
||||
{
|
||||
baseColumnName: column.name,
|
||||
newColumnName: columnName,
|
||||
columnInsertIndex: columnIndex + 1,
|
||||
onError: "set-to-blank"
|
||||
},
|
||||
{ expression: "cell.recon.match.id" },
|
||||
{ modelsChanged: true },
|
||||
{
|
||||
onDone: function(o) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var doCopyAcrossColumns = function() {
|
||||
var frame = $(DOM.loadHTML("core", "scripts/views/data-table/copy-recon-across-columns-dialog.html"));
|
||||
@ -471,6 +515,13 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
label: $.i18n('core-views/use-values-as-identifiers'),
|
||||
tooltip: $.i18n('core-views/use-values-as-identifiers2'),
|
||||
click: doUseValuesAsIdentifiers
|
||||
},
|
||||
{},
|
||||
{
|
||||
id: "core/add-id-column",
|
||||
label: $.i18n('core-views/add-id-column'),
|
||||
tooltip: $.i18n('core-views/add-id-column2'),
|
||||
click: doAddIdcolumn
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user