Add possibility to define icons for plugin-buttons
Change-Id: I4a30fa72953ae6136d5c5056c992bdadac135ffe
diff --git a/dev/demo/export.js b/dev/demo/export.js
index 09e126f..d7548b2 100644
--- a/dev/demo/export.js
+++ b/dev/demo/export.js
@@ -1,7 +1,7 @@
/**
* Export Demo
*
- * @author Helge
+ * @author Helge
*
*/
@@ -12,49 +12,50 @@
}
});
-
-require(['plugin/server', 'panel/result', 'init'], function (pluginClass, resultPanelClass){
+require([ 'plugin/server', 'panel/result', 'init' ], function(pluginClass, resultPanelClass) {
KorAP.Plugin = pluginClass.create();
// Add services container to head
document.head.appendChild(KorAP.Plugin.element());
-
- //Register result plugin
- KorAP.Plugin.register({
- 'name' : 'Export',
- 'desc' : 'Exports Kalamar results',
- // 'about' : 'https://localhost:5678/',
- 'embed' : [{
- 'panel' : 'result',
- 'title' : 'Export',
- 'classes' : ['export'],
- 'onClick' : {
- 'action' : 'addWidget',
- 'template' : 'http://localhost:7777/res/export.html'
- }
- }]
- });
- //Add result panel
- var show = {};
- var resultPanel = resultPanelClass.create(show);
-
- var resultInfo = document.getElementById('resultinfo');
- if (resultInfo != null) {
- // Move buttons to resultinfo
+ // Register result plugin
+ KorAP.Plugin.register({
+ 'name' : 'Export',
+ 'desc' : 'Exports Kalamar results',
+ // 'about' : 'https://localhost:5678/',
+ 'embed' : [ {
+ 'panel' : 'result',
+ 'title' : 'exports KWICs and snippets',
+ //Unicode-Code of the plugins button-icon, Font: Font Awesome
+ 'icon' : "\uf019",
+ 'classes' : [ 'button-icon', 'plugin' ],
+ 'onClick' : {
+ 'action' : 'addWidget',
+ 'template' : 'http://localhost:7777/res/export.html'
+ }
+ } ]
+ });
+
+ //Add result panel
+ var show = {};
+ var resultPanel = resultPanelClass.create(show);
+
+ var resultInfo = document.getElementById('resultinfo');
+ if (resultInfo != null) {
+ // Move buttons to resultinfo
resultInfo.appendChild(resultPanel.actions.element());
// The views are at the top of the search results
var sb = document.getElementById('search');
sb.insertBefore(resultPanel.element(), sb.firstChild);
- };
-
- // There is a koralQuery
- if (KorAP.koralQuery !== undefined) {
+ };
+
+ // There is a koralQuery
+ if (KorAP.koralQuery !== undefined) {
if (KorAP.koralQuery["errors"]) {
var errors = KorAP.koralQuery["errors"];
- for (var i in errors) {
+ for ( var i in errors) {
// Malformed query
if (errors[i][0] === 302 && errors[i][2]) {
@@ -66,9 +67,9 @@
// no query
else if (errors[i][0] === 301) {
obj.hint = hintClass.create();
- obj.hint.alert(0, errors[i][1]);
- }
+ obj.hint.alert(0, errors[i][1]);
}
- };
- };
+ }
+ };
+ };
});