#459 wcag styles + now builds proprly

This commit is contained in:
krzysztofmadejski
2016-11-10 14:47:38 +00:00
parent 54e3824846
commit e9f6554eac
8 changed files with 44 additions and 15 deletions

View File

@@ -11,4 +11,4 @@ this.recline.View.translations['en'] = {
map_mapping: 'Coordinates source',
map_mapping_lat_lon: 'Latitude / Longitude fields',
map_mapping_geojson: 'GeoJSON field'
}
};

View File

@@ -63,4 +63,4 @@ this.recline.View.translations['pl'] = {
Cluster_markers: 'Łącz pobliskie punkty w grupy',
num_records: '<span class="doc-count">{recordCount}</span> rekordów'
}
};

View File

@@ -13,12 +13,11 @@ Backbone.I18nView = Backbone.View.extend({
this.cache[this.locale] = {};
},
formatMessage(key, values) {
this.cachedMsg.format(key, values);
},
// TODO how to use it from outside? an singleton instance of I18n? use case: pass translated strings into view initializer
t: function(key, values = {}, defaultMessage = null) {
t: function(key) {
this.t(key, {}, null);
},
t: function(key, values, defaultMessage) {
// get the message from current locale
var msg = recline.View.translations[this.locale][key];
@@ -38,8 +37,6 @@ Backbone.I18nView = Backbone.View.extend({
}
// TODO i18n documentation
try {
var formatter = this.cache[this.locale][msg];
if (formatter === undefined) {
@@ -61,7 +58,7 @@ Backbone.I18nView = Backbone.View.extend({
MustacheFormatter: function() {
var formatter = new Proxy(this, {
get(view, name) {
get: function(view, name) {
return function() {
var f = function (text, render) {
var trans = view.t(name, this, text);
@@ -73,7 +70,7 @@ Backbone.I18nView = Backbone.View.extend({
return f;
};
},
has(target, prop) {
has: function(target, prop) {
return true;
}
});

View File

@@ -448,10 +448,11 @@ my.GridControl= Backbone.I18nView.extend({
// Template for row edit menu , change it if you don't love
template: '<h1><button href="#" class="recline-row-add btn btn-default">{{t.Add_row}}</button></h1>',
initialize: function(options = {}){
initialize: function(options){
var self = this;
_.bindAll(this, 'render');
this.state = new recline.Model.ObjectState();
options = options || {};
this.initializeI18n(options.locale);
this.render();

View File

@@ -27,9 +27,10 @@ my.QueryEditor = Backbone.I18nView.extend({
'submit form': 'onFormSubmit'
},
initialize: function(options = {}) {
initialize: function(options) {
_.bindAll(this, 'render');
this.listenTo(this.model, 'change', this.render);
options = options || {};
this.initializeI18n(options.locale);
this.render();

View File

@@ -50,10 +50,12 @@ my.ValueFilter = Backbone.I18nView.extend({
'submit form.js-edit': 'onTermFiltersUpdate',
'submit form.js-add': 'onAddFilter'
},
initialize: function(options = {}) {
initialize: function(options) {
_.bindAll(this, 'render');
this.listenTo(this.model.fields, 'all', this.render);
this.listenTo(this.model.queryState, 'change change:filters:new-blank', this.render);
options = options || {};
this.initializeI18n(options.locale);
this.render();