diff --git a/app/js/arethusa.core/directives/arethusa_tool.js b/app/js/arethusa.core/directives/arethusa_tool.js new file mode 100644 index 000000000..3a4fec4e6 --- /dev/null +++ b/app/js/arethusa.core/directives/arethusa_tool.js @@ -0,0 +1,17 @@ +"use strict"; + +angular.module('arethusa.core').directive('arethusaTool', [ + function() { + return { + restrict: 'A', + scope: { + tool: '=arethusaTool', + }, + link: function(scope, element, attrs) { + var tool = scope.tool; + scope.uri = tool.uri; + }, + templateUrl: 'templates/arethusa.core/arethusa_tool.html' + }; + } +]); diff --git a/app/js/arethusa.core/directives/prov_tools.js b/app/js/arethusa.core/directives/prov_tools.js new file mode 100644 index 000000000..c0ec968da --- /dev/null +++ b/app/js/arethusa.core/directives/prov_tools.js @@ -0,0 +1,15 @@ +"use strict"; + +angular.module('arethusa.core').directive('provTools', [ + 'provTools', + function(provTools) { + return { + restrict: 'A', + scope: {}, + link: function(scope, element, attrs) { + scope.provTools = provTools; + }, + templateUrl: 'templates/arethusa.core/prov_tools.html' + }; + } +]); diff --git a/app/js/arethusa.core/prov_tools.js b/app/js/arethusa.core/prov_tools.js new file mode 100644 index 000000000..c6d013e25 --- /dev/null +++ b/app/js/arethusa.core/prov_tools.js @@ -0,0 +1,19 @@ +"use strict"; + +angular.module('arethusa.core').service('provTools', [ + 'Tool', + function(Tool) { + var self = this; + + this.perDocument = {}; + + this.addTool = function(docId, tool) { + var doc = self.perDocument[docId]; + if (!doc) doc = self.perDocument[docId] = []; + doc.push(new Tool(tool)); + self.toolsPresent = true; + }; + + this.toolsPresent = false; + } +]); diff --git a/app/js/arethusa.core/tool.js b/app/js/arethusa.core/tool.js new file mode 100644 index 000000000..f8b7390a4 --- /dev/null +++ b/app/js/arethusa.core/tool.js @@ -0,0 +1,9 @@ +"use strict"; + +angular.module('arethusa.core').factory('Tool', [ + function() { + return function(args) { + this.uri = args.uri; + }; + } +]); diff --git a/app/js/arethusa/treebank_retriever.js b/app/js/arethusa/treebank_retriever.js index 9cef30624..0df035768 100644 --- a/app/js/arethusa/treebank_retriever.js +++ b/app/js/arethusa/treebank_retriever.js @@ -12,8 +12,9 @@ angular.module('arethusa').factory('TreebankRetriever', [ 'idHandler', 'commons', 'editors', + 'provTools', function (configurator, documentStore, retrieverHelper, - idHandler, commons, editors) { + idHandler, commons, editors, provTools) { function parseDocument(json, docId) { var annotators = arethusaUtil.toAry(json.treebank.annotator || []); parseEditors(annotators, docId); @@ -30,6 +31,10 @@ angular.module('arethusa').factory('TreebankRetriever', [ page: annotator.url, mail: annotator.address }); + } else { + provTools.addTool(docId, { + uri: annotator.uri + }); } }); } diff --git a/app/templates/arethusa.core/arethusa_tool.html b/app/templates/arethusa.core/arethusa_tool.html new file mode 100644 index 000000000..a40438b25 --- /dev/null +++ b/app/templates/arethusa.core/arethusa_tool.html @@ -0,0 +1 @@ +{{ uri }} diff --git a/app/templates/arethusa.core/help_panel.html b/app/templates/arethusa.core/help_panel.html index 3a7ed707f..c50e8e047 100644 --- a/app/templates/arethusa.core/help_panel.html +++ b/app/templates/arethusa.core/help_panel.html @@ -42,6 +42,9 @@