{:uriI"Ífile:///Users/thomasmuntaner/Projects/Websites/cavy/app/assets/javascripts/cavy/translations.js?type=application/javascript&pipeline=self&id=48592307584276dae62bb8ceaa91e04b9f1c8ebb77661c980f7997188282dfda:ET:load_pathI"H/Users/thomasmuntaner/Projects/Websites/cavy/app/assets/javascripts;T: filenameI"]/Users/thomasmuntaner/Projects/Websites/cavy/app/assets/javascripts/cavy/translations.js;T: nameI"cavy/translations;T:logical_pathI"cavy/translations.self.js;T:content_typeI"application/javascript;T: sourceI"Ø 'use strict'; window.translationFieldEmpty = function (label) { "use strict"; label.removeClass('filled'); label.addClass('empty'); }; window.translationFieldFilled = function (label) { "use strict"; label.addClass('filled'); label.removeClass('empty'); }; window.initializeTranslationFields = function (fieldsContainer, labelsContainer, id) { "use strict"; var localeLabels = {}; $('#' + labelsContainer + ' a').each(function () { var locale = $(this).data('locale'); localeLabels[locale] = $(this); }); $('#' + fieldsContainer + ' input, #' + fieldsContainer + ' textarea').each(function () { $(this).hide(); var locale = $(this).data('locale'); var value = $(this).val(); var label = localeLabels[locale]; label.attr('data-input', $(this).attr('id')); $(this).attr('data-label', label.attr('id')); if (value === "") { translationFieldEmpty(localeLabels[locale]); } else { translationFieldFilled(localeLabels[locale]); } }); var initialField = $('#' + id); localeLabels[initialField.data('locale')].addClass('active'); if (initialField.is('textarea')) { CKEDITOR.replace(id, { language: 'en' }); } else { initialField.show(); } }; window.translationFieldChanged = function (input) { "use strict"; var labelId = input.data('label'); var label = $('#' + labelId); if (input.val() === '') { translationFieldEmpty(label); } else { translationFieldFilled(label); } }; window.translationLabelClicked = function (label, fieldsContainer) { "use strict"; var input = $('#' + label.data('input')); var labels = $('#' + label.data('labels')); labels.find('li a').removeClass('active'); label.addClass('active'); $('#' + fieldsContainer + ' input, #' + fieldsContainer + ' textarea').each(function () { $(this).hide(); var id = $(this).attr('id'); if ($(this).is('textarea')) { if (typeof CKEDITOR.instances[id] !== 'undefined') { CKEDITOR.instances[id].updateElement(); CKEDITOR.instances[id].destroy(); } } $('#' + id).hide(); }); console.log(input.attr('type')); if (input.is('textarea')) { CKEDITOR.replace(input.attr('id'), { language: 'en' }); } else { input.show(); } }; ;T: metadata{ :dependencieso:Set: @hash} I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"kfile-digest:///Users/thomasmuntaner/Projects/Websites/cavy/app/assets/javascripts/cavy/translations.js;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%”—ì¥Ø«1a3©€Áà¦c`vÙé…àVpŸ™jb: lengthiØ :dependencies_digest"%ó‹ÆMuÖ—ǬÍf$)ï4ž–E¯œ7âtxrÒÌO€¬:idI"E48592307584276dae62bb8ceaa91e04b9f1c8ebb77661c980f7997188282dfda;F: mtimel+¥ÐÃX