first commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
(function () {
|
||||
TaxonomyTranslation.collections.TermRows = Backbone.Collection.extend({
|
||||
model: TaxonomyTranslation.models.TermRow
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,101 @@
|
||||
/*globals ajaxurl, jQuery, document, window, WPML_core, wpml_taxonomies */
|
||||
|
||||
var TaxonomyTranslation = TaxonomyTranslation || {};
|
||||
TaxonomyTranslation.classes = {
|
||||
instantiatedTermModels : {}
|
||||
};
|
||||
TaxonomyTranslation.models = {};
|
||||
TaxonomyTranslation.collections = {};
|
||||
TaxonomyTranslation.views = {};
|
||||
TaxonomyTranslation.mainView = {};
|
||||
TaxonomyTranslation.mainView.filterView = {};
|
||||
TaxonomyTranslation.data = {};
|
||||
TaxonomyTranslation.data.translatedTaxonomyLabels = {};
|
||||
TaxonomyTranslation.data.compiledTemplates = {};
|
||||
TaxonomyTranslation.data.syncData = {};
|
||||
|
||||
/* WCML compatibility */
|
||||
WPML_Translate_taxonomy = {};
|
||||
WPML_Translate_taxonomy.callbacks = jQuery.Callbacks();
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
jQuery(function () {
|
||||
|
||||
var loading = jQuery('.wpml_taxonomy_loading .spinner');
|
||||
if (loading.length) {
|
||||
loading.css({
|
||||
'visibility': 'visible',
|
||||
'float' : 'left'
|
||||
});
|
||||
loading.show();
|
||||
}
|
||||
jQuery('.icl_tt_main_bottom').hide();
|
||||
|
||||
TaxonomyTranslation.data.activeLanguages = wpml_taxonomies.activeLanguages;
|
||||
TaxonomyTranslation.data.allLanguages = wpml_taxonomies.allLanguages;
|
||||
TaxonomyTranslation.data.taxonomies = wpml_taxonomies.taxonomies;
|
||||
TaxonomyTranslation.util.init();
|
||||
|
||||
var headerHTML = WPML_core[ 'templates/taxonomy-translation/main.html' ]({taxonomies: TaxonomyTranslation.data.taxonomies});
|
||||
jQuery("#wpml_tt_taxonomy_translation_wrap").html(headerHTML);
|
||||
|
||||
// WCML compatibility
|
||||
var taxonomySwitcher = jQuery("#icl_tt_tax_switch");
|
||||
var potentialHiddenSelectInput = jQuery('#tax-selector-hidden');
|
||||
var potentialHiddenTaxInput = jQuery('#tax-preselected');
|
||||
var taxonomy;
|
||||
|
||||
if (potentialHiddenSelectInput.length !== 0 && potentialHiddenSelectInput.val() && potentialHiddenTaxInput.length !== 0 && potentialHiddenTaxInput.val()) {
|
||||
taxonomy = potentialHiddenTaxInput.val();
|
||||
taxonomySwitcher.closest('label').hide();
|
||||
jQuery('[id="term-table-header"]').hide();
|
||||
jQuery('[id="term-table-summary"]').hide();
|
||||
taxonomySwitcher.val(taxonomy);
|
||||
loadModelAndView(taxonomy);
|
||||
TaxonomyTranslation.mainView.showLoadingSpinner();
|
||||
} else if ((taxonomy = taxonomyFromLocation()) !== false) {
|
||||
taxonomySwitcher.val(taxonomy);
|
||||
switchToTaxonomy(taxonomy);
|
||||
} else {
|
||||
taxonomySwitcher.one("change", function () {
|
||||
switchToTaxonomy(jQuery(this).val());
|
||||
});
|
||||
}
|
||||
|
||||
function switchToTaxonomy(taxonomy){
|
||||
|
||||
loadModelAndView(taxonomy);
|
||||
TaxonomyTranslation.mainView.showLoadingSpinner();
|
||||
|
||||
jQuery("#icl_tt_tax_switch").on("change", function () {
|
||||
TaxonomyTranslation.mainView.showLoadingSpinner();
|
||||
jQuery('.icl_tt_main_bottom').hide();
|
||||
jQuery('#taxonomy-translation').html('');
|
||||
TaxonomyTranslation.mainView.selectTaxonomy();
|
||||
});
|
||||
}
|
||||
|
||||
function isSyncTab(){
|
||||
return window.location.search.substring(1).indexOf('&sync=1') > -1;
|
||||
}
|
||||
|
||||
function loadModelAndView(taxonomy){
|
||||
TaxonomyTranslation.classes.taxonomy = new TaxonomyTranslation.models.Taxonomy({taxonomy: taxonomy});
|
||||
TaxonomyTranslation.mainView = new TaxonomyTranslation.views.TaxonomyView({model: TaxonomyTranslation.classes.taxonomy}, {sync: isSyncTab()});
|
||||
}
|
||||
|
||||
function taxonomyFromLocation() {
|
||||
var queryString = window.location.search.substring(1);
|
||||
var taxonomy = false;
|
||||
Object.getOwnPropertyNames(TaxonomyTranslation.data.taxonomies).forEach(function (tax) {
|
||||
if (queryString.indexOf('taxonomy=' + tax) > -1) {
|
||||
taxonomy = tax;
|
||||
}
|
||||
});
|
||||
|
||||
return taxonomy;
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,257 @@
|
||||
/*globals labels, ajaxurl, TaxonomyTranslation, Backbone, jQuery, _, WPML_Translate_taxonomy */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
TaxonomyTranslation.models.Taxonomy = Backbone.Model.extend({
|
||||
|
||||
defaults: function () {
|
||||
return {
|
||||
name: false,
|
||||
taxonomy: false,
|
||||
terms: {},
|
||||
parents: {},
|
||||
termNames: {},
|
||||
showSlugTranslationField: true
|
||||
};
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
TaxonomyTranslation.data.termRowsCollection = new TaxonomyTranslation.collections.TermRows();
|
||||
this.setTaxonomy(this.get("taxonomy"));
|
||||
},
|
||||
|
||||
setTaxonomy: function (taxonomy) {
|
||||
this.set("taxonomy", taxonomy, {silent: true});
|
||||
TaxonomyTranslation.data.termRowsCollection.reset();
|
||||
|
||||
if (taxonomy !== undefined) {
|
||||
this.getTaxonomyTerms(taxonomy);
|
||||
} else {
|
||||
this.trigger('newTaxonomySet');
|
||||
}
|
||||
},
|
||||
|
||||
getTaxonomyTerms: function (taxonomy) {
|
||||
var self = this;
|
||||
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_get_terms_and_labels_for_taxonomy_table',
|
||||
nonce: labels.wpml_taxonomy_translation_nonce,
|
||||
taxonomy: taxonomy
|
||||
},
|
||||
success: function (response) {
|
||||
var termsData = response.terms;
|
||||
var labelsData = response.taxLabelTranslations;
|
||||
|
||||
if (response.defaultLanguage) {
|
||||
self.set('defaultLang', response.defaultLanguage);
|
||||
}
|
||||
|
||||
if (labelsData) {
|
||||
TaxonomyTranslation.data.translatedTaxonomyLabels = labelsData;
|
||||
TaxonomyTranslation.data.langSelector = response.taxLangSelector;
|
||||
if (labelsData.st_default_lang) {
|
||||
self.set('stDefaultLang', labelsData.st_default_lang);
|
||||
self.set('showSlugTranslationField', labelsData[ labelsData.st_default_lang ]['showSlugTranslationField']);
|
||||
}
|
||||
} else {
|
||||
TaxonomyTranslation.data.translatedTaxonomyLabels = false;
|
||||
}
|
||||
|
||||
if (response.bottomContent) {
|
||||
self.set('bottomContent', response.bottomContent);
|
||||
}
|
||||
|
||||
TaxonomyTranslation.data.resultsTruncated = response.resultsTruncated;
|
||||
|
||||
if (termsData) {
|
||||
self.processData(termsData);
|
||||
} else {
|
||||
self.trigger('newTaxonomySet');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
processData: function (termsData) {
|
||||
|
||||
var parentTermIDs = [],
|
||||
parents = {},
|
||||
termNames = {};
|
||||
|
||||
_.each(termsData, function (tridGroup) {
|
||||
var termsObject = {};
|
||||
_.each(TaxonomyTranslation.data.activeLanguages, function (lang, code) {
|
||||
var term;
|
||||
if (tridGroup[code] !== undefined && tridGroup[code].term_taxonomy_id) {
|
||||
term = new TaxonomyTranslation.models.Term(tridGroup[code]);
|
||||
var parent = term.get("parent");
|
||||
if (parent > 0) {
|
||||
parentTermIDs.push(parent);
|
||||
}
|
||||
termsObject[code] = term;
|
||||
termNames[tridGroup[code].term_taxonomy_id] = tridGroup[code].name;
|
||||
}
|
||||
});
|
||||
TaxonomyTranslation.data.termRowsCollection.add(new TaxonomyTranslation.models.TermRow({
|
||||
trid: tridGroup.trid,
|
||||
terms: termsObject
|
||||
}));
|
||||
});
|
||||
|
||||
_.each(termsData, function (tridGroup) {
|
||||
_.each(TaxonomyTranslation.data.activeLanguages, function (lang, code) {
|
||||
if (tridGroup[code] !== undefined && parentTermIDs.indexOf(tridGroup[code].term_id) !== -1) {
|
||||
parents[tridGroup[code].term_id] = tridGroup[code].name;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
this.set("parents", parents, {silent: true});
|
||||
this.set("termNames", termNames, {silent: true});
|
||||
|
||||
this.trigger('newTaxonomySet');
|
||||
},
|
||||
|
||||
getOriginalTerm: function ( trid ) {
|
||||
var row = TaxonomyTranslation.data.termRowsCollection.get(trid);
|
||||
var originalTerm = null;
|
||||
var terms = row.get("terms");
|
||||
_.each( terms, function ( term ) {
|
||||
if ( term.get( "source_language_code") === null ) {
|
||||
originalTerm = term;
|
||||
}
|
||||
});
|
||||
return originalTerm;
|
||||
},
|
||||
getOriginalTermMeta: function( trid ) {
|
||||
var originalTerm = this.getOriginalTerm(trid),
|
||||
term_metas = [],
|
||||
original_meta_data;
|
||||
|
||||
original_meta_data = originalTerm.get('meta_data');
|
||||
_.each( original_meta_data, function ( meta_data, meta_key ) {
|
||||
term_metas.push({
|
||||
'meta_key': meta_key,
|
||||
'meta_value': meta_data
|
||||
});
|
||||
});
|
||||
|
||||
return term_metas;
|
||||
},
|
||||
getTermName: function (termID) {
|
||||
|
||||
var res = "";
|
||||
if (termID > 0) {
|
||||
var termNames = this.get("termNames");
|
||||
res = termID in termNames ? termNames[termID] : "";
|
||||
}
|
||||
|
||||
return res;
|
||||
},
|
||||
saveLabel: function (singular, plural, slug, lang) {
|
||||
var self = this;
|
||||
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_tt_save_labels_translation',
|
||||
nonce: labels.wpml_taxonomy_translation_nonce,
|
||||
singular: singular,
|
||||
plural: plural,
|
||||
slug: slug,
|
||||
taxonomy_language_code: lang,
|
||||
taxonomy: self.get('taxonomy')
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.data) {
|
||||
var newLabelData = response.data;
|
||||
if (newLabelData.singular && newLabelData.general && newLabelData.lang) {
|
||||
TaxonomyTranslation.data.translatedTaxonomyLabels[newLabelData.lang] = {
|
||||
singular: newLabelData.singular,
|
||||
general: newLabelData.general,
|
||||
slug: newLabelData.slug
|
||||
};
|
||||
WPML_Translate_taxonomy.callbacks.fire('wpml_tt_save_term_translation', self.get('taxonomy'));
|
||||
self.trigger("labelTranslationSaved");
|
||||
|
||||
return self;
|
||||
}
|
||||
}
|
||||
self.trigger("saveFailed");
|
||||
return self;
|
||||
},
|
||||
error: function () {
|
||||
self.trigger("saveFailed");
|
||||
return self;
|
||||
}
|
||||
});
|
||||
},
|
||||
isHierarchical: function(){
|
||||
var self = this;
|
||||
|
||||
return TaxonomyTranslation.data.taxonomies[self.get("taxonomy")].hierarchical;
|
||||
},
|
||||
loadSyncData: function (lang) {
|
||||
var self = this;
|
||||
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_tt_sync_hierarchy_preview',
|
||||
_icl_nonce: labels.wpml_tt_sync_hierarchy_nonce,
|
||||
taxonomy: self.get('taxonomy'),
|
||||
ref_lang: lang
|
||||
},
|
||||
success: function (response) {
|
||||
TaxonomyTranslation.data.syncData = response.data;
|
||||
self.trigger('syncDataLoaded');
|
||||
}
|
||||
});
|
||||
},
|
||||
doSync: function (lang) {
|
||||
var self = this;
|
||||
var tax = self.get('taxonomy');
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_tt_sync_hierarchy_save',
|
||||
_icl_nonce: labels.wpml_tt_sync_hierarchy_nonce,
|
||||
taxonomy: tax,
|
||||
ref_lang: lang
|
||||
},
|
||||
success: function (response) {
|
||||
TaxonomyTranslation.data.syncData = response.data;
|
||||
self.setTaxonomy(tax);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
changeTaxStringsLanguage: function(sourceLang) {
|
||||
var self = this;
|
||||
var tax = self.get('taxonomy');
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_tt_change_tax_strings_language',
|
||||
nonce: labels.wpml_taxonomy_translation_nonce,
|
||||
taxonomy: tax,
|
||||
source_lang: sourceLang
|
||||
},
|
||||
success: function () {
|
||||
self.setTaxonomy(tax);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,124 @@
|
||||
/*globals TaxonomyTranslation, _, Backbone */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
TaxonomyTranslation.models.TermRow = Backbone.Model.extend({
|
||||
|
||||
defaults: function () {
|
||||
return {
|
||||
terms: {},
|
||||
trid: false,
|
||||
allTranslated: false,
|
||||
parents: {}
|
||||
};
|
||||
},
|
||||
|
||||
idAttribute: "trid",
|
||||
|
||||
initialize: function (data, options) {
|
||||
var self = this;
|
||||
self.updateAllTranslated();
|
||||
var parents = {};
|
||||
_.each(data.terms, function (term, lang) {
|
||||
parents[lang] = term.get("parent");
|
||||
});
|
||||
|
||||
self.set("parents", parents);
|
||||
},
|
||||
|
||||
parentOf: function (parentID) {
|
||||
var self = this;
|
||||
var parents = self.get("parents");
|
||||
var res = false;
|
||||
_.each(parents, function (parent, lang) {
|
||||
if (parent == parentID) {
|
||||
res = true;
|
||||
return res;
|
||||
}
|
||||
});
|
||||
|
||||
return res;
|
||||
},
|
||||
|
||||
add: function (term) {
|
||||
|
||||
if (!this.get("trid") && term.get("trid")) {
|
||||
this.set("trid", term.get("trid"), {silent: true});
|
||||
}
|
||||
|
||||
if (term.get("trid") == this.get("trid") && term.get("language_code") && term.get("name")) {
|
||||
var terms = this.get("terms");
|
||||
terms[term.get("language_code")] = term;
|
||||
this.set("terms", terms, {silent: true});
|
||||
}
|
||||
this.updateAllTranslated();
|
||||
},
|
||||
|
||||
updateAllTranslated: function () {
|
||||
var self = this;
|
||||
var terms = self.get("terms");
|
||||
self.set("allTranslated", true, {silent: true});
|
||||
_.each(TaxonomyTranslation.util.langCodes, function (lang) {
|
||||
if (terms === undefined || terms[lang] === undefined || !terms[lang].get("name")) {
|
||||
self.set("allTranslated", false, {silent: true});
|
||||
}
|
||||
});
|
||||
return self;
|
||||
},
|
||||
|
||||
allTermsTranslated: function () {
|
||||
this.updateAllTranslated();
|
||||
return this.get("allTranslated");
|
||||
},
|
||||
translatedIn: function (lang) {
|
||||
var self = this;
|
||||
var terms = self.get("terms");
|
||||
var res = true;
|
||||
if (terms === undefined || terms[lang] === undefined || !terms[lang].get("name")) {
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
matches: function (search) {
|
||||
var self = this;
|
||||
var res = false;
|
||||
_.each(TaxonomyTranslation.util.langCodes, function (lang) {
|
||||
if (self.matchesInLang(search, lang) === true) {
|
||||
res = true;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return res;
|
||||
},
|
||||
matchesInLang: function (search, lang) {
|
||||
var self = this;
|
||||
var terms = self.get("terms");
|
||||
var res = false;
|
||||
if (
|
||||
terms !== undefined &&
|
||||
terms[lang] !== undefined &&
|
||||
terms[lang].get("name") &&
|
||||
terms[lang].get("name").toLowerCase().indexOf(search.toLowerCase()) > -1
|
||||
) {
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
unSyncFilter: function () {
|
||||
var self = this;
|
||||
var syncData = TaxonomyTranslation.data.syncData;
|
||||
var terms = self.get("terms");
|
||||
var res = false;
|
||||
_.each(syncData, function (correction) {
|
||||
_.each(TaxonomyTranslation.util.langCodes, function (lang) {
|
||||
if (terms[lang] !== undefined && correction.translated_id == terms[lang].get('term_taxonomy_id')) {
|
||||
res = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,97 @@
|
||||
(function () {
|
||||
TaxonomyTranslation.models.Term = Backbone.Model.extend({
|
||||
|
||||
idAttribute: "term_taxonomy_id",
|
||||
|
||||
defaults: function () {
|
||||
return {
|
||||
name: false,
|
||||
trid: false,
|
||||
term_taxonomy_id: false,
|
||||
language_code: false,
|
||||
slug: false,
|
||||
parent: false,
|
||||
correctedParent: false,
|
||||
description: false,
|
||||
level: 0,
|
||||
correctedLevel: 0,
|
||||
source_language_code: false,
|
||||
meta_data: false
|
||||
};
|
||||
},
|
||||
|
||||
save: function (name, slug, description, meta_data) {
|
||||
var self = this;
|
||||
slug = slug ? slug : '';
|
||||
description = description ? description : '';
|
||||
|
||||
if (name) {
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_save_term',
|
||||
name: name,
|
||||
slug: slug,
|
||||
_icl_nonce: labels.wpml_save_term_nonce,
|
||||
description: description,
|
||||
trid: self.get("trid"),
|
||||
term_language_code: self.get("language_code"),
|
||||
taxonomy: TaxonomyTranslation.classes.taxonomy.get("taxonomy"),
|
||||
meta_data: meta_data,
|
||||
force_hierarchical_sync: true
|
||||
},
|
||||
success: function (response) {
|
||||
var newTermData = response.data;
|
||||
|
||||
if (newTermData.language_code && newTermData.trid && newTermData.slug && newTermData.term_taxonomy_id) {
|
||||
self.set(newTermData);
|
||||
self.trigger("translationSaved");
|
||||
WPML_Translate_taxonomy.callbacks.fire('wpml_tt_save_term_translation', TaxonomyTranslation.classes.taxonomy.get("taxonomy"));
|
||||
} else {
|
||||
self.trigger("saveFailed");
|
||||
}
|
||||
return self;
|
||||
},
|
||||
error: function(){
|
||||
self.trigger("saveFailed");
|
||||
return self;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
isOriginal: function() {
|
||||
return this.get( 'source_language_code' ) === null;
|
||||
},
|
||||
getNameSlugAndDescription: function () {
|
||||
var self = this;
|
||||
var term = {};
|
||||
term.slug = self.getSlug();
|
||||
|
||||
term.description = self.get("description");
|
||||
if ( ! term.description ) {
|
||||
term.description = "";
|
||||
}
|
||||
term.name = self.get("name");
|
||||
if ( ! term.name) {
|
||||
term.name = "";
|
||||
}
|
||||
return term;
|
||||
},
|
||||
getSlug: function () {
|
||||
var self = this;
|
||||
|
||||
var slug = self.get("slug");
|
||||
if (!slug) {
|
||||
slug = "";
|
||||
}
|
||||
slug = decodeURIComponent(slug);
|
||||
|
||||
return slug;
|
||||
},
|
||||
getMetaData: function() {
|
||||
return this.get('meta_data');
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,706 @@
|
||||
this["WPML_core"] = this["WPML_core"] || {};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/copy-all-popup.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<div class="icl_tt_form wpml-dialog" id="icl_tt_form_' +
|
||||
((__t = ( trid + '_' + lang )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( labels.copyToAllLanguages )) == null ? '' : __t) +
|
||||
'">\n\t<div class="wpml-dialog-body wpml-dialog-translate ">\n\n\t\t<p class="wpml-dialog-cols-icon">\n\t\t\t<i class="otgs-ico-copy wpml-dialog-icon-xl"></i>\n\t\t</p>\n\n\t\t<div class="wpml-dialog-cols-content">\n\t\t\t<p>\n\t\t\t\t' +
|
||||
((__t = ( copyMessage )) == null ? '' : __t) +
|
||||
'\n\t\t\t</p>\n\t\t\t<label><input type="checkbox" name="overwrite"> ' +
|
||||
((__t = ( labels.copyAllOverwrite )) == null ? '' : __t) +
|
||||
'</label>\n\t\t</div>\n\t\t<div class="wpml-dialog-footer ">\n\t\t\t<span class="errors icl_error_text"></span>\n\t\t\t<input class="cancel wpml-dialog-close-button alignleft" value="' +
|
||||
((__t = ( labels.cancel )) == null ? '' : __t) +
|
||||
'" type="button">\n\t\t\t<input class="button-primary js-copy-all-ok alignright" value="' +
|
||||
((__t = ( labels.Ok )) == null ? '' : __t) +
|
||||
'" type="submit">\n\t\t\t<span class="spinner alignright"></span>\n\t\t</div>\n\t</div>\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/filter.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<div class="icl-tt-tools tablenav top clearfix">\n\t';
|
||||
if ( mode === "translate" ) { ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( WPML_core[ "templates/taxonomy-translation/status-trans-select.html" ]( { taxonomy: taxonomy } ) )) == null ? '' : __t) +
|
||||
'\n\t\t<label for="in-lang" id="in-lang-label" class="hidden">' +
|
||||
((__t = (labels.in)) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<select name="language" id="in-lang" class="hidden">\n\t\t\t\t<option value="all">' +
|
||||
((__t = ( labels.anyLang )) == null ? '' : __t) +
|
||||
'</option>\n\t\t\t\t';
|
||||
_.each(langs, function( lang, code ) { ;
|
||||
__p += '\n\t\t\t\t\t<option value="' +
|
||||
((__t = ( code )) == null ? '' : __t) +
|
||||
'">' +
|
||||
((__t = ( lang.label )) == null ? '' : __t) +
|
||||
'</option>\n\t\t\t\t';
|
||||
}); ;
|
||||
__p += '\n\t\t\t</select>\n\t\t<div class="alignright">\n\t\t\t<input type="text" name="search" id="tax-search" placeholder="' +
|
||||
((__t = ( labels.searchPlaceHolder )) == null ? '' : __t) +
|
||||
'" value="">\n\t\t</div>\n\t';
|
||||
} else { ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( labels.refLang.replace( "%language%", WPML_core[ "templates/taxonomy-translation/ref_sync_select.html" ]( { taxonomy:taxonomy, langs:langs } ) ) )) == null ? '' : __t) +
|
||||
'\n\t';
|
||||
} ;
|
||||
__p += '\n\t<span class="spinner"></span>\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/individual-label.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<a class="icl_tt_label" id="' +
|
||||
((__t = (taxonomy)) == null ? '' : __t) +
|
||||
'_' +
|
||||
((__t = (lang)) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
': ' +
|
||||
((__t = ( labels.editTranslation )) == null ? '' : __t) +
|
||||
'">\n\t<i class="otgs-ico-edit"></i>\n</a>\n<div id="popup-' +
|
||||
((__t = (lang)) == null ? '' : __t) +
|
||||
'"></div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/label-popup.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<div class="icl_tt_form wpml-dialog" id="icl_tt_form_' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( labels.labelPopupDialogTitle )) == null ? '' : __t) +
|
||||
'">\n\t<div class="wpml-dialog-body wpml-dialog-translate ">\n\t\t<header class="wpml-term-translation-header">\n\t\t\t<h3 class="wpml-header-original">' +
|
||||
__e( labels.original ) +
|
||||
' <span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( langs[ source_lang ].flag )) == null ? '' : __t) +
|
||||
'"></span><strong>' +
|
||||
__e( langs[ source_lang ].label ) +
|
||||
'</strong></h3>\n\t\t\t<h3 class="wpml-header-translation">' +
|
||||
__e( labels.translationTo ) +
|
||||
' <span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( langs[ lang ].flag )) == null ? '' : __t) +
|
||||
'"></span><strong>' +
|
||||
__e( langs[ lang ].label ) +
|
||||
'</strong></h3>\n\t\t</header>\n\t\n\t\t<div class="wpml-form-row">\n\t\t\t<label for="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-singular">' +
|
||||
__e( labels.Singular ) +
|
||||
'</label>\n\t\t\t<input readonly id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-singular-original" value="' +
|
||||
__e( originalLabels.singular ) +
|
||||
'" type="text">\n\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
__e( labels.copyFromOriginal ) +
|
||||
'"></button>\n\t\t\t<input class="js-translation js-required-translation" id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-singular" value="' +
|
||||
__e( translatedLabels.singular ) +
|
||||
'" type="text">\n\t\t</div>\n\t\n\t\t<div class="wpml-form-row">\n\t\t\t<label for="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-plural">' +
|
||||
__e( labels.Plural ) +
|
||||
'</label>\n\t\t\t<input readonly id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-plural-original" value="' +
|
||||
__e(originalLabels.general ) +
|
||||
'" type="text">\n\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
__e( labels.copyFromOriginal ) +
|
||||
'"></button>\n\t\t\t<input class="js-translation js-required-translation" id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-plural" value="' +
|
||||
__e( translatedLabels.general ) +
|
||||
'" type="text">\n\t\t</div>\n\n\t\t';
|
||||
if( slugTranslationEnabled ) { ;
|
||||
__p += '\n\t\t\t<div class="wpml-form-row js-slug-translation-wrapper">\n\t\t\t\t<label for="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-slug">' +
|
||||
__e( labels.Slug ) +
|
||||
'</label>\n\t\t\t\t<input readonly id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-slug-original" value="' +
|
||||
__e(originalLabels.slug ) +
|
||||
'" type="text">\n\t\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
__e( labels.copyFromOriginal ) +
|
||||
'"></button>\n\t\t\t\t<input class="js-translation" id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'-slug" value="' +
|
||||
__e( translatedLabels.slug ) +
|
||||
'" type="text">\n\t\t\t</div>\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t\n\t\t<div class="wpml-dialog-footer ">\n\t\t\t<span class="errors icl_error_text"></span>\n\t\t\t<input class="cancel wpml-dialog-close-button alignleft" value="' +
|
||||
__e( labels.cancel ) +
|
||||
'" type="button">\n\t\t\t<input class="button-primary js-label-save alignright" value="' +
|
||||
__e( labels.save ) +
|
||||
'" type="submit">\n\t\t\t<span class="spinner alignright"></span>\n\t\t</div>\t\n\t</div>\n</div>\n\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/main.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<label for="icl_tt_tax_switch">\n\t' +
|
||||
((__t = (labels.taxToTranslate)) == null ? '' : __t) +
|
||||
'\n\t<select id="icl_tt_tax_switch">\n\t\t<option disabled selected> -- ' +
|
||||
((__t = (labels.taxonomy)) == null ? '' : __t) +
|
||||
' --</option>\n\t\t';
|
||||
_.each(taxonomies, function(taxonomy, index){ ;
|
||||
__p += '\n\t\t\t<option value="' +
|
||||
((__t = (index)) == null ? '' : __t) +
|
||||
'">\n\t\t\t\t' +
|
||||
((__t = (taxonomy.label)) == null ? '' : __t) +
|
||||
'\n\t\t\t</option>\n\t';
|
||||
}); ;
|
||||
__p += '\n\t</select>\n</label>\n<div class="wpml-loading-taxonomy"><span class="spinner is-active"></span>' +
|
||||
((__t = (labels.preparingTermsData)) == null ? '' : __t) +
|
||||
'</div>\n<div id="taxonomy-translation">\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/nav.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<div class="tablenav bottom">\n\t<div class="tablenav-pages" id="taxonomy-terms-table-nav">\n\t\t<span class="displaying-num">\n\t\t\t';
|
||||
if(pages > 1) { ;
|
||||
__p += '\n\t\t\t\t' +
|
||||
((__t = (items)) == null ? '' : __t) +
|
||||
' ' +
|
||||
((__t = (labels.items)) == null ? '' : __t) +
|
||||
'\n\t\t\t';
|
||||
} else if(pages === 1) {;
|
||||
__p += '\n\t\t\t\t1 ' +
|
||||
((__t = (labels.item)) == null ? '' : __t) +
|
||||
'\n\t\t\t';
|
||||
} ;
|
||||
__p += '\n\t\t</span>\n\t\t<a class="first-page ';
|
||||
if(page <= 1 ){ ;
|
||||
__p += ' disabled ';
|
||||
} ;
|
||||
__p += '" href="###" title="' +
|
||||
((__t = (labels.goToFirstPage)) == null ? '' : __t) +
|
||||
'">«</a>\n\t\t<a href="###" title="' +
|
||||
((__t = (labels.goToPreviousPage)) == null ? '' : __t) +
|
||||
'" class="prev-page ';
|
||||
if(page < 2 ) {;
|
||||
__p += ' disabled';
|
||||
} ;
|
||||
__p += '">‹</a>\n\t\t<input class="current-page" size="1" value="' +
|
||||
((__t = (page)) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = (labels.currentPage)) == null ? '' : __t) +
|
||||
'" type="text"/>\n\t\t' +
|
||||
((__t = ( labels.of )) == null ? '' : __t) +
|
||||
' <span class="total-pages">' +
|
||||
((__t = ( pages )) == null ? '' : __t) +
|
||||
'</span>\n\t\t<a class="next-page ';
|
||||
if(page == pages ) {;
|
||||
__p += ' disabled ';
|
||||
} ;
|
||||
__p += '" href="###" title="' +
|
||||
((__t = (labels.goToNextPage)) == null ? '' : __t) +
|
||||
'">›</a>\n\t\t<a class="last-page ';
|
||||
if(page == pages ) {;
|
||||
__p += ' disabled ';
|
||||
} ;
|
||||
__p += '" href="###" title="' +
|
||||
((__t = (labels.goToLastPage)) == null ? '' : __t) +
|
||||
'">»</a>\n\t</div>\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/no-terms-found.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<tr>\n\t<td colspan="2">\n\t\t<h2 class="text-center">' +
|
||||
((__t = ( message )) == null ? '' : __t) +
|
||||
'</h2>\n\t</td>\n</tr>';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/not-translated-label.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<a class="icl_tt_label lowlight" id="' +
|
||||
((__t = ( taxonomy )) == null ? '' : __t) +
|
||||
'_' +
|
||||
((__t = ( lang )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
': ' +
|
||||
((__t = ( labels.addTranslation )) == null ? '' : __t) +
|
||||
'" >\n\t<i class="otgs-ico-add"></i>\n</a>\n<div id="popup-' +
|
||||
((__t = ( lang )) == null ? '' : __t) +
|
||||
'"></div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/original-label-disabled.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<span title="' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
': ' +
|
||||
((__t = ( labels.originalLanguage )) == null ? '' : __t) +
|
||||
'">\n\t<i class="otgs-ico-original"></i>\n</span>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/original-label.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<td class="wpml-col-title">\n\t<span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( flag )) == null ? '' : __t) +
|
||||
'"></span><strong>' +
|
||||
((__t = ( taxLabel.singular + ' / ' + taxLabel.general )) == null ? '' : __t) +
|
||||
'</strong>\n\t<p>\n\t\t';
|
||||
if(!langSelector){ ;
|
||||
__p += '<a href="#" class="js-show-lang-selector">' +
|
||||
((__t = ( labels.changeLanguage )) == null ? '' : __t) +
|
||||
'</a>';
|
||||
} ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( langSelector )) == null ? '' : __t) +
|
||||
'\n\t</p>\n</td>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/original-term-popup.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<div class="icl_tt_form wpml-dialog" id="icl_tt_form_' +
|
||||
((__t = ( trid + '_' + lang )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( labels.originalTermPopupDialogTitle )) == null ? '' : __t) +
|
||||
'">\n\t<div class="wpml-dialog-body wpml-dialog-translate ">\n\t\t<header class="wpml-term-translation-header">\n\t\t\t<h3 class="wpml-header-original-no-translation">' +
|
||||
((__t = ( labels.original )) == null ? '' : __t) +
|
||||
' <span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( langs[ lang ].flag )) == null ? '' : __t) +
|
||||
'"></span><strong>' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
'</strong></h3>\n\t\t</header>\n\t\n\t\t<div class="wpml-form-row-no-translation">\n\t\t\t<label for="term-name">' +
|
||||
((__t = ( labels.Name )) == null ? '' : __t) +
|
||||
'</label >\n\t\t\t<input id="term-name" value="' +
|
||||
((__t = ( term.name )) == null ? '' : __t) +
|
||||
'" type="text">\n\t\t</div>\n\n\t\t<div class="wpml-form-row-no-translation">\n\t\t\t<label for="term-slug">' +
|
||||
((__t = ( labels.Slug )) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<input id="term-slug" value="' +
|
||||
((__t = ( term.slug )) == null ? '' : __t) +
|
||||
'" type="text">\n\t\t</div>\n\t\t<div class="wpml-form-row-no-translation">\n\t\t\t<label for="term-description">' +
|
||||
((__t = ( labels.Description )) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<textarea id="term-description" cols="22" rows="4">' +
|
||||
((__t = ( term.description )) == null ? '' : __t) +
|
||||
'</textarea>\n\t\t</div>\n\t\t<div class="wpml-dialog-footer ">\n\t\t\t<span class="errors icl_error_text"></span>\n\t\t\t<input class="cancel wpml-dialog-close-button alignleft" value="' +
|
||||
((__t = ( labels.cancel )) == null ? '' : __t) +
|
||||
'" type="button">\n\t\t\t<input class="button-primary term-save alignright" value="' +
|
||||
((__t = ( labels.save )) == null ? '' : __t) +
|
||||
'" type="submit">\n\t\t\t<span class="spinner alignright"></span>\n\t\t</div>\t\n\t</div>\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/original-term.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<a class="icl_tt_term_name"\tid="' +
|
||||
((__t = (trid + '-' + lang)) == null ? '' : __t) +
|
||||
'">\n\t<span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( langs[ lang ].flag )) == null ? '' : __t) +
|
||||
'"></span>\n\t<strong>\n\t\t';
|
||||
if(!name){ ;
|
||||
__p += '\n\t\t\t' +
|
||||
((__t = (labels.lowercaseTranslate)) == null ? '' : __t) +
|
||||
'\n\t\t';
|
||||
} else { ;
|
||||
__p += '\n\t\t\t';
|
||||
if ( level > 0 ) { ;
|
||||
__p += '\n\t\t\t\t' +
|
||||
((__t = (Array(level+1).join('—') + " ")) == null ? '' : __t) +
|
||||
'\n\t\t\t';
|
||||
} ;
|
||||
__p += '\n\t\t\t' +
|
||||
((__t = (name)) == null ? '' : __t) +
|
||||
'\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t</strong>\n</a>\n<div id="' +
|
||||
((__t = (trid + '-popup-' + lang)) == null ? '' : __t) +
|
||||
'"></div>\n<div class="row-actions">\n\t<a class="js-copy-to-all-langs">' +
|
||||
((__t = ( labels.copyToAllLanguages )) == null ? '' : __t) +
|
||||
'</a>\n</div>\n\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/ref_sync_select.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<select id="in-lang" name="language">\n\t';
|
||||
_.each( langs, function( lang, code ) { ;
|
||||
__p += '\n\t\t<option value="' +
|
||||
((__t = (code)) == null ? '' : __t) +
|
||||
'">' +
|
||||
((__t = ( lang.label )) == null ? '' : __t) +
|
||||
'</option>\n\t';
|
||||
}); ;
|
||||
__p += '\n</select>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/status-trans-select.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<div class="alignleft">\n\t<label for="status-select">' +
|
||||
((__t = (labels.Show)) == null ? '' : __t) +
|
||||
'</label>\n\t<select id="status-select" name="status">\n\t\t<option value="0">' +
|
||||
((__t = (labels.all + ' ' + taxonomy.label)) == null ? '' : __t) +
|
||||
'</option>\n\t\t<option value="1">' +
|
||||
((__t = (labels.untranslated + ' ' + taxonomy.label)) == null ? '' : __t) +
|
||||
'</option>\n\t</select>\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/table.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<table class="widefat striped fixed ' +
|
||||
((__t = ( ( mode !== 'sync' )? 'wpml-tt-table' : 'wpml-tt-sync-table' )) == null ? '' : __t) +
|
||||
'" id="tax-table-' +
|
||||
((__t = (tableType)) == null ? '' : __t) +
|
||||
'">\n\t<thead>\n\t\t<tr>\n\t\t\t';
|
||||
if ( mode !== 'sync' ) { ;
|
||||
__p += '\n\t\t\t\t<th class="wpml-col-title">' +
|
||||
((__t = ( firstColumnHeading )) == null ? '' : __t) +
|
||||
'</th>\n\t\t\t\t<th class="wpml-col-languages">\n\t\t\t\t\t';
|
||||
_.each(langs, function( lang ) { ;
|
||||
__p += '\n\t\t\t\t\t\t<span title="' +
|
||||
((__t = ( lang.label )) == null ? '' : __t) +
|
||||
'"><img src="' +
|
||||
((__t = ( lang.flag )) == null ? '' : __t) +
|
||||
'" alt="' +
|
||||
((__t = ( lang.label )) == null ? '' : __t) +
|
||||
'"></span>\n\t\t\t\t\t';
|
||||
}); ;
|
||||
__p += '\n\t\t\t\t</th>\n\t\t\t';
|
||||
} else { ;
|
||||
__p += '\n\t\t\t\t';
|
||||
_.each(langs, function( lang ) { ;
|
||||
__p += '\n\t\t\t\t\t<th class="wpml-col-ttsync">\n\t\t\t\t\t\t<span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( lang.flag )) == null ? '' : __t) +
|
||||
'" alt="' +
|
||||
((__t = ( lang.label )) == null ? '' : __t) +
|
||||
'"></span>' +
|
||||
((__t = ( lang.label )) == null ? '' : __t) +
|
||||
'\n\t\t\t\t\t</th>\n\t\t\t\t';
|
||||
}); ;
|
||||
__p += '\n\t\t\t';
|
||||
} ;
|
||||
__p += '\n\t\t</tr>\n\t</thead>\n</table>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/tabs.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<div id="term-table-tab-controls" class="wpml-tabs">\n\t<button class="nav-tab ' +
|
||||
((__t = ( ( mode ==='translate' ? 'nav-tab-active' : '' ) )) == null ? '' : __t) +
|
||||
'" id="term-table-header">' +
|
||||
((__t = ( headerTerms )) == null ? '' : __t) +
|
||||
'</button>\n\t';
|
||||
if( taxonomy.hierarchical ) {;
|
||||
__p += '\n\t\t<button class="nav-tab ' +
|
||||
((__t = ( ( mode ==='sync' ? 'nav-tab-active' : '' ) )) == null ? '' : __t) +
|
||||
'" id="term-table-sync-header">' +
|
||||
((__t = ( syncLabel )) == null ? '' : __t) +
|
||||
'</button>\n\t';
|
||||
} ;
|
||||
__p += '\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/taxonomy-main-wrap.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<div class="wpml-wrap">\n\t';
|
||||
if ( mode === 'translate' ) { ;
|
||||
__p += '\n\t\t<h3 id="term-table-summary">' +
|
||||
((__t = ( summaryTerms )) == null ? '' : __t) +
|
||||
'</h3>\n\t\t';
|
||||
if ( TaxonomyTranslation.data.resultsTruncated ) { ;
|
||||
__p += '\n\t\t<div class="icl-admin-message-warning"><p>' +
|
||||
((__t = ( resultsTruncated )) == null ? '' : __t) +
|
||||
'</p></div>\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t\t<div id="wpml-taxonomy-translation-filters"></div>\n\t\t<div id="wpml-taxonomy-translation-terms-table"></div>\n\t\t<div id="wpml-taxonomy-translation-terms-nav"></div>\n\n\t\t<h3 id="term-label-summary">' +
|
||||
((__t = ( labelSummary )) == null ? '' : __t) +
|
||||
'</h3>\n\t\t';
|
||||
if ( TaxonomyTranslation.data.translatedTaxonomyLabels ) { ;
|
||||
__p += '\n\t\t\t<div id="wpml-taxonomy-translation-labels-table"></div>\n\t\t';
|
||||
} else { ;
|
||||
__p += '\n\t\t\t<div class="otgs-notice notice notice-warning"><p>' +
|
||||
((__t = ( labels.activateStringTranslation )) == null ? '' : __t) +
|
||||
'</p></div>\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t';
|
||||
} else if ( mode === 'sync' ) { ;
|
||||
__p += '\n\t\t<div id="wpml-taxonomy-translation-filters"></div>\n\t\t';
|
||||
if ( hasContent ) { ;
|
||||
__p += '\n\t\t\t<div id="wpml-taxonomy-translation-terms-table"></div>\n\t\t\t<div id="wpml-taxonomy-translation-terms-nav"></div>\n\t\t\t<div class="wpml-tt-sync-section">\n\t\t\t\t<div class="wpml-tt-sync-legend">\n\t\t\t\t\t<strong>' +
|
||||
((__t = ( labels.legend )) == null ? '' : __t) +
|
||||
'</strong>\n\t\t\t\t\t<span class="wpml-parent-added" style="background-color:#CCFF99;">' +
|
||||
((__t = ( labels.willBeAdded )) == null ? '' : __t) +
|
||||
'</span>\n\t\t\t\t\t<span class="wpml-parent-removed" style="background-color:#F55959;">' +
|
||||
((__t = ( labels.willBeRemoved )) == null ? '' : __t) +
|
||||
'</span>\n\t\t\t\t</div>\n\t\t\t\t<div class="wpml-tt-sync-action">\n\t\t\t\t\t<input type="submit" class="button-primary button-lg" value="' +
|
||||
((__t = ( labels.synchronizeBtn )) == null ? '' : __t) +
|
||||
'" id="tax-apply">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t';
|
||||
} else { ;
|
||||
__p += '\n\t\t\t<h2 class="text-center">' +
|
||||
((__t = ( labelSynced )) == null ? '' : __t) +
|
||||
'</h2>\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t';
|
||||
} ;
|
||||
__p += '\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/term-not-synced.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<span class="icl_tt_term_name_sync" id="' +
|
||||
((__t = (trid + '-' + lang)) == null ? '' : __t) +
|
||||
'">\n\t';
|
||||
if ( name ) { ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( parent )) == null ? '' : __t) +
|
||||
'</br>\n\t\t';
|
||||
if ( level > 0 ) { ;
|
||||
__p += '\n\t\t\t' +
|
||||
((__t = ( Array(level+1).join('—') + " " )) == null ? '' : __t) +
|
||||
'\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( name )) == null ? '' : __t) +
|
||||
'\n\t';
|
||||
} ;
|
||||
__p += '\n</span>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/term-not-translated.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<a class="icl_tt_term_name lowlight" id="' +
|
||||
((__t = ( trid + '-' + lang )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
': ' +
|
||||
((__t = ( labels.addTranslation )) == null ? '' : __t) +
|
||||
'" >\n\t<i class="otgs-ico-add"></i>\n</a>\n<div id="' +
|
||||
((__t = ( trid + '-popup-' + lang )) == null ? '' : __t) +
|
||||
'"></div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/term-original-disabled.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<span title="' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
': ' +
|
||||
((__t = ( labels.originalLanguage )) == null ? '' : __t) +
|
||||
'">\n\t<i class="otgs-ico-original"></i>\n</span>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/term-popup.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<div class="icl_tt_form wpml-dialog" id="icl_tt_form_' +
|
||||
((__t = ( trid + '_' + lang )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( labels.termPopupDialogTitle )) == null ? '' : __t) +
|
||||
'">\n\t<div class="wpml-dialog-body wpml-dialog-translate ">\n\t\t<header class="wpml-term-translation-header">\n\t\t\t<h3 class="wpml-header-original">' +
|
||||
((__t = ( labels.original )) == null ? '' : __t) +
|
||||
' <span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( langs[ source_lang ].flag )) == null ? '' : __t) +
|
||||
'"></span><strong>' +
|
||||
((__t = ( langs[ source_lang ].label )) == null ? '' : __t) +
|
||||
'</strong></h3>\n\t\t\t<h3 class="wpml-header-translation">' +
|
||||
((__t = ( labels.translationTo )) == null ? '' : __t) +
|
||||
' <span class="wpml-title-flag"><img src="' +
|
||||
((__t = ( langs[ lang ].flag )) == null ? '' : __t) +
|
||||
'"></span><strong>' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
'</strong></h3>\n\t\t</header>\n\t\n\t\t<div class="wpml-form-row">\n\t\t\t<label for="term-name">' +
|
||||
((__t = ( labels.Name )) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<input readonly id="term-name-original" value="' +
|
||||
((__t = ( original_term.name )) == null ? '' : __t) +
|
||||
'" type="text">\n\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
((__t = ( labels.copyFromOriginal )) == null ? '' : __t) +
|
||||
'"></button>\n\t\t\t<input id="term-name" value="' +
|
||||
((__t = ( term.name )) == null ? '' : __t) +
|
||||
'" type="text">\n\t\t</div>\n\t\n\t\t<div class="wpml-form-row">\n\t\t\t<label for="term-slug">' +
|
||||
((__t = ( labels.Slug )) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<input readonly id="term-slug-original" value="' +
|
||||
((__t = ( original_term.slug )) == null ? '' : __t) +
|
||||
'" type="text">\n\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
((__t = ( labels.copyFromOriginal )) == null ? '' : __t) +
|
||||
'"></button>\n\t\t\t<input id="term-slug" value="' +
|
||||
((__t = ( term.slug )) == null ? '' : __t) +
|
||||
'" type="text">\n\t\t</div>\n\t\t<div class="wpml-form-row">\n\t\t\t<label for="term-description">' +
|
||||
((__t = ( labels.Description )) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<textarea readonly id="term-description-original" cols="22" rows="4">' +
|
||||
((__t = ( original_term.description )) == null ? '' : __t) +
|
||||
'</textarea>\n\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
((__t = ( labels.copyFromOriginal )) == null ? '' : __t) +
|
||||
'"></button>\n\t\t\t<textarea id="term-description" cols="22" rows="4">' +
|
||||
((__t = ( term.description )) == null ? '' : __t) +
|
||||
'</textarea>\n\t\t</div>\n\t\t';
|
||||
if ( original_term_meta.length ) { ;
|
||||
__p += '\n\t\t\t<hr>\n\t\t\t<label>' +
|
||||
((__t = ( labels.termMetaLabel)) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t<div class="wpml-form-row">\n\t\t\t\t';
|
||||
_.each(original_term_meta, function(meta_data){ ;
|
||||
__p += '\n\t\t\t\t\t<label for="term-meta">' +
|
||||
((__t = ( meta_data.meta_key )) == null ? '' : __t) +
|
||||
'</label>\n\t\t\t\t\t<input readonly value="' +
|
||||
__e( meta_data.meta_value ) +
|
||||
'" type="text">\n\t\t\t\t\t<button class="button-copy button-secondary js-button-copy otgs-ico-copy" title="' +
|
||||
((__t = ( labels.copyFromOriginal )) == null ? '' : __t) +
|
||||
'"></button>\n\t\t\t\t\t<input name="term-meta" class="term-meta" data-meta-key="' +
|
||||
((__t = ( meta_data.meta_key )) == null ? '' : __t) +
|
||||
'" value="' +
|
||||
__e( term_meta[meta_data.meta_key] ) +
|
||||
'" type="text">\n\t\t\t\t';
|
||||
}); ;
|
||||
__p += '\n\t\t\t</div>\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t</div>\n\t<div class="wpml-dialog-footer ">\n\t\t<span class="errors icl_error_text"></span>\n\t\t<input class="cancel wpml-dialog-close-button alignleft" value="' +
|
||||
((__t = ( labels.cancel )) == null ? '' : __t) +
|
||||
'" type="button">\n\t\t<input class="button-primary term-save alignright" value="' +
|
||||
((__t = ( labels.save )) == null ? '' : __t) +
|
||||
'" type="submit">\n\t\t<span class="spinner alignright"></span>\n\t</div>\n</div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/term-synced.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
with (obj) {
|
||||
__p += '<span class="icl_tt_term_name_sync" id="' +
|
||||
((__t = (trid + '-' + lang)) == null ? '' : __t) +
|
||||
'">\n\t';
|
||||
if ( name ) { ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( parent )) == null ? '' : __t) +
|
||||
'\n\t\t';
|
||||
if ( level > 0 ) { ;
|
||||
__p += '\n\t\t\t</br>\n\t\t\t' +
|
||||
((__t = ( Array(level+1).join('—') + " " )) == null ? '' : __t) +
|
||||
'\n\t\t';
|
||||
} ;
|
||||
__p += '\n\t\t' +
|
||||
((__t = ( name )) == null ? '' : __t) +
|
||||
'\n\t';
|
||||
} ;
|
||||
__p += '\n</span>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
|
||||
this["WPML_core"]["templates/taxonomy-translation/term-translated.html"] = function(obj) {
|
||||
obj || (obj = {});
|
||||
var __t, __p = '', __e = _.escape;
|
||||
with (obj) {
|
||||
__p += '<a class="icl_tt_term_name " id="' +
|
||||
((__t = ( trid + '-' + lang )) == null ? '' : __t) +
|
||||
'" title="' +
|
||||
((__t = ( langs[ lang ].label )) == null ? '' : __t) +
|
||||
': ' +
|
||||
((__t = ( labels.editTranslation )) == null ? '' : __t) +
|
||||
'">\n\t<i class="otgs-ico-edit"></i>\n</a>\n<div id="' +
|
||||
((__t = ( trid + '-popup-' + lang )) == null ? '' : __t) +
|
||||
'"></div>\n';
|
||||
|
||||
}
|
||||
return __p
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
(function () {
|
||||
TaxonomyTranslation.util = {
|
||||
langCodes: [],
|
||||
init: function () {
|
||||
_.each(TaxonomyTranslation.data.activeLanguages, function (lang, code) {
|
||||
TaxonomyTranslation.util.langCodes.push(code);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,105 @@
|
||||
/*globals labels, TaxonomyTranslation, Backbone, WPML_core, jQuery, _ */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
TaxonomyTranslation.views.CopyAllPopUpView = Backbone.View.extend({
|
||||
|
||||
tagName: 'div',
|
||||
template: WPML_core[ 'templates/taxonomy-translation/copy-all-popup.html' ],
|
||||
model: TaxonomyTranslation.models.TermRow,
|
||||
|
||||
events: {
|
||||
'click .cancel': 'close',
|
||||
'click .js-copy-all-ok': 'copyAll'
|
||||
},
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
self.dialog = null;
|
||||
return self;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
||||
var self = this,
|
||||
trid = self.model.get('trid'),
|
||||
originalLang = self.getOriginalLanguage(),
|
||||
flagUrl = TaxonomyTranslation.data.activeLanguages[ originalLang ].flag,
|
||||
langLabel = TaxonomyTranslation.data.activeLanguages[ originalLang ].label,
|
||||
copyMessage = labels.copyToAllMessage.replace( '%language%', '<img src="' + flagUrl + '"> <strong>' + langLabel + '</strong>' );
|
||||
|
||||
self.$el.html(
|
||||
this.template({
|
||||
trid: trid,
|
||||
lang: originalLang,
|
||||
labels: labels,
|
||||
copyMessage: copyMessage
|
||||
})
|
||||
);
|
||||
|
||||
self.delegateEvents();
|
||||
return self;
|
||||
},
|
||||
open: function ( ) {
|
||||
var self = this,
|
||||
popUpDomEl,
|
||||
trid = self.model.get( 'trid' ),
|
||||
lang = self.getOriginalLanguage();
|
||||
|
||||
self.render();
|
||||
popUpDomEl = jQuery('#' + trid + '-popup-' + lang);
|
||||
popUpDomEl.append( self.$el );
|
||||
|
||||
self.dialog = jQuery( '#icl_tt_form_' + trid + '_' + lang );
|
||||
self.dialog.dialog({
|
||||
autoOpen: true,
|
||||
modal: true,
|
||||
minWidth: 600,
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
dialogClass: 'dialog-fixed otgs-ui-dialog'
|
||||
});
|
||||
self.setElement( self.dialog );
|
||||
self.delegateEvents();
|
||||
|
||||
},
|
||||
close: function () {
|
||||
if ( this.dialog ) {
|
||||
this.dialog.dialog( 'close' );
|
||||
this.undelegateEvents();
|
||||
this.remove();
|
||||
this.dialog = null;
|
||||
}
|
||||
},
|
||||
getOriginalLanguage: function () {
|
||||
var trid = this.model.get( 'trid' );
|
||||
return TaxonomyTranslation.classes.taxonomy.getOriginalTerm( trid ).get( 'language_code' );
|
||||
},
|
||||
copyAll: function () {
|
||||
|
||||
var self = this,
|
||||
trid = self.model.get( 'trid' ),
|
||||
originalTerm = TaxonomyTranslation.classes.taxonomy.getOriginalTerm( trid ),
|
||||
name = originalTerm.get( 'name' ),
|
||||
slug = originalTerm.get( 'slug' ),
|
||||
description = originalTerm.get( 'description' ),
|
||||
overwrite = self.$el.find( 'input[name="overwrite"]:checked' ).length > 0;
|
||||
|
||||
self.$el.find('.js-copy-all-ok').prop( 'disabled', true );
|
||||
self.$el.find('.cancel').prop( 'disabled', true );
|
||||
|
||||
|
||||
var terms = self.model.get("terms");
|
||||
_.each( terms, function ( term ) {
|
||||
if ( overwrite || term.get( 'name' ) === false ) {
|
||||
term.save( name, slug, description );
|
||||
}
|
||||
});
|
||||
|
||||
self.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,129 @@
|
||||
/*globals TaxonomyTranslation, Backbone, WPML_core, labels, jQuery */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
TaxonomyTranslation.views.FilterView = Backbone.View.extend({
|
||||
|
||||
template: WPML_core[ 'templates/taxonomy-translation/filter.html' ],
|
||||
model: TaxonomyTranslation.models.Taxonomy,
|
||||
tag: "div",
|
||||
untranslated: false,
|
||||
parent: 0,
|
||||
lang: 'all',
|
||||
search: '',
|
||||
updatingFilter: false,
|
||||
|
||||
events: {
|
||||
"change #child_of": "updateFilter",
|
||||
"change #status-select": "updateFilter",
|
||||
"change #in-lang": "updateLangFilter",
|
||||
"keyup #tax-search": "updateFilter",
|
||||
"click #tax-apply": "updateTaxHierachy"
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'newTaxonomySet', this.render);
|
||||
this.listenTo(this.model, 'syncDataLoaded', this.render);
|
||||
this.listenTo(this.model, 'modeChanged', this.modeChanged);
|
||||
this.listenTo(TaxonomyTranslation.classes.taxonomy, 'syncDataLoaded', this.updateLangFilter);
|
||||
},
|
||||
render: function () {
|
||||
var self = this;
|
||||
|
||||
if ( ! self.updatingFilter ) {
|
||||
var currentTaxonomy = self.model.get("taxonomy");
|
||||
|
||||
if (!currentTaxonomy) {
|
||||
return false;
|
||||
} else {
|
||||
currentTaxonomy = TaxonomyTranslation.data.taxonomies[currentTaxonomy];
|
||||
}
|
||||
|
||||
self.$el.html(self.template({
|
||||
langs: TaxonomyTranslation.data.activeLanguages,
|
||||
taxonomy: currentTaxonomy,
|
||||
parents: self.model.get("parents"),
|
||||
mode: TaxonomyTranslation.mainView.mode
|
||||
}));
|
||||
}
|
||||
|
||||
self.updatingFilter = false;
|
||||
return self;
|
||||
},
|
||||
updateLangFilter: function () {
|
||||
var self = this;
|
||||
|
||||
if (TaxonomyTranslation.mainView.mode === 'sync') {
|
||||
var newLang = self.selectedLang();
|
||||
if (self.lang !== newLang) {
|
||||
self.lang = newLang;
|
||||
self.updatingFilter = true;
|
||||
TaxonomyTranslation.classes.taxonomy.loadSyncData(newLang);
|
||||
TaxonomyTranslation.mainView.showLoadingSpinner();
|
||||
}
|
||||
} else {
|
||||
self.updateFilter();
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
updateFilter: function () {
|
||||
var self = this;
|
||||
|
||||
var parent = self.$el.find("#child_of").val();
|
||||
self.parent = parent != undefined && parent != -1 ? parent : 0;
|
||||
var untranslated = self.$el.find("#status-select").val();
|
||||
self.untranslated = !!(untranslated != undefined && untranslated == 1);
|
||||
self.setSelectVisibility();
|
||||
var search = self.$el.find("#tax-search").val();
|
||||
self.search = search != undefined && search.length > 1 ? search : 0;
|
||||
|
||||
self.trigger("updatedFilter");
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
selectedLang: function(){
|
||||
|
||||
var self = this;
|
||||
var inLangSelect = self.$el.find("#in-lang");
|
||||
|
||||
return inLangSelect.val();
|
||||
},
|
||||
setSelectVisibility: function(){
|
||||
var self = this;
|
||||
var inLangLabel = jQuery('#in-lang-label');
|
||||
var inLangSelect = self.$el.find("#in-lang");
|
||||
if (self.untranslated || TaxonomyTranslation.mainView.mode === 'sync') {
|
||||
var lang = self.selectedLang();
|
||||
self.lang = lang != undefined && lang != 'all' ? lang : 'all';
|
||||
inLangSelect.show();
|
||||
inLangLabel.show();
|
||||
} else {
|
||||
self.lang = 'all';
|
||||
inLangSelect.hide();
|
||||
inLangLabel.hide();
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
modeChanged: function() {
|
||||
var self = this;
|
||||
if (TaxonomyTranslation.mainView.mode === 'translate') {
|
||||
self.render();
|
||||
}
|
||||
},
|
||||
updateTaxHierachy: function () {
|
||||
var self = this;
|
||||
|
||||
if (TaxonomyTranslation.mainView.mode === 'sync') {
|
||||
TaxonomyTranslation.mainView.model.doSync(self.selectedLang());
|
||||
} else {
|
||||
self.updateLangFilter();
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,148 @@
|
||||
(function () {
|
||||
TaxonomyTranslation.views.LabelPopUpView = Backbone.View.extend({
|
||||
|
||||
tagName: "div",
|
||||
template: WPML_core[ 'templates/taxonomy-translation/label-popup.html' ],
|
||||
model: TaxonomyTranslation.models.Taxonomy,
|
||||
|
||||
events: {
|
||||
"click .cancel": "close",
|
||||
"click .js-label-save": "saveLabel",
|
||||
"click .js-button-copy": "copyOriginal",
|
||||
"keydown" : "handleEnter",
|
||||
"input .js-translation": "updateUI"
|
||||
},
|
||||
initialize: function (data, options) {
|
||||
var self = this;
|
||||
self.lang = options.lang;
|
||||
self.defLang = options.defLang;
|
||||
self.listenTo(self.model, 'labelTranslationSaved', self.close);
|
||||
self.listenTo(self.model, 'saveFailed', self.render);
|
||||
return self;
|
||||
},
|
||||
|
||||
open: function ( lang ) {
|
||||
var self = this;
|
||||
self.render();
|
||||
var popUpDomEl = jQuery( '#popup-' + lang );
|
||||
popUpDomEl.append( self.$el );
|
||||
|
||||
self.dialog = jQuery( "#icl_tt_form_" + self.model.get( "taxonomy" ) );
|
||||
self.dialog.dialog({
|
||||
autoOpen: true,
|
||||
modal: true,
|
||||
minWidth: 800,
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
dialogClass: 'dialog-fixed otgs-ui-dialog'
|
||||
});
|
||||
self.setElement( self.dialog );
|
||||
self.delegateEvents();
|
||||
self.updateUI();
|
||||
},
|
||||
close: function () {
|
||||
if ( this.dialog ) {
|
||||
this.dialog.dialog( 'close' );
|
||||
this.undelegateEvents();
|
||||
this.remove();
|
||||
this.dialog = null;
|
||||
}
|
||||
},
|
||||
render: function () {
|
||||
var self = this;
|
||||
var taxonomy = self.model.get("taxonomy");
|
||||
var labels = TaxonomyTranslation.data.translatedTaxonomyLabels[self.lang];
|
||||
var originalLabels = TaxonomyTranslation.data.translatedTaxonomyLabels[self.model.get('stDefaultLang')];
|
||||
var slugTranslationEnabled = originalLabels['globalSlugTranslationEnabled']
|
||||
&& self.model.get('showSlugTranslationField');
|
||||
|
||||
if (!labels) {
|
||||
labels = {
|
||||
singular: undefined,
|
||||
general: undefined
|
||||
};
|
||||
}
|
||||
|
||||
this.$el.html(
|
||||
self.template({
|
||||
langs: TaxonomyTranslation.data.allLanguages,
|
||||
lang: self.lang,
|
||||
source_lang: self.model.get('stDefaultLang'),
|
||||
originalLabels: originalLabels,
|
||||
translatedLabels: labels,
|
||||
taxonomy: taxonomy,
|
||||
slugTranslationEnabled: slugTranslationEnabled
|
||||
})
|
||||
);
|
||||
|
||||
self.delegateEvents();
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
handleEnter: function(e){
|
||||
var self = this;
|
||||
if(self.$el.find('input:focus').length !== 0 && e.keyCode == 13){
|
||||
self.saveLabel(e);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
|
||||
updateUI: function ( e ) {
|
||||
var self = this,
|
||||
translationsEntered = true;
|
||||
|
||||
self.$el.find( '.js-required-translation' ).each( function () {
|
||||
if ( jQuery( this ).val() === '' ) {
|
||||
translationsEntered = false;
|
||||
}
|
||||
});
|
||||
|
||||
self.$el.find( '.js-label-save' ).prop( 'disabled', !translationsEntered );
|
||||
},
|
||||
|
||||
saveLabel: function (e) {
|
||||
var singularValueField, pluralValueField, slugValueField, singularValue, pluralValue, slugValue, self, inputPrefix;
|
||||
self = this;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
inputPrefix = '#' + self.model.get("taxonomy") + '-';
|
||||
singularValueField = self.$el.find(inputPrefix + 'singular');
|
||||
pluralValueField = self.$el.find(inputPrefix + 'plural');
|
||||
slugValueField = self.$el.find(inputPrefix + 'slug');
|
||||
|
||||
if (singularValueField.length > 0 && pluralValueField.length > 0) {
|
||||
singularValue = singularValueField.val();
|
||||
pluralValue = pluralValueField.val();
|
||||
}
|
||||
|
||||
if (slugValueField.length > 0) {
|
||||
slugValue = slugValueField.val();
|
||||
}
|
||||
|
||||
if (singularValue && pluralValue) {
|
||||
self.undelegateEvents();
|
||||
|
||||
self.$el.find(".spinner").show();
|
||||
self.$el.find(".js-label-save").prop( 'disabled', true );
|
||||
self.$el.find(".cancel").prop( 'disabled', true );
|
||||
|
||||
self.model.saveLabel(singularValue, pluralValue, slugValue, self.lang);
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
},
|
||||
|
||||
copyOriginal: function ( e ) {
|
||||
var self = this,
|
||||
original = jQuery( e.currentTarget ).prev().val();
|
||||
|
||||
jQuery( e.currentTarget ).next().val( original );
|
||||
|
||||
self.updateUI();
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,108 @@
|
||||
(function () {
|
||||
|
||||
TaxonomyTranslation.views.LabelRowView = Backbone.View.extend({
|
||||
|
||||
tagName: 'tbody',
|
||||
model: TaxonomyTranslation.models.Taxonomy,
|
||||
events: {
|
||||
'click .icl_tt_label': 'openPopUPLabel',
|
||||
'click .js-show-lang-selector': 'showLanguageSelector',
|
||||
'change .js-tax-lang-selector': 'changeTaxStringsLanguage'
|
||||
},
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
self.listenTo(self.model, 'labelTranslationSaved', self.render);
|
||||
},
|
||||
|
||||
showLanguageSelector: function(e) {
|
||||
e.preventDefault();
|
||||
this.render( true );
|
||||
|
||||
if ( WPML_Core.SimpleLanguageSelector ) {
|
||||
new WPML_Core.SimpleLanguageSelector();
|
||||
}
|
||||
},
|
||||
|
||||
render: function ( withLangSelector ) {
|
||||
var self = this,
|
||||
taxLabels = TaxonomyTranslation.data.translatedTaxonomyLabels,
|
||||
langs = TaxonomyTranslation.util.langCodes,
|
||||
taxonomy = self.model.get( 'taxonomy' ),
|
||||
labelLang = TaxonomyTranslation.classes.taxonomy.get( 'stDefaultLang' ),
|
||||
langSelector = withLangSelector ? TaxonomyTranslation.data.langSelector : '',
|
||||
html = '<tr>';
|
||||
|
||||
|
||||
html += WPML_core[ 'templates/taxonomy-translation/original-label.html' ](
|
||||
{
|
||||
taxLabel : taxLabels[labelLang],
|
||||
flag : TaxonomyTranslation.data.allLanguages[labelLang].flag,
|
||||
langSelector: langSelector
|
||||
}
|
||||
);
|
||||
|
||||
html += '<td class="wpml-col-languages">';
|
||||
|
||||
_.each(langs, function(lang, code) {
|
||||
if( ! taxLabels[lang] ) {
|
||||
html += WPML_core[ 'templates/taxonomy-translation/not-translated-label.html' ](
|
||||
{
|
||||
taxonomy: taxonomy,
|
||||
lang : lang,
|
||||
langs : TaxonomyTranslation.data.activeLanguages
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if( taxLabels[lang].original ) {
|
||||
html += WPML_core[ 'templates/taxonomy-translation/original-label-disabled.html' ](
|
||||
{
|
||||
lang : lang,
|
||||
langs: TaxonomyTranslation.data.activeLanguages
|
||||
}
|
||||
);
|
||||
} else {
|
||||
html += WPML_core[ 'templates/taxonomy-translation/individual-label.html' ](
|
||||
{
|
||||
taxonomy: taxonomy,
|
||||
lang : lang,
|
||||
langs : TaxonomyTranslation.data.activeLanguages
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
html += '</td>';
|
||||
html += '</tr>';
|
||||
|
||||
self.$el.html( html );
|
||||
|
||||
self.delegateEvents();
|
||||
return self;
|
||||
},
|
||||
openPopUPLabel: function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var link = e.target.closest( '.icl_tt_label' ),
|
||||
id = jQuery( link ).attr( 'id' ),
|
||||
lang = id.split( '_' ).pop();
|
||||
|
||||
if (TaxonomyTranslation.classes.labelPopUpView && typeof TaxonomyTranslation.classes.labelPopUpView !== 'undefined') {
|
||||
TaxonomyTranslation.classes.labelPopUpView.close();
|
||||
}
|
||||
|
||||
TaxonomyTranslation.classes.labelPopUpView = new TaxonomyTranslation.views.LabelPopUpView({model: TaxonomyTranslation.classes.taxonomy}, {
|
||||
lang: lang,
|
||||
defLang: TaxonomyTranslation.classes.taxonomy.get( 'defaultLang' )
|
||||
});
|
||||
TaxonomyTranslation.classes.labelPopUpView.open( lang );
|
||||
},
|
||||
|
||||
changeTaxStringsLanguage: function(e) {
|
||||
var sourceLang = e.target.value;
|
||||
this.$el.find('.js-tax-lang-selector').prepend( '<span class="spinner is-active">' );
|
||||
this.model.changeTaxStringsLanguage(sourceLang);
|
||||
}
|
||||
});
|
||||
}(TaxonomyTranslation));
|
||||
@@ -0,0 +1,73 @@
|
||||
(function () {
|
||||
TaxonomyTranslation.views.NavView = Backbone.View.extend({
|
||||
|
||||
template: WPML_core[ 'templates/taxonomy-translation/nav.html' ],
|
||||
model: TaxonomyTranslation.models.taxonomy,
|
||||
events: {
|
||||
"change .current-page": 'goToPage',
|
||||
"click .next-page": 'nextPage',
|
||||
"click .prev-page": 'prevPage',
|
||||
"click .first-page": 'firstPage',
|
||||
"click .last-page": 'lastPage'
|
||||
},
|
||||
initialize: function (data, options) {
|
||||
this.page = 1;
|
||||
this.perPage = options.perPage;
|
||||
},
|
||||
goToPage: function () {
|
||||
var self = this;
|
||||
var currentPageField = jQuery(".current-page");
|
||||
var page = currentPageField.val();
|
||||
|
||||
if (page > 0 && page <= self.pages) {
|
||||
self.page = parseInt(page);
|
||||
self.trigger("newPage");
|
||||
} else {
|
||||
currentPageField.val(self.page);
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
nextPage: function(){
|
||||
var self = this;
|
||||
self.$el.find('.current-page').val(self.page + 1).change();
|
||||
},
|
||||
prevPage: function(){
|
||||
var self = this;
|
||||
self.$el.find('.current-page').val(self.page - 1).change();
|
||||
},
|
||||
firstPage: function(){
|
||||
var self = this;
|
||||
self.$el.find('.current-page').val(1).change();
|
||||
},
|
||||
lastPage: function(){
|
||||
var self = this;
|
||||
self.$el.find('.current-page').val(self.pages).change();
|
||||
},
|
||||
setCounts: function(){
|
||||
var self = this;
|
||||
var rows = TaxonomyTranslation.data.termRowsCollection.length;
|
||||
var displayedCount = TaxonomyTranslation.mainView.termRowsView.getDisplayCount();
|
||||
rows = displayedCount >= 0 ? displayedCount : rows;
|
||||
rows = rows ? rows : 0;
|
||||
self.rows = rows;
|
||||
self.pages = Math.ceil(rows / self.perPage);
|
||||
},
|
||||
render: function () {
|
||||
var self = this;
|
||||
self.setCounts();
|
||||
if (self.pages > 1) {
|
||||
self.$el.html(self.template({
|
||||
page: self.page,
|
||||
pages: self.pages,
|
||||
items: self.rows
|
||||
}));
|
||||
self.$el.show();
|
||||
} else {
|
||||
self.$el.hide();
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,11 @@
|
||||
/*globals labels */
|
||||
|
||||
(function () {
|
||||
TaxonomyTranslation.views.OriginalTermPopUpView = TaxonomyTranslation.views.TermPopUpView.extend({
|
||||
|
||||
template: WPML_core[ 'templates/taxonomy-translation/original-term-popup.html' ],
|
||||
getMinDialogWidth: function ( ) {
|
||||
return 400;
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,48 @@
|
||||
/*globals labels */
|
||||
|
||||
(function () {
|
||||
TaxonomyTranslation.views.TableView = Backbone.View.extend({
|
||||
|
||||
template: WPML_core[ 'templates/taxonomy-translation/table.html' ],
|
||||
tag: 'div',
|
||||
termsView: {},
|
||||
|
||||
model: TaxonomyTranslation.models.Taxonomy,
|
||||
|
||||
initialize: function ( data, options ) {
|
||||
this.type = options.type;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
||||
if ( ! TaxonomyTranslation.classes.taxonomy.get( "taxonomy" ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var self = this,
|
||||
langs = TaxonomyTranslation.data.activeLanguages,
|
||||
count = self.isTermTable() ? TaxonomyTranslation.data.termRowsCollection.length : 1,
|
||||
tax = self.model.get( 'taxonomy' ),
|
||||
firstColumnHeading = self.isTermTable() ? labels.firstColumnHeading.replace( '%taxonomy%', TaxonomyTranslation.data.taxonomies[ tax ].singularLabel ) : '';
|
||||
|
||||
this.$el.html(self.template({
|
||||
langs: langs,
|
||||
tableType: self.type,
|
||||
count: count,
|
||||
firstColumnHeading: firstColumnHeading,
|
||||
mode: TaxonomyTranslation.mainView.mode
|
||||
}));
|
||||
|
||||
return self;
|
||||
},
|
||||
isTermTable: function () {
|
||||
return this.type === 'terms';
|
||||
},
|
||||
clear: function () {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
/*globals WPML_core, TaxonomyTranslation, Backbone, labels, jQuery, document */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
TaxonomyTranslation.views.TaxonomyView = Backbone.View.extend({
|
||||
|
||||
el: "#taxonomy-translation",
|
||||
model: TaxonomyTranslation.models.Taxonomy,
|
||||
tag: "div",
|
||||
termRowsView: {},
|
||||
mode: 'translate',
|
||||
initialMode: 'translate',
|
||||
perPage: 10,
|
||||
events: {
|
||||
"click #term-table-sync-header": "setToSync",
|
||||
"click #term-table-header": "setToTranslate",
|
||||
"click #tax-apply": "doSync"
|
||||
},
|
||||
syncedLabel: labels.hieraAlreadySynced,
|
||||
initialize: function (model, options) {
|
||||
var self = this;
|
||||
self.perPage = jQuery( '#wpml_tt_taxonomy_translation_wrap' ).data( 'items_per_page' );
|
||||
self.initialMode = options.sync === true ? 'sync' : 'translate';
|
||||
self.navView = new TaxonomyTranslation.views.NavView({model: self.model}, {perPage: self.perPage});
|
||||
self.filterView = new TaxonomyTranslation.views.FilterView({model: self.model});
|
||||
self.listenTo(self.filterView, 'updatedFilter', function () {
|
||||
self.navView.page = 1;
|
||||
self.renderRows();
|
||||
});
|
||||
self.termTableView = new TaxonomyTranslation.views.TableView({model: self.model}, {type: "terms"});
|
||||
self.labelTableView = new TaxonomyTranslation.views.TableView({model: self.model}, {type: "labels"});
|
||||
self.termRowsView = new TaxonomyTranslation.views.TermRowsView({collection: TaxonomyTranslation.data.termRowsCollection}, {
|
||||
start: 0,
|
||||
end: self.perPage
|
||||
});
|
||||
self.listenTo(self.model, 'newTaxonomySet', self.renderNewTaxonomy);
|
||||
self.listenTo(self.model, 'syncDataLoaded', self.renderNewTaxonomy);
|
||||
|
||||
return self;
|
||||
},
|
||||
changeMode: function (mode) {
|
||||
var self = this;
|
||||
self.mode = mode === 'translate' || ( mode === 'sync' && self.model.isHierarchical() ) ? mode : 'translate';
|
||||
self.navView.off();
|
||||
self.navView = new TaxonomyTranslation.views.NavView({model: self.model}, {perPage: self.perPage});
|
||||
self.listenTo(self.navView, 'newPage', self.render);
|
||||
|
||||
if (self.mode === "sync") {
|
||||
self.model.loadSyncData(self.filterView.selectedLang());
|
||||
} else {
|
||||
self.renderRows();
|
||||
self.render();
|
||||
}
|
||||
self.model.trigger('modeChanged');
|
||||
|
||||
self.syncedLabel = labels.hieraAlreadySynced;
|
||||
|
||||
return self;
|
||||
},
|
||||
setToTranslate: function () {
|
||||
var self = this;
|
||||
if (self.mode !== 'translate') {
|
||||
self.changeMode('translate');
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
setToSync: function () {
|
||||
var self = this;
|
||||
if (self.mode !== 'sync') {
|
||||
self.changeMode('sync');
|
||||
TaxonomyTranslation.mainView.showLoadingSpinner();
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
setLabels: function () {
|
||||
var self = this,
|
||||
tax = self.model.get("taxonomy"),
|
||||
taxonomyPluralLabel = TaxonomyTranslation.data.taxonomies[tax].label,
|
||||
taxonomySingularLabel = TaxonomyTranslation.data.taxonomies[tax].singularLabel;
|
||||
|
||||
self.headerTerms = labels.translate.replace( '%taxonomy%', taxonomySingularLabel );
|
||||
self.summaryTerms = labels.summaryTerms.replace( '%taxonomy%', '<strong>' + taxonomyPluralLabel + '</strong>' );
|
||||
self.resultsTruncated = labels.resultsTruncated.replace( '%taxonomy%', '<strong>' + taxonomyPluralLabel + '</strong>' );
|
||||
self.labelSummary = labels.summaryLabels.replace( '%taxonomy%', '<strong>' + taxonomySingularLabel + '</strong>' );
|
||||
|
||||
return self;
|
||||
},
|
||||
renderRows: function () {
|
||||
var self = this;
|
||||
if (TaxonomyTranslation.data.termRowsCollection.length > 0) {
|
||||
self.termRowsView.start = (self.navView.page - 1 ) * self.perPage;
|
||||
self.termRowsView.end = self.termRowsView.start + self.perPage;
|
||||
var termRowsFragment = self.termRowsView.render().el;
|
||||
jQuery("#tax-table-terms").first('tbody').append(termRowsFragment);
|
||||
}
|
||||
self.navView.render();
|
||||
|
||||
return self;
|
||||
},
|
||||
renderNewTaxonomy: function(){
|
||||
var self = this;
|
||||
self.navView.off();
|
||||
self.navView = undefined;
|
||||
self.navView = new TaxonomyTranslation.views.NavView({model: self.model}, {perPage: self.perPage});
|
||||
this.listenTo(this.navView, 'newPage', this.render);
|
||||
self.renderRows();
|
||||
self.render();
|
||||
if (self.initialMode === 'sync') {
|
||||
self.initialMode = false;
|
||||
self.setToSync();
|
||||
}
|
||||
return self;
|
||||
},
|
||||
getMainFragment: function () {
|
||||
var self = this;
|
||||
|
||||
var mainFragment = document.createElement("div"),
|
||||
mainTemplate = WPML_core[ 'templates/taxonomy-translation/taxonomy-main-wrap.html' ],
|
||||
tabsTemplate = WPML_core[ 'templates/taxonomy-translation/tabs.html' ],
|
||||
taxonomy = TaxonomyTranslation.data.taxonomies[ self.model.get( "taxonomy" ) ],
|
||||
htmlTabs = tabsTemplate( {
|
||||
taxonomy: taxonomy,
|
||||
headerTerms: self.headerTerms,
|
||||
syncLabel: labels.Synchronize,
|
||||
mode: self.mode
|
||||
}),
|
||||
hasContent = self.termRowsView && self.termRowsView.getDisplayCount() !== 0,
|
||||
htmlMain = mainTemplate({
|
||||
taxonomy: taxonomy,
|
||||
langs: TaxonomyTranslation.data.activeLanguages,
|
||||
summaryTerms: self.summaryTerms,
|
||||
resultsTruncated: self.resultsTruncated,
|
||||
labelSummary: self.labelSummary,
|
||||
mode: self.mode,
|
||||
hasContent: hasContent,
|
||||
labelSynced: self.syncedLabel
|
||||
});
|
||||
|
||||
mainFragment.innerHTML = htmlTabs + htmlMain;
|
||||
|
||||
mainFragment = self.addMainElements( mainFragment, hasContent );
|
||||
|
||||
return mainFragment;
|
||||
},
|
||||
addMainElements: function ( mainFragment, hasContent ) {
|
||||
var self = this;
|
||||
self.filterFragment = self.filterFragment ? self.filterFragment : self.filterView.render().el;
|
||||
mainFragment.querySelector("#wpml-taxonomy-translation-filters").appendChild(self.filterFragment);
|
||||
if ( hasContent || self.mode === 'translate' ) {
|
||||
var termTableFragment = self.termTableView.render().el;
|
||||
mainFragment.querySelector("#wpml-taxonomy-translation-terms-table").appendChild(termTableFragment);
|
||||
mainFragment = self.addTableRows(mainFragment);
|
||||
}
|
||||
|
||||
var bottomContent = self.model.get( "bottomContent" );
|
||||
if( typeof bottomContent != 'undefined' ){
|
||||
mainFragment.appendChild( jQuery( bottomContent )[0] );
|
||||
}
|
||||
|
||||
return mainFragment;
|
||||
},
|
||||
render: function () {
|
||||
var self = this;
|
||||
|
||||
self.setLabels();
|
||||
var renderedFragment = document.createDocumentFragment();
|
||||
var mainFragment = self.getMainFragment();
|
||||
renderedFragment.appendChild(mainFragment);
|
||||
|
||||
if (TaxonomyTranslation.data.termRowsCollection.length > self.perPage &&
|
||||
renderedFragment.querySelector("#wpml-taxonomy-translation-terms-nav")) {
|
||||
var navFragment = self.navView.render().el;
|
||||
renderedFragment.querySelector("#wpml-taxonomy-translation-terms-nav").appendChild(navFragment);
|
||||
}
|
||||
self.addLabelTranslation(mainFragment, renderedFragment);
|
||||
self.$el.html(renderedFragment);
|
||||
jQuery(".icl_tt_label").on("click", self.openPopUPLabel);
|
||||
self.showLoadingSpinner( false );
|
||||
self.isRendered = true;
|
||||
self.filterView.delegateEvents();
|
||||
self.delegateEvents();
|
||||
self.maybeHideHeader();
|
||||
jQuery('.icl_tt_main_bottom').show();
|
||||
|
||||
var loading = jQuery( '.wpml-loading-taxonomy' );
|
||||
if ( loading.length ) {
|
||||
loading.hide();
|
||||
var loaded = jQuery( '.wpml_taxonomy_loaded' );
|
||||
if ( loaded.length ) {
|
||||
loaded.show();
|
||||
loaded.parent().children( '.wpml-loading-taxonomy' ).remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
addLabelTranslation: function (mainFragment, renderedFragment) {
|
||||
var self = this;
|
||||
|
||||
if (TaxonomyTranslation.data.translatedTaxonomyLabels && self.mode !== 'sync') {
|
||||
var labelTableFragment = self.labelTableView.render().el;
|
||||
mainFragment.querySelector("#wpml-taxonomy-translation-labels-table").appendChild(labelTableFragment);
|
||||
if (renderedFragment.querySelector("#tax-table-labels")) {
|
||||
var labelRowFragment = new TaxonomyTranslation.views.LabelRowView(({model: self.model})).render().el;
|
||||
mainFragment.querySelector("#tax-table-labels").appendChild(labelRowFragment);
|
||||
}
|
||||
}
|
||||
|
||||
return mainFragment;
|
||||
},
|
||||
addTableRows: function (mainFragment) {
|
||||
var self = this;
|
||||
var termRowsFragment;
|
||||
|
||||
self.termRowsView.start = (self.navView.page - 1 ) * self.perPage;
|
||||
self.termRowsView.end = self.termRowsView.start + self.perPage;
|
||||
termRowsFragment = self.termRowsView.render().el;
|
||||
mainFragment.querySelector("#tax-table-terms").appendChild(termRowsFragment);
|
||||
|
||||
return mainFragment;
|
||||
},
|
||||
/**
|
||||
* Used by WCML to hide the controls for changing the taxonomy
|
||||
*/
|
||||
maybeHideHeader: function () {
|
||||
var taxonomySwitcher = jQuery("#icl_tt_tax_switch");
|
||||
var potentialHiddenSelectInput = jQuery('#tax-selector-hidden');
|
||||
var potentialHiddenTaxInput = jQuery('#tax-preselected');
|
||||
if (potentialHiddenSelectInput.length !== 0 &&
|
||||
potentialHiddenSelectInput.val() &&
|
||||
potentialHiddenTaxInput.length !== 0 &&
|
||||
potentialHiddenTaxInput.val()) {
|
||||
taxonomySwitcher.closest('label').hide();
|
||||
jQuery('[id="term-table-summary"]').hide();
|
||||
}
|
||||
},
|
||||
selectTaxonomy: function () {
|
||||
var self = this,
|
||||
tax = jQuery("#icl_tt_tax_switch").val();
|
||||
|
||||
if (tax !== undefined) {
|
||||
self.mode = 'translate';
|
||||
self.model.setTaxonomy(tax);
|
||||
}
|
||||
},
|
||||
doSync: function () {
|
||||
var self = this;
|
||||
|
||||
self.$el.find( '#tax-apply' ).prop( 'disabled', true );
|
||||
TaxonomyTranslation.mainView.model.doSync( self.$el.find("#in-lang").val() );
|
||||
self.syncedLabel = labels.hieraSynced;
|
||||
},
|
||||
showLoadingSpinner: function( state ) {
|
||||
if ( state === undefined || state ) {
|
||||
jQuery('.wpml-loading-taxonomy').show();
|
||||
} else {
|
||||
jQuery('.wpml-loading-taxonomy').hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,30 @@
|
||||
/*globals labels */
|
||||
|
||||
(function () {
|
||||
|
||||
TaxonomyTranslation.views.TermOriginalView = TaxonomyTranslation.views.TermView.extend({
|
||||
|
||||
tagName: "td",
|
||||
className: "wpml-col-title wpml-col-title-flag",
|
||||
template: WPML_core[ 'templates/taxonomy-translation/original-term.html' ],
|
||||
render: function () {
|
||||
var self = this;
|
||||
|
||||
self.needsCorrection = false;
|
||||
|
||||
self.$el.html(
|
||||
self.template({
|
||||
trid: self.model.get("trid"),
|
||||
lang: self.model.get("language_code"),
|
||||
name: self.model.get("name"),
|
||||
level: self.model.get("level"),
|
||||
correctedLevel: self.model.get("level"),
|
||||
langs: TaxonomyTranslation.data.activeLanguages
|
||||
})
|
||||
);
|
||||
|
||||
self.delegateEvents();
|
||||
return self;
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,156 @@
|
||||
/*globals labels */
|
||||
|
||||
(function () {
|
||||
TaxonomyTranslation.views.TermPopUpView = Backbone.View.extend({
|
||||
|
||||
tagName: 'div',
|
||||
template: WPML_core[ 'templates/taxonomy-translation/term-popup.html' ],
|
||||
model: TaxonomyTranslation.models.Term,
|
||||
|
||||
events: {
|
||||
'click .cancel': 'close',
|
||||
'click .term-save': 'saveTerm',
|
||||
'click .js-button-copy': 'copyOriginal',
|
||||
'keydown': 'handleEnter',
|
||||
'input #term-name': 'updateUI',
|
||||
'focusout input#term-name': 'generateSlug'
|
||||
},
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
self.listenTo(self.model, 'translationSaved', self.close);
|
||||
self.listenTo(self.model, 'saveFailed', self.render);
|
||||
self.dialog = null;
|
||||
return self;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
||||
var self = this,
|
||||
trid = self.model.get('trid'),
|
||||
term = self.model.getNameSlugAndDescription(),
|
||||
term_meta = self.model.getMetaData(),
|
||||
original_term_meta = TaxonomyTranslation.classes.taxonomy.getOriginalTermMeta( trid ),
|
||||
original_term = TaxonomyTranslation.classes.taxonomy.getOriginalTerm( trid );
|
||||
|
||||
self.$el.html(
|
||||
this.template({
|
||||
trid: trid,
|
||||
lang: self.model.get('language_code'),
|
||||
source_lang: original_term.get( 'language_code' ),
|
||||
langs: TaxonomyTranslation.data.activeLanguages,
|
||||
ttid: self.model.get('term_taxonomy_id'),
|
||||
term: term,
|
||||
original_term: original_term.getNameSlugAndDescription(),
|
||||
term_meta: term_meta,
|
||||
original_term_meta: original_term_meta
|
||||
})
|
||||
);
|
||||
|
||||
self.delegateEvents();
|
||||
return self;
|
||||
},
|
||||
handleEnter: function (e) {
|
||||
var self = this;
|
||||
if (self.$el.find('input:focus').length !== 0 && e.keyCode == 13) {
|
||||
self.saveTerm(e);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
saveTerm: function (e) {
|
||||
var self = this,
|
||||
meta_data = {};
|
||||
|
||||
self.undelegateEvents();
|
||||
|
||||
e.preventDefault();
|
||||
var name = self.$el.find('#term-name').val(),
|
||||
slug = self.$el.find('#term-slug').val(),
|
||||
description = self.$el.find('#term-description').val();
|
||||
|
||||
|
||||
var term_metas = self.$el.find('.term-meta');
|
||||
_.each( term_metas, function ( meta_object ) {
|
||||
meta_data[ meta_object.dataset.metaKey ] = meta_object.value;
|
||||
});
|
||||
|
||||
if (name) {
|
||||
self.$el.find('.spinner').show();
|
||||
self.$el.find('.term-save').prop( 'disabled', true );
|
||||
self.$el.find('.cancel').prop( 'disabled', true );
|
||||
self.model.save(name, slug, description, meta_data);
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
open: function ( trid, lang ) {
|
||||
var self = this;
|
||||
self.render();
|
||||
var popUpDomEl = jQuery('#' + trid + '-popup-' + lang);
|
||||
popUpDomEl.append( self.$el );
|
||||
|
||||
self.dialog = jQuery( '#icl_tt_form_' + trid + '_' + lang );
|
||||
self.dialog.dialog({
|
||||
autoOpen: true,
|
||||
modal: true,
|
||||
minWidth: self.getMinDialogWidth(),
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
dialogClass: 'dialog-fixed otgs-ui-dialog'
|
||||
});
|
||||
self.setElement( self.dialog );
|
||||
self.delegateEvents();
|
||||
self.updateUI();
|
||||
|
||||
},
|
||||
getMinDialogWidth: function ( ) {
|
||||
return 800;
|
||||
},
|
||||
close: function () {
|
||||
if ( this.dialog ) {
|
||||
this.dialog.dialog( 'close' );
|
||||
this.undelegateEvents();
|
||||
this.remove();
|
||||
this.dialog = null;
|
||||
}
|
||||
},
|
||||
copyOriginal: function ( e ) {
|
||||
var self = this,
|
||||
original = jQuery( e.currentTarget ).prev().val();
|
||||
jQuery( e.currentTarget ).next().val( original );
|
||||
self.generateSlug();
|
||||
self.updateUI();
|
||||
},
|
||||
updateUI: function ( ) {
|
||||
var self = this;
|
||||
self.$el.find( '.term-save' ).prop( 'disabled', self.$el.find( '#term-name').val() === '' );
|
||||
},
|
||||
generateSlug: function() {
|
||||
var self = this,
|
||||
term_slug = self.$el.find( '#term-slug' ),
|
||||
term_name = self.$el.find( '#term-name' );
|
||||
if ('' === term_slug.val() && '' !== term_name.val()) {
|
||||
term_slug.prop('disabled', true);
|
||||
term_slug.css('background', 'url(' + window.icl_ajxloaderimg_src + ') no-repeat left center');
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'wpml_generate_term_slug',
|
||||
term: term_name.val(),
|
||||
nonce: labels.wpml_generate_unique_slug_nonce,
|
||||
language_code: self.model.get('language_code'),
|
||||
taxonomy: TaxonomyTranslation.classes.taxonomy.get("taxonomy"),
|
||||
},
|
||||
success: function(response) {
|
||||
if( true === response.success ) {
|
||||
term_slug.val( response.data.slug );
|
||||
}
|
||||
term_slug.prop('disabled', false);
|
||||
term_slug.css('background', '');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,100 @@
|
||||
/*globals _, TaxonomyTranslation, document, Backbone, jQuery */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
TaxonomyTranslation.views.TermRowView = Backbone.View.extend({
|
||||
|
||||
tagName: "tr",
|
||||
model: TaxonomyTranslation.models.TermRow,
|
||||
termViews: {},
|
||||
className: '',
|
||||
events: {
|
||||
'click .js-copy-to-all-langs': 'copyToAllLangs'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
|
||||
self.listenTo(TaxonomyTranslation.classes.taxonomy, 'syncDataLoaded', self.maybeHide);
|
||||
},
|
||||
maybeHide: function () {
|
||||
var self = this;
|
||||
var visible = false;
|
||||
var terms = self.model.get("terms");
|
||||
_.each(TaxonomyTranslation.data.syncData, function (correction) {
|
||||
_.each(terms, function (term) {
|
||||
if (correction.translated_id == term.get("term_taxonomy_id")) {
|
||||
visible = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if (visible) {
|
||||
self.$el.show();
|
||||
} else {
|
||||
self.$el.hide();
|
||||
}
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var termsFragments = {};
|
||||
var self = this;
|
||||
var langs = TaxonomyTranslation.util.langCodes;
|
||||
var terms = self.model.get("terms");
|
||||
var originalTerm = null;
|
||||
|
||||
_.each(langs, function (lang) {
|
||||
var term = terms[lang];
|
||||
if (term === undefined) {
|
||||
term = new TaxonomyTranslation.models.Term({language_code: lang, trid: self.model.get("trid")});
|
||||
terms[lang] = term;
|
||||
self.model.set("terms", terms, {silent: true});
|
||||
}
|
||||
if ( term.isOriginal() ) {
|
||||
originalTerm = term;
|
||||
}
|
||||
var newView = new TaxonomyTranslation.views.TermView({model: term});
|
||||
self.termViews[lang] = newView;
|
||||
if (TaxonomyTranslation.mainView.mode === 'sync') {
|
||||
termsFragments[lang] = newView.loadSyncData().el;
|
||||
} else {
|
||||
termsFragments[lang] = newView.render().el;
|
||||
}
|
||||
});
|
||||
|
||||
if ( originalTerm ) {
|
||||
var newRowFragment = document.createDocumentFragment();
|
||||
|
||||
if ( TaxonomyTranslation.mainView.mode !== 'sync' ) {
|
||||
var originalView = new TaxonomyTranslation.views.TermOriginalView({model: originalTerm });
|
||||
newRowFragment.appendChild( originalView.render().el );
|
||||
|
||||
var newRowLangs = document.createElement( 'td' );
|
||||
jQuery( newRowLangs ).addClass( 'wpml-col-languages' );
|
||||
_.each(langs, function(lang){
|
||||
newRowLangs.appendChild(termsFragments[lang]);
|
||||
});
|
||||
|
||||
newRowFragment.appendChild( newRowLangs );
|
||||
} else {
|
||||
_.each(langs, function(lang){
|
||||
var newRowTD = document.createElement( 'td' );
|
||||
newRowTD.appendChild(termsFragments[lang]);
|
||||
newRowFragment.appendChild( newRowTD );
|
||||
});
|
||||
}
|
||||
self.$el.html(newRowFragment);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
},
|
||||
copyToAllLangs: function () {
|
||||
var self = this;
|
||||
TaxonomyTranslation.classes.copyAllPopUpView = new TaxonomyTranslation.views.CopyAllPopUpView( { model: self.model } );
|
||||
TaxonomyTranslation.classes.copyAllPopUpView.open( );
|
||||
|
||||
}
|
||||
});
|
||||
}(TaxonomyTranslation));
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
(function () {
|
||||
TaxonomyTranslation.views.TermRowsView = Backbone.View.extend({
|
||||
|
||||
tagName: 'tbody',
|
||||
collection: TaxonomyTranslation.data.termRowsCollection,
|
||||
rowViews: [],
|
||||
start: 0,
|
||||
end: 10,
|
||||
count: -1,
|
||||
initialize: function (data, options) {
|
||||
var self = this;
|
||||
self.end = options.end;
|
||||
self.start = options.start;
|
||||
},
|
||||
getDisplayedRows: function () {
|
||||
var self = this;
|
||||
var displayedRows = self.collection;
|
||||
|
||||
if (!displayedRows) {
|
||||
self.count = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TaxonomyTranslation.mainView.mode === 'sync') {
|
||||
displayedRows = displayedRows.filter(function (row) {
|
||||
"use strict";
|
||||
return row.unSyncFilter();
|
||||
});
|
||||
}
|
||||
|
||||
var parentFilter = TaxonomyTranslation.mainView.filterView.parent ? TaxonomyTranslation.mainView.filterView.parent : false;
|
||||
|
||||
if (parentFilter) {
|
||||
displayedRows = displayedRows.filter(function (row) {
|
||||
return row.parentOf(parentFilter);
|
||||
});
|
||||
}
|
||||
|
||||
var untranslatedFilter = TaxonomyTranslation.mainView.filterView.untranslated ? TaxonomyTranslation.mainView.filterView.untranslated : false;
|
||||
|
||||
if (untranslatedFilter) {
|
||||
displayedRows = displayedRows.filter(function (row) {
|
||||
return !row.allTermsTranslated();
|
||||
});
|
||||
}
|
||||
|
||||
var langFilter = TaxonomyTranslation.mainView.filterView.lang && TaxonomyTranslation.mainView.filterView.lang !== 'all' ? TaxonomyTranslation.mainView.filterView.lang : false;
|
||||
|
||||
if (langFilter && langFilter != 'all' && (untranslatedFilter || parentFilter)) {
|
||||
displayedRows = displayedRows.filter(function (row) {
|
||||
return !row.translatedIn(langFilter);
|
||||
});
|
||||
}
|
||||
|
||||
var searchFilter = false;
|
||||
|
||||
if (TaxonomyTranslation.mainView.filterView.search && TaxonomyTranslation.mainView.filterView.search !== '') {
|
||||
searchFilter = TaxonomyTranslation.mainView.filterView.search;
|
||||
}
|
||||
|
||||
if (searchFilter) {
|
||||
displayedRows = displayedRows.filter(function (row) {
|
||||
if (langFilter && langFilter !== 'all') {
|
||||
return row.matchesInLang(searchFilter, langFilter);
|
||||
} else {
|
||||
return row.matches(searchFilter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.count = displayedRows.length;
|
||||
|
||||
return displayedRows;
|
||||
},
|
||||
getDisplayCount: function(){
|
||||
return this.count;
|
||||
},
|
||||
render: function () {
|
||||
|
||||
var self = this,
|
||||
output = document.createDocumentFragment(),
|
||||
displayedRows = self.getDisplayedRows();
|
||||
|
||||
self.rowViews = [];
|
||||
|
||||
if ( displayedRows && displayedRows.length > 0 ) {
|
||||
displayedRows = displayedRows.slice(self.start, self.end);
|
||||
|
||||
displayedRows.forEach(function (row) {
|
||||
var newView = new TaxonomyTranslation.views.TermRowView({model: row });
|
||||
self.rowViews.push(newView);
|
||||
output.appendChild(newView.render().el);
|
||||
newView.delegateEvents();
|
||||
|
||||
});
|
||||
self.$el.html(output);
|
||||
} else {
|
||||
var taxonomy = TaxonomyTranslation.classes.taxonomy.get("taxonomy"),
|
||||
taxonomyPluralLabel = TaxonomyTranslation.data.taxonomies[taxonomy].label,
|
||||
message = labels.noTermsFound.replace( '%taxonomy%', taxonomyPluralLabel );
|
||||
|
||||
self.$el.html(
|
||||
WPML_core[ 'templates/taxonomy-translation/no-terms-found.html' ] ({
|
||||
message: message
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
@@ -0,0 +1,119 @@
|
||||
/*globals labels, TaxonomyTranslation, _, jQuery, WPML_core */
|
||||
|
||||
(function () {
|
||||
|
||||
TaxonomyTranslation.views.TermView = Backbone.View.extend({
|
||||
|
||||
tagName: 'span',
|
||||
template: WPML_core[ "templates/taxonomy-translation/term-translated.html" ],
|
||||
model: TaxonomyTranslation.models.Term,
|
||||
popUpView: false,
|
||||
needsCorrection: false,
|
||||
events: {
|
||||
"click .icl_tt_term_name": "openPopUpTerm"
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
self.listenTo(self.model, 'translationSaved', self.render);
|
||||
self.listenTo(self.model, 'translationSaved', function () {
|
||||
jQuery('#tax-apply').prop('disabled', false);
|
||||
});
|
||||
},
|
||||
loadSyncData: function () {
|
||||
"use strict";
|
||||
var self = this;
|
||||
|
||||
var syncData = TaxonomyTranslation.data.syncData;
|
||||
var ttid = self.model.get('term_taxonomy_id');
|
||||
var parent = self.model.get('parent');
|
||||
var found = false;
|
||||
var needsCorrection = false;
|
||||
var correctParentText = false;
|
||||
var parentName = TaxonomyTranslation.classes.taxonomy.getTermName(parent);
|
||||
_.each(syncData, function (correction) {
|
||||
if (correction.translated_id == ttid) {
|
||||
found = true;
|
||||
|
||||
var oldParent = '';
|
||||
if (parent !== 0) {
|
||||
oldParent = '<span style="background-color:#F55959;">-' + TaxonomyTranslation.classes.taxonomy.getTermName(parent) + '</span>';
|
||||
jQuery('.wpml-parent-removed').show();
|
||||
}
|
||||
var newParent = '';
|
||||
if (correction.correct_parent !== 0) {
|
||||
newParent = '<span style="background-color:#CCFF99;">+' + TaxonomyTranslation.classes.taxonomy.getTermName(correction.correct_parent) + '</span>';
|
||||
jQuery('.wpml-parent-added').show();
|
||||
}
|
||||
parentName = oldParent + ' ' + newParent;
|
||||
needsCorrection = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (needsCorrection === true) {
|
||||
self.template = WPML_core[ 'templates/taxonomy-translation/term-not-synced.html' ];
|
||||
} else {
|
||||
self.template = WPML_core[ 'templates/taxonomy-translation/term-synced.html' ];
|
||||
}
|
||||
|
||||
self.$el.html(
|
||||
self.template({
|
||||
trid: self.model.get("trid"),
|
||||
lang: self.model.get("language_code"),
|
||||
name: self.model.get("name"),
|
||||
level: self.model.get("level"),
|
||||
correctedLevel: self.model.get("level"),
|
||||
correctParent: correctParentText,
|
||||
parent: parentName
|
||||
})
|
||||
);
|
||||
|
||||
self.needsCorrection = needsCorrection;
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var self = this;
|
||||
|
||||
self.needsCorrection = false;
|
||||
if ( ! self.model.get( "name" ) ) {
|
||||
self.template = WPML_core[ "templates/taxonomy-translation/term-not-translated.html" ];
|
||||
} else if ( self.model.isOriginal() ) {
|
||||
self.template = WPML_core[ "templates/taxonomy-translation/term-original-disabled.html" ];
|
||||
} else {
|
||||
self.template = WPML_core[ "templates/taxonomy-translation/term-translated.html" ];
|
||||
}
|
||||
|
||||
var html = self.template({
|
||||
trid: self.model.get("trid"),
|
||||
lang: self.model.get("language_code"),
|
||||
name: self.model.get("name"),
|
||||
level: self.model.get("level"),
|
||||
correctedLevel: self.model.get("level"),
|
||||
langs: TaxonomyTranslation.data.activeLanguages
|
||||
});
|
||||
self.$el.html( html );
|
||||
|
||||
return self;
|
||||
},
|
||||
openPopUpTerm: function (e) {
|
||||
var self = this;
|
||||
|
||||
e.preventDefault();
|
||||
var trid = self.model.get("trid");
|
||||
var lang = self.model.get("language_code");
|
||||
if (trid && lang) {
|
||||
if (TaxonomyTranslation.classes.termPopUpView && typeof TaxonomyTranslation.classes.termPopUpView !== 'undefined') {
|
||||
TaxonomyTranslation.classes.termPopUpView.close();
|
||||
}
|
||||
if ( self.model.isOriginal() ) {
|
||||
TaxonomyTranslation.classes.termPopUpView = new TaxonomyTranslation.views.OriginalTermPopUpView( { model: self.model } );
|
||||
} else {
|
||||
TaxonomyTranslation.classes.termPopUpView = new TaxonomyTranslation.views.TermPopUpView( { model: self.model } );
|
||||
}
|
||||
TaxonomyTranslation.classes.termPopUpView.open( trid, lang );
|
||||
}
|
||||
}
|
||||
});
|
||||
})(TaxonomyTranslation);
|
||||
Reference in New Issue
Block a user