From 003b97553e8c4aab1c67847a18dcc07f06f48b75 Mon Sep 17 00:00:00 2001 From: Lars Scheideler Date: Thu, 6 Dec 2018 11:47:56 +0100 Subject: [PATCH 1/7] hide action sections with dataset dependency --- basic-backend-api.js | 2 +- local-storage-api.js | 4 ++-- plugin-actions.js | 12 +++++++++++- styles.css | 4 ++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/basic-backend-api.js b/basic-backend-api.js index b3f5027..1d12e7d 100644 --- a/basic-backend-api.js +++ b/basic-backend-api.js @@ -35,7 +35,7 @@ var plugin_xml_datasets = $('
') // Add plugin section -var basicPluginXMLStorage = new BasicAppPlugin('app-plugin-xml', 'eXist Storage Configuration', 'fas fa-database', '#app-content-plugins-configuration'); +var basicPluginXMLStorage = new BasicAppPlugin('app-plugin-xml', 'eXist Storage Configuration', 'fas fa-database', '#app-content-plugins-configuration', 'NO'); basicPluginXMLStorage.render(plugin_xml_datasets); diff --git a/local-storage-api.js b/local-storage-api.js index 8f0f33b..58d3d9b 100644 --- a/local-storage-api.js +++ b/local-storage-api.js @@ -25,7 +25,7 @@ var plugin_ls_dataset_info = $('
') // Add plugin section -var basicPluginLocalStorage = new BasicAppPlugin('app-plugin-ls', 'Local Storage Configuration', 'fas fa-database', '#app-content-plugins-configuration'); +var basicPluginLocalStorage = new BasicAppPlugin('app-plugin-ls', 'Local Storage Configuration', 'fas fa-database', '#app-content-plugins-configuration', 'NO'); basicPluginLocalStorage.render([plugin_ls_datasets, plugin_ls_dataset_info, plugin_ls_dataset_name]); @@ -171,7 +171,6 @@ LocalStorageAdapter.prototype.load = function () { console.log('Local Storage API: ' + objects_array.length + ' object(s) loaded (context: ' + ctx + ', dataset: ' + ds + ')'); // Update frontend info updateFrontendDatasetInformation(this.last_updated, objects_array.length); - $('body').trigger('datasetLoaded'); } else { console.log('Local Storage API (ERROR): Context or dataset is null. Nothing loaded.'); } @@ -203,6 +202,7 @@ LocalStorageAdapter.prototype.setDataset = function (ds) { // Save current dataset name localStorage.setItem(this.ls_key_last, ds); console.log('Local Storage API: Current dataset: ' + ds); + $('body').trigger('datasetLoaded'); return this; } diff --git a/plugin-actions.js b/plugin-actions.js index 62df680..81d283b 100644 --- a/plugin-actions.js +++ b/plugin-actions.js @@ -1,8 +1,9 @@ -function BasicAppPlugin (id, title, icon_classes, container_selector) { +function BasicAppPlugin (id, title, icon_classes, container_selector, dataset_dependency) { this.id = id; this.title = title; this.icon_classes = icon_classes; this.DOMContainer = $(container_selector); + this.dataset_dependency = dataset_dependency || 'YES'; } @@ -14,6 +15,10 @@ BasicAppPlugin.prototype.renderPluginBase = function () { .append('
' + this.title + '
') .append('
') .appendTo(this.DOMContainer); + // add class to hide an action section + if (this.dataset_dependency == 'YES') { + this.plugin.addClass('plugin-hidden'); + } return this; } @@ -38,6 +43,11 @@ BasicAppPlugin.prototype.render = function (content) { return this; } +// if dataset are loaded remove class to show the sections +$('body').on('datasetLoaded', function (e) { + $('.plugin-hidden').removeClass('plugin-hidden').show(); +}) + function ActionButtonPlugin (id, title, icon_classes, container_selector) { BasicAppPlugin.call(this, id, title, icon_classes, container_selector) diff --git a/styles.css b/styles.css index 56fdd6a..9fd8481 100644 --- a/styles.css +++ b/styles.css @@ -331,3 +331,7 @@ a.link-seealso { height: 100%; } } + +.plugin-hidden { + display: none; +} \ No newline at end of file From 58f1d9b27daa871c09fb2b3c88e24ef9227a1bfb Mon Sep 17 00:00:00 2001 From: Lars Scheideler Date: Thu, 6 Dec 2018 11:49:17 +0100 Subject: [PATCH 2/7] Change JSON export name with affiliation --- plugin-json-imexport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin-json-imexport.js b/plugin-json-imexport.js index 710e841..21ecee9 100644 --- a/plugin-json-imexport.js +++ b/plugin-json-imexport.js @@ -6,7 +6,7 @@ function ImportExportPlugin() { Download JSON\ '); this.btn_json_down.on('click', function(e){ - plugin.downloadJSON(data_objects, 'basic-app-data'); + plugin.downloadJSON(data_objects, 'basic-' + context); // Hide plugins $('#app-content-plugins-area').collapse('hide'); }) From b6cc7fc30a5c593773333f43ba327476a3f07e4a Mon Sep 17 00:00:00 2001 From: Uwe Kretschmer Date: Thu, 6 Dec 2018 12:58:02 +0100 Subject: [PATCH 3/7] Enabled CSV-Import to handle variant names of object with the same id. --- config.tpl.js | 13 +++++++++---- plugin-csv-imexport.js | 44 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/config.tpl.js b/config.tpl.js index 90f9df4..b1ab6ed 100644 --- a/config.tpl.js +++ b/config.tpl.js @@ -36,7 +36,8 @@ var config = { "statusElement": "status", "identifierElement": "ref", "identifierAbbreviation": "DNB", - "identifierBaseURL": "http://d-nb.info/gnd/" + "identifierBaseURL": "http://d-nb.info/gnd/", + "aliasElement": "alias" }, "places": { "titleElement": "name", @@ -44,7 +45,8 @@ var config = { "statusElement": "status", "identifierElement": "ref", "identifierAbbreviation": "GEO", - "identifierBaseURL": "http://www.geonames.org/" + "identifierBaseURL": "http://www.geonames.org/", + "aliasElement": "alias" }, "organisations":{ "titleElement": "name", @@ -52,7 +54,8 @@ var config = { "statusElement": "status", "identifierElement": "ref", "identifierAbbreviation": "DNB", - "identifierBaseURL": "http://d-nb.info/gnd/" + "identifierBaseURL": "http://d-nb.info/gnd/", + "aliasElement": "alias" } }, @@ -124,7 +127,9 @@ var config = { "localJSONPath": "name" },{ "displayName": "Namensvariante", - "JSONPath": "alternateNames.name" + "JSONPath": "alternateNames.name", + "localJSONPath": "alias", + "multiple": true },{ "displayName": "Breitengrad", "JSONPath": "lat" diff --git a/plugin-csv-imexport.js b/plugin-csv-imexport.js index 3b2c64b..ef66023 100644 --- a/plugin-csv-imexport.js +++ b/plugin-csv-imexport.js @@ -34,11 +34,13 @@ function CSVImportExportPlugin() { \ \