From 39f08569a5e595a7622b8bb4ab27dbfcab502c62 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 7 Aug 2013 09:48:50 +0200 Subject: [PATCH 1/1] Custom names for wlxml tags/classes - first approach --- modules/documentToolbar/documentToolbar.js | 4 +-- modules/documentToolbar/template.html | 6 ++-- modules/nodePane/nodePane.js | 7 +++-- modules/nodePane/template.html | 6 ++-- utils/wlxml.js | 36 ++++++++++++++++++++++ 5 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 utils/wlxml.js diff --git a/modules/documentToolbar/documentToolbar.js b/modules/documentToolbar/documentToolbar.js index e4d5039..e3bc1eb 100644 --- a/modules/documentToolbar/documentToolbar.js +++ b/modules/documentToolbar/documentToolbar.js @@ -1,11 +1,11 @@ -define(['libs/jquery-1.9.1.min', 'libs/underscore-min', 'libs/text!./template.html'], function($, _, template) { +define(['libs/jquery-1.9.1.min', 'libs/underscore-min', 'utils/wlxml', 'libs/text!./template.html'], function($, _, wlxmlUtils, template) { 'use strict'; return function(sandbox) { var view = { - node: $(_.template(template)()), + node: $(_.template(template)({tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})), setup: function() { var view = this; diff --git a/modules/documentToolbar/template.html b/modules/documentToolbar/template.html index e521f25..86357bc 100644 --- a/modules/documentToolbar/template.html +++ b/modules/documentToolbar/template.html @@ -7,13 +7,13 @@ diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index 3a4a0ef..b723e68 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -2,14 +2,15 @@ define([ 'libs/text!./template.html', 'libs/jquery-1.9.1.min', 'libs/underscore-min', -'modules/nodePane/metaWidget/metaWidget' -], function(templateSrc, $, _, metaWidget) { +'modules/nodePane/metaWidget/metaWidget', +'utils/wlxml' +], function(templateSrc, $, _, metaWidget, wlxmlUtils) { 'use strict'; return function(sandbox) { - var view = $(_.template(templateSrc)()); + var view = $(_.template(templateSrc)({tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})); view.on('change', 'select', function(e) { var target = $(e.target); diff --git a/modules/nodePane/template.html b/modules/nodePane/template.html index a40e711..b9a1254 100644 --- a/modules/nodePane/template.html +++ b/modules/nodePane/template.html @@ -6,16 +6,16 @@
diff --git a/utils/wlxml.js b/utils/wlxml.js new file mode 100644 index 0000000..5f1b84d --- /dev/null +++ b/utils/wlxml.js @@ -0,0 +1,36 @@ +define([ + +], function() { + +'use strict'; + + + +return { + wlxmlTagNames: { + '': '', + section: 'sekcja', + header: 'nagłówek', + div: 'blok', + span: 'tekst', + aside: 'poboczny' + }, + wlxmlClassNames: { + '': '', + author: 'autor', + title: 'tytuł', + cite: 'cytat', + 'cite.code': 'cytat.kod', + 'cite.code.xml': 'cytat.kod.xml', + 'list.items': 'lista', + 'list.items.enum': 'lista.numerowana', + item: 'element', + uri: 'uri', + p: 'paragraf', + footnote: 'przypis', + todo: 'todo', + emp: 'wyróżnienie' + } +}; + +}); \ No newline at end of file -- 2.20.1