From: Aleksander Ɓukasz Date: Wed, 7 Aug 2013 13:42:54 +0000 (+0200) Subject: Custom wlxml tag/class names in breadcrumbs and familytree X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/967294bc545f6ae15e52f169927a89bd4a3b1122?ds=sidebyside Custom wlxml tag/class names in breadcrumbs and familytree --- diff --git a/modules/nodeBreadCrumbs/nodeBreadCrumbs.js b/modules/nodeBreadCrumbs/nodeBreadCrumbs.js index 34e514a..5e7fecd 100644 --- a/modules/nodeBreadCrumbs/nodeBreadCrumbs.js +++ b/modules/nodeBreadCrumbs/nodeBreadCrumbs.js @@ -1,7 +1,8 @@ define([ 'libs/jquery-1.9.1.min', 'libs/underscore-min', -'libs/text!./template.html'], function($, _, templateSrc) { +'utils/wlxml', +'libs/text!./template.html'], function($, _, wlxmlUtils, templateSrc) { 'use strict'; @@ -32,7 +33,7 @@ return function(sandbox) { this.dom.empty(); this.currentNodeElement = nodeElement; var parents = nodeElement.parents(); - this.dom.html(template({node: nodeElement, parents: parents})); + this.dom.html(template({node: nodeElement, parents: parents, tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})); this.dom.find('li > a[href="#"]').each(function(idx, a) { $(a).data('element', parents[parents.length - 1 - idx]); diff --git a/modules/nodeBreadCrumbs/template.html b/modules/nodeBreadCrumbs/template.html index 6c46613..afe44de 100644 --- a/modules/nodeBreadCrumbs/template.html +++ b/modules/nodeBreadCrumbs/template.html @@ -2,9 +2,9 @@ \ No newline at end of file diff --git a/modules/nodeFamilyTree/nodeFamilyTree.js b/modules/nodeFamilyTree/nodeFamilyTree.js index 0825506..688f353 100644 --- a/modules/nodeFamilyTree/nodeFamilyTree.js +++ b/modules/nodeFamilyTree/nodeFamilyTree.js @@ -1,8 +1,9 @@ define([ 'libs/jquery-1.9.1.min', 'libs/underscore-min', +'utils/wlxml', 'libs/text!./template.html' -], function($, _, templateSrc) { +], function($, _, wlxmlUtils, templateSrc) { 'use strict'; @@ -39,7 +40,7 @@ return function(sandbox) { if(nodeElementParent) { parent = { - repr: nodeElementParent.getWlxmlTag() + (nodeElementParent.getWlxmlClass() ? ' / ' + nodeElementParent.getWlxmlClass() : '') + repr: wlxmlUtils.wlxmlTagNames[nodeElementParent.getWlxmlTag()] + (nodeElementParent.getWlxmlClass() ? ' / ' + wlxmlUtils.wlxmlClassNames[nodeElementParent.getWlxmlClass()] : '') }; } @@ -58,7 +59,7 @@ return function(sandbox) { } children.push({repr: _.escape(text), bold: child.sameNode(textElement)}); } else { - children.push({repr: child.getWlxmlTag() + (child.getWlxmlClass() ? ' / ' + child.getWlxmlClass() : '')}); + children.push({repr: wlxmlUtils.wlxmlTagNames[child.getWlxmlTag()] + (child.getWlxmlClass() ? ' / ' + wlxmlUtils.wlxmlClassNames[child.getWlxmlClass()] : '')}); } }); this.dom.empty();