export clusters button added

This commit is contained in:
Cora Johnson-Roberson 2015-11-18 11:17:29 -08:00
parent 803882d533
commit e1a8e44a02
4 changed files with 19 additions and 0 deletions

View File

@ -644,6 +644,7 @@
"pick-record": "Pick Record Elements",
"merge-cluster": "Merge Selected & Re-Cluster",
"merge-close": "Merge Selected & Close",
"export-cluster": "Export Clusters",
"close": "Close",
"reset-template": "Reset Template",
"export": "Export",

View File

@ -644,6 +644,7 @@
"pick-record": "Pick Record Elements",
"merge-cluster": "Merge Selected & Re-Cluster",
"merge-close": "Merge Selected & Close",
"export-cluster": "Export Clusters",
"close": "Close",
"reset-template": "Reset Template",
"export": "Export",

View File

@ -56,6 +56,7 @@
<button class="button" bind="deselectAllButton"></button>
</td>
<td class="right" style="text-align: right">
<button class="button" bind="exportClusterButton"></button>
<button class="button button-primary" bind="applyReClusterButton"></button>
<button class="button" bind="applyCloseButton"></button>
<button class="button" bind="closeButton"></button>

View File

@ -69,6 +69,7 @@ ClusteringDialog.prototype._createDialog = function() {
this._elmts.or_dialog_blockChars.html($.i18n._('core-dialogs')["block-chars"]);
this._elmts.selectAllButton.html($.i18n._('core-buttons')["select-all"]);
this._elmts.deselectAllButton.html($.i18n._('core-buttons')["unselect-all"]);
this._elmts.exportClusterButton.html($.i18n._('core-buttons')["export-cluster"]);
this._elmts.applyReClusterButton.html($.i18n._('core-buttons')["merge-cluster"]);
this._elmts.applyCloseButton.html($.i18n._('core-buttons')["merge-close"]);
this._elmts.closeButton.html($.i18n._('core-buttons')["close"]);
@ -121,6 +122,7 @@ ClusteringDialog.prototype._createDialog = function() {
this._elmts.selectAllButton.click(function() { self._selectAll(); });
this._elmts.deselectAllButton.click(function() { self._deselectAll(); });
this._elmts.exportClusterButton.click(function() { self._onExportCluster(); });
this._elmts.applyReClusterButton.click(function() { self._onApplyReCluster(); });
this._elmts.applyCloseButton.click(function() { self._onApplyClose(); });
this._elmts.closeButton.click(function() { self._dismiss(); });
@ -333,6 +335,11 @@ ClusteringDialog.prototype._onApplyReCluster = function() {
});
};
ClusteringDialog.prototype._onExportCluster = function() {
var self = this;
self._export();
};
ClusteringDialog.prototype._apply = function(onDone) {
var clusters = this._getRestrictedClusters();
var edits = [];
@ -373,6 +380,15 @@ ClusteringDialog.prototype._apply = function(onDone) {
}
};
ClusteringDialog.prototype._export = function() {
var clusters = this._getRestrictedClusters();
var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(clusters));
var link=document.createElement('a');
link.href='data:' + data;
link.download="clusters" + (new Date()).toISOString() + ".json";
link.click();
};
ClusteringDialog.prototype._dismiss = function() {
DialogSystem.dismissUntil(this._level - 1);
};